(String[] args)
| 14 | public class FetchTrades { |
| 15 | |
| 16 | public static void main(String[] args) { |
| 17 | String symbol = args.length > 0 ? args[0] : "BTC/USDT"; |
| 18 | |
| 19 | System.out.println("Symbol: " + symbol); |
| 20 | System.out.println(); |
| 21 | |
| 22 | Binance exchange = new Binance(); |
| 23 | |
| 24 | exchange.loadMarkets(false); |
| 25 | |
| 26 | List<Trade> trades = exchange.fetchTrades(symbol, null, 20L, null); |
| 27 | |
| 28 | System.out.printf("%-24s %-5s %12s %12s %14s%n", |
| 29 | "Datetime", "Side", "Price", "Amount", "Cost"); |
| 30 | System.out.println("-".repeat(70)); |
| 31 | |
| 32 | for (Trade t : trades) { |
| 33 | System.out.printf("%-24s %-5s %12.2f %12.6f %14.2f%n", |
| 34 | t.datetime, |
| 35 | t.side, |
| 36 | safe(t.price), |
| 37 | safe(t.amount), |
| 38 | safe(t.cost)); |
| 39 | } |
| 40 | |
| 41 | System.out.println("\nTotal trades: " + trades.size()); |
| 42 | } |
| 43 | |
| 44 | static double safe(Double v) { return v != null ? v : 0.0; } |
| 45 | } |
nothing calls this directly
no test coverage detected