MCPcopy Index your code
hub / github.com/ccxt/ccxt / main

Method main

java/examples/src/main/java/examples/FetchOHLCV.java:23–48  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

21 .withZone(ZoneId.systemDefault());
22
23 public static void main(String[] args) {
24 String symbol = args.length > 0 ? args[0] : "BTC/USDT";
25 String timeframe = args.length > 1 ? args[1] : "1h";
26
27 System.out.println("Symbol: " + symbol);
28 System.out.println("Timeframe: " + timeframe);
29 System.out.println();
30
31 Binance exchange = new Binance();
32
33 exchange.loadMarkets(false);
34
35 List<OHLCV> candles = exchange.fetchOHLCV(symbol, timeframe, null, 20L, null);
36
37 System.out.printf("%-18s %12s %12s %12s %12s %14s%n",
38 "Date", "Open", "High", "Low", "Close", "Volume");
39 System.out.println("-".repeat(82));
40
41 for (OHLCV c : candles) {
42 String date = FMT.format(Instant.ofEpochMilli(c.timestamp));
43 System.out.printf("%-18s %12.2f %12.2f %12.2f %12.2f %14.4f%n",
44 date, c.open, c.high, c.low, c.close, c.volume);
45 }
46
47 System.out.println("\nTotal candles: " + candles.size());
48 }
49}

Callers

nothing calls this directly

Calls 4

loadMarketsMethod · 0.95
fetchOHLCVMethod · 0.95
repeatMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected