From 973952ba01554a392d9e9a65bd0acb6d77969002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Ilja=C5=BE?= Date: Mon, 28 Aug 2023 15:23:16 +0200 Subject: [PATCH 1/3] Update types for SymbolMinNotionalFilter: minNotional -> notional --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index e172ec4a..32d6c4d8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1036,7 +1036,7 @@ declare module 'binance-api-node' { export interface SymbolMinNotionalFilter { filterType: SymbolFilterType.MIN_NOTIONAL - minNotional: string + notional: string } export interface SymbolMaxNumOrdersFilter { From 6e444ff8309036af208cac8cfa2a05bbc4f2ed7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Ilja=C5=BE?= Date: Fri, 13 Oct 2023 07:47:43 +0000 Subject: [PATCH 2/3] Add proper types for futuresExchangeInfo --- .gitignore | 4 ++- index.d.ts | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d1082087..a0db0c61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ node_modules/ .nyc_output/ dist/ - +.vscode/ +.yarn/ +.yarnrc .env .idea diff --git a/index.d.ts b/index.d.ts index 2ba4c8c5..6bfe1c91 100644 --- a/index.d.ts +++ b/index.d.ts @@ -610,7 +610,7 @@ declare module 'binance-api-node' { ): Promise futuresPing(): Promise futuresTime(): Promise - futuresExchangeInfo(): Promise> + futuresExchangeInfo(): Promise futuresBook(options: { symbol: string; limit?: number }): Promise futuresCandles(options: CandlesOptions): Promise futuresMarkPriceCandles(options: CandlesOptions): Promise @@ -1036,7 +1036,7 @@ declare module 'binance-api-node' { export interface SymbolMinNotionalFilter { filterType: SymbolFilterType.MIN_NOTIONAL - notional: string + minNotional: string } export interface SymbolMaxNumOrdersFilter { @@ -1094,6 +1094,73 @@ declare module 'binance-api-node' { bids: Bid[] } + export interface FuturesSymbolMinNotionalFilter { + filterType: SymbolFilterType.MIN_NOTIONAL + notional: string + } + + export interface FuturesSymbolMaxNumOrdersFilter { + filterType: SymbolFilterType.MAX_NUM_ORDERS + limit: number + } + + export interface FuturesSymbolMaxAlgoOrdersFilter { + filterType: SymbolFilterType.MAX_ALGO_ORDERS + limit: number + } + + export type FuturesSymbolFilter = + | SymbolPriceFilter + | SymbolLotSizeFilter + | SymbolMarketLotSizeFilter + | FuturesSymbolMaxNumOrdersFilter + | FuturesSymbolMaxAlgoOrdersFilter + | SymbolPercentPriceFilter + | FuturesSymbolMinNotionalFilter + + export interface FuturesSymbol { + baseAsset: string + baseAssetPrecision: number + contractType: FuturesContractType, + deliveryDate: number + filters: FuturesSymbolFilter[], + liquidationFee: string + maintMarginPercent: string + marginAsset: string + marketTakeBound: string + maxMoveOrderLimit: number + onboardDate: number + orderTypes: FuturesOrderType_LT + pair: string + pricePrecision: number + quantityPrecision: number + quoteAsset: string + quotePrecision: number + requiredMarginPercent: string + settlePlan: number + status: FuturesContractStatus + symbol: string + timeInForce: FuturesTimeInForce + triggerProtect: string + underlyingType: string + underlyingSubType: string[] + } + + export interface FuturesAsset_EI { + asset: string + marginAvailable: boolean + autoAssetExchange: string + } + + export interface FuturesExchangeInfo { + timezone: string + serverTime: number + rateLimits: ExchangeInfoRateLimit[] + exchangeFilters: ExchangeFilter[] + assets: FuturesAsset_EI[] + symbols: FuturesSymbol[] + } + interface NewFuturesOrderBase { symbol: string side: OrderSide_LT @@ -1401,6 +1468,25 @@ declare module 'binance-api-node' { TRAILING_STOP_MARKET = 'TRAILING_STOP_MARKET', } + export type FuturesContractType = + | 'PERPETUAL' + | 'CURRENT_MONTH' + | 'NEXT_MONTH' + | 'CURRENT_QUARTER' + | 'NEXT_QUARTER' + | 'PERPETUAL_DELIVERING' + + export type FuturesContractStatus = + | 'PENDING_TRADING' + | 'TRADING' + | 'PRE_DELIVERING' + | 'DELIVERING' + | 'DELIVERED' + | 'PRE_SETTLE' + | 'SETTLING' + | 'CLOSE' + + export type NewOrderRespType_LT = 'ACK' | 'RESULT' | 'FULL' export const enum NewOrderRespType { @@ -1411,6 +1497,8 @@ declare module 'binance-api-node' { export type TimeInForce_LT = 'GTC' | 'IOC' | 'FOK' | 'GTE_GTC' + export type FuturesTimeInForce = 'GTC' | 'IOC' | 'FOK' | 'GTX' | 'GTD' + export const enum TimeInForce { GTC = 'GTC', IOC = 'IOC', From 7ced505454d93f9201fe9b9dc1a82277d1e19cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Ilja=C5=BE?= Date: Fri, 20 Oct 2023 14:21:33 +0000 Subject: [PATCH 3/3] Add missing filters for Spot; Decouple Futures filters from Spot --- index.d.ts | 127 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 113 insertions(+), 14 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6bfe1c91..45da1f8c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -976,11 +976,12 @@ declare module 'binance-api-node' { limit: number } - export type ExchangeFilterType_LT = 'EXCHANGE_MAX_NUM_ORDERS' | 'EXCHANGE_MAX_ALGO_ORDERS' + export type ExchangeFilterType_LT = 'EXCHANGE_MAX_NUM_ORDERS' | 'EXCHANGE_MAX_NUM_ALGO_ORDERS' | 'EXCHANGE_MAX_NUM_ICEBERG_ORDERS' export const enum ExchangeFilterType { EXCHANGE_MAX_NUM_ORDERS = 'EXCHANGE_MAX_NUM_ORDERS', - EXCHANGE_MAX_ALGO_ORDERS = 'EXCHANGE_MAX_ALGO_ORDERS', + EXCHANGE_MAX_NUM_ALGO_ORDERS = 'EXCHANGE_MAX_NUM_ALGO_ORDERS', + EXCHANGE_MAX_NUM_ICEBERG_ORDERS = 'EXCHANGE_MAX_NUM_ICEBERG_ORDERS', } export interface ExchangeFilter { @@ -991,19 +992,32 @@ declare module 'binance-api-node' { export type SymbolFilterType_LT = | 'PRICE_FILTER' | 'PERCENT_PRICE' + | 'PERCENT_PRICE_BY_SIDE' | 'LOT_SIZE' + | 'MARKET_LOT_SIZE' | 'MIN_NOTIONAL' + | 'NOTIONAL' | 'MAX_NUM_ORDERS' - | 'MAX_ALGO_ORDERS' + | 'MAX_NUM_ALGO_ORDERS' + | 'MAX_NUM_ICEBERG_ORDERS' + | 'ICEBERG_PARTS' + | 'MAX_POSITION' + | 'TRAILING_DELTA' export const enum SymbolFilterType { PRICE_FILTER = 'PRICE_FILTER', PERCENT_PRICE = 'PERCENT_PRICE', + PERCENT_PRICE_BY_SIDE = 'PERCENT_PRICE_BY_SIDE', LOT_SIZE = 'LOT_SIZE', MARKET_LOT_SIZE = 'MARKET_LOT_SIZE', MIN_NOTIONAL = 'MIN_NOTIONAL', + NOTIONAL = 'NOTIONAL', MAX_NUM_ORDERS = 'MAX_NUM_ORDERS', - MAX_ALGO_ORDERS = 'MAX_ALGO_ORDERS', + MAX_NUM_ALGO_ORDERS = 'MAX_NUM_ALGO_ORDERS', + MAX_NUM_ICEBERG_ORDERS = 'MAX_NUM_ICEBERG_ORDERS', + ICEBERG_PARTS = 'ICEBERG_PARTS', + MAX_POSITION = 'MAX_POSITION', + TRAILING_DELTA = 'TRAILING_DELTA', } export interface SymbolPriceFilter { @@ -1044,19 +1058,66 @@ declare module 'binance-api-node' { maxNumOrders: number } - export interface SymbolMaxAlgoOrdersFilter { - filterType: SymbolFilterType.MAX_ALGO_ORDERS + export interface SymbolMaxNumAlgoOrdersFilter { + filterType: SymbolFilterType.MAX_NUM_ALGO_ORDERS maxNumAlgoOrders: number } + export interface SymbolPercentPricePerSideFilter { + filterType: SymbolFilterType.PERCENT_PRICE_BY_SIDE + bidMultiplierUp: string + bidMultiplierDown: string + askMultiplierUp: string + askMultiplierDown: string + avgPriceMins: number + } + + export interface SymbolNotionalFilter { + filterType: SymbolFilterType.NOTIONAL + minNotional: string + applyMinToMarket: boolean + maxNotional: string + applyMaxToMarket: boolean + avgPriceMins: number + } + + export interface SymbolMaxNumIcebergOrdersFilter { + filterType: SymbolFilterType.MAX_NUM_ICEBERG_ORDERS + maxNumIcebergOrders: number + } + + export interface SymbolIcebergPartsFilter { + filterType: SymbolFilterType.ICEBERG_PARTS + limit: number + } + + export interface SymbolMaxPositionFilter { + filterType: SymbolFilterType.MAX_POSITION + maxPosition: string + } + + export interface SymbolTrailingDeltaFilter { + filterType: SymbolFilterType.TRAILING_DELTA + minTrailingAboveDelta: number + maxTrailingAboveDelta: number + minTrailingBelowDelta: number + maxTrailingBelowDelta: number + } + export type SymbolFilter = | SymbolPriceFilter | SymbolPercentPriceFilter + | SymbolPercentPricePerSideFilter | SymbolLotSizeFilter | SymbolMarketLotSizeFilter | SymbolMinNotionalFilter + | SymbolNotionalFilter | SymbolMaxNumOrdersFilter - | SymbolMaxAlgoOrdersFilter + | SymbolMaxNumAlgoOrdersFilter + | SymbolMaxNumIcebergOrdersFilter + | SymbolIcebergPartsFilter + | SymbolMaxPositionFilter + | SymbolTrailingDeltaFilter export interface Symbol { baseAsset: string @@ -1094,28 +1155,66 @@ declare module 'binance-api-node' { bids: Bid[] } + export const enum FuturesSymbolFilterType { + PRICE_FILTER = 'PRICE_FILTER', + LOT_SIZE = 'LOT_SIZE', + MARKET_LOT_SIZE = 'MARKET_LOT_SIZE', + MAX_NUM_ORDERS = 'MAX_NUM_ORDERS', + MAX_NUM_ALGO_ORDERS = 'MAX_NUM_ALGO_ORDERS', + PERCENT_PRICE = 'PERCENT_PRICE', + MIN_NOTIONAL = 'MIN_NOTIONAL', + } + + export interface FuturesSymbolPriceFilter { + filterType: FuturesSymbolFilterType.PRICE_FILTER + minPrice: string + maxPrice: string + tickSize: string + } + + export interface FuturesSymbolLotSizeFilter { + filterType: FuturesSymbolFilterType.LOT_SIZE + minQty: string + maxQty: string + stepSize: string + } + + export interface FuturesSymbolMarketLotSizeFilter { + filterType: FuturesSymbolFilterType.MARKET_LOT_SIZE + minQty: string + maxQty: string + stepSize: string + } + + export interface FuturesSymbolPercentPriceFilter { + filterType: FuturesSymbolFilterType.PERCENT_PRICE + multiplierDown: string + multiplierUp: string + multiplierDecimal: number + } + export interface FuturesSymbolMinNotionalFilter { - filterType: SymbolFilterType.MIN_NOTIONAL + filterType: FuturesSymbolFilterType.MIN_NOTIONAL notional: string } export interface FuturesSymbolMaxNumOrdersFilter { - filterType: SymbolFilterType.MAX_NUM_ORDERS + filterType: FuturesSymbolFilterType.MAX_NUM_ORDERS limit: number } export interface FuturesSymbolMaxAlgoOrdersFilter { - filterType: SymbolFilterType.MAX_ALGO_ORDERS + filterType: FuturesSymbolFilterType.MAX_NUM_ALGO_ORDERS limit: number } export type FuturesSymbolFilter = - | SymbolPriceFilter - | SymbolLotSizeFilter - | SymbolMarketLotSizeFilter + | FuturesSymbolPriceFilter + | FuturesSymbolLotSizeFilter + | FuturesSymbolMarketLotSizeFilter | FuturesSymbolMaxNumOrdersFilter | FuturesSymbolMaxAlgoOrdersFilter - | SymbolPercentPriceFilter + | FuturesSymbolPercentPriceFilter | FuturesSymbolMinNotionalFilter export interface FuturesSymbol {