gateio-api 1.4.2 → 1.5.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.
Files changed (51) hide show
  1. package/README.md +3 -2
  2. package/dist/cjs/RestClient.d.ts +184 -117
  3. package/dist/cjs/RestClient.js +287 -105
  4. package/dist/cjs/RestClient.js.map +1 -1
  5. package/dist/cjs/index.d.ts +4 -0
  6. package/dist/cjs/index.js +4 -0
  7. package/dist/cjs/index.js.map +1 -1
  8. package/dist/cjs/types/request/earn.d.ts +10 -0
  9. package/dist/cjs/types/request/futures.d.ts +65 -0
  10. package/dist/cjs/types/request/p2pMerchant.d.ts +108 -0
  11. package/dist/cjs/types/request/p2pMerchant.js +4 -0
  12. package/dist/cjs/types/request/p2pMerchant.js.map +1 -0
  13. package/dist/cjs/types/request/tradfi.d.ts +56 -0
  14. package/dist/cjs/types/request/tradfi.js +4 -0
  15. package/dist/cjs/types/request/tradfi.js.map +1 -0
  16. package/dist/cjs/types/response/earn.d.ts +1 -0
  17. package/dist/cjs/types/response/futures.d.ts +80 -7
  18. package/dist/cjs/types/response/multicollateralLoan.d.ts +4 -0
  19. package/dist/cjs/types/response/p2pMerchant.d.ts +178 -0
  20. package/dist/cjs/types/response/p2pMerchant.js +4 -0
  21. package/dist/cjs/types/response/p2pMerchant.js.map +1 -0
  22. package/dist/cjs/types/response/spot.d.ts +1 -1
  23. package/dist/cjs/types/response/tradfi.d.ts +200 -0
  24. package/dist/cjs/types/response/tradfi.js +4 -0
  25. package/dist/cjs/types/response/tradfi.js.map +1 -0
  26. package/dist/mjs/RestClient.d.ts +184 -117
  27. package/dist/mjs/RestClient.js +287 -105
  28. package/dist/mjs/RestClient.js.map +1 -1
  29. package/dist/mjs/index.d.ts +4 -0
  30. package/dist/mjs/index.js +4 -0
  31. package/dist/mjs/index.js.map +1 -1
  32. package/dist/mjs/types/request/earn.d.ts +10 -0
  33. package/dist/mjs/types/request/futures.d.ts +65 -0
  34. package/dist/mjs/types/request/p2pMerchant.d.ts +108 -0
  35. package/dist/mjs/types/request/p2pMerchant.js +3 -0
  36. package/dist/mjs/types/request/p2pMerchant.js.map +1 -0
  37. package/dist/mjs/types/request/tradfi.d.ts +56 -0
  38. package/dist/mjs/types/request/tradfi.js +3 -0
  39. package/dist/mjs/types/request/tradfi.js.map +1 -0
  40. package/dist/mjs/types/response/earn.d.ts +1 -0
  41. package/dist/mjs/types/response/futures.d.ts +80 -7
  42. package/dist/mjs/types/response/multicollateralLoan.d.ts +4 -0
  43. package/dist/mjs/types/response/p2pMerchant.d.ts +178 -0
  44. package/dist/mjs/types/response/p2pMerchant.js +3 -0
  45. package/dist/mjs/types/response/p2pMerchant.js.map +1 -0
  46. package/dist/mjs/types/response/spot.d.ts +1 -1
  47. package/dist/mjs/types/response/tradfi.d.ts +200 -0
  48. package/dist/mjs/types/response/tradfi.js +3 -0
  49. package/dist/mjs/types/response/tradfi.js.map +1 -0
  50. package/llms.txt +13011 -11849
  51. package/package.json +1 -1
@@ -1594,6 +1594,18 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
1594
1594
  const { settle, ...query } = params;
1595
1595
  return this.get(`/futures/${settle}/funding_rate`, query);
1596
1596
  }
1597
+ /**
1598
+ * Batch query historical funding rate data for perpetual contracts
1599
+ *
1600
+ * @param params settle and array of contract names
1601
+ * @returns Promise<BatchFundingRatesResponse[]>
1602
+ */
1603
+ getBatchFundingRates(params) {
1604
+ const { settle, contracts } = params;
1605
+ return this.post(`/futures/${settle}/funding_rates`, {
1606
+ body: { contracts },
1607
+ });
1608
+ }
1597
1609
  /**
1598
1610
  * Futures insurance balance history
1599
1611
  *
@@ -2144,10 +2156,90 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
2144
2156
  */
2145
2157
  updateFuturesPriceTriggeredOrder(params) {
2146
2158
  const { settle, order_id, ...body } = params;
2147
- return this.putPrivate(`/futures/${settle}/price_orders/${order_id}`, {
2159
+ return this.putPrivate(`/futures/${settle}/price_orders/amend/${order_id}`, {
2148
2160
  body: body,
2149
2161
  });
2150
2162
  }
2163
+ /**
2164
+ * Create trail order
2165
+ *
2166
+ * @param params settle and trail order parameters
2167
+ * @returns Promise with code, message, data containing id and timestamp
2168
+ */
2169
+ createTrailOrder(params) {
2170
+ const { settle, ...body } = params;
2171
+ return this.postPrivate(`/futures/${settle}/autoorder/v1/trail/create`, {
2172
+ body,
2173
+ });
2174
+ }
2175
+ /**
2176
+ * Terminate trail order
2177
+ *
2178
+ * @param params settle and id or text
2179
+ * @returns Promise<TrailOrder>
2180
+ */
2181
+ terminateTrailOrder(params) {
2182
+ const { settle, ...body } = params;
2183
+ return this.postPrivate(`/futures/${settle}/autoorder/v1/trail/stop`, {
2184
+ body,
2185
+ });
2186
+ }
2187
+ /**
2188
+ * Batch terminate trail orders
2189
+ *
2190
+ * @param params settle and optional contract, related_position
2191
+ * @returns Promise<{ orders: TrailOrder[] }>
2192
+ */
2193
+ batchTerminateTrailOrders(params) {
2194
+ const { settle, ...body } = params;
2195
+ return this.postPrivate(`/futures/${settle}/autoorder/v1/trail/stop_all`, {
2196
+ body,
2197
+ });
2198
+ }
2199
+ /**
2200
+ * Get trail order list
2201
+ *
2202
+ * @param params query parameters
2203
+ * @returns Promise<{ orders: TrailOrder[] }>
2204
+ */
2205
+ getTrailOrderList(params) {
2206
+ const { settle, ...query } = params;
2207
+ return this.getPrivate(`/futures/${settle}/autoorder/v1/trail/list`, query);
2208
+ }
2209
+ /**
2210
+ * Get trail order details
2211
+ *
2212
+ * @param params settle and order id
2213
+ * @returns Promise with code, message, data.order
2214
+ */
2215
+ getTrailOrderDetail(params) {
2216
+ const { settle, id } = params;
2217
+ return this.getPrivate(`/futures/${settle}/autoorder/v1/trail/detail`, {
2218
+ id,
2219
+ });
2220
+ }
2221
+ /**
2222
+ * Update trail order
2223
+ *
2224
+ * @param params settle, id and fields to update
2225
+ * @returns Promise<TrailOrder>
2226
+ */
2227
+ updateTrailOrder(params) {
2228
+ const { settle, id, ...body } = params;
2229
+ return this.postPrivate(`/futures/${settle}/autoorder/v1/trail/update`, {
2230
+ body: { id, ...body },
2231
+ });
2232
+ }
2233
+ /**
2234
+ * Get trail order user modification records
2235
+ *
2236
+ * @param params settle, id and optional pagination
2237
+ * @returns Promise<{ change_log: TrailChangeLog[] }>
2238
+ */
2239
+ getTrailOrderChangeLog(params) {
2240
+ const { settle, ...query } = params;
2241
+ return this.getPrivate(`/futures/${settle}/autoorder/v1/trail/change_log`, query);
2242
+ }
2151
2243
  getFuturesPositionCloseHistory(params) {
2152
2244
  return this.getPrivate(`/futures/${params.settle}/position_close_history`, params);
2153
2245
  }
@@ -2838,108 +2930,6 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
2838
2930
  getLendingEstimatedRates() {
2839
2931
  return this.getPrivate('/earn/uni/rate');
2840
2932
  }
2841
- /**==========================================================================================================================
2842
- * COLLATERAL LOAN
2843
- * ==========================================================================================================================
2844
- */
2845
- /**
2846
- * Place order
2847
- *
2848
- * @param params Parameters for placing an order
2849
- * @returns Promise<{ order_id: number }>
2850
- */
2851
- submitLoanOrder(params) {
2852
- return this.postPrivate('/loan/collateral/orders', { body: params });
2853
- }
2854
- /**
2855
- * List Orders
2856
- *
2857
- * @param params Parameters for listing orders
2858
- * @returns Promise<GetLoanOrdersResp[]>
2859
- */
2860
- getLoanOrders(params) {
2861
- return this.getPrivate('/loan/collateral/orders', params);
2862
- }
2863
- /**
2864
- * Get a single order
2865
- *
2866
- * @param params Parameters for retrieving a single order
2867
- * @returns Promise<GetLoanOrdersResp>
2868
- */
2869
- getLoanOrder(params) {
2870
- return this.getPrivate(`/loan/collateral/orders/${params.order_id}`);
2871
- }
2872
- /**
2873
- * Repayment
2874
- *
2875
- * @param params Parameters for repayment
2876
- * @returns Promise<{
2877
- * repaid_principal: string;
2878
- * repaid_interest: string;
2879
- * }>
2880
- */
2881
- submitLoanRepay(params) {
2882
- return this.postPrivate('/loan/collateral/repay', { body: params });
2883
- }
2884
- /**
2885
- * Repayment history
2886
- *
2887
- * @param params Parameters for retrieving repayment history
2888
- * @returns Promise<GetLoanRepaymentHistoryResp[]>
2889
- */
2890
- getLoanRepaymentHistory(params) {
2891
- return this.getPrivate('/loan/collateral/repay_records', params);
2892
- }
2893
- /**
2894
- * Increase or redeem collateral
2895
- *
2896
- * @param params Parameters for increasing or redeeming collateral
2897
- * @returns Promise<any>
2898
- */
2899
- updateLoanCollateral(params) {
2900
- return this.postPrivate('/loan/collateral/collaterals', { body: params });
2901
- }
2902
- /**
2903
- * Query collateral adjustment records
2904
- *
2905
- * @param params Parameters for querying collateral adjustment records
2906
- * @returns Promise<GetLoanCollateralRecordsResp[]>
2907
- */
2908
- getLoanCollateralRecords(params) {
2909
- return this.getPrivate('/loan/collateral/collaterals', params);
2910
- }
2911
- /**
2912
- * Query the total borrowing and collateral amount for the user
2913
- *
2914
- * @returns Promise<{
2915
- * borrow_amount: string;
2916
- * collateral_amount: string;
2917
- * }>
2918
- */
2919
- getLoanTotalAmount() {
2920
- return this.getPrivate('/loan/collateral/total_amount');
2921
- }
2922
- /**
2923
- * Query user's collateralization ratio
2924
- *
2925
- * @param params Parameters for querying user's collateralization ratio
2926
- * @returns Promise<GetLoanCollateralizationRatioResp>
2927
- */
2928
- getLoanCollateralizationRatio(params) {
2929
- return this.getPrivate('/loan/collateral/ltv', params);
2930
- }
2931
- /**
2932
- * Query supported borrowing and collateral currencies
2933
- *
2934
- * @param params Parameters for querying supported borrowing and collateral currencies
2935
- * @returns Promise<{
2936
- * loan_currency: string;
2937
- * collateral_currency: string[];
2938
- * }[]>
2939
- */
2940
- getLoanSupportedCurrencies(params) {
2941
- return this.get('/loan/collateral/currencies', params);
2942
- }
2943
2933
  /**==========================================================================================================================
2944
2934
  * MULTI COLLATERAL LOAN
2945
2935
  * ==========================================================================================================================
@@ -3093,8 +3083,8 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
3093
3083
  /**
3094
3084
  * Place Dual Investment order
3095
3085
  *
3096
- * @param params Parameters for placing a dual investment order
3097
- * @returns Promise<any>
3086
+ * @param params plan_id, amount (or copies), optional text
3087
+ * @returns Promise<DualInvestmentOrder>
3098
3088
  */
3099
3089
  submitDualInvestmentOrder(params) {
3100
3090
  return this.postPrivate('/earn/dual/orders', { body: params });
@@ -3445,6 +3435,136 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
3445
3435
  getOTCFiatOrderDetail(params) {
3446
3436
  return this.getPrivate('/otc/order/detail', params);
3447
3437
  }
3438
+ /**==========================================================================================================================
3439
+ * P2P MERCHANT
3440
+ * ==========================================================================================================================
3441
+ */
3442
+ /**
3443
+ * Get account information
3444
+ */
3445
+ getP2PMerchantUserInfo() {
3446
+ return this.postPrivate('/p2p/merchant/account/get_user_info', {
3447
+ body: {},
3448
+ });
3449
+ }
3450
+ /**
3451
+ * Get counterparty information
3452
+ */
3453
+ getP2PMerchantCounterpartyUserInfo(params) {
3454
+ return this.postPrivate('/p2p/merchant/account/get_counterparty_user_info', { body: params });
3455
+ }
3456
+ /**
3457
+ * Get payment method list
3458
+ */
3459
+ getP2PMerchantMyselfPayment(params) {
3460
+ return this.postPrivate('/p2p/merchant/account/get_myself_payment', {
3461
+ body: params ?? {},
3462
+ });
3463
+ }
3464
+ /**
3465
+ * Get pending orders
3466
+ */
3467
+ getP2PMerchantPendingTransactionList(params) {
3468
+ return this.postPrivate('/p2p/merchant/transaction/get_pending_transaction_list', { body: params });
3469
+ }
3470
+ /**
3471
+ * Get completed/historical orders
3472
+ */
3473
+ getP2PMerchantCompletedTransactionList(params) {
3474
+ return this.postPrivate('/p2p/merchant/transaction/get_completed_transaction_list', { body: params });
3475
+ }
3476
+ /**
3477
+ * Get order details
3478
+ */
3479
+ getP2PMerchantTransactionDetails(params) {
3480
+ return this.postPrivate('/p2p/merchant/transaction/get_transaction_details', { body: params });
3481
+ }
3482
+ /**
3483
+ * Confirm payment
3484
+ */
3485
+ confirmP2PMerchantPayment(params) {
3486
+ return this.postPrivate('/p2p/merchant/transaction/confirm-payment', {
3487
+ body: params,
3488
+ });
3489
+ }
3490
+ /**
3491
+ * Confirm receipt
3492
+ */
3493
+ confirmP2PMerchantReceipt(params) {
3494
+ return this.postPrivate('/p2p/merchant/transaction/confirm-receipt', {
3495
+ body: params,
3496
+ });
3497
+ }
3498
+ /**
3499
+ * Cancel order
3500
+ */
3501
+ cancelP2PMerchantTransaction(params) {
3502
+ return this.postPrivate('/p2p/merchant/transaction/cancel', {
3503
+ body: params,
3504
+ });
3505
+ }
3506
+ /**
3507
+ * Place ad order
3508
+ */
3509
+ placeP2PMerchantBizPushOrder(params) {
3510
+ return this.postPrivate('/p2p/merchant/books/place_biz_push_order', {
3511
+ body: params,
3512
+ });
3513
+ }
3514
+ /**
3515
+ * Update ad status
3516
+ */
3517
+ updateP2PMerchantAdsStatus(params) {
3518
+ const { trade_type, ...body } = params;
3519
+ return this.postPrivate('/p2p/merchant/books/ads_update_status', {
3520
+ body,
3521
+ query: trade_type ? { trade_type } : undefined,
3522
+ });
3523
+ }
3524
+ /**
3525
+ * Get ad details
3526
+ */
3527
+ getP2PMerchantAdsDetail(params) {
3528
+ return this.postPrivate('/p2p/merchant/books/ads_detail', { body: params });
3529
+ }
3530
+ /**
3531
+ * Get my ads list
3532
+ */
3533
+ getP2PMerchantMyAdsList(params) {
3534
+ return this.postPrivate('/p2p/merchant/books/my_ads_list', {
3535
+ body: params ?? {},
3536
+ });
3537
+ }
3538
+ /**
3539
+ * Get advertisement list
3540
+ */
3541
+ getP2PMerchantAdsList(params) {
3542
+ return this.postPrivate('/p2p/merchant/books/ads_list', { body: params });
3543
+ }
3544
+ /**
3545
+ * Get chat history
3546
+ */
3547
+ getP2PMerchantChatsList(params) {
3548
+ return this.postPrivate('/p2p/merchant/chat/get_chats_list', {
3549
+ body: params,
3550
+ });
3551
+ }
3552
+ /**
3553
+ * Send chat message
3554
+ */
3555
+ sendP2PMerchantChatMessage(params) {
3556
+ return this.postPrivate('/p2p/merchant/chat/send_chat_message', {
3557
+ body: params,
3558
+ });
3559
+ }
3560
+ /**
3561
+ * Upload chat file
3562
+ */
3563
+ uploadP2PMerchantChatFile(params) {
3564
+ return this.postPrivate('/p2p/merchant/chat/upload_chat_file', {
3565
+ body: params,
3566
+ });
3567
+ }
3448
3568
  /**==========================================================================================================================
3449
3569
  * CROSSEX
3450
3570
  * ==========================================================================================================================
@@ -3883,6 +4003,68 @@ class RestClient extends BaseRestClient_js_1.BaseRestClient {
3883
4003
  getAlphaTickers(params) {
3884
4004
  return this.get('/alpha/tickers', params);
3885
4005
  }
4006
+ // ============ TradFi ============
4007
+ getTradFiMT5Account() {
4008
+ return this.get('/tradfi/users/mt5-account');
4009
+ }
4010
+ getTradFiSymbolCategories() {
4011
+ return this.get('/tradfi/symbols/categories');
4012
+ }
4013
+ getTradFiSymbols() {
4014
+ return this.get('/tradfi/symbols');
4015
+ }
4016
+ getTradFiSymbolDetail(params) {
4017
+ return this.get('/tradfi/symbols/detail', params);
4018
+ }
4019
+ getTradFiKlines(symbol, params) {
4020
+ return this.get(`/tradfi/symbols/${symbol}/klines`, params);
4021
+ }
4022
+ getTradFiTicker(symbol) {
4023
+ return this.get(`/tradfi/symbols/${symbol}/tickers`);
4024
+ }
4025
+ createTradFiUser() {
4026
+ return this.postPrivate('/tradfi/users');
4027
+ }
4028
+ getTradFiAssets() {
4029
+ return this.getPrivate('/tradfi/users/assets');
4030
+ }
4031
+ createTradFiTransaction(params) {
4032
+ return this.postPrivate('/tradfi/transactions', { body: params });
4033
+ }
4034
+ getTradFiTransactions(params) {
4035
+ return this.getPrivate('/tradfi/transactions', params);
4036
+ }
4037
+ createTradFiOrder(params) {
4038
+ return this.postPrivate('/tradfi/orders', { body: params });
4039
+ }
4040
+ getTradFiOrders() {
4041
+ return this.getPrivate('/tradfi/orders');
4042
+ }
4043
+ modifyTradFiOrder(orderId, params) {
4044
+ return this.putPrivate(`/tradfi/orders/${orderId}`, { body: params });
4045
+ }
4046
+ cancelTradFiOrder(orderId) {
4047
+ return this.deletePrivate(`/tradfi/orders/${orderId}`);
4048
+ }
4049
+ getTradFiOrderHistory(params) {
4050
+ return this.getPrivate('/tradfi/orders/history', params);
4051
+ }
4052
+ getTradFiPositions() {
4053
+ return this.getPrivate('/tradfi/positions');
4054
+ }
4055
+ modifyTradFiPosition(positionId, params) {
4056
+ return this.putPrivate(`/tradfi/positions/${positionId}`, {
4057
+ body: params,
4058
+ });
4059
+ }
4060
+ closeTradFiPosition(positionId, params) {
4061
+ return this.postPrivate(`/tradfi/positions/${positionId}/close`, {
4062
+ body: params,
4063
+ });
4064
+ }
4065
+ getTradFiPositionHistory(params) {
4066
+ return this.getPrivate('/tradfi/positions/history', params);
4067
+ }
3886
4068
  }
3887
4069
  exports.RestClient = RestClient;
3888
4070
  //# sourceMappingURL=RestClient.js.map