binance 2.13.20 → 2.15.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.
@@ -0,0 +1,1236 @@
1
+ export type PMStrategyType = 'STOP' | 'STOP_MARKET' | 'TAKE_PROFIT' | 'TAKE_PROFIT_MARKET' | 'TRAILING_STOP_MARKET';
2
+ export type PMWorkingType = 'MARK_PRICE' | 'CONTRACT_PRICE';
3
+ export type PMPriceMatch = 'NONE' | 'OPPONENT' | 'OPPONENT_5' | 'OPPONENT_10' | 'OPPONENT_20' | 'QUEUE' | 'QUEUE_5' | 'QUEUE_10' | 'QUEUE_20';
4
+ export type PMSelfTradePreventionMode = 'NONE' | 'EXPIRE_TAKER' | 'EXPIRE_MAKER' | 'EXPIRE_BOTH';
5
+ export type PMMarginOrderType = 'LIMIT' | 'MARKET' | 'STOP_LOSS' | 'STOP_LOSS_LIMIT' | 'TAKE_PROFIT' | 'TAKE_PROFIT_LIMIT';
6
+ export type PMMarginSideEffectType = 'NO_SIDE_EFFECT' | 'MARGIN_BUY' | 'AUTO_REPAY' | 'AUTO_BORROW_REPAY';
7
+ export type PMAutoCloseType = 'LIQUIDATION' | 'ADL';
8
+ export interface NewPortfolioUMOrderReq {
9
+ symbol: string;
10
+ side: 'BUY' | 'SELL';
11
+ positionSide?: 'BOTH' | 'LONG' | 'SHORT';
12
+ type: 'LIMIT' | 'MARKET';
13
+ timeInForce?: string;
14
+ quantity?: string;
15
+ reduceOnly?: boolean;
16
+ price?: string;
17
+ newClientOrderId?: string;
18
+ newOrderRespType?: 'ACK' | 'RESULT';
19
+ priceMatch?: PMPriceMatch;
20
+ selfTradePreventionMode?: PMSelfTradePreventionMode;
21
+ goodTillDate?: number;
22
+ }
23
+ export interface NewPortfolioUMOrderResponse {
24
+ clientOrderId: string;
25
+ cumQty: string;
26
+ cumQuote: string;
27
+ executedQty: string;
28
+ orderId: number;
29
+ avgPrice: string;
30
+ origQty: string;
31
+ price: string;
32
+ reduceOnly: boolean;
33
+ side: 'BUY' | 'SELL';
34
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
35
+ status: string;
36
+ symbol: string;
37
+ timeInForce: string;
38
+ type: 'LIMIT' | 'MARKET';
39
+ selfTradePreventionMode: PMSelfTradePreventionMode;
40
+ goodTillDate?: number;
41
+ updateTime: number;
42
+ priceMatch: PMPriceMatch;
43
+ }
44
+ export interface NewPortfolioUMConditionalOrderReq {
45
+ symbol: string;
46
+ side: 'BUY' | 'SELL';
47
+ positionSide?: 'BOTH' | 'LONG' | 'SHORT';
48
+ strategyType: PMStrategyType;
49
+ timeInForce?: string;
50
+ quantity?: string;
51
+ reduceOnly?: boolean;
52
+ price?: string;
53
+ workingType?: PMWorkingType;
54
+ priceProtect?: boolean;
55
+ newClientStrategyId?: string;
56
+ stopPrice?: string;
57
+ activationPrice?: string;
58
+ callbackRate?: string;
59
+ priceMatch?: PMPriceMatch;
60
+ selfTradePreventionMode?: PMSelfTradePreventionMode;
61
+ goodTillDate?: number;
62
+ }
63
+ export interface NewPortfolioConditionalOrderResponse {
64
+ newClientStrategyId: string;
65
+ strategyId: number;
66
+ strategyStatus: string;
67
+ strategyType: PMStrategyType;
68
+ origQty: string;
69
+ price: string;
70
+ reduceOnly: boolean;
71
+ side: 'BUY' | 'SELL';
72
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
73
+ stopPrice?: string;
74
+ symbol: string;
75
+ timeInForce: string;
76
+ activatePrice?: string;
77
+ priceRate?: string;
78
+ bookTime: number;
79
+ updateTime: number;
80
+ workingType: PMWorkingType;
81
+ priceProtect: boolean;
82
+ selfTradePreventionMode: PMSelfTradePreventionMode;
83
+ goodTillDate?: number;
84
+ priceMatch: PMPriceMatch;
85
+ }
86
+ export interface NewPortfolioCMOrderReq {
87
+ symbol: string;
88
+ side: 'BUY' | 'SELL';
89
+ positionSide?: 'BOTH' | 'LONG' | 'SHORT';
90
+ type: 'LIMIT' | 'MARKET';
91
+ timeInForce?: string;
92
+ quantity?: string;
93
+ reduceOnly?: boolean;
94
+ price?: string;
95
+ newClientOrderId?: string;
96
+ newOrderRespType?: 'ACK' | 'RESULT';
97
+ }
98
+ export interface NewPortfolioCMOrderResponse {
99
+ clientOrderId: string;
100
+ cumQty: string;
101
+ cumBase: string;
102
+ executedQty: string;
103
+ orderId: number;
104
+ avgPrice: string;
105
+ origQty: string;
106
+ price: string;
107
+ reduceOnly: boolean;
108
+ side: 'BUY' | 'SELL';
109
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
110
+ status: string;
111
+ symbol: string;
112
+ pair: string;
113
+ timeInForce: string;
114
+ type: 'LIMIT' | 'MARKET';
115
+ updateTime: number;
116
+ }
117
+ export interface NewPortfolioCMConditionalOrderReq {
118
+ symbol: string;
119
+ side: 'BUY' | 'SELL';
120
+ positionSide?: 'BOTH' | 'LONG' | 'SHORT';
121
+ strategyType: PMStrategyType;
122
+ timeInForce?: string;
123
+ quantity?: string;
124
+ reduceOnly?: boolean;
125
+ price?: string;
126
+ workingType?: PMWorkingType;
127
+ priceProtect?: boolean;
128
+ newClientStrategyId?: string;
129
+ stopPrice?: string;
130
+ activationPrice?: string;
131
+ callbackRate?: string;
132
+ }
133
+ export interface NewPortfolioCMConditionalOrderResponse {
134
+ newClientStrategyId: string;
135
+ strategyId: number;
136
+ strategyStatus: string;
137
+ strategyType: PMStrategyType;
138
+ origQty: string;
139
+ price: string;
140
+ reduceOnly: boolean;
141
+ side: 'BUY' | 'SELL';
142
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
143
+ stopPrice?: string;
144
+ symbol: string;
145
+ pair: string;
146
+ timeInForce: string;
147
+ activatePrice?: string;
148
+ priceRate?: string;
149
+ bookTime: number;
150
+ updateTime: number;
151
+ workingType: PMWorkingType;
152
+ priceProtect: boolean;
153
+ }
154
+ export interface MarginOrderFill {
155
+ price: string;
156
+ qty: string;
157
+ commission: string;
158
+ commissionAsset: string;
159
+ }
160
+ export interface NewPortfolioMarginOrderReq {
161
+ symbol: string;
162
+ side: 'BUY' | 'SELL';
163
+ type: PMMarginOrderType;
164
+ quantity?: string;
165
+ quoteOrderQty?: string;
166
+ price?: string;
167
+ stopPrice?: string;
168
+ newClientOrderId?: string;
169
+ newOrderRespType?: 'ACK' | 'RESULT' | 'FULL';
170
+ icebergQty?: string;
171
+ sideEffectType?: PMMarginSideEffectType;
172
+ timeInForce?: string;
173
+ selfTradePreventionMode?: PMSelfTradePreventionMode;
174
+ autoRepayAtCancel?: boolean;
175
+ }
176
+ export interface NewPortfolioMarginOrderResponse {
177
+ symbol: string;
178
+ orderId: number;
179
+ clientOrderId: string;
180
+ transactTime: number;
181
+ price: string;
182
+ origQty: string;
183
+ executedQty: string;
184
+ cummulativeQuoteQty: string;
185
+ status: string;
186
+ timeInForce: string;
187
+ type: PMMarginOrderType;
188
+ side: 'BUY' | 'SELL';
189
+ marginBuyBorrowAmount?: string;
190
+ marginBuyBorrowAsset?: string;
191
+ fills: MarginOrderFill[];
192
+ }
193
+ export interface PortfolioMarginOCOOrder {
194
+ symbol: string;
195
+ orderId: number;
196
+ clientOrderId: string;
197
+ }
198
+ export interface PortfolioMarginOCOOrderReport {
199
+ symbol: string;
200
+ orderId: number;
201
+ orderListId: number;
202
+ clientOrderId: string;
203
+ transactTime: number;
204
+ price: string;
205
+ origQty: string;
206
+ executedQty: string;
207
+ cummulativeQuoteQty: string;
208
+ status: string;
209
+ timeInForce: string;
210
+ type: string;
211
+ side: 'BUY' | 'SELL';
212
+ stopPrice?: string;
213
+ }
214
+ export interface NewPortfolioMarginOCOReq {
215
+ symbol: string;
216
+ listClientOrderId?: string;
217
+ side: 'BUY' | 'SELL';
218
+ quantity: string;
219
+ limitClientOrderId?: string;
220
+ price: string;
221
+ limitIcebergQty?: string;
222
+ stopClientOrderId?: string;
223
+ stopPrice: string;
224
+ stopLimitPrice?: string;
225
+ stopIcebergQty?: string;
226
+ stopLimitTimeInForce?: 'GTC' | 'FOK' | 'IOC';
227
+ newOrderRespType?: 'ACK' | 'RESULT' | 'FULL';
228
+ sideEffectType?: PMMarginSideEffectType;
229
+ }
230
+ export interface NewPortfolioMarginOCOResponse {
231
+ orderListId: number;
232
+ contingencyType: 'OCO';
233
+ listStatusType: string;
234
+ listOrderStatus: string;
235
+ listClientOrderId: string;
236
+ transactionTime: number;
237
+ symbol: string;
238
+ marginBuyBorrowAmount?: string;
239
+ marginBuyBorrowAsset?: string;
240
+ orders: PortfolioMarginOCOOrder[];
241
+ orderReports: PortfolioMarginOCOOrderReport[];
242
+ }
243
+ export interface CancelPortfolioUMOrderReq {
244
+ symbol: string;
245
+ orderId?: number;
246
+ origClientOrderId?: string;
247
+ }
248
+ export interface PortfolioUMCancelOrderResponse {
249
+ avgPrice: string;
250
+ clientOrderId: string;
251
+ cumQty: string;
252
+ cumQuote: string;
253
+ executedQty: string;
254
+ orderId: number;
255
+ origQty: string;
256
+ price: string;
257
+ reduceOnly: boolean;
258
+ side: 'BUY' | 'SELL';
259
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
260
+ status: string;
261
+ symbol: string;
262
+ timeInForce: string;
263
+ type: 'LIMIT' | 'MARKET';
264
+ updateTime: number;
265
+ selfTradePreventionMode: PMSelfTradePreventionMode;
266
+ goodTillDate: number;
267
+ priceMatch: PMPriceMatch;
268
+ }
269
+ export interface CancelPortfolioUMConditionalOrderReq {
270
+ symbol: string;
271
+ strategyId?: number;
272
+ newClientStrategyId?: string;
273
+ }
274
+ export interface PortfolioUMCancelConditionalOrderResponse {
275
+ newClientStrategyId: string;
276
+ strategyId: number;
277
+ strategyStatus: string;
278
+ strategyType: PMStrategyType;
279
+ origQty: string;
280
+ price: string;
281
+ reduceOnly: boolean;
282
+ side: 'BUY' | 'SELL';
283
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
284
+ stopPrice?: string;
285
+ symbol: string;
286
+ timeInForce: string;
287
+ activatePrice?: string;
288
+ priceRate?: string;
289
+ bookTime: number;
290
+ updateTime: number;
291
+ workingType: PMWorkingType;
292
+ priceProtect: boolean;
293
+ selfTradePreventionMode: PMSelfTradePreventionMode;
294
+ goodTillDate: number;
295
+ priceMatch: PMPriceMatch;
296
+ }
297
+ export interface CancelPortfolioCMOrderReq {
298
+ symbol: string;
299
+ orderId?: number;
300
+ origClientOrderId?: string;
301
+ }
302
+ export interface PortfolioCMCancelOrderResponse {
303
+ avgPrice: string;
304
+ clientOrderId: string;
305
+ cumQty: string;
306
+ cumBase: string;
307
+ executedQty: string;
308
+ orderId: number;
309
+ origQty: string;
310
+ price: string;
311
+ reduceOnly: boolean;
312
+ side: 'BUY' | 'SELL';
313
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
314
+ status: string;
315
+ symbol: string;
316
+ pair: string;
317
+ timeInForce: string;
318
+ type: 'LIMIT' | 'MARKET';
319
+ updateTime: number;
320
+ }
321
+ export interface CancelPortfolioCMConditionalOrderReq {
322
+ symbol: string;
323
+ strategyId?: number;
324
+ newClientStrategyId?: string;
325
+ }
326
+ export interface PortfolioCMCancelConditionalOrderResponse {
327
+ newClientStrategyId: string;
328
+ strategyId: number;
329
+ strategyStatus: string;
330
+ strategyType: PMStrategyType;
331
+ origQty: string;
332
+ price: string;
333
+ reduceOnly: boolean;
334
+ side: 'BUY' | 'SELL';
335
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
336
+ stopPrice?: string;
337
+ symbol: string;
338
+ timeInForce: string;
339
+ activatePrice?: string;
340
+ priceRate?: string;
341
+ bookTime: number;
342
+ updateTime: number;
343
+ workingType: PMWorkingType;
344
+ priceProtect: boolean;
345
+ }
346
+ export interface CancelPortfolioMarginOrderReq {
347
+ symbol: string;
348
+ orderId?: number;
349
+ origClientOrderId?: string;
350
+ newClientOrderId?: string;
351
+ }
352
+ export interface PortfolioMarginCancelOrderResponse {
353
+ symbol: string;
354
+ orderId: number;
355
+ origClientOrderId: string;
356
+ clientOrderId: string;
357
+ price: string;
358
+ origQty: string;
359
+ executedQty: string;
360
+ cummulativeQuoteQty: string;
361
+ status: string;
362
+ timeInForce: string;
363
+ type: PMMarginOrderType;
364
+ side: 'BUY' | 'SELL';
365
+ }
366
+ export interface CancelPortfolioMarginOCOReq {
367
+ symbol: string;
368
+ orderListId?: number;
369
+ listClientOrderId?: string;
370
+ newClientOrderId?: string;
371
+ }
372
+ export interface PortfolioMarginOCOCancelOrder {
373
+ symbol: string;
374
+ orderId: number;
375
+ clientOrderId: string;
376
+ }
377
+ export interface PortfolioMarginOCOCancelOrderReport {
378
+ symbol: string;
379
+ origClientOrderId: string;
380
+ orderId: number;
381
+ orderListId: number;
382
+ clientOrderId: string;
383
+ price: string;
384
+ origQty: string;
385
+ executedQty: string;
386
+ cummulativeQuoteQty: string;
387
+ status: string;
388
+ timeInForce: string;
389
+ type: 'STOP_LOSS_LIMIT' | 'LIMIT_MAKER';
390
+ side: 'BUY' | 'SELL';
391
+ stopPrice?: string;
392
+ }
393
+ export interface PortfolioMarginOCOCancelResponse {
394
+ orderListId: number;
395
+ contingencyType: 'OCO';
396
+ listStatusType: string;
397
+ listOrderStatus: string;
398
+ listClientOrderId: string;
399
+ transactionTime: number;
400
+ symbol: string;
401
+ orders: PortfolioMarginOCOCancelOrder[];
402
+ orderReports: PortfolioMarginOCOCancelOrderReport[];
403
+ }
404
+ export interface PortfolioMarginCancelAllOrdersOrderReport {
405
+ symbol: string;
406
+ origClientOrderId: string;
407
+ orderId: number;
408
+ orderListId: number;
409
+ clientOrderId: string;
410
+ price: string;
411
+ origQty: string;
412
+ executedQty: string;
413
+ cummulativeQuoteQty: string;
414
+ status: string;
415
+ timeInForce: string;
416
+ type: PMMarginOrderType;
417
+ side: 'BUY' | 'SELL';
418
+ stopPrice?: string;
419
+ icebergQty?: string;
420
+ }
421
+ export interface PortfolioMarginCancelAllOrdersOCOReport {
422
+ orderListId: number;
423
+ contingencyType: 'OCO';
424
+ listStatusType: string;
425
+ listOrderStatus: string;
426
+ listClientOrderId: string;
427
+ transactionTime: number;
428
+ symbol: string;
429
+ orders: PortfolioMarginOCOCancelOrder[];
430
+ orderReports: PortfolioMarginCancelAllOrdersOrderReport[];
431
+ }
432
+ export type PortfolioMarginCancelAllOrdersResponse = PortfolioMarginCancelAllOrdersOrderReport | PortfolioMarginCancelAllOrdersOCOReport;
433
+ export interface ModifyPortfolioUMOrderReq {
434
+ symbol: string;
435
+ side: 'BUY' | 'SELL';
436
+ quantity: string;
437
+ price: string;
438
+ orderId?: number;
439
+ origClientOrderId?: string;
440
+ priceMatch?: PMPriceMatch;
441
+ }
442
+ export interface PortfolioUMModifyOrderResponse {
443
+ orderId: number;
444
+ symbol: string;
445
+ status: string;
446
+ clientOrderId: string;
447
+ price: string;
448
+ avgPrice: string;
449
+ origQty: string;
450
+ executedQty: string;
451
+ cumQty: string;
452
+ cumQuote: string;
453
+ timeInForce: string;
454
+ type: 'LIMIT';
455
+ reduceOnly: boolean;
456
+ side: 'BUY' | 'SELL';
457
+ positionSide: 'LONG' | 'SHORT' | 'BOTH';
458
+ origType: 'LIMIT';
459
+ selfTradePreventionMode: PMSelfTradePreventionMode;
460
+ goodTillDate: number;
461
+ updateTime: number;
462
+ priceMatch: PMPriceMatch;
463
+ }
464
+ export interface ModifyPortfolioCMOrderReq {
465
+ symbol: string;
466
+ side: 'BUY' | 'SELL';
467
+ quantity: string;
468
+ price: string;
469
+ orderId?: number;
470
+ origClientOrderId?: string;
471
+ }
472
+ export interface PortfolioCMModifyOrderResponse {
473
+ orderId: number;
474
+ symbol: string;
475
+ pair: string;
476
+ status: string;
477
+ clientOrderId: string;
478
+ price: string;
479
+ avgPrice: string;
480
+ origQty: string;
481
+ executedQty: string;
482
+ cumQty: string;
483
+ cumBase: string;
484
+ timeInForce: string;
485
+ type: 'LIMIT';
486
+ reduceOnly: boolean;
487
+ side: 'BUY' | 'SELL';
488
+ positionSide: 'LONG' | 'SHORT' | 'BOTH';
489
+ origType: 'LIMIT';
490
+ updateTime: number;
491
+ }
492
+ export interface QueryPortfolioUMOrderReq {
493
+ symbol: string;
494
+ orderId?: number;
495
+ origClientOrderId?: string;
496
+ }
497
+ export interface PortfolioUMOrder {
498
+ avgPrice: string;
499
+ clientOrderId: string;
500
+ cumQuote: string;
501
+ executedQty: string;
502
+ orderId: number;
503
+ origQty: string;
504
+ origType: 'LIMIT' | 'MARKET';
505
+ price: string;
506
+ reduceOnly: boolean;
507
+ side: 'BUY' | 'SELL';
508
+ positionSide: 'LONG' | 'SHORT' | 'BOTH';
509
+ status: string;
510
+ symbol: string;
511
+ time: number;
512
+ timeInForce: string;
513
+ type: 'LIMIT' | 'MARKET';
514
+ updateTime: number;
515
+ selfTradePreventionMode: PMSelfTradePreventionMode;
516
+ goodTillDate: number;
517
+ priceMatch: PMPriceMatch;
518
+ }
519
+ export interface QueryPortfolioAllUMOrdersReq {
520
+ symbol: string;
521
+ orderId?: number;
522
+ startTime?: number;
523
+ endTime?: number;
524
+ limit?: number;
525
+ }
526
+ export interface QueryPortfolioUMOpenOrderReq {
527
+ symbol: string;
528
+ orderId?: number;
529
+ origClientOrderId?: string;
530
+ }
531
+ export interface QueryPortfolioAllUMConditionalOrdersReq {
532
+ symbol?: string;
533
+ strategyId?: number;
534
+ startTime?: number;
535
+ endTime?: number;
536
+ limit?: number;
537
+ }
538
+ export interface PortfolioUMConditionalOrder {
539
+ newClientStrategyId: string;
540
+ strategyId: number;
541
+ strategyStatus: string;
542
+ strategyType: PMStrategyType;
543
+ origQty: string;
544
+ price: string;
545
+ reduceOnly: boolean;
546
+ side: 'BUY' | 'SELL';
547
+ positionSide: 'LONG' | 'SHORT' | 'BOTH';
548
+ stopPrice?: string;
549
+ symbol: string;
550
+ orderId?: number;
551
+ status?: string;
552
+ bookTime: number;
553
+ updateTime: number;
554
+ triggerTime?: number;
555
+ timeInForce: string;
556
+ type?: 'MARKET' | 'LIMIT';
557
+ activatePrice?: string;
558
+ priceRate?: string;
559
+ selfTradePreventionMode: PMSelfTradePreventionMode;
560
+ goodTillDate: number;
561
+ priceMatch: PMPriceMatch;
562
+ }
563
+ export interface QueryPortfolioUMOpenConditionalOrderReq {
564
+ symbol: string;
565
+ strategyId?: number;
566
+ newClientStrategyId?: string;
567
+ }
568
+ export interface QueryPortfolioUMConditionalOrderHistoryReq {
569
+ symbol: string;
570
+ strategyId?: number;
571
+ newClientStrategyId?: string;
572
+ }
573
+ export interface QueryPortfolioCMOrderReq {
574
+ symbol: string;
575
+ orderId?: number;
576
+ origClientOrderId?: string;
577
+ }
578
+ export interface PortfolioCMOrder {
579
+ avgPrice: string;
580
+ clientOrderId: string;
581
+ cumBase: string;
582
+ executedQty: string;
583
+ orderId: number;
584
+ origQty: string;
585
+ origType: 'LIMIT' | 'MARKET';
586
+ price: string;
587
+ reduceOnly: boolean;
588
+ side: 'BUY' | 'SELL';
589
+ status: string;
590
+ symbol: string;
591
+ pair: string;
592
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
593
+ time: number;
594
+ timeInForce: string;
595
+ type: 'LIMIT' | 'MARKET';
596
+ updateTime: number;
597
+ }
598
+ export interface QueryPortfolioAllCMOrdersReq {
599
+ symbol: string;
600
+ pair?: string;
601
+ orderId?: number;
602
+ startTime?: number;
603
+ endTime?: number;
604
+ limit?: number;
605
+ }
606
+ export interface QueryPortfolioCMOpenOrderReq {
607
+ symbol: string;
608
+ orderId?: number;
609
+ origClientOrderId?: string;
610
+ }
611
+ export interface QueryPortfolioAllCMConditionalOrdersReq {
612
+ symbol?: string;
613
+ strategyId?: number;
614
+ startTime?: number;
615
+ endTime?: number;
616
+ limit?: number;
617
+ }
618
+ export interface PortfolioCMConditionalOrder {
619
+ newClientStrategyId: string;
620
+ strategyId: number;
621
+ strategyStatus: string;
622
+ strategyType: PMStrategyType;
623
+ origQty: string;
624
+ price: string;
625
+ reduceOnly: boolean;
626
+ side: 'BUY' | 'SELL';
627
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
628
+ stopPrice?: string;
629
+ symbol: string;
630
+ orderId?: number;
631
+ status?: string;
632
+ bookTime: number;
633
+ updateTime: number;
634
+ triggerTime?: number;
635
+ timeInForce: string;
636
+ type?: 'MARKET' | 'LIMIT';
637
+ activatePrice?: string;
638
+ priceRate?: string;
639
+ workingType: PMWorkingType;
640
+ priceProtect: boolean;
641
+ }
642
+ export interface QueryPortfolioCMConditionalOrderHistoryReq {
643
+ symbol: string;
644
+ strategyId?: number;
645
+ newClientStrategyId?: string;
646
+ }
647
+ export interface PortfolioCMConditionalHistoryOrder extends PortfolioCMConditionalOrder {
648
+ priceMatch: PMPriceMatch;
649
+ }
650
+ export interface QueryPortfolioUMForceOrdersReq {
651
+ symbol?: string;
652
+ autoCloseType?: PMAutoCloseType;
653
+ startTime?: number;
654
+ endTime?: number;
655
+ limit?: number;
656
+ }
657
+ export interface PortfolioUMForceOrder {
658
+ orderId: number;
659
+ symbol: string;
660
+ status: string;
661
+ clientOrderId: string;
662
+ price: string;
663
+ avgPrice: string;
664
+ origQty: string;
665
+ executedQty: string;
666
+ cumQuote: string;
667
+ timeInForce: string;
668
+ type: 'LIMIT';
669
+ reduceOnly: boolean;
670
+ side: 'BUY' | 'SELL';
671
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
672
+ origType: 'LIMIT';
673
+ time: number;
674
+ updateTime: number;
675
+ }
676
+ export interface QueryPortfolioCMForceOrdersReq {
677
+ symbol?: string;
678
+ autoCloseType?: PMAutoCloseType;
679
+ startTime?: number;
680
+ endTime?: number;
681
+ limit?: number;
682
+ }
683
+ export interface PortfolioCMForceOrder {
684
+ orderId: number;
685
+ symbol: string;
686
+ pair: string;
687
+ status: string;
688
+ clientOrderId: string;
689
+ price: string;
690
+ avgPrice: string;
691
+ origQty: string;
692
+ executedQty: string;
693
+ cumBase: string;
694
+ timeInForce: string;
695
+ type: 'LIMIT';
696
+ reduceOnly: boolean;
697
+ side: 'BUY' | 'SELL';
698
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
699
+ origType: 'LIMIT';
700
+ time: number;
701
+ updateTime: number;
702
+ }
703
+ export interface QueryPortfolioUMOrderAmendmentReq {
704
+ symbol: string;
705
+ orderId?: number;
706
+ origClientOrderId?: string;
707
+ startTime?: number;
708
+ endTime?: number;
709
+ limit?: number;
710
+ }
711
+ export interface PortfolioUMOrderAmendment {
712
+ price: {
713
+ before: string;
714
+ after: string;
715
+ };
716
+ origQty: {
717
+ before: string;
718
+ after: string;
719
+ };
720
+ count: number;
721
+ }
722
+ export interface PortfolioUMOrderModificationHistory {
723
+ amendmentId: number;
724
+ symbol: string;
725
+ pair: string;
726
+ orderId: number;
727
+ clientOrderId: string;
728
+ time: number;
729
+ amendment: PortfolioUMOrderAmendment;
730
+ priceMatch: PMPriceMatch;
731
+ }
732
+ export interface QueryPortfolioCMOrderAmendmentReq {
733
+ symbol: string;
734
+ orderId?: number;
735
+ origClientOrderId?: string;
736
+ startTime?: number;
737
+ endTime?: number;
738
+ limit?: number;
739
+ }
740
+ export interface PortfolioCMOrderAmendment {
741
+ price: {
742
+ before: string;
743
+ after: string;
744
+ };
745
+ origQty: {
746
+ before: string;
747
+ after: string;
748
+ };
749
+ count: number;
750
+ }
751
+ export interface PortfolioCMOrderModificationHistory {
752
+ amendmentId: number;
753
+ symbol: string;
754
+ pair: string;
755
+ orderId: number;
756
+ clientOrderId: string;
757
+ time: number;
758
+ amendment: PortfolioCMOrderAmendment;
759
+ }
760
+ export interface QueryPortfolioMarginForceOrdersReq {
761
+ startTime?: number;
762
+ endTime?: number;
763
+ current?: number;
764
+ size?: number;
765
+ }
766
+ export interface PortfolioMarginForceOrder {
767
+ avgPrice: string;
768
+ executedQty: string;
769
+ orderId: number;
770
+ price: string;
771
+ qty: string;
772
+ side: 'BUY' | 'SELL';
773
+ symbol: string;
774
+ timeInForce: string;
775
+ updatedTime: number;
776
+ }
777
+ export interface QueryPortfolioUMTradesReq {
778
+ symbol: string;
779
+ startTime?: number;
780
+ endTime?: number;
781
+ fromId?: number;
782
+ limit?: number;
783
+ }
784
+ export interface PortfolioUMTrade {
785
+ symbol: string;
786
+ id: number;
787
+ orderId: number;
788
+ side: 'BUY' | 'SELL';
789
+ price: string;
790
+ qty: string;
791
+ realizedPnl: string;
792
+ quoteQty: string;
793
+ commission: string;
794
+ commissionAsset: string;
795
+ time: number;
796
+ buyer: boolean;
797
+ maker: boolean;
798
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
799
+ }
800
+ export interface QueryPortfolioCMTradesReq {
801
+ symbol?: string;
802
+ pair?: string;
803
+ startTime?: number;
804
+ endTime?: number;
805
+ fromId?: number;
806
+ limit?: number;
807
+ }
808
+ export interface PortfolioCMTrade {
809
+ symbol: string;
810
+ id: number;
811
+ orderId: number;
812
+ pair: string;
813
+ side: 'BUY' | 'SELL';
814
+ price: string;
815
+ qty: string;
816
+ realizedPnl: string;
817
+ marginAsset: string;
818
+ baseQty: string;
819
+ commission: string;
820
+ commissionAsset: string;
821
+ time: number;
822
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
823
+ buyer: boolean;
824
+ maker: boolean;
825
+ }
826
+ export interface PortfolioADLQuantile {
827
+ LONG: number;
828
+ SHORT: number;
829
+ BOTH?: number;
830
+ HEDGE?: number;
831
+ }
832
+ export interface QueryPortfolioMarginOrderReq {
833
+ symbol: string;
834
+ orderId?: number;
835
+ origClientOrderId?: string;
836
+ recvWindow?: number;
837
+ timestamp: number;
838
+ }
839
+ export interface PortfolioMarginOrder {
840
+ clientOrderId: string;
841
+ cummulativeQuoteQty: string;
842
+ executedQty: string;
843
+ icebergQty: string;
844
+ isWorking: boolean;
845
+ orderId: number;
846
+ origQty: string;
847
+ price: string;
848
+ side: 'BUY' | 'SELL';
849
+ status: string;
850
+ stopPrice: string;
851
+ symbol: string;
852
+ time: number;
853
+ timeInForce: string;
854
+ type: PMMarginOrderType;
855
+ updateTime: number;
856
+ accountId: number;
857
+ selfTradePreventionMode: PMSelfTradePreventionMode;
858
+ preventedMatchId: number | null;
859
+ preventedQuantity: string | null;
860
+ }
861
+ export interface QueryPortfolioMarginAllOrdersReq {
862
+ symbol: string;
863
+ orderId?: number;
864
+ startTime?: number;
865
+ endTime?: number;
866
+ limit?: number;
867
+ recvWindow?: number;
868
+ timestamp: number;
869
+ }
870
+ export interface QueryPortfolioMarginOCOReq {
871
+ orderListId?: number;
872
+ origClientOrderId?: string;
873
+ recvWindow?: number;
874
+ timestamp: number;
875
+ }
876
+ export interface PortfolioMarginOCOQueryOrder {
877
+ symbol: string;
878
+ orderId: number;
879
+ clientOrderId: string;
880
+ }
881
+ export interface PortfolioMarginOCO {
882
+ orderListId: number;
883
+ contingencyType: 'OCO';
884
+ listStatusType: string;
885
+ listOrderStatus: string;
886
+ listClientOrderId: string;
887
+ transactionTime: number;
888
+ symbol: string;
889
+ orders: PortfolioMarginOCOQueryOrder[];
890
+ }
891
+ export interface QueryPortfolioMarginAllOCOReq {
892
+ fromId?: number;
893
+ startTime?: number;
894
+ endTime?: number;
895
+ limit?: number;
896
+ }
897
+ export interface QueryPortfolioMarginTradesReq {
898
+ symbol: string;
899
+ orderId?: number;
900
+ startTime?: number;
901
+ endTime?: number;
902
+ fromId?: number;
903
+ limit?: number;
904
+ }
905
+ export interface PortfolioMarginTrade {
906
+ commission: string;
907
+ commissionAsset: string;
908
+ id: number;
909
+ isBestMatch: boolean;
910
+ isBuyer: boolean;
911
+ isMaker: boolean;
912
+ orderId: number;
913
+ price: string;
914
+ qty: string;
915
+ symbol: string;
916
+ time: number;
917
+ }
918
+ export interface PortfolioMarginRepayDebtReq {
919
+ asset: string;
920
+ amount?: string;
921
+ specifyRepayAssets?: string;
922
+ }
923
+ export interface PortfolioMarginRepayDebtResponse {
924
+ amount: string;
925
+ asset: string;
926
+ specifyRepayAssets: string[];
927
+ updateTime: number;
928
+ success: boolean;
929
+ }
930
+ /**
931
+ *
932
+ * DERIVATIVES - ACCOUNT endpoints
933
+ *
934
+ **/
935
+ export type PMAccountStatus = 'NORMAL' | 'MARGIN_CALL' | 'SUPPLY_MARGIN' | 'REDUCE_ONLY' | 'ACTIVE_LIQUIDATION' | 'FORCE_LIQUIDATION' | 'BANKRUPTED';
936
+ export type PMIndicatorType = 'UFR' | 'IFER' | 'GCR' | 'DR' | 'TMV';
937
+ export type PMMarginLoanStatus = 'PENDING' | 'CONFIRMED' | 'FAILED';
938
+ export interface PortfolioTotalBalance {
939
+ asset: string;
940
+ totalWalletBalance: string;
941
+ crossMarginAsset: string;
942
+ crossMarginBorrowed: string;
943
+ crossMarginFree: string;
944
+ crossMarginInterest: string;
945
+ crossMarginLocked: string;
946
+ umWalletBalance: string;
947
+ umUnrealizedPNL: string;
948
+ cmWalletBalance: string;
949
+ cmUnrealizedPNL: string;
950
+ updateTime: number;
951
+ negativeBalance: string;
952
+ }
953
+ export interface PortfolioSingleBalance {
954
+ asset: string;
955
+ totalWalletBalance: string;
956
+ crossMarginBorrowed: string;
957
+ crossMarginFree: string;
958
+ crossMarginInterest: string;
959
+ crossMarginLocked: string;
960
+ umWalletBalance: string;
961
+ umUnrealizedPNL: string;
962
+ cmWalletBalance: string;
963
+ cmUnrealizedPNL: string;
964
+ updateTime: number;
965
+ negativeBalance: string;
966
+ }
967
+ export type PortfolioBalance = PortfolioBalance[] | PortfolioSingleBalance;
968
+ export interface PortfolioAccountInformation {
969
+ uniMMR: string;
970
+ accountEquity: string;
971
+ actualEquity: string;
972
+ accountInitialMargin: string;
973
+ accountMaintMargin: string;
974
+ accountStatus: PMAccountStatus;
975
+ virtualMaxWithdrawAmount: string;
976
+ totalAvailableBalance: string;
977
+ totalMarginOpenLoss: string;
978
+ updateTime: number;
979
+ }
980
+ export interface PortfolioUMPosition {
981
+ symbol: string;
982
+ positionAmt: string;
983
+ entryPrice: string;
984
+ markPrice: string;
985
+ unRealizedProfit: string;
986
+ liquidationPrice: string;
987
+ leverage: string;
988
+ maxNotionalValue: string;
989
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
990
+ notional: string;
991
+ updateTime: number;
992
+ }
993
+ export interface PortfolioCMPosition {
994
+ symbol: string;
995
+ positionAmt: string;
996
+ entryPrice: string;
997
+ markPrice: string;
998
+ unRealizedProfit: string;
999
+ liquidationPrice: string;
1000
+ leverage: string;
1001
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
1002
+ updateTime: number;
1003
+ maxQty: string;
1004
+ notionalValue: string;
1005
+ }
1006
+ export interface PortfolioUMLeverageBracket {
1007
+ bracket: number;
1008
+ initialLeverage: number;
1009
+ notionalCap: number;
1010
+ notionalFloor: number;
1011
+ maintMarginRatio: number;
1012
+ cum: number;
1013
+ }
1014
+ export interface PortfolioCMLeverageBracket {
1015
+ bracket: number;
1016
+ initialLeverage: number;
1017
+ qtyCap: number;
1018
+ qtyFloor: number;
1019
+ maintMarginRatio: number;
1020
+ cum: number;
1021
+ }
1022
+ export interface PortfolioTradingIndicator {
1023
+ isLocked: boolean;
1024
+ plannedRecoverTime: number;
1025
+ indicator: PMIndicatorType;
1026
+ value: number;
1027
+ triggerValue: number;
1028
+ }
1029
+ export interface PortfolioTradingStatus {
1030
+ indicators: {
1031
+ [key: string]: PortfolioTradingIndicator[];
1032
+ };
1033
+ updateTime: number;
1034
+ }
1035
+ export interface PortfolioMarginLoanRecord {
1036
+ txId: number;
1037
+ asset: string;
1038
+ principal: string;
1039
+ timestamp: number;
1040
+ status: PMMarginLoanStatus;
1041
+ }
1042
+ export interface GetMarginLoanRecordsReq {
1043
+ asset: string;
1044
+ txId?: number;
1045
+ startTime?: number;
1046
+ endTime?: number;
1047
+ current?: number;
1048
+ size?: number;
1049
+ archived?: boolean;
1050
+ }
1051
+ export interface GetMarginRepayRecordsReq {
1052
+ asset: string;
1053
+ txId?: number;
1054
+ startTime?: number;
1055
+ endTime?: number;
1056
+ current?: number;
1057
+ size?: number;
1058
+ archived?: boolean;
1059
+ }
1060
+ export interface PortfolioMarginRepayRecord {
1061
+ amount: string;
1062
+ asset: string;
1063
+ interest: string;
1064
+ principal: string;
1065
+ status: PMMarginLoanStatus;
1066
+ txId: number;
1067
+ }
1068
+ export interface GetMarginInterestHistoryReq {
1069
+ asset?: string;
1070
+ startTime?: number;
1071
+ endTime?: number;
1072
+ current?: number;
1073
+ size?: number;
1074
+ archived?: boolean;
1075
+ }
1076
+ export type PMInterestType = 'PERIODIC' | 'ON_BORROW' | 'PERIODIC_CONVERTED' | 'ON_BORROW_CONVERTED' | 'PORTFOLIO';
1077
+ export interface PortfolioMarginInterestRecord {
1078
+ txId: number;
1079
+ interestAccuredTime: number;
1080
+ asset: string;
1081
+ rawAsset: string;
1082
+ principal: string;
1083
+ interest: string;
1084
+ interestRate: string;
1085
+ type: PMInterestType;
1086
+ }
1087
+ export interface GetPortfolioInterestHistoryReq {
1088
+ asset?: string;
1089
+ startTime?: number;
1090
+ endTime?: number;
1091
+ size?: number;
1092
+ recvWindow?: number;
1093
+ }
1094
+ export interface PortfolioNegativeBalanceInterestRecord {
1095
+ asset: string;
1096
+ interest: string;
1097
+ interestAccuredTime: number;
1098
+ interestRate: string;
1099
+ principal: string;
1100
+ }
1101
+ export type UMIncomeType = 'TRANSFER' | 'WELCOME_BONUS' | 'REALIZED_PNL' | 'FUNDING_FEE' | 'COMMISSION' | 'INSURANCE_CLEAR' | 'REFERRAL_KICKBACK' | 'COMMISSION_REBATE' | 'API_REBATE' | 'CONTEST_REWARD' | 'CROSS_COLLATERAL_TRANSFER' | 'OPTIONS_PREMIUM_FEE' | 'OPTIONS_SETTLE_PROFIT' | 'INTERNAL_TRANSFER' | 'AUTO_EXCHANGE' | 'DELIVERED_SETTELMENT' | 'COIN_SWAP_DEPOSIT' | 'COIN_SWAP_WITHDRAW' | 'POSITION_LIMIT_INCREASE_FEE';
1102
+ export interface QueryPortfolioUMIncomeReq {
1103
+ symbol?: string;
1104
+ incomeType?: UMIncomeType;
1105
+ startTime?: number;
1106
+ endTime?: number;
1107
+ page?: number;
1108
+ limit?: number;
1109
+ recvWindow?: number;
1110
+ }
1111
+ export interface PortfolioUMIncome {
1112
+ symbol: string;
1113
+ incomeType: UMIncomeType;
1114
+ income: string;
1115
+ asset: string;
1116
+ info: string;
1117
+ time: number;
1118
+ tranId: string;
1119
+ tradeId: string;
1120
+ }
1121
+ export type CMIncomeType = 'TRANSFER' | 'WELCOME_BONUS' | 'FUNDING_FEE' | 'REALIZED_PNL' | 'COMMISSION' | 'INSURANCE_CLEAR' | 'DELIVERED_SETTELMENT';
1122
+ export interface QueryPortfolioCMIncomeReq {
1123
+ symbol?: string;
1124
+ incomeType?: CMIncomeType;
1125
+ startTime?: number;
1126
+ endTime?: number;
1127
+ page?: number;
1128
+ limit?: number;
1129
+ recvWindow?: number;
1130
+ }
1131
+ export interface PortfolioCMIncome {
1132
+ symbol: string;
1133
+ incomeType: CMIncomeType;
1134
+ income: string;
1135
+ asset: string;
1136
+ info: string;
1137
+ time: number;
1138
+ tranId: string;
1139
+ tradeId: string;
1140
+ }
1141
+ export interface PortfolioUMAccountAsset {
1142
+ asset: string;
1143
+ crossWalletBalance: string;
1144
+ crossUnPnl: string;
1145
+ maintMargin: string;
1146
+ initialMargin: string;
1147
+ positionInitialMargin: string;
1148
+ openOrderInitialMargin: string;
1149
+ updateTime: number;
1150
+ }
1151
+ export interface PortfolioUMAccountPosition {
1152
+ symbol: string;
1153
+ initialMargin: string;
1154
+ maintMargin: string;
1155
+ unrealizedProfit: string;
1156
+ positionInitialMargin: string;
1157
+ openOrderInitialMargin: string;
1158
+ leverage: string;
1159
+ entryPrice: string;
1160
+ maxNotional: string;
1161
+ bidNotional: string;
1162
+ askNotional: string;
1163
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
1164
+ positionAmt: string;
1165
+ updateTime: number;
1166
+ }
1167
+ export interface PortfolioCMAccountAsset {
1168
+ asset: string;
1169
+ crossWalletBalance: string;
1170
+ crossUnPnl: string;
1171
+ maintMargin: string;
1172
+ initialMargin: string;
1173
+ positionInitialMargin: string;
1174
+ openOrderInitialMargin: string;
1175
+ updateTime: number;
1176
+ }
1177
+ export interface PortfolioCMAccountPosition {
1178
+ symbol: string;
1179
+ positionAmt: string;
1180
+ initialMargin: string;
1181
+ maintMargin: string;
1182
+ unrealizedProfit: string;
1183
+ positionInitialMargin: string;
1184
+ openOrderInitialMargin: string;
1185
+ leverage: string;
1186
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
1187
+ entryPrice: string;
1188
+ maxQty: string;
1189
+ updateTime: number;
1190
+ }
1191
+ export interface PortfolioUMAccountConfig {
1192
+ feeTier: number;
1193
+ canTrade: boolean;
1194
+ canDeposit: boolean;
1195
+ canWithdraw: boolean;
1196
+ dualSidePosition: boolean;
1197
+ updateTime: number;
1198
+ multiAssetsMargin: boolean;
1199
+ tradeGroupId: number;
1200
+ }
1201
+ export interface PortfolioUMSymbolConfig {
1202
+ symbol: string;
1203
+ marginType: 'CROSSED' | 'ISOLATED';
1204
+ isAutoAddMargin: string;
1205
+ leverage: number;
1206
+ maxNotionalValue: string;
1207
+ }
1208
+ export interface PortfolioUMAccountAssetV2 {
1209
+ asset: string;
1210
+ crossWalletBalance: string;
1211
+ crossUnPnl: string;
1212
+ maintMargin: string;
1213
+ initialMargin: string;
1214
+ positionInitialMargin: string;
1215
+ openOrderInitialMargin: string;
1216
+ updateTime: number;
1217
+ }
1218
+ export interface PortfolioUMAccountPositionV2 {
1219
+ symbol: string;
1220
+ initialMargin: string;
1221
+ maintMargin: string;
1222
+ unrealizedProfit: string;
1223
+ positionSide: 'BOTH' | 'LONG' | 'SHORT';
1224
+ positionAmt: string;
1225
+ updateTime: number;
1226
+ notional: string;
1227
+ }
1228
+ export interface DownloadLinkResponse {
1229
+ downloadId: string;
1230
+ status: 'completed' | 'processing';
1231
+ url: string;
1232
+ s3Link: string | null;
1233
+ notified: boolean;
1234
+ expirationTimestamp: number;
1235
+ isExpired: boolean | null;
1236
+ }