MCPcopy
hub / github.com/ccxt/ccxt / main

Method main

java/examples/src/main/java/examples/FetchMarkets.java:17–53  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

15public class FetchMarkets {
16
17 public static void main(String[] args) {
18 String filterType = args.length > 0 ? args[0] : null; // "spot", "swap", "future", "option"
19
20 if (filterType != null) System.out.println("Filter: " + filterType);
21 System.out.println();
22
23 Binance exchange = new Binance();
24
25 Map<String, MarketInterface> markets = exchange.loadMarkets(false);
26
27 System.out.printf("%-16s %-8s %-6s %-8s %-12s %-14s %-14s%n",
28 "Symbol", "Type", "Active", "Base", "Quote", "Price Prec", "Amount Prec");
29 System.out.println("-".repeat(82));
30
31 int count = 0;
32 for (MarketInterface m : markets.values()) {
33 // Apply type filter if specified
34 if (filterType != null && !filterType.equals(m.type)) continue;
35
36 // Show first 30 markets to keep output manageable
37 if (++count > 30) {
38 System.out.println("... (showing first 30 of " + markets.size() + " markets)");
39 break;
40 }
41
42 System.out.printf("%-16s %-8s %-6s %-8s %-12s %-14s %-14s%n",
43 m.symbol,
44 m.type,
45 m.active,
46 m.base,
47 m.quote,
48 m.precision != null ? m.precision.price : "n/a",
49 m.precision != null ? m.precision.amount : "n/a");
50 }
51
52 System.out.println("\nTotal markets loaded: " + markets.size());
53 }
54}

Callers

nothing calls this directly

Calls 4

loadMarketsMethod · 0.95
repeatMethod · 0.80
valuesMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected