|
16 | 16 | */ |
17 | 17 | public class OrdersExampleAsync { |
18 | 18 |
|
19 | | - public static void main(String[] args) { |
20 | | - BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance("YOUR_API_KEY", "YOUR_SECRET"); |
21 | | - BinanceApiAsyncRestClient client = factory.newAsyncRestClient(); |
| 19 | + public static void main(String[] args) { |
| 20 | + BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance("YOUR_API_KEY", "YOUR_SECRET"); |
| 21 | + BinanceApiAsyncRestClient client = factory.newAsyncRestClient(); |
22 | 22 |
|
23 | | - // Getting list of open orders |
24 | | - client.getOpenOrders(new OrderRequest("LINKETH"), response -> System.out.println(response)); |
| 23 | + // Getting list of open orders |
| 24 | + client.getOpenOrders(new OrderRequest("LINKETH"), System.out::println); |
25 | 25 |
|
26 | | - // Get status of a particular order |
27 | | - client.getOrderStatus(new OrderStatusRequest("LINKETH", 745262L), |
28 | | - response -> System.out.println(response)); |
| 26 | + // Get status of a particular order |
| 27 | + client.getOrderStatus(new OrderStatusRequest("LINKETH", 745262L), System.out::println); |
29 | 28 |
|
30 | | - // Getting list of all orders with a limit of 10 |
31 | | - client.getAllOrders(new AllOrdersRequest("LINKETH").limit(10), response -> System.out.println(response)); |
| 29 | + // Getting list of all orders with a limit of 10 |
| 30 | + client.getAllOrders(new AllOrdersRequest("LINKETH").limit(10), System.out::println); |
32 | 31 |
|
33 | | - // Canceling an order |
34 | | - client.cancelOrder(new CancelOrderRequest("LINKETH", 756703L), |
35 | | - response -> System.out.println(response)); |
| 32 | + // Canceling an order |
| 33 | + client.cancelOrder(new CancelOrderRequest("LINKETH", 756703L), System.out::println); |
36 | 34 |
|
37 | | - // Placing a test LIMIT order |
38 | | - client.newOrderTest(limitBuy("LINKETH", TimeInForce.GTC, "1000", "0.0001"), |
39 | | - response -> System.out.println("Test order has succeeded.")); |
| 35 | + // Placing a test LIMIT order |
| 36 | + client.newOrderTest(limitBuy("LINKETH", TimeInForce.GTC, "1000", "0.0001"), |
| 37 | + response -> System.out.println("Test order has succeeded.")); |
40 | 38 |
|
41 | | - // Placing a test MARKET order |
42 | | - client.newOrderTest(marketBuy("LINKETH", "1000"), response -> System.out.println("Test order has succeeded.")); |
| 39 | + // Placing a test MARKET order |
| 40 | + client.newOrderTest(marketBuy("LINKETH", "1000"), response -> System.out.println("Test order has succeeded.")); |
43 | 41 |
|
44 | | - // Placing a real LIMIT order |
45 | | - client.newOrder(limitBuy("LINKETH", TimeInForce.GTC, "1000", "0.0001"), |
46 | | - response -> System.out.println(response)); |
47 | | - } |
| 42 | + // Placing a real LIMIT order |
| 43 | + client.newOrder(limitBuy("LINKETH", TimeInForce.GTC, "1000", "0.0001"), System.out::println); |
| 44 | + } |
48 | 45 | } |
0 commit comments