(String[] args)
| 273 | // } |
| 274 | |
| 275 | public static void main(String[] args) throws IOException, InterruptedException { |
| 276 | System.out.println("[java][" + Version.VERSION +"] CCXT CLI"); |
| 277 | // System.out.println("User Directory: " + userDirectory); |
| 278 | |
| 279 | args = new String[] { |
| 280 | "binance", |
| 281 | "watchTrades", |
| 282 | "BTC/USDT" |
| 283 | }; |
| 284 | |
| 285 | if (args.length < 2) { |
| 286 | System.out.println("Usage: java -cp <classpath> cli.Main [--verbose] [--sandbox] <exchange-id> [arg1 arg2 ...]"); |
| 287 | return; |
| 288 | } |
| 289 | |
| 290 | var exchangeName = args[0]; |
| 291 | var methodName = args[1]; |
| 292 | |
| 293 | var isWsMethod = methodName.startsWith("watch"); |
| 294 | |
| 295 | var params = getParamsFromArgs(args); |
| 296 | |
| 297 | var isProExchange = MetaData.ProExchanges.contains(exchangeName); |
| 298 | |
| 299 | var instance = Exchange.dynamicallyCreateInstance(exchangeName, null, isProExchange); |
| 300 | |
| 301 | var callExpressionString = instance.id + "." + methodName + "(" + java.util.Arrays.toString(params) + ")"; |
| 302 | System.out.println(callExpressionString); |
| 303 | |
| 304 | try { |
| 305 | InitOptions(instance, args); |
| 306 | setCredentials(instance); |
| 307 | |
| 308 | if (Main.verbose) { |
| 309 | instance.verbose = true; |
| 310 | } |
| 311 | instance.loadMarkets().get(); |
| 312 | |
| 313 | while (true) { |
| 314 | var f = callDynamic(instance, methodName, params); |
| 315 | Object response; |
| 316 | if (f instanceof CompletableFuture) { |
| 317 | response = ((CompletableFuture<?>) f).get(); |
| 318 | } else { |
| 319 | response = f; |
| 320 | } |
| 321 | PrettyPrinter.prettyPrintData(response); |
| 322 | |
| 323 | if (!isWsMethod) { |
| 324 | break; |
| 325 | } |
| 326 | } |
| 327 | } catch (Exception e) { |
| 328 | System.out.println(e); |
| 329 | } |
| 330 | } |
| 331 | } |
nothing calls this directly
no test coverage detected