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

Add new property clientTag for MarginTransaction and endpoint get all margin orders #301

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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 @@ -2,10 +2,7 @@

import com.binance.api.client.domain.TransferType;
import com.binance.api.client.domain.account.*;
import com.binance.api.client.domain.account.request.CancelOrderRequest;
import com.binance.api.client.domain.account.request.CancelOrderResponse;
import com.binance.api.client.domain.account.request.OrderRequest;
import com.binance.api.client.domain.account.request.OrderStatusRequest;
import com.binance.api.client.domain.account.request.*;

import java.util.List;

Expand All @@ -15,6 +12,13 @@ public interface BinanceApiMarginRestClient {
*/
MarginAccount getAccount();

/**
* Get all orders on margin account.
*
* @param orderRequest order request parameters
*/
List<Order> getAllOrders(AllOrdersRequest orderRequest);

/**
* Get all open orders on margin account for a symbol.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class MarginTransaction {

private String clientTag;
private String tranId;

public String getTranId() {
Expand All @@ -20,10 +21,19 @@ public void setTranId(String tranId) {
this.tranId = tranId;
}

public String getClientTag() {
return clientTag;
}

public void setClientTag(String clientTag) {
this.clientTag = clientTag;
}

@Override
public String toString() {
return new ToStringBuilder(this, BinanceApiConstants.TO_STRING_BUILDER_STYLE)
.append("transactionId", tranId)
.toString();
.append("transactionId", tranId)
.append("clientTag", clientTag)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.binance.api.client.constant.BinanceApiConstants;
import com.binance.api.client.domain.TransferType;
import com.binance.api.client.domain.account.*;
import com.binance.api.client.domain.account.request.CancelOrderRequest;
import com.binance.api.client.domain.account.request.CancelOrderResponse;
import com.binance.api.client.domain.account.request.OrderRequest;
import com.binance.api.client.domain.account.request.OrderStatusRequest;
import com.binance.api.client.domain.account.request.*;

import java.util.List;

Expand Down Expand Up @@ -58,6 +55,13 @@ public Order getOrderStatus(OrderStatusRequest orderStatusRequest) {
orderStatusRequest.getRecvWindow(), orderStatusRequest.getTimestamp()));
}

@Override
public List<Order> getAllOrders(AllOrdersRequest orderRequest) {
return executeSync(binanceApiService.getAllMarginOrders(orderRequest.getSymbol(),
orderRequest.getOrderId(), orderRequest.getLimit(),
orderRequest.getRecvWindow(), orderRequest.getTimestamp()));
}

@Override
public List<Trade> getMyTrades(String symbol) {
return executeSync(binanceApiService.getMyTrades(symbol, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ Call<List<Trade>> getMyMarginTrades(@Query("symbol") String symbol, @Query("limi
@PUT("/sapi/v1/userDataStream")
Call<Void> keepAliveMarginUserDataStream(@Query("listenKey") String listenKey);

@Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER)
@GET("/sapi/v1/margin/allOrders")
Call<List<Order>> getAllMarginOrders(@Query("symbol") String symbol, @Query("orderId") Long orderId,
@Query("limit") Integer limit, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp);

// Binance Liquidity Swap Pool endpoints

@Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_APIKEY_HEADER)
Expand Down