@medievalrain/binance-ts 0.14.10 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -85,17 +85,19 @@ type FuturesExchangeInfoFilter = {
85
85
  filterType: "POSITION_RISK_CONTROL";
86
86
  positionControlSide: "NONE";
87
87
  };
88
- type FuturesContractType = "PERPETUAL" | "CURRENT_QUARTER" | "NEXT_QUARTER";
89
- type FuturesUnderlyingType = "COIN" | "INDEX" | "PREMARKET";
88
+ type FuturesContractType = "PERPETUAL" | "CURRENT_QUARTER" | "NEXT_QUARTER" | "TRADIFI_PERPETUAL";
89
+ type FuturesUnderlyingType = "COIN" | "INDEX" | "PREMARKET" | "COMMODITY";
90
90
  type FuturesOrderType = "LIMIT" | "MARKET" | "STOP" | "TAKE_PROFIT" | "STOP_MARKET" | "TAKE_PROFIT_MARKET" | "TRAILING_STOP_MARKET";
91
- type PermissionSet = "COPY" | "GRID" | "DCA";
91
+ type FuturesPermissionSet = "GRID" | "COPY" | "DCA" | "PSB" | "RPI";
92
+ type FuturesTimeInForce = "GTC" | "IOC" | "FOK" | "GTX" | "GTD";
93
+ type FuturesExchangeInfoSymbolTradingStatus = "TRADING" | "SETTLING" | "PENDING_TRADING" | "DELIVERING";
92
94
  type FuturesExchangeInfoSymbol = {
93
95
  symbol: string;
94
96
  pair: string;
95
97
  contractType: FuturesContractType;
96
98
  deliveryDate: number;
97
99
  onboardDate: number;
98
- status: "TRADING" | "SETTLING" | "PENDING_TRADING";
100
+ status: FuturesExchangeInfoSymbolTradingStatus;
99
101
  maintMarginPercent: string;
100
102
  requiredMarginPercent: string;
101
103
  baseAsset: string;
@@ -107,14 +109,15 @@ type FuturesExchangeInfoSymbol = {
107
109
  quotePrecision: number;
108
110
  underlyingType: FuturesUnderlyingType;
109
111
  underlyingSubType: string[];
110
- permissionSets: PermissionSet[];
112
+ permissionSets: FuturesPermissionSet[];
111
113
  settlePlan?: number;
112
114
  triggerProtect: string;
113
115
  filters: FuturesExchangeInfoFilter[];
114
- OrderType?: FuturesOrderType[];
115
- timeInForce: string[];
116
+ orderTypes?: FuturesOrderType[];
117
+ timeInForce: FuturesTimeInForce[];
116
118
  liquidationFee: string;
117
119
  marketTakeBound: string;
120
+ maxMoveOrderLimit: number;
118
121
  };
119
122
  type FuturesExchangeInfo = {
120
123
  exchangeFilters: unknown[];
@@ -351,6 +354,7 @@ type FuturesCommissionRate = {
351
354
  symbol: string;
352
355
  makerCommissionRate: string;
353
356
  takerCommissionRate: string;
357
+ rpiCommissionRate: string;
354
358
  };
355
359
  type FuturesAccountConfig = {
356
360
  feeTier: number;
@@ -367,7 +371,7 @@ type FuturesSymbolConfig = {
367
371
  marginType: "ISOLATED" | "CROSSED";
368
372
  isAutoAddMargin: boolean;
369
373
  leverage: number;
370
- maxNotionalValue: string | "INF";
374
+ maxNotionalValue: "INF" | (string & {});
371
375
  };
372
376
  type FuturesUserRateLimit = {
373
377
  rateLimitType: "ORDERS";
@@ -404,7 +408,6 @@ type FuturesIncomeHistory = {
404
408
  };
405
409
  type FuturesOrderSide = "BUY" | "SELL";
406
410
  type FuturesPositionSide = "BOTH" | "LONG" | "SHORT";
407
- type FuturesTimeInForce = "GTC" | "IOC" | "FOK" | "GTX" | "GTD";
408
411
  type FuturesWorkingType = "MARK_PRICE" | "CONTRACT_PRICE";
409
412
  type FuturesNewOrderRespType = "ACK" | "RESULT";
410
413
  type FuturesPriceMatch = "OPPONENT" | "OPPONENT_5" | "OPPONENT_10" | "OPPONENT_20" | "QUEUE" | "QUEUE_5" | "QUEUE_10" | "QUEUE_20" | "NONE";
@@ -731,6 +734,119 @@ type SpotTestConnectivity = {};
731
734
  type SpotCheckServerTime = {
732
735
  serverTime: number;
733
736
  };
737
+ type SpotExchangeInfoRateLimit = {
738
+ rateLimitType: "REQUEST_WEIGHT";
739
+ interval: "MINUTE";
740
+ intervalNum: number;
741
+ limit: number;
742
+ } | {
743
+ rateLimitType: "ORDERS";
744
+ interval: "SECOND";
745
+ intervalNum: number;
746
+ limit: number;
747
+ } | {
748
+ rateLimitType: "ORDERS";
749
+ interval: "DAY";
750
+ intervalNum: number;
751
+ limit: number;
752
+ } | {
753
+ rateLimitType: "RAW_REQUESTS";
754
+ interval: "MINUTE";
755
+ intervalNum: number;
756
+ limit: number;
757
+ };
758
+ type SpotOrderType = "LIMIT" | "LIMIT_MAKER" | "MARKET" | "STOP_LOSS" | "STOP_LOSS_LIMIT" | "TAKE_PROFIT" | "TAKE_PROFIT_LIMIT";
759
+ type SpotSelfTradePreventionMode = "EXPIRE_TAKER" | "EXPIRE_MAKER" | "EXPIRE_BOTH" | "DECREMENT";
760
+ type SpotExchangeInfoFilter = {
761
+ filterType: "PRICE_FILTER";
762
+ minPrice: string;
763
+ maxPrice: string;
764
+ tickSize: string;
765
+ } | {
766
+ filterType: "LOT_SIZE";
767
+ minQty: string;
768
+ maxQty: string;
769
+ stepSize: string;
770
+ } | {
771
+ filterType: "ICEBERG_PARTS";
772
+ limit: number;
773
+ } | {
774
+ filterType: "MARKET_LOT_SIZE";
775
+ minQty: string;
776
+ maxQty: string;
777
+ stepSize: string;
778
+ } | {
779
+ filterType: "TRAILING_DELTA";
780
+ minTrailingAboveDelta: number;
781
+ maxTrailingAboveDelta: number;
782
+ minTrailingBelowDelta: number;
783
+ maxTrailingBelowDelta: number;
784
+ } | {
785
+ filterType: "PERCENT_PRICE_BY_SIDE";
786
+ bidMultiplierUp: string;
787
+ bidMultiplierDown: string;
788
+ askMultiplierUp: string;
789
+ askMultiplierDown: string;
790
+ avgPriceMins: number;
791
+ } | {
792
+ filterType: "NOTIONAL";
793
+ minNotional: string;
794
+ applyMinToMarket: boolean;
795
+ maxNotional: string;
796
+ applyMaxToMarket: boolean;
797
+ avgPriceMins: number;
798
+ } | {
799
+ filterType: "MAX_NUM_ORDERS";
800
+ maxNumOrders: number;
801
+ } | {
802
+ filterType: "MAX_NUM_ORDER_LISTS";
803
+ maxNumOrderLists: number;
804
+ } | {
805
+ filterType: "MAX_NUM_ALGO_ORDERS";
806
+ maxNumAlgoOrders: number;
807
+ } | {
808
+ filterType: "MAX_NUM_ORDER_AMENDS";
809
+ maxNumOrderAmends: number;
810
+ } | {
811
+ filterType: "MAX_POSITION";
812
+ maxPosition: string;
813
+ };
814
+ type SpotExchangeInfoSymbolTradingStatus = "TRADING" | "BREAK";
815
+ type SpotExchangeInfoSymbol = {
816
+ symbol: string;
817
+ status: SpotExchangeInfoSymbolTradingStatus;
818
+ baseAsset: string;
819
+ baseAssetPrecision: number;
820
+ quoteAsset: string;
821
+ quotePrecision: number;
822
+ quoteAssetPrecision: number;
823
+ baseCommissionPrecision: number;
824
+ quoteCommissionPrecision: number;
825
+ orderTypes: SpotOrderType[];
826
+ icebergAllowed: boolean;
827
+ ocoAllowed: boolean;
828
+ otoAllowed: boolean;
829
+ opoAllowed: boolean;
830
+ quoteOrderQtyMarketAllowed: boolean;
831
+ allowTrailingStop: boolean;
832
+ cancelReplaceAllowed: boolean;
833
+ amendAllowed: boolean;
834
+ pegInstructionsAllowed: boolean;
835
+ isSpotTradingAllowed: boolean;
836
+ isMarginTradingAllowed: boolean;
837
+ filters: SpotExchangeInfoFilter[];
838
+ permissions: unknown[];
839
+ permissionSets: [string[]];
840
+ defaultSelfTradePreventionMode: SpotSelfTradePreventionMode;
841
+ allowedSelfTradePreventionModes: SpotSelfTradePreventionMode[];
842
+ };
843
+ type SpotExchangeInfo = {
844
+ timezone: string;
845
+ serverTime: number;
846
+ rateLimits: SpotExchangeInfoRateLimit[];
847
+ exchangeFilters: unknown[];
848
+ symbols: SpotExchangeInfoSymbol[];
849
+ };
734
850
  //#endregion
735
851
  //#region src/rest/spot/client.d.ts
736
852
  declare class SpotRestClient extends BaseRestClient {
@@ -745,6 +861,7 @@ declare class SpotRestClient extends BaseRestClient {
745
861
  });
746
862
  testConnectivity(): Promise<SpotTestConnectivity>;
747
863
  checkServerTime(): Promise<SpotCheckServerTime>;
864
+ exchangeInformation(): Promise<SpotExchangeInfo>;
748
865
  }
749
866
  //#endregion
750
867
  //#region src/rest/client.d.ts
@@ -830,7 +947,7 @@ type ChannelsMap = Record<string, {
830
947
  messageSchema: object;
831
948
  subscriptionOptions?: object;
832
949
  }>;
833
- type OptArgs<CM extends ChannelsMap, K$1 extends keyof CM> = CM[K$1]["subscriptionOptions"] extends never | undefined ? [] : [options: CM[K$1]["subscriptionOptions"]];
950
+ type OptArgs<CM extends ChannelsMap, K$1 extends keyof CM> = CM[K$1]["subscriptionOptions"] extends never ? [] : [options: CM[K$1]["subscriptionOptions"]];
834
951
  type WebsocketClient<CM extends ChannelsMap> = { [K in keyof CM]: {
835
952
  subscribe: (symbols: string[], ...args: OptArgs<CM, K>) => Promise<void>;
836
953
  unsubscribe: (symbols: string[], ...args: OptArgs<CM, K>) => Promise<void>;
@@ -848,9 +965,15 @@ type FuturesBookTickerEvent = {
848
965
  A: string;
849
966
  };
850
967
  type FuturesBookDepthEvent = {
851
- lastUpdateId: number;
852
- bids: [string, string][];
853
- asks: [string, string][];
968
+ e: "depthUpdate";
969
+ E: number;
970
+ T: number;
971
+ U: number;
972
+ u: number;
973
+ pu: number;
974
+ s: string;
975
+ b: [string, string][];
976
+ a: [string, string][];
854
977
  };
855
978
  type FuturesAggTradeEvent = {
856
979
  e: "aggTrade";
@@ -908,7 +1031,7 @@ type FuturesAccountUpdateEventPosition = {
908
1031
  bep: string;
909
1032
  cr: string;
910
1033
  up: string;
911
- mt: "isolated" & string & {};
1034
+ mt: "isolated" | (string & {});
912
1035
  iw: string;
913
1036
  ps: FuturesPositionSide$1;
914
1037
  };
@@ -1089,4 +1212,4 @@ declare const createFuturesUserWebsocketClient: ({
1089
1212
  apiSecret: string;
1090
1213
  }) => Promise<FuturesUserWebsocketClient>;
1091
1214
  //#endregion
1092
- export { ApiError, BinanceRestClient, ErrorMessageParsingError, FuturesAccountAsset, FuturesAccountBalance, FuturesAccountConfig, FuturesAccountInfo, FuturesAccountPosition, type FuturesAggTradeEvent, FuturesAggregateTrade, FuturesAssetIndex, FuturesBasis, type FuturesBookDepthEvent, FuturesBookTicker, type FuturesBookTickerEvent, FuturesCancelOrder, FuturesChangeInitialLeverage, FuturesCheckServerTime, FuturesCommissionRate, FuturesCompositeIndex, FuturesCompositeIndexAsset, FuturesContractType, FuturesDeliveryPrice, FuturesExchangeInfo, FuturesExchangeInfoAsset, FuturesExchangeInfoFilter, FuturesExchangeInfoRateLimit, FuturesExchangeInfoSymbol, FuturesFundingInfo, FuturesFundingRate, FuturesGetListenKey, FuturesIncomeHistory, FuturesIncomeType, FuturesIndexPriceConstituentItem, FuturesIndexPriceConstituents, FuturesInsuranceBalance, FuturesInsuranceBalanceAsset, FuturesKline, FuturesKlineInterval, FuturesLeverageBracket, FuturesLeverageBracketEntry, FuturesLongShortRatio, FuturesMarkPrice, FuturesModifyOrder, FuturesNewOrder, FuturesNewOrderRespType, FuturesOpenInterest, FuturesOpenInterestPeriod, FuturesOpenInterestStats, FuturesOrderBook, FuturesOrderSide, FuturesOrderStatus, FuturesOrderType, FuturesPositionMode, FuturesPositionSide, FuturesPriceMatch, FuturesSelfTradePrevention, FuturesSymbolConfig, FuturesSymbolPrice, FuturesTakerBuySellRatio, FuturesTestConnectivity, FuturesTicker24h, FuturesTimeInForce, FuturesTrade, FuturesUnderlyingType, FuturesUserRateLimit, FuturesWorkingType, MalformedParamError, PermissionSet, ResponseError, SpotCheckServerTime, SpotTestConnectivity, WeightError, createBinanceRestClient, createFuturesUserWebsocketClient, createFuturesWebsocketClient };
1215
+ export { ApiError, BinanceRestClient, ErrorMessageParsingError, FuturesAccountAsset, FuturesAccountBalance, FuturesAccountConfig, FuturesAccountInfo, FuturesAccountPosition, type FuturesAggTradeEvent, FuturesAggregateTrade, FuturesAssetIndex, FuturesBasis, type FuturesBookDepthEvent, FuturesBookTicker, type FuturesBookTickerEvent, FuturesCancelOrder, FuturesChangeInitialLeverage, FuturesCheckServerTime, FuturesCommissionRate, FuturesCompositeIndex, FuturesCompositeIndexAsset, FuturesContractType, FuturesDeliveryPrice, FuturesExchangeInfo, FuturesExchangeInfoAsset, FuturesExchangeInfoFilter, FuturesExchangeInfoRateLimit, FuturesExchangeInfoSymbol, FuturesExchangeInfoSymbolTradingStatus, FuturesFundingInfo, FuturesFundingRate, FuturesGetListenKey, FuturesIncomeHistory, FuturesIncomeType, FuturesIndexPriceConstituentItem, FuturesIndexPriceConstituents, FuturesInsuranceBalance, FuturesInsuranceBalanceAsset, FuturesKline, FuturesKlineInterval, FuturesLeverageBracket, FuturesLeverageBracketEntry, FuturesLongShortRatio, FuturesMarkPrice, FuturesModifyOrder, FuturesNewOrder, FuturesNewOrderRespType, FuturesOpenInterest, FuturesOpenInterestPeriod, FuturesOpenInterestStats, FuturesOrderBook, FuturesOrderSide, FuturesOrderStatus, FuturesOrderType, FuturesPermissionSet, FuturesPositionMode, FuturesPositionSide, FuturesPriceMatch, FuturesSelfTradePrevention, FuturesSymbolConfig, FuturesSymbolPrice, FuturesTakerBuySellRatio, FuturesTestConnectivity, FuturesTicker24h, FuturesTimeInForce, FuturesTrade, FuturesUnderlyingType, FuturesUserRateLimit, FuturesWorkingType, MalformedParamError, ResponseError, SpotCheckServerTime, SpotExchangeInfo, SpotExchangeInfoFilter, SpotExchangeInfoRateLimit, SpotExchangeInfoSymbol, SpotExchangeInfoSymbolTradingStatus, SpotOrderType, SpotSelfTradePreventionMode, SpotTestConnectivity, WeightError, createBinanceRestClient, createFuturesUserWebsocketClient, createFuturesWebsocketClient };
package/dist/index.mjs CHANGED
@@ -89,7 +89,7 @@ var BaseRestClient = class {
89
89
  url.search = searchParams.toString();
90
90
  const response = await fetch(url.toString(), { keepalive: true });
91
91
  const json = await response.json();
92
- if (response.status === 200) return json;
92
+ if (response.ok) return json;
93
93
  throw this.parseErrorResponse(endpoint, response.status, json);
94
94
  };
95
95
  async privateRequest({ endpoint, params, method }) {
@@ -111,7 +111,7 @@ var BaseRestClient = class {
111
111
  else url.search = searchParams.toString();
112
112
  const response = await fetch(url.toString(), requestOptions);
113
113
  const json = await response.json();
114
- if (response.status === 200) return json;
114
+ if (response.ok) return json;
115
115
  throw this.parseErrorResponse(endpoint, response.status, json);
116
116
  }
117
117
  sign(message, secret) {
@@ -437,6 +437,9 @@ var SpotRestClient = class extends BaseRestClient {
437
437
  async checkServerTime() {
438
438
  return this.marketRequest({ endpoint: "/api/v3/time" });
439
439
  }
440
+ async exchangeInformation() {
441
+ return this.marketRequest({ endpoint: "/api/v3/exchangeInfo" });
442
+ }
440
443
  };
441
444
 
442
445
  //#endregion
package/package.json CHANGED
@@ -1,53 +1,54 @@
1
1
  {
2
- "name": "@medievalrain/binance-ts",
3
- "version": "0.14.10",
4
- "description": "Binance API SDK",
5
- "access": "public",
6
- "type": "module",
7
- "license": "MIT",
8
- "files": [
9
- "dist"
10
- ],
11
- "main": "./dist/index.mjs",
12
- "module": "./dist/index.mjs",
13
- "types": "./dist/index.d.mts",
14
- "exports": {
15
- ".": "./dist/index.mjs",
16
- "./package.json": "./package.json"
17
- },
18
- "scripts": {
19
- "build": "tsdown",
20
- "dev": "tsdown --watch",
21
- "test": "vitest",
22
- "gen:all": "NODE_OPTIONS='--localstorage-file=ls' ts-to-zod --all",
23
- "lint": "oxlint",
24
- "format": "prettier --check .",
25
- "typecheck": "tsc"
26
- },
27
- "devDependencies": {
28
- "@types/node": "24.10.1",
29
- "dotenv": "17.2.3",
30
- "oxlint": "1.31.0",
31
- "prettier": "3.7.4",
32
- "ts-to-zod": "5.1.0",
33
- "tsdown": "0.16.8",
34
- "typescript": "5.9.3",
35
- "vitest": "4.0.15",
36
- "zod": "4.1.13"
37
- },
38
- "dependencies": {
39
- "@medievalrain/emitter": "0.8.7"
40
- },
41
- "repository": {
42
- "type": "git",
43
- "url": "git+https://github.com/medievalrain/binance-ts.git"
44
- },
45
- "packageManager": "pnpm@10.24.0",
46
- "publishConfig": {
47
- "access": "public",
48
- "provenance": true
49
- },
50
- "engines": {
51
- "node": ">=24.11.0"
52
- }
2
+ "name": "@medievalrain/binance-ts",
3
+ "version": "0.17.0",
4
+ "description": "Binance API SDK",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/medievalrain/binance-ts.git"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "type": "module",
14
+ "main": "./dist/index.mjs",
15
+ "module": "./dist/index.mjs",
16
+ "types": "./dist/index.d.mts",
17
+ "exports": {
18
+ ".": "./dist/index.mjs",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "provenance": true
24
+ },
25
+ "scripts": {
26
+ "build": "tsdown",
27
+ "dev": "tsdown --watch",
28
+ "test": "vitest",
29
+ "gen:all": "NODE_OPTIONS='--localstorage-file=ls' ts-to-zod --all",
30
+ "lint": "oxlint --type-aware",
31
+ "format": "oxfmt --check .",
32
+ "typecheck": "tsgo"
33
+ },
34
+ "dependencies": {
35
+ "@medievalrain/emitter": "0.8.10"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "25.0.3",
39
+ "@typescript/native-preview": "7.0.0-dev.20251227.1",
40
+ "dotenv": "17.2.3",
41
+ "oxfmt": "0.20.0",
42
+ "oxlint": "1.35.0",
43
+ "oxlint-tsgolint": "0.10.0",
44
+ "ts-to-zod": "5.1.0",
45
+ "tsdown": "0.18.3",
46
+ "vitest": "4.0.16",
47
+ "zod": "4.2.1"
48
+ },
49
+ "engines": {
50
+ "node": ">=24.12.0"
51
+ },
52
+ "packageManager": "pnpm@10.26.2",
53
+ "access": "public"
53
54
  }