binance 2.13.19 → 2.14.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/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export * from './types/shared';
8
8
  export * from './types/spot';
9
9
  export * from './types/websockets';
10
10
  export * from './usdm-client';
11
- export * from './util/proxy';
11
+ export * from './portfolio-client';
12
12
  export * from './util/requestUtils';
13
13
  export * from './util/typeGuards';
14
14
  export * from './util/WsStore';
package/lib/index.js CHANGED
@@ -24,7 +24,7 @@ __exportStar(require("./types/shared"), exports);
24
24
  __exportStar(require("./types/spot"), exports);
25
25
  __exportStar(require("./types/websockets"), exports);
26
26
  __exportStar(require("./usdm-client"), exports);
27
- __exportStar(require("./util/proxy"), exports);
27
+ __exportStar(require("./portfolio-client"), exports);
28
28
  __exportStar(require("./util/requestUtils"), exports);
29
29
  __exportStar(require("./util/typeGuards"), exports);
30
30
  __exportStar(require("./util/WsStore"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qCAAmB;AACnB,iDAA+B;AAC/B,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,iDAA+B;AAC/B,+CAA6B;AAC7B,qDAAmC;AACnC,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,oDAAkC;AAClC,iDAA+B;AAC/B,8CAA4B;AAC5B,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qCAAmB;AACnB,iDAA+B;AAC/B,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,iDAA+B;AAC/B,+CAA6B;AAC7B,qDAAmC;AACnC,gDAA8B;AAC9B,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC;AAClC,iDAA+B;AAC/B,8CAA4B;AAC5B,qDAAmC"}
@@ -0,0 +1,344 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { BinanceBaseUrlKey } from './types/shared';
3
+ import { RestClientOptions } from './util/requestUtils';
4
+ import BaseRestClient from './util/BaseRestClient';
5
+ import { CancelPortfolioCMConditionalOrderReq, CancelPortfolioCMOrderReq, CancelPortfolioMarginOCOReq, CancelPortfolioMarginOrderReq, CancelPortfolioUMConditionalOrderReq, CancelPortfolioUMOrderReq, ModifyPortfolioCMOrderReq, ModifyPortfolioUMOrderReq, NewPortfolioCMConditionalOrderReq, NewPortfolioCMOrderReq, NewPortfolioUMConditionalOrderReq, NewPortfolioMarginOCOReq, NewPortfolioMarginOrderReq, PortfolioADLQuantile, PortfolioCMCancelConditionalOrderResponse, PortfolioCMCancelOrderResponse, PortfolioCMConditionalHistoryOrder, PortfolioCMConditionalOrder, NewPortfolioCMConditionalOrderResponse, PortfolioCMForceOrder, PortfolioCMModifyOrderResponse, PortfolioCMOrderModificationHistory, PortfolioCMOrder, NewPortfolioCMOrderResponse, PortfolioCMTrade, NewPortfolioConditionalOrderResponse, PortfolioMarginCancelAllOrdersResponse, PortfolioMarginCancelOrderResponse, PortfolioMarginForceOrder, PortfolioMarginOCO, PortfolioMarginOCOCancelResponse, NewPortfolioMarginOCOResponse, PortfolioMarginOrder, NewPortfolioMarginOrderResponse, PortfolioMarginRepayDebtReq, PortfolioMarginRepayDebtResponse, PortfolioMarginTrade, PortfolioUMCancelConditionalOrderResponse, PortfolioUMCancelOrderResponse, PortfolioUMConditionalOrder, PortfolioUMForceOrder, PortfolioUMModifyOrderResponse, PortfolioUMOrderModificationHistory, PortfolioUMOrder, PortfolioUMTrade, QueryPortfolioAllCMConditionalOrdersReq, QueryPortfolioAllCMOrdersReq, QueryPortfolioAllUMConditionalOrdersReq, QueryPortfolioAllUMOrdersReq, QueryPortfolioCMConditionalOrderHistoryReq, QueryPortfolioCMForceOrdersReq, QueryPortfolioCMOpenOrderReq, QueryPortfolioCMOrderAmendmentReq, QueryPortfolioCMOrderReq, QueryPortfolioCMTradesReq, QueryPortfolioMarginAllOCOReq, QueryPortfolioMarginAllOrdersReq, QueryPortfolioMarginForceOrdersReq, QueryPortfolioMarginOCOReq, QueryPortfolioMarginOrderReq, QueryPortfolioMarginTradesReq, QueryPortfolioUMConditionalOrderHistoryReq, QueryPortfolioUMForceOrdersReq, QueryPortfolioUMOpenConditionalOrderReq, QueryPortfolioUMOpenOrderReq, QueryPortfolioUMOrderAmendmentReq, QueryPortfolioUMOrderReq, QueryPortfolioUMTradesReq, PortfolioBalance, PortfolioAccountInformation, PortfolioUMPosition, PortfolioCMPosition, PortfolioUMLeverageBracket, PortfolioCMLeverageBracket, PortfolioTradingStatus, PortfolioMarginLoanRecord, GetMarginLoanRecordsReq, GetMarginRepayRecordsReq, PortfolioMarginRepayRecord, PortfolioMarginInterestRecord, GetMarginInterestHistoryReq, GetPortfolioInterestHistoryReq, PortfolioNegativeBalanceInterestRecord, QueryPortfolioUMIncomeReq, PortfolioUMIncome, QueryPortfolioCMIncomeReq, PortfolioCMIncome, PortfolioUMAccountAsset, PortfolioUMAccountPosition, PortfolioCMAccountAsset, PortfolioCMAccountPosition, PortfolioUMAccountConfig, PortfolioUMSymbolConfig, PortfolioUMAccountAssetV2, PortfolioUMAccountPositionV2, DownloadLinkResponse, NewPortfolioUMOrderReq, NewPortfolioUMOrderResponse } from './types/portfolio-margin';
6
+ /**
7
+ * REST client for Portfolio Margin APIs (papi)
8
+ *
9
+ * https://developers.binance.com/docs/derivatives/portfolio-margin/general-info
10
+ */
11
+ export declare class PortfolioClient extends BaseRestClient {
12
+ private clientId;
13
+ constructor(restClientOptions?: RestClientOptions, requestOptions?: AxiosRequestConfig);
14
+ getClientId(): BinanceBaseUrlKey;
15
+ /**
16
+ * Abstraction required by each client to aid with time sync / drift handling
17
+ */
18
+ getServerTime(): Promise<number>;
19
+ /**
20
+ *
21
+ * Misc Endpoints
22
+ *
23
+ **/
24
+ testConnectivity(): Promise<{}>;
25
+ /**
26
+ *
27
+ * DERIVATIVES -TRADE endpoints
28
+ *
29
+ **/
30
+ submitNewUMOrder(params: NewPortfolioUMOrderReq): Promise<NewPortfolioUMOrderResponse>;
31
+ submitNewUMConditionalOrder(params: NewPortfolioUMConditionalOrderReq): Promise<NewPortfolioConditionalOrderResponse>;
32
+ submitNewCMOrder(params: NewPortfolioCMOrderReq): Promise<NewPortfolioCMOrderResponse>;
33
+ submitNewCMConditionalOrder(params: NewPortfolioCMConditionalOrderReq): Promise<NewPortfolioCMConditionalOrderResponse>;
34
+ submitNewMarginOrder(params: NewPortfolioMarginOrderReq): Promise<NewPortfolioMarginOrderResponse>;
35
+ submitMarginLoan(params: {
36
+ asset: string;
37
+ amount: string;
38
+ }): Promise<{
39
+ tranId: number;
40
+ }>;
41
+ submitMarginRepay(params: {
42
+ asset: string;
43
+ amount: string;
44
+ }): Promise<{
45
+ tranId: number;
46
+ }>;
47
+ submitNewMarginOCO(params: NewPortfolioMarginOCOReq): Promise<NewPortfolioMarginOCOResponse>;
48
+ cancelUMOrder(params: CancelPortfolioUMOrderReq): Promise<PortfolioUMCancelOrderResponse>;
49
+ cancelAllUMOrders(params: {
50
+ symbol: string;
51
+ }): Promise<{
52
+ code: number;
53
+ msg: string;
54
+ }>;
55
+ cancelUMConditionalOrder(params: CancelPortfolioUMConditionalOrderReq): Promise<PortfolioUMCancelConditionalOrderResponse>;
56
+ cancelAllUMConditionalOrders(params: {
57
+ symbol: string;
58
+ }): Promise<{
59
+ code: number;
60
+ msg: string;
61
+ }>;
62
+ cancelCMOrder(params: CancelPortfolioCMOrderReq): Promise<PortfolioCMCancelOrderResponse>;
63
+ cancelAllCMOrders(params: {
64
+ symbol: string;
65
+ }): Promise<{
66
+ code: number;
67
+ msg: string;
68
+ }>;
69
+ cancelCMConditionalOrder(params: CancelPortfolioCMConditionalOrderReq): Promise<PortfolioCMCancelConditionalOrderResponse>;
70
+ cancelAllCMConditionalOrders(params: {
71
+ symbol: string;
72
+ }): Promise<{
73
+ code: number;
74
+ msg: string;
75
+ }>;
76
+ cancelMarginOrder(params: CancelPortfolioMarginOrderReq): Promise<PortfolioMarginCancelOrderResponse>;
77
+ cancelMarginOCO(params: CancelPortfolioMarginOCOReq): Promise<PortfolioMarginOCOCancelResponse>;
78
+ cancelAllMarginOrders(params: {
79
+ symbol: string;
80
+ }): Promise<PortfolioMarginCancelAllOrdersResponse[]>;
81
+ modifyUMOrder(params: ModifyPortfolioUMOrderReq): Promise<PortfolioUMModifyOrderResponse>;
82
+ modifyCMOrder(params: ModifyPortfolioCMOrderReq): Promise<PortfolioCMModifyOrderResponse>;
83
+ getUMOrder(params: QueryPortfolioUMOrderReq): Promise<PortfolioUMOrder>;
84
+ getAllUMOrders(params: QueryPortfolioAllUMOrdersReq): Promise<PortfolioUMOrder[]>;
85
+ getUMOpenOrder(params: QueryPortfolioUMOpenOrderReq): Promise<PortfolioUMOrder>;
86
+ getAllUMOpenOrders(params: {
87
+ symbol?: string;
88
+ }): Promise<PortfolioUMOrder[]>;
89
+ getAllUMConditionalOrders(params: QueryPortfolioAllUMConditionalOrdersReq): Promise<PortfolioUMConditionalOrder[]>;
90
+ getUMOpenConditionalOrders(params: {
91
+ symbol?: string;
92
+ }): Promise<PortfolioUMConditionalOrder[]>;
93
+ getUMOpenConditionalOrder(params: QueryPortfolioUMOpenConditionalOrderReq): Promise<PortfolioUMConditionalOrder>;
94
+ getUMConditionalOrderHistory(params: QueryPortfolioUMConditionalOrderHistoryReq): Promise<PortfolioUMConditionalOrder>;
95
+ getCMOrder(params: QueryPortfolioCMOrderReq): Promise<PortfolioCMOrder>;
96
+ getAllCMOrders(params: QueryPortfolioAllCMOrdersReq): Promise<PortfolioCMOrder[]>;
97
+ getCMOpenOrder(params: QueryPortfolioCMOpenOrderReq): Promise<PortfolioCMOrder>;
98
+ getAllCMOpenOrders(params: {
99
+ symbol?: string;
100
+ pair?: string;
101
+ }): Promise<PortfolioCMOrder[]>;
102
+ getCMOpenConditionalOrders(params: {
103
+ symbol?: string;
104
+ }): Promise<PortfolioCMConditionalOrder[]>;
105
+ getCMOpenConditionalOrder(params: {
106
+ symbol: string;
107
+ strategyId?: number;
108
+ newClientStrategyId?: string;
109
+ }): Promise<PortfolioCMConditionalOrder>;
110
+ getAllCMConditionalOrders(params: QueryPortfolioAllCMConditionalOrdersReq): Promise<PortfolioCMConditionalOrder[]>;
111
+ getCMConditionalOrderHistory(params: QueryPortfolioCMConditionalOrderHistoryReq): Promise<PortfolioCMConditionalHistoryOrder>;
112
+ getUMForceOrders(params: QueryPortfolioUMForceOrdersReq): Promise<PortfolioUMForceOrder[]>;
113
+ getCMForceOrders(params: QueryPortfolioCMForceOrdersReq): Promise<PortfolioCMForceOrder[]>;
114
+ getUMOrderModificationHistory(params: QueryPortfolioUMOrderAmendmentReq): Promise<PortfolioUMOrderModificationHistory[]>;
115
+ getCMOrderModificationHistory(params: QueryPortfolioCMOrderAmendmentReq): Promise<PortfolioCMOrderModificationHistory[]>;
116
+ getMarginForceOrders(params: QueryPortfolioMarginForceOrdersReq): Promise<{
117
+ rows: PortfolioMarginForceOrder[];
118
+ total: number;
119
+ }>;
120
+ getUMTrades(params: QueryPortfolioUMTradesReq): Promise<PortfolioUMTrade[]>;
121
+ getCMTrades(params: QueryPortfolioCMTradesReq): Promise<PortfolioCMTrade[]>;
122
+ getUMADLQuantile(params: {
123
+ symbol?: string;
124
+ }): Promise<{
125
+ symbol: string;
126
+ adlQuantile: PortfolioADLQuantile;
127
+ }[]>;
128
+ getCMADLQuantile(params: {
129
+ symbol?: string;
130
+ }): Promise<{
131
+ symbol: string;
132
+ adlQuantile: PortfolioADLQuantile;
133
+ }[]>;
134
+ toggleUMFeeBurn(params: {
135
+ feeBurn: 'true' | 'false';
136
+ }): Promise<{
137
+ code: number;
138
+ msg: string;
139
+ }>;
140
+ getUMFeeBurnStatus(): Promise<{
141
+ feeBurn: boolean;
142
+ }>;
143
+ getMarginOrder(params: QueryPortfolioMarginOrderReq): Promise<PortfolioMarginOrder>;
144
+ getMarginOpenOrders(params: {
145
+ symbol: string;
146
+ }): Promise<PortfolioMarginOrder>;
147
+ getAllMarginOrders(params: QueryPortfolioMarginAllOrdersReq): Promise<PortfolioMarginOrder[]>;
148
+ getMarginOCO(params: QueryPortfolioMarginOCOReq): Promise<PortfolioMarginOCO>;
149
+ getAllMarginOCO(params: QueryPortfolioMarginAllOCOReq): Promise<PortfolioMarginOCO[]>;
150
+ getMarginOpenOCO(): Promise<PortfolioMarginOCO[]>;
151
+ getMarginTrades(params: QueryPortfolioMarginTradesReq): Promise<PortfolioMarginTrade[]>;
152
+ repayMarginDebt(params: PortfolioMarginRepayDebtReq): Promise<PortfolioMarginRepayDebtResponse>;
153
+ /**
154
+ *
155
+ * DERIVATIVES - ACCOUNT endpoints
156
+ *
157
+ **/
158
+ getBalance(params?: {
159
+ asset?: string;
160
+ }): Promise<PortfolioBalance>;
161
+ getAccountInfo(): Promise<PortfolioAccountInformation>;
162
+ getMarginMaxBorrow(params: {
163
+ asset: string;
164
+ }): Promise<{
165
+ amount: string;
166
+ borrowLimit: string;
167
+ }>;
168
+ getMarginMaxWithdraw(params: {
169
+ asset: string;
170
+ }): Promise<{
171
+ amount: string;
172
+ }>;
173
+ getUMPosition(params?: {
174
+ symbol?: string;
175
+ }): Promise<PortfolioUMPosition[]>;
176
+ getCMPosition(params?: {
177
+ marginAsset?: string;
178
+ pair?: string;
179
+ }): Promise<PortfolioCMPosition[]>;
180
+ updateUMLeverage(params: {
181
+ symbol: string;
182
+ leverage: number;
183
+ }): Promise<{
184
+ leverage: number;
185
+ maxNotionalValue: string;
186
+ symbol: string;
187
+ }>;
188
+ updateCMLeverage(params: {
189
+ symbol: string;
190
+ leverage: number;
191
+ }): Promise<{
192
+ leverage: number;
193
+ maxQty: string;
194
+ symbol: string;
195
+ }>;
196
+ updateUMPositionMode(params: {
197
+ dualSidePosition: 'true' | 'false';
198
+ }): Promise<{
199
+ code: number;
200
+ msg: string;
201
+ }>;
202
+ updateCMPositionMode(params: {
203
+ dualSidePosition: 'true' | 'false';
204
+ }): Promise<{
205
+ code: number;
206
+ msg: string;
207
+ }>;
208
+ getUMPositionMode(): Promise<{
209
+ dualSidePosition: boolean;
210
+ }>;
211
+ getCMPositionMode(): Promise<{
212
+ dualSidePosition: boolean;
213
+ }>;
214
+ getUMLeverageBrackets(params?: {
215
+ symbol?: string;
216
+ }): Promise<{
217
+ symbol: string;
218
+ notionalCoef: string;
219
+ brackets: PortfolioUMLeverageBracket[];
220
+ }[]>;
221
+ getCMLeverageBrackets(params?: {
222
+ symbol?: string;
223
+ }): Promise<{
224
+ symbol: string;
225
+ brackets: PortfolioCMLeverageBracket[];
226
+ }[]>;
227
+ getUMTradingStatus(params?: {
228
+ symbol?: string;
229
+ }): Promise<PortfolioTradingStatus>;
230
+ getUMCommissionRate(params: {
231
+ symbol: string;
232
+ }): Promise<{
233
+ symbol: string;
234
+ makerCommissionRate: string;
235
+ takerCommissionRate: string;
236
+ }>;
237
+ getCMCommissionRate(params: {
238
+ symbol: string;
239
+ }): Promise<{
240
+ symbol: string;
241
+ makerCommissionRate: string;
242
+ takerCommissionRate: string;
243
+ }>;
244
+ getMarginLoanRecords(params: GetMarginLoanRecordsReq): Promise<{
245
+ rows: PortfolioMarginLoanRecord[];
246
+ total: number;
247
+ }>;
248
+ getMarginRepayRecords(params: GetMarginRepayRecordsReq): Promise<{
249
+ rows: PortfolioMarginRepayRecord[];
250
+ total: number;
251
+ }>;
252
+ getAutoRepayFuturesStatus(): Promise<{
253
+ autoRepay: boolean;
254
+ }>;
255
+ updateAutoRepayFuturesStatus(params: {
256
+ autoRepay: 'true' | 'false';
257
+ }): Promise<{
258
+ msg: string;
259
+ }>;
260
+ getMarginInterestHistory(params?: GetMarginInterestHistoryReq): Promise<{
261
+ rows: PortfolioMarginInterestRecord[];
262
+ total: number;
263
+ }>;
264
+ repayFuturesNegativeBalance(): Promise<{
265
+ msg: string;
266
+ }>;
267
+ getPortfolioNegativeBalanceInterestHistory(params?: GetPortfolioInterestHistoryReq): Promise<PortfolioNegativeBalanceInterestRecord[]>;
268
+ autoCollectFunds(): Promise<{
269
+ msg: string;
270
+ }>;
271
+ transferAssetFuturesMargin(params: {
272
+ asset: string;
273
+ }): Promise<{
274
+ msg: string;
275
+ }>;
276
+ transferBNB(params: {
277
+ amount: string;
278
+ transferSide: 'TO_UM' | 'FROM_UM';
279
+ }): Promise<{
280
+ tranId: number;
281
+ }>;
282
+ getUMIncomeHistory(params?: QueryPortfolioUMIncomeReq): Promise<PortfolioUMIncome[]>;
283
+ getCMIncomeHistory(params?: QueryPortfolioCMIncomeReq): Promise<PortfolioCMIncome[]>;
284
+ getUMAccount(): Promise<{
285
+ assets: PortfolioUMAccountAsset[];
286
+ positions: PortfolioUMAccountPosition[];
287
+ }>;
288
+ getCMAccount(): Promise<{
289
+ assets: PortfolioCMAccountAsset[];
290
+ positions: PortfolioCMAccountPosition[];
291
+ }>;
292
+ getUMAccountConfig(): Promise<PortfolioUMAccountConfig>;
293
+ getUMSymbolConfig(params?: {
294
+ symbol?: string;
295
+ }): Promise<PortfolioUMSymbolConfig[]>;
296
+ getUMAccountV2(): Promise<{
297
+ assets: PortfolioUMAccountAssetV2[];
298
+ positions: PortfolioUMAccountPositionV2[];
299
+ }>;
300
+ getUMTradeHistoryDownloadId(params: {
301
+ startTime: number;
302
+ endTime: number;
303
+ }): Promise<{
304
+ avgCostTimestampOfLast30d: number;
305
+ downloadId: string;
306
+ }>;
307
+ getUMTradeDownloadLink(params: {
308
+ downloadId: string;
309
+ }): Promise<DownloadLinkResponse>;
310
+ getUMOrderHistoryDownloadId(params: {
311
+ startTime: number;
312
+ endTime: number;
313
+ }): Promise<{
314
+ avgCostTimestampOfLast30d: number;
315
+ downloadId: string;
316
+ }>;
317
+ getUMOrderDownloadLink(params: {
318
+ downloadId: string;
319
+ }): Promise<DownloadLinkResponse>;
320
+ getUMTransactionHistoryDownloadId(params: {
321
+ startTime: number;
322
+ endTime: number;
323
+ }): Promise<{
324
+ avgCostTimestampOfLast30d: number;
325
+ downloadId: string;
326
+ }>;
327
+ getUMTransactionDownloadLink(params: {
328
+ downloadId: string;
329
+ }): Promise<DownloadLinkResponse>;
330
+ /**
331
+ * Validate syntax meets requirements set by binance. Log warning if not.
332
+ */
333
+ private validateOrderId;
334
+ /**
335
+ *
336
+ * User Data Stream Endpoints
337
+ *
338
+ **/
339
+ getPMUserDataListenKey(): Promise<{
340
+ listenKey: string;
341
+ }>;
342
+ keepAlivePMUserDataListenKey(): Promise<{}>;
343
+ closePMUserDataListenKey(): Promise<{}>;
344
+ }