Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Add orderId to getMyTrades() #404

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,15 @@ public interface BinanceApiAsyncRestClient {
void getAccount(BinanceApiCallback<Account> 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<List<Trade>> callback);
void getMyTrades(String symbol, Long orderId, Integer limit, Long fromId, Long recvWindow, Long timestamp, BinanceApiCallback<List<Trade>> callback);

/**
* Get trades for a specific account and symbol.
Expand Down Expand Up @@ -311,4 +312,4 @@ public interface BinanceApiAsyncRestClient {
* @param callback the callback that handles the response which contains a listenKey
*/
void closeUserDataStream(String listenKey, BinanceApiCallback<Void> callback);
}
}
24 changes: 16 additions & 8 deletions src/main/java/com/binance/api/client/BinanceApiRestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Trade> 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<Trade> getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp);
List<Trade> 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<Trade> getMyTrades(String symbol, Integer limit);

List<Trade> 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<Trade> getMyTrades(String symbol);

List<Trade> getMyTrades(String symbol, Long fromId);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void getOrderStatus(OrderStatusRequest orderStatusRequest, BinanceApiCall

@Override
public void getMyTrades(String symbol, BinanceApiCallback<List<Trade>> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,18 @@ public void getAccount(BinanceApiCallback<Account> callback) {
}

@Override
public void getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp, BinanceApiCallback<List<Trade>> 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<List<Trade>> callback) {
binanceApiService.getMyTrades(symbol, orderId, limit, fromId, recvWindow, timestamp).enqueue(new BinanceApiCallbackAdapter<>(callback));
}

@Override
public void getMyTrades(String symbol, Integer limit, BinanceApiCallback<List<Trade>> 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<List<Trade>> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Order getOrderStatus(OrderStatusRequest orderStatusRequest) {

@Override
public List<Trade> 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
Expand Down Expand Up @@ -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));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,25 @@ public Account getAccount() {
}

@Override
public List<Trade> getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp) {
return executeSync(binanceApiService.getMyTrades(symbol, limit, fromId, recvWindow, timestamp));
public List<Trade> 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<Trade> 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<Trade> 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<Trade> 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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Call<List<OrderList>> getAllOrderList(@Query("fromId") Long fromId, @Query("star

@Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER)
@GET("/api/v3/myTrades")
Call<List<Trade>> getMyTrades(@Query("symbol") String symbol, @Query("limit") Integer limit, @Query("fromId") Long fromId,
Call<List<Trade>> 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)
Expand Down