(String[] args)
| 22 | .withZone(ZoneId.systemDefault()); |
| 23 | |
| 24 | public static void main(String[] args) throws Exception { |
| 25 | String symbol = args.length > 0 ? args[0] : "BTC/USDT"; |
| 26 | String timeframe = args.length > 1 ? args[1] : "1m"; |
| 27 | |
| 28 | Binance exchange = new Binance(); |
| 29 | exchange.verbose = false; |
| 30 | |
| 31 | System.out.println("Loading markets..."); |
| 32 | exchange.loadMarkets(false); |
| 33 | System.out.println("Watching " + symbol + " OHLCV (" + timeframe + ", 15 updates)...\n"); |
| 34 | |
| 35 | System.out.printf("%-18s %12s %12s %12s %12s %14s%n", |
| 36 | "Date", "Open", "High", "Low", "Close", "Volume"); |
| 37 | System.out.println("-".repeat(82)); |
| 38 | |
| 39 | for (int i = 0; i < 15; i++) { |
| 40 | List<OHLCV> candles = exchange.watchOHLCV(symbol, timeframe, null, null, null); |
| 41 | |
| 42 | // Print the latest candle |
| 43 | if (!candles.isEmpty()) { |
| 44 | OHLCV c = candles.get(candles.size() - 1); |
| 45 | String date = FMT.format(Instant.ofEpochMilli(c.timestamp)); |
| 46 | System.out.printf("%-18s %12.2f %12.2f %12.2f %12.2f %14.4f%n", |
| 47 | date, c.open, c.high, c.low, c.close, c.volume); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | System.out.println("\nDone!"); |
| 52 | System.exit(0); |
| 53 | } |
| 54 | } |
nothing calls this directly
no test coverage detected