Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -19,6 +19,16 @@ public interface BinanceFuturesAuthenticated extends BinanceFutures {
String SIGNATURE = "signature";
String X_MBX_APIKEY = "X-MBX-APIKEY";

@GET
@Path("fapi/v1/klines")
List<Object[]> klines(
@QueryParam("symbol") String symbol,
@QueryParam("interval") String interval,
@QueryParam("limit") Integer limit,
@QueryParam("startTime") Long startTime,
@QueryParam("endTime") Long endTime)
throws IOException, BinanceException;

/**
* Get current futures account information.
*
Expand Down Expand Up @@ -327,6 +337,17 @@ List<BinanceOrder> futureOpenOrders(
@QueryParam(SIGNATURE) ParamsDigest signature)
throws IOException, BinanceException;


@GET
@Path("fapi/v1/allOrders")
List<BinanceOrder> futureAllOrders(
@QueryParam("symbol") String symbol,
@QueryParam("recvWindow") Long recvWindow,
@QueryParam("timestamp") SynchronizedValueFactory<Long> timestamp,
@HeaderParam(X_MBX_APIKEY) String apiKey,
@QueryParam(SIGNATURE) ParamsDigest signature)
throws IOException, BinanceException;

/**
* Get future open orders on a symbol.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public BinanceOrder(
@JsonProperty("price") BigDecimal price,
@JsonProperty("origQty") BigDecimal origQty,
@JsonProperty("executedQty") BigDecimal executedQty,
@JsonProperty("cummulativeQuoteQty") BigDecimal cummulativeQuoteQty,
@JsonProperty("cumQuote") BigDecimal cummulativeQuoteQty,
@JsonProperty("status") OrderStatus status,
@JsonProperty("timeInForce") TimeInForce timeInForce,
@JsonProperty("type") OrderType type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public enum TimeInForce implements IOrderFlags {
GTC,
GTX,
FOK,
IOC;
IOC,
GTE_GTC;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no GTE_GTC in Binance


@JsonCreator
public static TimeInForce getTimeInForce(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,18 @@ public BinanceKline lastKline(CurrencyPair pair, KlineInterval interval) throws
return klines(pair, interval, 1, null, null).stream().collect(StreamUtils.singletonCollector());
}

public BinanceKline lastKline(Instrument pair, KlineInterval interval) throws IOException {
return klines(pair, interval, 1, null, null).stream().collect(StreamUtils.singletonCollector());
}

public List<BinanceKline> klines(CurrencyPair pair, KlineInterval interval) throws IOException {
return klines(pair, interval, null, null, null);
}

public List<BinanceKline> klines(Instrument pair, KlineInterval interval) throws IOException {
return klines(pair, interval, null, null, null);
}

public List<BinanceKline> klines(
CurrencyPair pair, KlineInterval interval, Integer limit, Long startTime, Long endTime)
throws IOException {
Expand All @@ -108,6 +116,27 @@ public List<BinanceKline> klines(
.collect(Collectors.toList());
}

public List<BinanceKline> klines(
Instrument pair, KlineInterval interval, Integer limit, Long startTime, Long endTime)
throws IOException {
List<Object[]> raw =
decorateApiCall(
() ->
(pair instanceof FuturesContract) ?
binanceFutures.klines(
BinanceAdapters.toSymbol(pair), interval.code(), limit, startTime, endTime)

:
binance.klines(
BinanceAdapters.toSymbol(pair), interval.code(), limit, startTime, endTime))
.withRetry(retry("klines"))
.withRateLimiter(rateLimiter(REQUEST_WEIGHT_RATE_LIMITER))
.call();
return raw.stream()
.map(obj -> new BinanceKline(pair, interval, obj))
.collect(Collectors.toList());
}

public List<BinanceTicker24h> ticker24hAllProducts(boolean isFutures) throws IOException {
if(isFutures)
return decorateApiCall(binanceFutures::ticker24h)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,33 @@ public List<BinanceOrder> openOrdersAllProducts() throws BinanceException, IOExc
return openOrdersAllProducts(null);
}

public List<BinanceOrder> allOrders(Instrument pair)
throws BinanceException, IOException {

return decorateApiCall(
() ->
(pair instanceof FuturesContract)
?
binanceFutures.futureAllOrders(
Optional.of(pair).map(BinanceAdapters::toSymbol).orElse(null),
getRecvWindow(),
getTimestampFactory(),
apiKey,
signatureCreator)
: binance.allOrders(
Optional.ofNullable(pair).map(BinanceAdapters::toSymbol).orElse(null),
null,
null,
getRecvWindow(),
getTimestampFactory(),
apiKey,
signatureCreator))
.withRetry(retry("allOrders"))
.withRateLimiter(rateLimiter(REQUEST_WEIGHT_RATE_LIMITER))
.call();

}

public List<BinanceOrder> openOrdersAllProducts(Instrument pair)
throws BinanceException, IOException {
if (exchange.isPortfolioMarginEnabled()) {
Expand Down