gateio-api 1.1.0 → 1.1.1
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 +49 -7
- package/dist/cjs/RestClient.js +117 -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 +36 -27
- package/dist/cjs/types/response/wallet.d.ts +6 -0
- package/dist/mjs/RestClient.d.ts +49 -7
- package/dist/mjs/RestClient.js +117 -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 +36 -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';
|
|
@@ -707,10 +707,14 @@ export declare class RestClient extends BaseRestClient {
|
|
|
707
707
|
* - At most 4 currency pairs, maximum 10 orders each, are allowed in one request
|
|
708
708
|
* - No mixture of spot orders and margin orders, i.e. account must be identical for all orders
|
|
709
709
|
*
|
|
710
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
711
|
+
*
|
|
710
712
|
* @param params Parameters for creating a batch of orders
|
|
711
713
|
* @returns Promise<SubmitSpotBatchOrdersResp[]>
|
|
712
714
|
*/
|
|
713
|
-
submitSpotBatchOrders(
|
|
715
|
+
submitSpotBatchOrders(body: SpotOrder[], params?: {
|
|
716
|
+
xGateExptime?: number;
|
|
717
|
+
}): Promise<SubmitSpotBatchOrdersResp[]>;
|
|
714
718
|
/**
|
|
715
719
|
* List all open orders
|
|
716
720
|
*
|
|
@@ -740,6 +744,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
740
744
|
*
|
|
741
745
|
* 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
746
|
*
|
|
747
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
748
|
+
*
|
|
743
749
|
* @param params Parameters for creating an order
|
|
744
750
|
* @returns Promise<Order>
|
|
745
751
|
*/
|
|
@@ -759,6 +765,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
759
765
|
* If account is not set, all open orders, including spot, portfolio, margin and cross margin ones, will be cancelled.
|
|
760
766
|
* You can set account to cancel only orders within the specified account.
|
|
761
767
|
*
|
|
768
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
769
|
+
*
|
|
762
770
|
* @param params Parameters for cancelling all open orders in specified currency pair
|
|
763
771
|
* @returns Promise<Order[]>
|
|
764
772
|
*/
|
|
@@ -767,16 +775,21 @@ export declare class RestClient extends BaseRestClient {
|
|
|
767
775
|
side?: 'buy' | 'sell';
|
|
768
776
|
account?: 'spot' | 'margin' | 'cross_margin' | 'unified';
|
|
769
777
|
action_mode?: 'ACK' | 'RESULT' | 'FULL';
|
|
778
|
+
xGateExptime?: number;
|
|
770
779
|
}): Promise<SpotOrder[]>;
|
|
771
780
|
/**
|
|
772
781
|
* Cancel a batch of orders with an ID list
|
|
773
782
|
*
|
|
774
783
|
* Multiple currency pairs can be specified, but maximum 20 orders are allowed per request.
|
|
775
784
|
*
|
|
785
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
786
|
+
*
|
|
776
787
|
* @param params Parameters for cancelling a batch of orders
|
|
777
788
|
* @returns Promise<DeleteSpotBatchOrdersResp[]>
|
|
778
789
|
*/
|
|
779
|
-
batchCancelSpotOrders(
|
|
790
|
+
batchCancelSpotOrders(body: CancelSpotBatchOrdersReq[], params?: {
|
|
791
|
+
xGateExptime?: number;
|
|
792
|
+
}): Promise<DeleteSpotBatchOrdersResp[]>;
|
|
780
793
|
/**
|
|
781
794
|
* Get a single order
|
|
782
795
|
*
|
|
@@ -793,6 +806,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
793
806
|
*
|
|
794
807
|
* Currently, only supports modification of price or amount fields.
|
|
795
808
|
*
|
|
809
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
810
|
+
*
|
|
796
811
|
* @param params Parameters for amending an order
|
|
797
812
|
* @returns Promise<Order>
|
|
798
813
|
*/
|
|
@@ -802,6 +817,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
802
817
|
*
|
|
803
818
|
* 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
819
|
*
|
|
820
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
821
|
+
*
|
|
805
822
|
* @param params Parameters for cancelling a single order
|
|
806
823
|
* @returns Promise<Order>
|
|
807
824
|
*/
|
|
@@ -848,10 +865,14 @@ export declare class RestClient extends BaseRestClient {
|
|
|
848
865
|
*
|
|
849
866
|
* 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
867
|
*
|
|
868
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
869
|
+
*
|
|
851
870
|
* @param params Parameters for batch modification of orders
|
|
852
871
|
* @returns Promise<Order[]>
|
|
853
872
|
*/
|
|
854
|
-
batchUpdateSpotOrders(
|
|
873
|
+
batchUpdateSpotOrders(body: UpdateSpotBatchOrdersReq[], params?: {
|
|
874
|
+
xGateExptime?: number;
|
|
875
|
+
}): Promise<SpotOrder[]>;
|
|
855
876
|
/**
|
|
856
877
|
* Create a price-triggered order
|
|
857
878
|
*
|
|
@@ -1439,12 +1460,12 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1439
1460
|
* Before setting dual mode, make sure all positions are closed and no orders are open.
|
|
1440
1461
|
*
|
|
1441
1462
|
* @param params Parameters for enabling or disabling dual mode
|
|
1442
|
-
* @returns Promise<
|
|
1463
|
+
* @returns Promise<FuturesAccount>
|
|
1443
1464
|
*/
|
|
1444
1465
|
updateFuturesDualMode(params: {
|
|
1445
1466
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1446
1467
|
dual_mode: boolean;
|
|
1447
|
-
}): Promise<
|
|
1468
|
+
}): Promise<FuturesAccount>;
|
|
1448
1469
|
/**
|
|
1449
1470
|
* Retrieve position detail in dual mode
|
|
1450
1471
|
*
|
|
@@ -1490,6 +1511,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1490
1511
|
* 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
1512
|
* 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
1513
|
*
|
|
1514
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1515
|
+
*
|
|
1493
1516
|
* @param params Parameters for creating a futures order
|
|
1494
1517
|
* @returns Promise<FuturesOrder>
|
|
1495
1518
|
*/
|
|
@@ -1509,6 +1532,8 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1509
1532
|
*
|
|
1510
1533
|
* Zero-filled order cannot be retrieved 10 minutes after order cancellation.
|
|
1511
1534
|
*
|
|
1535
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1536
|
+
*
|
|
1512
1537
|
* @param params Parameters for cancelling all open orders matched
|
|
1513
1538
|
* @returns Promise<FuturesOrder[]>
|
|
1514
1539
|
*/
|
|
@@ -1531,10 +1556,13 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1531
1556
|
* 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
1557
|
* In the rate limiting, each order is counted individually.
|
|
1533
1558
|
*
|
|
1559
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1560
|
+
*
|
|
1534
1561
|
* @param params Parameters for creating a batch of futures orders
|
|
1535
1562
|
* @returns Promise<FuturesOrder[]>
|
|
1536
1563
|
*/
|
|
1537
1564
|
submitFuturesBatchOrders(params: {
|
|
1565
|
+
xGateExptime?: number;
|
|
1538
1566
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1539
1567
|
orders: SubmitFuturesOrderReq[];
|
|
1540
1568
|
}): Promise<FuturesOrder[]>;
|
|
@@ -1554,16 +1582,21 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1554
1582
|
/**
|
|
1555
1583
|
* Cancel a single order
|
|
1556
1584
|
*
|
|
1585
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1586
|
+
*
|
|
1557
1587
|
* @param params Parameters for cancelling a single order
|
|
1558
1588
|
* @returns Promise<FuturesOrder>
|
|
1559
1589
|
*/
|
|
1560
1590
|
cancelFuturesOrder(params: {
|
|
1591
|
+
xGateExptime?: number;
|
|
1561
1592
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1562
1593
|
order_id: string;
|
|
1563
1594
|
}): Promise<FuturesOrder>;
|
|
1564
1595
|
/**
|
|
1565
1596
|
* Amend an order
|
|
1566
1597
|
*
|
|
1598
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1599
|
+
*
|
|
1567
1600
|
* @param params Parameters for amending an order
|
|
1568
1601
|
* @returns Promise<FuturesOrder>
|
|
1569
1602
|
*/
|
|
@@ -1639,10 +1672,13 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1639
1672
|
*
|
|
1640
1673
|
* Multiple distinct order ID list can be specified. Each request can cancel a maximum of 20 records.
|
|
1641
1674
|
*
|
|
1675
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1676
|
+
*
|
|
1642
1677
|
* @param params Parameters for cancelling a batch of orders with an ID list
|
|
1643
1678
|
* @returns Promise<DeleteFuturesBatchOrdersResp[]>
|
|
1644
1679
|
*/
|
|
1645
1680
|
batchCancelFuturesOrders(params: {
|
|
1681
|
+
xGateExptime?: number;
|
|
1646
1682
|
settle: 'btc' | 'usdt' | 'usd';
|
|
1647
1683
|
orderIds: string[];
|
|
1648
1684
|
}): Promise<DeleteFuturesBatchOrdersResp[]>;
|
|
@@ -1651,11 +1687,17 @@ export declare class RestClient extends BaseRestClient {
|
|
|
1651
1687
|
*
|
|
1652
1688
|
* You can specify multiple different order IDs. You can only modify up to 10 orders in one request.
|
|
1653
1689
|
*
|
|
1690
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1691
|
+
*
|
|
1654
1692
|
* @param params Array of BatchAmendOrderReq objects
|
|
1655
1693
|
* @param settle Settlement currency (e.g., 'btc', 'usdt', 'usd')
|
|
1656
1694
|
* @returns Promise<BatchAmendOrderResp[]>
|
|
1657
1695
|
*/
|
|
1658
|
-
batchUpdateFuturesOrders(
|
|
1696
|
+
batchUpdateFuturesOrders(params: {
|
|
1697
|
+
xGateExptime?: number;
|
|
1698
|
+
settle: 'btc' | 'usdt' | 'usd';
|
|
1699
|
+
orders: BatchAmendOrderReq[];
|
|
1700
|
+
}): Promise<BatchAmendOrderResp[]>;
|
|
1659
1701
|
/**
|
|
1660
1702
|
* Create a price-triggered order
|
|
1661
1703
|
*
|
package/dist/cjs/RestClient.js
CHANGED
|
@@ -748,11 +748,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
748
748
|
* - At most 4 currency pairs, maximum 10 orders each, are allowed in one request
|
|
749
749
|
* - No mixture of spot orders and margin orders, i.e. account must be identical for all orders
|
|
750
750
|
*
|
|
751
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
752
|
+
*
|
|
751
753
|
* @param params Parameters for creating a batch of orders
|
|
752
754
|
* @returns Promise<SubmitSpotBatchOrdersResp[]>
|
|
753
755
|
*/
|
|
754
|
-
submitSpotBatchOrders(params) {
|
|
755
|
-
|
|
756
|
+
submitSpotBatchOrders(body, params) {
|
|
757
|
+
const { xGateExptime } = params || {};
|
|
758
|
+
const headers = xGateExptime
|
|
759
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
760
|
+
: undefined;
|
|
761
|
+
return this.postPrivate('/spot/batch_orders', {
|
|
762
|
+
headers: headers,
|
|
763
|
+
body: body,
|
|
764
|
+
});
|
|
756
765
|
}
|
|
757
766
|
/**
|
|
758
767
|
* List all open orders
|
|
@@ -783,11 +792,17 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
783
792
|
*
|
|
784
793
|
* 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
794
|
*
|
|
795
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
796
|
+
*
|
|
786
797
|
* @param params Parameters for creating an order
|
|
787
798
|
* @returns Promise<Order>
|
|
788
799
|
*/
|
|
789
800
|
submitSpotOrder(params) {
|
|
790
|
-
|
|
801
|
+
const { xGateExptime, ...body } = params;
|
|
802
|
+
const headers = xGateExptime
|
|
803
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
804
|
+
: undefined;
|
|
805
|
+
return this.postPrivate('/spot/orders', { headers: headers, body: body });
|
|
791
806
|
}
|
|
792
807
|
/**
|
|
793
808
|
* List orders
|
|
@@ -806,22 +821,40 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
806
821
|
* If account is not set, all open orders, including spot, portfolio, margin and cross margin ones, will be cancelled.
|
|
807
822
|
* You can set account to cancel only orders within the specified account.
|
|
808
823
|
*
|
|
824
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
825
|
+
*
|
|
809
826
|
* @param params Parameters for cancelling all open orders in specified currency pair
|
|
810
827
|
* @returns Promise<Order[]>
|
|
811
828
|
*/
|
|
812
829
|
cancelSpotOpenOrders(params) {
|
|
813
|
-
|
|
830
|
+
const { xGateExptime, ...query } = params;
|
|
831
|
+
const headers = xGateExptime
|
|
832
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
833
|
+
: undefined;
|
|
834
|
+
return this.deletePrivate('/spot/orders', {
|
|
835
|
+
headers: headers,
|
|
836
|
+
query: query,
|
|
837
|
+
});
|
|
814
838
|
}
|
|
815
839
|
/**
|
|
816
840
|
* Cancel a batch of orders with an ID list
|
|
817
841
|
*
|
|
818
842
|
* Multiple currency pairs can be specified, but maximum 20 orders are allowed per request.
|
|
819
843
|
*
|
|
844
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
845
|
+
*
|
|
820
846
|
* @param params Parameters for cancelling a batch of orders
|
|
821
847
|
* @returns Promise<DeleteSpotBatchOrdersResp[]>
|
|
822
848
|
*/
|
|
823
|
-
batchCancelSpotOrders(params) {
|
|
824
|
-
|
|
849
|
+
batchCancelSpotOrders(body, params) {
|
|
850
|
+
const { xGateExptime } = params || {};
|
|
851
|
+
const headers = xGateExptime
|
|
852
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
853
|
+
: undefined;
|
|
854
|
+
return this.postPrivate('/spot/cancel_batch_orders', {
|
|
855
|
+
headers: headers,
|
|
856
|
+
body: body,
|
|
857
|
+
});
|
|
825
858
|
}
|
|
826
859
|
/**
|
|
827
860
|
* Get a single order
|
|
@@ -842,16 +875,22 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
842
875
|
*
|
|
843
876
|
* Currently, only supports modification of price or amount fields.
|
|
844
877
|
*
|
|
878
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
879
|
+
*
|
|
845
880
|
* @param params Parameters for amending an order
|
|
846
881
|
* @returns Promise<Order>
|
|
847
882
|
*/
|
|
848
883
|
updateSpotOrder(params) {
|
|
849
|
-
const { order_id, currency_pair, account, ...body } = params;
|
|
884
|
+
const { xGateExptime, order_id, currency_pair, account, ...body } = params;
|
|
885
|
+
const headers = xGateExptime
|
|
886
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
887
|
+
: undefined;
|
|
850
888
|
const query = {
|
|
851
889
|
currency_pair: currency_pair,
|
|
852
890
|
account: account,
|
|
853
891
|
};
|
|
854
892
|
return this.patchPrivate(`/spot/orders/${order_id}`, {
|
|
893
|
+
headers: headers,
|
|
855
894
|
query: query,
|
|
856
895
|
body: body,
|
|
857
896
|
});
|
|
@@ -861,12 +900,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
861
900
|
*
|
|
862
901
|
* 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
902
|
*
|
|
903
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
904
|
+
*
|
|
864
905
|
* @param params Parameters for cancelling a single order
|
|
865
906
|
* @returns Promise<Order>
|
|
866
907
|
*/
|
|
867
908
|
cancelSpotOrder(params) {
|
|
868
|
-
const { order_id, ...query } = params;
|
|
909
|
+
const { xGateExptime, order_id, ...query } = params;
|
|
910
|
+
const headers = xGateExptime
|
|
911
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
912
|
+
: undefined;
|
|
869
913
|
return this.deletePrivate(`/spot/orders/${order_id}`, {
|
|
914
|
+
headers: headers,
|
|
870
915
|
query: query,
|
|
871
916
|
});
|
|
872
917
|
}
|
|
@@ -911,11 +956,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
911
956
|
*
|
|
912
957
|
* 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
958
|
*
|
|
959
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
960
|
+
*
|
|
914
961
|
* @param params Parameters for batch modification of orders
|
|
915
962
|
* @returns Promise<Order[]>
|
|
916
963
|
*/
|
|
917
|
-
batchUpdateSpotOrders(params) {
|
|
918
|
-
|
|
964
|
+
batchUpdateSpotOrders(body, params) {
|
|
965
|
+
const { xGateExptime } = params || {};
|
|
966
|
+
const headers = xGateExptime
|
|
967
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
968
|
+
: undefined;
|
|
969
|
+
return this.postPrivate('/spot/amend_batch_orders', {
|
|
970
|
+
headers: headers,
|
|
971
|
+
body: body,
|
|
972
|
+
});
|
|
919
973
|
}
|
|
920
974
|
/**
|
|
921
975
|
* Create a price-triggered order
|
|
@@ -1529,7 +1583,7 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1529
1583
|
* Before setting dual mode, make sure all positions are closed and no orders are open.
|
|
1530
1584
|
*
|
|
1531
1585
|
* @param params Parameters for enabling or disabling dual mode
|
|
1532
|
-
* @returns Promise<
|
|
1586
|
+
* @returns Promise<FuturesAccount>
|
|
1533
1587
|
*/
|
|
1534
1588
|
updateFuturesDualMode(params) {
|
|
1535
1589
|
const { settle, ...query } = params;
|
|
@@ -1586,12 +1640,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1586
1640
|
* 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
1641
|
* 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
1642
|
*
|
|
1643
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1644
|
+
*
|
|
1589
1645
|
* @param params Parameters for creating a futures order
|
|
1590
1646
|
* @returns Promise<FuturesOrder>
|
|
1591
1647
|
*/
|
|
1592
1648
|
submitFuturesOrder(params) {
|
|
1593
|
-
const { settle, ...body } = params;
|
|
1594
|
-
|
|
1649
|
+
const { xGateExptime, settle, ...body } = params;
|
|
1650
|
+
const headers = xGateExptime
|
|
1651
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1652
|
+
: undefined;
|
|
1653
|
+
return this.postPrivate(`/futures/${settle}/orders`, {
|
|
1654
|
+
headers: headers,
|
|
1655
|
+
body: body,
|
|
1656
|
+
});
|
|
1595
1657
|
}
|
|
1596
1658
|
/**
|
|
1597
1659
|
* List futures orders
|
|
@@ -1611,12 +1673,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1611
1673
|
*
|
|
1612
1674
|
* Zero-filled order cannot be retrieved 10 minutes after order cancellation.
|
|
1613
1675
|
*
|
|
1676
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1677
|
+
*
|
|
1614
1678
|
* @param params Parameters for cancelling all open orders matched
|
|
1615
1679
|
* @returns Promise<FuturesOrder[]>
|
|
1616
1680
|
*/
|
|
1617
1681
|
cancelAllFuturesOrders(params) {
|
|
1618
|
-
const { settle, ...query } = params;
|
|
1682
|
+
const { xGateExptime, settle, ...query } = params;
|
|
1683
|
+
const headers = xGateExptime
|
|
1684
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1685
|
+
: undefined;
|
|
1619
1686
|
return this.deletePrivate(`/futures/${settle}/orders`, {
|
|
1687
|
+
headers: headers,
|
|
1620
1688
|
query: query,
|
|
1621
1689
|
});
|
|
1622
1690
|
}
|
|
@@ -1641,12 +1709,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1641
1709
|
* 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
1710
|
* In the rate limiting, each order is counted individually.
|
|
1643
1711
|
*
|
|
1712
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1713
|
+
*
|
|
1644
1714
|
* @param params Parameters for creating a batch of futures orders
|
|
1645
1715
|
* @returns Promise<FuturesOrder[]>
|
|
1646
1716
|
*/
|
|
1647
1717
|
submitFuturesBatchOrders(params) {
|
|
1648
|
-
const { settle, orders } = params;
|
|
1718
|
+
const { xGateExptime, settle, orders } = params;
|
|
1719
|
+
const headers = xGateExptime
|
|
1720
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1721
|
+
: undefined;
|
|
1649
1722
|
return this.postPrivate(`/futures/${settle}/batch_orders`, {
|
|
1723
|
+
headers: headers,
|
|
1650
1724
|
body: orders,
|
|
1651
1725
|
});
|
|
1652
1726
|
}
|
|
@@ -1665,21 +1739,30 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1665
1739
|
/**
|
|
1666
1740
|
* Cancel a single order
|
|
1667
1741
|
*
|
|
1742
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1743
|
+
*
|
|
1668
1744
|
* @param params Parameters for cancelling a single order
|
|
1669
1745
|
* @returns Promise<FuturesOrder>
|
|
1670
1746
|
*/
|
|
1671
1747
|
cancelFuturesOrder(params) {
|
|
1672
|
-
|
|
1748
|
+
const { xGateExptime, settle, order_id } = params;
|
|
1749
|
+
const headers = xGateExptime
|
|
1750
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1751
|
+
: undefined;
|
|
1752
|
+
return this.deletePrivate(`/futures/${settle}/orders/${order_id}`, {
|
|
1753
|
+
headers: headers,
|
|
1754
|
+
});
|
|
1673
1755
|
}
|
|
1674
1756
|
/**
|
|
1675
1757
|
* Amend an order
|
|
1676
1758
|
*
|
|
1759
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1760
|
+
*
|
|
1677
1761
|
* @param params Parameters for amending an order
|
|
1678
1762
|
* @returns Promise<FuturesOrder>
|
|
1679
1763
|
*/
|
|
1680
1764
|
updateFuturesOrder(params) {
|
|
1681
|
-
const { settle, order_id, ...
|
|
1682
|
-
const { ['x-gate-exptime']: xGateExptime, ...body } = rest;
|
|
1765
|
+
const { xGateExptime, settle, order_id, ...body } = params;
|
|
1683
1766
|
const headers = xGateExptime
|
|
1684
1767
|
? { 'x-gate-exptime': xGateExptime }
|
|
1685
1768
|
: undefined;
|
|
@@ -1773,12 +1856,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1773
1856
|
*
|
|
1774
1857
|
* Multiple distinct order ID list can be specified. Each request can cancel a maximum of 20 records.
|
|
1775
1858
|
*
|
|
1859
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1860
|
+
*
|
|
1776
1861
|
* @param params Parameters for cancelling a batch of orders with an ID list
|
|
1777
1862
|
* @returns Promise<DeleteFuturesBatchOrdersResp[]>
|
|
1778
1863
|
*/
|
|
1779
1864
|
batchCancelFuturesOrders(params) {
|
|
1780
|
-
const { settle,
|
|
1865
|
+
const { xGateExptime, settle, orderIds } = params;
|
|
1866
|
+
const headers = xGateExptime
|
|
1867
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1868
|
+
: undefined;
|
|
1781
1869
|
return this.postPrivate(`/futures/${settle}/batch_cancel_orders`, {
|
|
1870
|
+
headers: headers,
|
|
1782
1871
|
body: orderIds,
|
|
1783
1872
|
});
|
|
1784
1873
|
}
|
|
@@ -1787,13 +1876,20 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
|
|
|
1787
1876
|
*
|
|
1788
1877
|
* You can specify multiple different order IDs. You can only modify up to 10 orders in one request.
|
|
1789
1878
|
*
|
|
1879
|
+
* NOTE: The "xGateExptime" parameter will translate to the "x-gate-exptime" header.
|
|
1880
|
+
*
|
|
1790
1881
|
* @param params Array of BatchAmendOrderReq objects
|
|
1791
1882
|
* @param settle Settlement currency (e.g., 'btc', 'usdt', 'usd')
|
|
1792
1883
|
* @returns Promise<BatchAmendOrderResp[]>
|
|
1793
1884
|
*/
|
|
1794
|
-
batchUpdateFuturesOrders(
|
|
1885
|
+
batchUpdateFuturesOrders(params) {
|
|
1886
|
+
const { xGateExptime, settle, orders } = params;
|
|
1887
|
+
const headers = xGateExptime
|
|
1888
|
+
? { 'x-gate-exptime': xGateExptime }
|
|
1889
|
+
: undefined;
|
|
1795
1890
|
return this.postPrivate(`/futures/${settle}/batch_amend_orders`, {
|
|
1796
|
-
|
|
1891
|
+
headers: headers,
|
|
1892
|
+
body: orders,
|
|
1797
1893
|
});
|
|
1798
1894
|
}
|
|
1799
1895
|
/**
|