gateio-api 1.1.0 → 1.1.2
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/cjs/RestClient.d.ts +65 -7
- package/dist/cjs/RestClient.js +129 -21
- package/dist/cjs/RestClient.js.map +1 -1
- package/dist/cjs/types/request/futures.d.ts +3 -1
- package/dist/cjs/types/request/spot.d.ts +3 -0
- package/dist/cjs/types/response/delivery.d.ts +6 -0
- package/dist/cjs/types/response/futures.d.ts +37 -27
- package/dist/cjs/types/response/wallet.d.ts +6 -0
- package/dist/mjs/RestClient.d.ts +65 -7
- package/dist/mjs/RestClient.js +129 -21
- package/dist/mjs/RestClient.js.map +1 -1
- package/dist/mjs/types/request/futures.d.ts +3 -1
- package/dist/mjs/types/request/spot.d.ts +3 -0
- package/dist/mjs/types/response/delivery.d.ts +6 -0
- package/dist/mjs/types/response/futures.d.ts +37 -27
- package/dist/mjs/types/response/wallet.d.ts +6 -0
- package/package.json +1 -1
package/dist/cjs/RestClient.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { DeliveryAccount, DeliveryBook, DeliveryCandle, DeliveryClosedPosition,
|
|
|
24
24
|
import { DualInvestmentOrder, DualInvestmentProduct, StructuredProduct, StructuredProductOrder } from './types/response/earn.js';
|
|
25
25
|
import { LendingCurrency, LendingInterestRecord, LendingOrder, LendingRecord } from './types/response/earnuni.js';
|
|
26
26
|
import { FlashSwapCurrencyPair, FlashSwapOrder, SubmitFlashSwapOrderPreviewResp } from './types/response/flashswap.js';
|
|
27
|
-
import { BatchAmendOrderResp, DeleteFuturesBatchOrdersResp, FuturesAccount, FuturesAccountBookRecord, FuturesAutoDeleveragingHistoryRecord, FuturesCandle, FuturesContract, FuturesDeliveryContract, FuturesLiquidationHistoryRecord, FuturesOrder, FuturesOrderBook, FuturesPosition, FuturesPositionHistoryRecord, FuturesPriceTriggeredOrder, FuturesStats, FuturesTicker, FuturesTrade, FuturesTradingHistoryRecord, IndexConstituents, LiquidationHistoryRecord, PremiumIndexKLine, RiskLimitTier
|
|
27
|
+
import { BatchAmendOrderResp, DeleteFuturesBatchOrdersResp, FuturesAccount, FuturesAccountBookRecord, FuturesAutoDeleveragingHistoryRecord, FuturesCandle, FuturesContract, FuturesDeliveryContract, FuturesLiquidationHistoryRecord, FuturesOrder, FuturesOrderBook, FuturesPosition, FuturesPositionHistoryRecord, FuturesPriceTriggeredOrder, FuturesStats, FuturesTicker, FuturesTrade, FuturesTradingHistoryRecord, IndexConstituents, LiquidationHistoryRecord, PremiumIndexKLine, RiskLimitTier } from './types/response/futures.js';
|
|
28
28
|
import { CrossMarginAccount, CrossMarginAccountHistoryRecord, CrossMarginCurrency, CrossMarginMorrowLoanRecord, MarginAccount, MarginBalanceHistoryRecord } from './types/response/margin.js';
|
|
29
29
|
import { LendingMarket, MarginUNIInterestRecord, MarginUNILoan, MarginUNILoanRecord, MarginUNIMaxBorrowable } from './types/response/marginuni.js';
|
|
30
30
|
import { MultiLoanAdjustmentRecord, MultiLoanCurrencyQuota, MultiLoanFixedRate, MultiLoanOrder, MultiLoanRatio, MultiLoanRepayRecord, MultiLoanSupportedCurrencies, RepayMultiLoanResp, UpdateMultiLoanResp } from './types/response/multicollateralLoan.js';
|
|
@@ -185,6 +185,22 @@ export declare class RestClient extends BaseRestClient {
|
|
|
185
185
|
* @returns Promise<any>
|
|
186
186
|
*/
|
|
187
187
|
submitSubToSubTransfer(params: SubmitSubToSubTransferReq): Promise<any>;
|
|
188
|
+
/**
|
|
189
|
+
* Query transfer status based on client_order_id or tx_id
|
|
190
|
+
*
|
|
191
|
+
* @param params Parameters for querying transfer status
|
|
192
|
+
* @returns Promise<{
|
|
193
|
+
* tx_id: string;
|
|
194
|
+
* status: 'PENDING' | 'SUCCESS' | 'FAIL' | 'PARTIAL_SUCCESS';
|
|
195
|
+
* }>
|
|
196
|
+
*/
|
|
197
|
+
getTransferStatus(params: {
|
|
198
|
+
client_order_id?: string;
|
|
199
|
+
tx_id?: string;
|
|
200
|
+
}): Promise<{
|
|
201
|
+
tx_id: string;
|
|
202
|
+
status: 'PENDING' | 'SUCCESS' | 'FAIL' | 'PARTIAL_SUCCESS';
|
|
203
|
+
}>;
|
|
188
204
|
/**
|
|
189
205
|
* Retrieve withdrawal status
|
|
190
206
|
*
|
|
@@ -707,10 +723,14 @@ export declare class RestClient extends BaseRestClient {
|
|
|
707
723
|
* - At most 4 currency pairs, maximum 10 orders each, are allowed in one request
|
|
708
724
|
* - No mixture of spot orders and margin orders, i.e. account must be identical for all orders
|
|
709
725
|
*
|
|
726
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
727
|
+
*
|
|
710
728
|
* @param params Parameters for creating a batch of orders
|
|
711
729
|
* @returns Promise<SubmitSpotBatchOrdersResp[]>
|
|
712
730
|
*/
|
|
713
|
-
submitSpotBatchOrders(
|
|
731
|
+
submitSpotBatchOrders(body: SpotOrder[], params?: {
|
|
732
|
+
xGateExptime?: number;
|
|
733
|
+
}): Promise<SubmitSpotBatchOrdersResp[]>;
|
|
714
734
|
/**
|
|
715
735
|
* List all open orders
|
|
716
736
|
*
|
|
@@ -740,6 +760,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
740
760
|
*
|
|
741
761
|
* You can place orders with spot, portfolio, margin or cross margin account through setting the account field. It defaults to spot, which means spot account is used to place orders. If the user is using unified account, it defaults to the unified account.
|
|
742
762
|
*
|
|
763
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
764
|
+
*
|
|
743
765
|
* @param params Parameters for creating an order
|
|
744
766
|
* @returns Promise<Order>
|
|
745
767
|
*/
|
|
@@ -759,6 +781,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
759
781
|
* If account is not set, all open orders, including spot, portfolio, margin and cross margin ones, will be cancelled.
|
|
760
782
|
* You can set account to cancel only orders within the specified account.
|
|
761
783
|
*
|
|
784
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
785
|
+
*
|
|
762
786
|
* @param params Parameters for cancelling all open orders in specified currency pair
|
|
763
787
|
* @returns Promise<Order[]>
|
|
764
788
|
*/
|
|
@@ -767,16 +791,21 @@ export declare class RestClient extends BaseRestClient {
|
|
|
767
791
|
side?: 'buy' | 'sell';
|
|
768
792
|
account?: 'spot' | 'margin' | 'cross_margin' | 'unified';
|
|
769
793
|
action_mode?: 'ACK' | 'RESULT' | 'FULL';
|
|
794
|
+
xGateExptime?: number;
|
|
770
795
|
}): Promise<SpotOrder[]>;
|
|
771
796
|
/**
|
|
772
797
|
* Cancel a batch of orders with an ID list
|
|
773
798
|
*
|
|
774
799
|
* Multiple currency pairs can be specified, but maximum 20 orders are allowed per request.
|
|
775
800
|
*
|
|
801
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
802
|
+
*
|
|
776
803
|
* @param params Parameters for cancelling a batch of orders
|
|
777
804
|
* @returns Promise<DeleteSpotBatchOrdersResp[]>
|
|
778
805
|
*/
|
|
779
|
-
batchCancelSpotOrders(
|
|
806
|
+
batchCancelSpotOrders(body: CancelSpotBatchOrdersReq[], params?: {
|
|
807
|
+
xGateExptime?: number;
|
|
808
|
+
}): Promise<DeleteSpotBatchOrdersResp[]>;
|
|
780
809
|
/**
|
|
781
810
|
* Get a single order
|
|
782
811
|
*
|
|
@@ -793,6 +822,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
793
822
|
*
|
|
794
823
|
* Currently, only supports modification of price or amount fields.
|
|
795
824
|
*
|
|
825
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
826
|
+
*
|
|
796
827
|
* @param params Parameters for amending an order
|
|
797
828
|
* @returns Promise<Order>
|
|
798
829
|
*/
|
|
@@ -802,6 +833,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
802
833
|
*
|
|
803
834
|
* Spot, portfolio and margin orders are cancelled by default. If trying to cancel cross margin orders or portfolio margin account are used, account must be set to cross_margin.
|
|
804
835
|
*
|
|
836
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
837
|
+
*
|
|
805
838
|
* @param params Parameters for cancelling a single order
|
|
806
839
|
* @returns Promise<Order>
|
|
807
840
|
*/
|
|
@@ -848,10 +881,14 @@ export declare class RestClient extends BaseRestClient {
|
|
|
848
881
|
*
|
|
849
882
|
* Default modification of orders for spot, portfolio, and margin accounts. To modify orders for a cross margin account, the account parameter must be specified as cross_margin. For portfolio margin accounts, the account parameter can only be specified as cross_margin. Currently, only modifications to price or quantity (choose one) are supported.
|
|
850
883
|
*
|
|
884
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
885
|
+
*
|
|
851
886
|
* @param params Parameters for batch modification of orders
|
|
852
887
|
* @returns Promise<Order[]>
|
|
853
888
|
*/
|
|
854
|
-
batchUpdateSpotOrders(
|
|
889
|
+
batchUpdateSpotOrders(body: UpdateSpotBatchOrdersReq[], params?: {
|
|
890
|
+
xGateExptime?: number;
|
|
891
|
+
}): Promise<SpotOrder[]>;
|
|
855
892
|
/**
|
|
856
893
|
* Create a price-triggered order
|
|
857
894
|
*
|
|
@@ -1439,12 +1476,12 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1439
1476
|
* Before setting dual mode, make sure all positions are closed and no orders are open.
|
|
1440
1477
|
*
|
|
1441
1478
|
* @param params Parameters for enabling or disabling dual mode
|
|
1442
|
-
* @returns Promise<
|
|
1479
|
+
* @returns Promise<FuturesAccount>
|
|
1443
1480
|
*/
|
|
1444
1481
|
updateFuturesDualMode(params: {
|
|
1445
1482
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1446
1483
|
dual_mode: boolean;
|
|
1447
|
-
}): Promise<
|
|
1484
|
+
}): Promise<FuturesAccount>;
|
|
1448
1485
|
/**
|
|
1449
1486
|
* Retrieve position detail in dual mode
|
|
1450
1487
|
*
|
|
@@ -1490,6 +1527,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1490
1527
|
* In dual position mode, to close one side position, you need to set auto_size side, reduce_only to true, and size to 0.
|
|
1491
1528
|
* Set stp_act to decide the strategy of self-trade prevention. For detailed usage, refer to the stp_act parameter in the request body.
|
|
1492
1529
|
*
|
|
1530
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1531
|
+
*
|
|
1493
1532
|
* @param params Parameters for creating a futures order
|
|
1494
1533
|
* @returns Promise<FuturesOrder>
|
|
1495
1534
|
*/
|
|
@@ -1509,6 +1548,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1509
1548
|
*
|
|
1510
1549
|
* Zero-filled order cannot be retrieved 10 minutes after order cancellation.
|
|
1511
1550
|
*
|
|
1551
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1552
|
+
*
|
|
1512
1553
|
* @param params Parameters for cancelling all open orders matched
|
|
1513
1554
|
* @returns Promise<FuturesOrder[]>
|
|
1514
1555
|
*/
|
|
@@ -1531,10 +1572,13 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1531
1572
|
* If the execution is successful, the normal order content is included; if the execution fails, the label field is included to indicate the cause of the error.
|
|
1532
1573
|
* In the rate limiting, each order is counted individually.
|
|
1533
1574
|
*
|
|
1575
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1576
|
+
*
|
|
1534
1577
|
* @param params Parameters for creating a batch of futures orders
|
|
1535
1578
|
* @returns Promise<FuturesOrder[]>
|
|
1536
1579
|
*/
|
|
1537
1580
|
submitFuturesBatchOrders(params: {
|
|
1581
|
+
xGateExptime?: number;
|
|
1538
1582
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1539
1583
|
orders: SubmitFuturesOrderReq[];
|
|
1540
1584
|
}): Promise<FuturesOrder[]>;
|
|
@@ -1554,16 +1598,21 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1554
1598
|
/**
|
|
1555
1599
|
* Cancel a single order
|
|
1556
1600
|
*
|
|
1601
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1602
|
+
*
|
|
1557
1603
|
* @param params Parameters for cancelling a single order
|
|
1558
1604
|
* @returns Promise<FuturesOrder>
|
|
1559
1605
|
*/
|
|
1560
1606
|
cancelFuturesOrder(params: {
|
|
1607
|
+
xGateExptime?: number;
|
|
1561
1608
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1562
1609
|
order_id: string;
|
|
1563
1610
|
}): Promise<FuturesOrder>;
|
|
1564
1611
|
/**
|
|
1565
1612
|
* Amend an order
|
|
1566
1613
|
*
|
|
1614
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1615
|
+
*
|
|
1567
1616
|
* @param params Parameters for amending an order
|
|
1568
1617
|
* @returns Promise<FuturesOrder>
|
|
1569
1618
|
*/
|
|
@@ -1639,10 +1688,13 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1639
1688
|
*
|
|
1640
1689
|
* Multiple distinct order ID list can be specified. Each request can cancel a maximum of 20 records.
|
|
1641
1690
|
*
|
|
1691
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1692
|
+
*
|
|
1642
1693
|
* @param params Parameters for cancelling a batch of orders with an ID list
|
|
1643
1694
|
* @returns Promise<DeleteFuturesBatchOrdersResp[]>
|
|
1644
1695
|
*/
|
|
1645
1696
|
batchCancelFuturesOrders(params: {
|
|
1697
|
+
xGateExptime?: number;
|
|
1646
1698
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1647
1699
|
orderIds: string[];
|
|
1648
1700
|
}): Promise<DeleteFuturesBatchOrdersResp[]>;
|
|
@@ -1651,11 +1703,17 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1651
1703
|
*
|
|
1652
1704
|
* You can specify multiple different order IDs. You can only modify up to 10 orders in one request.
|
|
1653
1705
|
*
|
|
1706
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1707
|
+
*
|
|
1654
1708
|
* @param params Array of BatchAmendOrderReq objects
|
|
1655
1709
|
* @param settle Settlement currency (e.g., 'btc', 'usdt', 'usd')
|
|
1656
1710
|
* @returns Promise<BatchAmendOrderResp[]>
|
|
1657
1711
|
*/
|
|
1658
|
-
batchUpdateFuturesOrders(
|
|
1712
|
+
batchUpdateFuturesOrders(params: {
|
|
1713
|
+
xGateExptime?: number;
|
|
1714
|
+
settle: 'btc' | 'usdt' | 'usd';
|
|
1715
|
+
orders: BatchAmendOrderReq[];
|
|
1716
|
+
}): Promise<BatchAmendOrderResp[]>;
|
|
1659
1717
|
/**
|
|
1660
1718
|
* Create a price-triggered order
|
|
1661
1719
|
*
|
package/dist/cjs/RestClient.js
CHANGED
|
@@ -203,6 +203,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
203
203
|
body: params,
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Query transfer status based on client_order_id or tx_id
|
|
208
|
+
*
|
|
209
|
+
* @param params Parameters for querying transfer status
|
|
210
|
+
* @returns Promise<{
|
|
211
|
+
* tx_id: string;
|
|
212
|
+
* status: 'PENDING' | 'SUCCESS' | 'FAIL' | 'PARTIAL_SUCCESS';
|
|
213
|
+
* }>
|
|
214
|
+
*/
|
|
215
|
+
getTransferStatus(params) {
|
|
216
|
+
return this.getPrivate('/wallet/order_status', params);
|
|
217
|
+
}
|
|
206
218
|
/**
|
|
207
219
|
* Retrieve withdrawal status
|
|
208
220
|
*
|
|
@@ -748,11 +760,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
748
760
|
* - At most 4 currency pairs, maximum 10 orders each, are allowed in one request
|
|
749
761
|
* - No mixture of spot orders and margin orders, i.e. account must be identical for all orders
|
|
750
762
|
*
|
|
763
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
764
|
+
*
|
|
751
765
|
* @param params Parameters for creating a batch of orders
|
|
752
766
|
* @returns Promise<SubmitSpotBatchOrdersResp[]>
|
|
753
767
|
*/
|
|
754
|
-
submitSpotBatchOrders(params) {
|
|
755
|
-
|
|
768
|
+
submitSpotBatchOrders(body, params) {
|
|
769
|
+
const { xGateExptime } = params || {};
|
|
770
|
+
const headers = xGateExptime
|
|
771
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
772
|
+
: undefined;
|
|
773
|
+
return this.postPrivate('/spot/batch_orders', {
|
|
774
|
+
headers: headers,
|
|
775
|
+
body: body,
|
|
776
|
+
});
|
|
756
777
|
}
|
|
757
778
|
/**
|
|
758
779
|
* List all open orders
|
|
@@ -783,11 +804,17 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
783
804
|
*
|
|
784
805
|
* You can place orders with spot, portfolio, margin or cross margin account through setting the account field. It defaults to spot, which means spot account is used to place orders. If the user is using unified account, it defaults to the unified account.
|
|
785
806
|
*
|
|
807
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
808
|
+
*
|
|
786
809
|
* @param params Parameters for creating an order
|
|
787
810
|
* @returns Promise<Order>
|
|
788
811
|
*/
|
|
789
812
|
submitSpotOrder(params) {
|
|
790
|
-
|
|
813
|
+
const { xGateExptime, ...body } = params;
|
|
814
|
+
const headers = xGateExptime
|
|
815
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
816
|
+
: undefined;
|
|
817
|
+
return this.postPrivate('/spot/orders', { headers: headers, body: body });
|
|
791
818
|
}
|
|
792
819
|
/**
|
|
793
820
|
* List orders
|
|
@@ -806,22 +833,40 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
806
833
|
* If account is not set, all open orders, including spot, portfolio, margin and cross margin ones, will be cancelled.
|
|
807
834
|
* You can set account to cancel only orders within the specified account.
|
|
808
835
|
*
|
|
836
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
837
|
+
*
|
|
809
838
|
* @param params Parameters for cancelling all open orders in specified currency pair
|
|
810
839
|
* @returns Promise<Order[]>
|
|
811
840
|
*/
|
|
812
841
|
cancelSpotOpenOrders(params) {
|
|
813
|
-
|
|
842
|
+
const { xGateExptime, ...query } = params;
|
|
843
|
+
const headers = xGateExptime
|
|
844
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
845
|
+
: undefined;
|
|
846
|
+
return this.deletePrivate('/spot/orders', {
|
|
847
|
+
headers: headers,
|
|
848
|
+
query: query,
|
|
849
|
+
});
|
|
814
850
|
}
|
|
815
851
|
/**
|
|
816
852
|
* Cancel a batch of orders with an ID list
|
|
817
853
|
*
|
|
818
854
|
* Multiple currency pairs can be specified, but maximum 20 orders are allowed per request.
|
|
819
855
|
*
|
|
856
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
857
|
+
*
|
|
820
858
|
* @param params Parameters for cancelling a batch of orders
|
|
821
859
|
* @returns Promise<DeleteSpotBatchOrdersResp[]>
|
|
822
860
|
*/
|
|
823
|
-
batchCancelSpotOrders(params) {
|
|
824
|
-
|
|
861
|
+
batchCancelSpotOrders(body, params) {
|
|
862
|
+
const { xGateExptime } = params || {};
|
|
863
|
+
const headers = xGateExptime
|
|
864
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
865
|
+
: undefined;
|
|
866
|
+
return this.postPrivate('/spot/cancel_batch_orders', {
|
|
867
|
+
headers: headers,
|
|
868
|
+
body: body,
|
|
869
|
+
});
|
|
825
870
|
}
|
|
826
871
|
/**
|
|
827
872
|
* Get a single order
|
|
@@ -842,16 +887,22 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
842
887
|
*
|
|
843
888
|
* Currently, only supports modification of price or amount fields.
|
|
844
889
|
*
|
|
890
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
891
|
+
*
|
|
845
892
|
* @param params Parameters for amending an order
|
|
846
893
|
* @returns Promise<Order>
|
|
847
894
|
*/
|
|
848
895
|
updateSpotOrder(params) {
|
|
849
|
-
const { order_id, currency_pair, account, ...body } = params;
|
|
896
|
+
const { xGateExptime, order_id, currency_pair, account, ...body } = params;
|
|
897
|
+
const headers = xGateExptime
|
|
898
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
899
|
+
: undefined;
|
|
850
900
|
const query = {
|
|
851
901
|
currency_pair: currency_pair,
|
|
852
902
|
account: account,
|
|
853
903
|
};
|
|
854
904
|
return this.patchPrivate(`/spot/orders/${order_id}`, {
|
|
905
|
+
headers: headers,
|
|
855
906
|
query: query,
|
|
856
907
|
body: body,
|
|
857
908
|
});
|
|
@@ -861,12 +912,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
861
912
|
*
|
|
862
913
|
* Spot, portfolio and margin orders are cancelled by default. If trying to cancel cross margin orders or portfolio margin account are used, account must be set to cross_margin.
|
|
863
914
|
*
|
|
915
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
916
|
+
*
|
|
864
917
|
* @param params Parameters for cancelling a single order
|
|
865
918
|
* @returns Promise<Order>
|
|
866
919
|
*/
|
|
867
920
|
cancelSpotOrder(params) {
|
|
868
|
-
const { order_id, ...query } = params;
|
|
921
|
+
const { xGateExptime, order_id, ...query } = params;
|
|
922
|
+
const headers = xGateExptime
|
|
923
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
924
|
+
: undefined;
|
|
869
925
|
return this.deletePrivate(`/spot/orders/${order_id}`, {
|
|
926
|
+
headers: headers,
|
|
870
927
|
query: query,
|
|
871
928
|
});
|
|
872
929
|
}
|
|
@@ -911,11 +968,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
911
968
|
*
|
|
912
969
|
* Default modification of orders for spot, portfolio, and margin accounts. To modify orders for a cross margin account, the account parameter must be specified as cross_margin. For portfolio margin accounts, the account parameter can only be specified as cross_margin. Currently, only modifications to price or quantity (choose one) are supported.
|
|
913
970
|
*
|
|
971
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
972
|
+
*
|
|
914
973
|
* @param params Parameters for batch modification of orders
|
|
915
974
|
* @returns Promise<Order[]>
|
|
916
975
|
*/
|
|
917
|
-
batchUpdateSpotOrders(params) {
|
|
918
|
-
|
|
976
|
+
batchUpdateSpotOrders(body, params) {
|
|
977
|
+
const { xGateExptime } = params || {};
|
|
978
|
+
const headers = xGateExptime
|
|
979
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
980
|
+
: undefined;
|
|
981
|
+
return this.postPrivate('/spot/amend_batch_orders', {
|
|
982
|
+
headers: headers,
|
|
983
|
+
body: body,
|
|
984
|
+
});
|
|
919
985
|
}
|
|
920
986
|
/**
|
|
921
987
|
* Create a price-triggered order
|
|
@@ -1529,7 +1595,7 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1529
1595
|
* Before setting dual mode, make sure all positions are closed and no orders are open.
|
|
1530
1596
|
*
|
|
1531
1597
|
* @param params Parameters for enabling or disabling dual mode
|
|
1532
|
-
* @returns Promise<
|
|
1598
|
+
* @returns Promise<FuturesAccount>
|
|
1533
1599
|
*/
|
|
1534
1600
|
updateFuturesDualMode(params) {
|
|
1535
1601
|
const { settle, ...query } = params;
|
|
@@ -1586,12 +1652,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1586
1652
|
* In dual position mode, to close one side position, you need to set auto_size side, reduce_only to true, and size to 0.
|
|
1587
1653
|
* Set stp_act to decide the strategy of self-trade prevention. For detailed usage, refer to the stp_act parameter in the request body.
|
|
1588
1654
|
*
|
|
1655
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1656
|
+
*
|
|
1589
1657
|
* @param params Parameters for creating a futures order
|
|
1590
1658
|
* @returns Promise<FuturesOrder>
|
|
1591
1659
|
*/
|
|
1592
1660
|
submitFuturesOrder(params) {
|
|
1593
|
-
const { settle, ...body } = params;
|
|
1594
|
-
|
|
1661
|
+
const { xGateExptime, settle, ...body } = params;
|
|
1662
|
+
const headers = xGateExptime
|
|
1663
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1664
|
+
: undefined;
|
|
1665
|
+
return this.postPrivate(`/futures/${settle}/orders`, {
|
|
1666
|
+
headers: headers,
|
|
1667
|
+
body: body,
|
|
1668
|
+
});
|
|
1595
1669
|
}
|
|
1596
1670
|
/**
|
|
1597
1671
|
* List futures orders
|
|
@@ -1611,12 +1685,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1611
1685
|
*
|
|
1612
1686
|
* Zero-filled order cannot be retrieved 10 minutes after order cancellation.
|
|
1613
1687
|
*
|
|
1688
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1689
|
+
*
|
|
1614
1690
|
* @param params Parameters for cancelling all open orders matched
|
|
1615
1691
|
* @returns Promise<FuturesOrder[]>
|
|
1616
1692
|
*/
|
|
1617
1693
|
cancelAllFuturesOrders(params) {
|
|
1618
|
-
const { settle, ...query } = params;
|
|
1694
|
+
const { xGateExptime, settle, ...query } = params;
|
|
1695
|
+
const headers = xGateExptime
|
|
1696
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1697
|
+
: undefined;
|
|
1619
1698
|
return this.deletePrivate(`/futures/${settle}/orders`, {
|
|
1699
|
+
headers: headers,
|
|
1620
1700
|
query: query,
|
|
1621
1701
|
});
|
|
1622
1702
|
}
|
|
@@ -1641,12 +1721,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1641
1721
|
* If the execution is successful, the normal order content is included; if the execution fails, the label field is included to indicate the cause of the error.
|
|
1642
1722
|
* In the rate limiting, each order is counted individually.
|
|
1643
1723
|
*
|
|
1724
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1725
|
+
*
|
|
1644
1726
|
* @param params Parameters for creating a batch of futures orders
|
|
1645
1727
|
* @returns Promise<FuturesOrder[]>
|
|
1646
1728
|
*/
|
|
1647
1729
|
submitFuturesBatchOrders(params) {
|
|
1648
|
-
const { settle, orders } = params;
|
|
1730
|
+
const { xGateExptime, settle, orders } = params;
|
|
1731
|
+
const headers = xGateExptime
|
|
1732
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1733
|
+
: undefined;
|
|
1649
1734
|
return this.postPrivate(`/futures/${settle}/batch_orders`, {
|
|
1735
|
+
headers: headers,
|
|
1650
1736
|
body: orders,
|
|
1651
1737
|
});
|
|
1652
1738
|
}
|
|
@@ -1665,21 +1751,30 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1665
1751
|
/**
|
|
1666
1752
|
* Cancel a single order
|
|
1667
1753
|
*
|
|
1754
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1755
|
+
*
|
|
1668
1756
|
* @param params Parameters for cancelling a single order
|
|
1669
1757
|
* @returns Promise<FuturesOrder>
|
|
1670
1758
|
*/
|
|
1671
1759
|
cancelFuturesOrder(params) {
|
|
1672
|
-
|
|
1760
|
+
const { xGateExptime, settle, order_id } = params;
|
|
1761
|
+
const headers = xGateExptime
|
|
1762
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1763
|
+
: undefined;
|
|
1764
|
+
return this.deletePrivate(`/futures/${settle}/orders/${order_id}`, {
|
|
1765
|
+
headers: headers,
|
|
1766
|
+
});
|
|
1673
1767
|
}
|
|
1674
1768
|
/**
|
|
1675
1769
|
* Amend an order
|
|
1676
1770
|
*
|
|
1771
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1772
|
+
*
|
|
1677
1773
|
* @param params Parameters for amending an order
|
|
1678
1774
|
* @returns Promise<FuturesOrder>
|
|
1679
1775
|
*/
|
|
1680
1776
|
updateFuturesOrder(params) {
|
|
1681
|
-
const { settle, order_id, ...
|
|
1682
|
-
const { ['x-gate-exptime']: xGateExptime, ...body } = rest;
|
|
1777
|
+
const { xGateExptime, settle, order_id, ...body } = params;
|
|
1683
1778
|
const headers = xGateExptime
|
|
1684
1779
|
? { 'x-gate-exptime': xGateExptime }
|
|
1685
1780
|
: undefined;
|
|
@@ -1773,12 +1868,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1773
1868
|
*
|
|
1774
1869
|
* Multiple distinct order ID list can be specified. Each request can cancel a maximum of 20 records.
|
|
1775
1870
|
*
|
|
1871
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1872
|
+
*
|
|
1776
1873
|
* @param params Parameters for cancelling a batch of orders with an ID list
|
|
1777
1874
|
* @returns Promise<DeleteFuturesBatchOrdersResp[]>
|
|
1778
1875
|
*/
|
|
1779
1876
|
batchCancelFuturesOrders(params) {
|
|
1780
|
-
const { settle,
|
|
1877
|
+
const { xGateExptime, settle, orderIds } = params;
|
|
1878
|
+
const headers = xGateExptime
|
|
1879
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1880
|
+
: undefined;
|
|
1781
1881
|
return this.postPrivate(`/futures/${settle}/batch_cancel_orders`, {
|
|
1882
|
+
headers: headers,
|
|
1782
1883
|
body: orderIds,
|
|
1783
1884
|
});
|
|
1784
1885
|
}
|
|
@@ -1787,13 +1888,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1787
1888
|
*
|
|
1788
1889
|
* You can specify multiple different order IDs. You can only modify up to 10 orders in one request.
|
|
1789
1890
|
*
|
|
1891
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1892
|
+
*
|
|
1790
1893
|
* @param params Array of BatchAmendOrderReq objects
|
|
1791
1894
|
* @param settle Settlement currency (e.g., 'btc', 'usdt', 'usd')
|
|
1792
1895
|
* @returns Promise<BatchAmendOrderResp[]>
|
|
1793
1896
|
*/
|
|
1794
|
-
batchUpdateFuturesOrders(
|
|
1897
|
+
batchUpdateFuturesOrders(params) {
|
|
1898
|
+
const { xGateExptime, settle, orders } = params;
|
|
1899
|
+
const headers = xGateExptime
|
|
1900
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1901
|
+
: undefined;
|
|
1795
1902
|
return this.postPrivate(`/futures/${settle}/batch_amend_orders`, {
|
|
1796
|
-
|
|
1903
|
+
headers: headers,
|
|
1904
|
+
body: orders,
|
|
1797
1905
|
});
|
|
1798
1906
|
}
|
|
1799
1907
|
/**
|