diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index d0e3b1c01..99b903d51 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -227,14 +227,15 @@ public interface BinanceApiAsyncRestClient { void getAccount(BinanceApiCallback callback); /** - * Get trades for a specific account and symbol. - * - * @param symbol symbol to get trades from + * Get trades for a specific account and symbol. + * + * @param symbol symbol to get trades from + * @param orderId orderId to get trades from * @param limit default 500; max 1000 * @param fromId TradeId to fetch from. Default gets most recent trades. * @param callback the callback that handles the response with a list of trades */ - void getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp, BinanceApiCallback> callback); + void getMyTrades(String symbol, Long orderId, Integer limit, Long fromId, Long recvWindow, Long timestamp, BinanceApiCallback> callback); /** * Get trades for a specific account and symbol. @@ -311,4 +312,4 @@ public interface BinanceApiAsyncRestClient { * @param callback the callback that handles the response which contains a listenKey */ void closeUserDataStream(String listenKey, BinanceApiCallback callback); -} \ No newline at end of file +} diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index ebe0b9667..f6dc7cd43 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -231,33 +231,41 @@ public interface BinanceApiRestClient { */ Account getAccount(); + /** + * Get trades for a specific account and symbol. + * + * @param symbol symbol to get trades from + * @param orderId orderId to get trades from + * @param limit default 500; max 1000 + * @param fromId TradeId to fetch from. Default gets most recent trades. + * @return a list of trades + */ + List getMyTrades(String symbol, Long orderId, Integer limit, Long fromId, Long recvWindow, Long timestamp); + /** * Get trades for a specific account and symbol. * * @param symbol symbol to get trades from * @param limit default 500; max 1000 - * @param fromId TradeId to fetch from. Default gets most recent trades. * @return a list of trades */ - List getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp); + List getMyTrades(String symbol, Integer limit); /** * Get trades for a specific account and symbol. * * @param symbol symbol to get trades from - * @param limit default 500; max 1000 * @return a list of trades */ - List getMyTrades(String symbol, Integer limit); - + List getMyTrades(String symbol); + /** * Get trades for a specific account and symbol. - * + * * @param symbol symbol to get trades from + * @param fromId TradeId to fetch from. Default gets most recent trades. * @return a list of trades */ - List getMyTrades(String symbol); - List getMyTrades(String symbol, Long fromId); /** diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncMarginRestClientImpl.java b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncMarginRestClientImpl.java index d3e5c22f6..833fc63b2 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncMarginRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncMarginRestClientImpl.java @@ -68,7 +68,7 @@ public void getOrderStatus(OrderStatusRequest orderStatusRequest, BinanceApiCall @Override public void getMyTrades(String symbol, BinanceApiCallback> callback) { - binanceApiService.getMyTrades(symbol, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()).enqueue(new BinanceApiCallbackAdapter<>(callback)); + binanceApiService.getMyTrades(symbol, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()).enqueue(new BinanceApiCallbackAdapter<>(callback)); } // user stream endpoints diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java index e6ea387b9..fef25593a 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -194,18 +194,18 @@ public void getAccount(BinanceApiCallback callback) { } @Override - public void getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp, BinanceApiCallback> callback) { - binanceApiService.getMyTrades(symbol, limit, fromId, recvWindow, timestamp).enqueue(new BinanceApiCallbackAdapter<>(callback)); + public void getMyTrades(String symbol, Long orderId, Integer limit, Long fromId, Long recvWindow, Long timestamp, BinanceApiCallback> callback) { + binanceApiService.getMyTrades(symbol, orderId, limit, fromId, recvWindow, timestamp).enqueue(new BinanceApiCallbackAdapter<>(callback)); } @Override public void getMyTrades(String symbol, Integer limit, BinanceApiCallback> callback) { - getMyTrades(symbol, limit, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis(), callback); + getMyTrades(symbol, null, limit, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis(), callback); } @Override public void getMyTrades(String symbol, BinanceApiCallback> callback) { - getMyTrades(symbol, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis(), callback); + getMyTrades(symbol, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis(), callback); } @Override diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiMarginRestClientImpl.java b/src/main/java/com/binance/api/client/impl/BinanceApiMarginRestClientImpl.java index 959fa2a5f..34a938e4c 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiMarginRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiMarginRestClientImpl.java @@ -60,7 +60,7 @@ public Order getOrderStatus(OrderStatusRequest orderStatusRequest) { @Override public List getMyTrades(String symbol) { - return executeSync(binanceApiService.getMyTrades(symbol, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); + return executeSync(binanceApiService.getMyTrades(symbol, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } // user stream endpoints @@ -116,4 +116,4 @@ public MarginTransaction repay(String asset, String amount) { long timestamp = System.currentTimeMillis(); return executeSync(binanceApiService.repay(asset, amount, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, timestamp)); } -} \ No newline at end of file +} diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java index c80c7a06d..d994e0824 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -206,25 +206,25 @@ public Account getAccount() { } @Override - public List getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp) { - return executeSync(binanceApiService.getMyTrades(symbol, limit, fromId, recvWindow, timestamp)); + public List getMyTrades(String symbol, Long orderId, Integer limit, Long fromId, Long recvWindow, Long timestamp) { + return executeSync(binanceApiService.getMyTrades(symbol, orderId, limit, fromId, recvWindow, timestamp)); } @Override public List getMyTrades(String symbol, Integer limit) { - return getMyTrades(symbol, limit, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, + return getMyTrades(symbol, null, limit, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()); } @Override public List getMyTrades(String symbol) { - return getMyTrades(symbol, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, + return getMyTrades(symbol, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()); } @Override public List getMyTrades(String symbol, Long fromId) { - return getMyTrades(symbol, null, fromId, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, + return getMyTrades(symbol, null, null, fromId, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()); } diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiService.java b/src/main/java/com/binance/api/client/impl/BinanceApiService.java index 5825f9844..5a35dded2 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -148,7 +148,7 @@ Call> getAllOrderList(@Query("fromId") Long fromId, @Query("star @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/api/v3/myTrades") - Call> getMyTrades(@Query("symbol") String symbol, @Query("limit") Integer limit, @Query("fromId") Long fromId, + Call> getMyTrades(@Query("symbol") String symbol, @Query("orderId") Long orderId, @Query("limit") Integer limit, @Query("fromId") Long fromId, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER)