ccxt 4.1.62 → 4.1.63
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/README.md +3 -3
- package/dist/ccxt.browser.js +466 -81
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +209 -48
- package/dist/cjs/src/binance.js +3 -3
- package/dist/cjs/src/kucoinfutures.js +34 -13
- package/dist/cjs/src/pro/poloniex.js +205 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +3 -3
- package/js/src/abstract/binancecoinm.d.ts +3 -3
- package/js/src/abstract/binanceus.d.ts +3 -3
- package/js/src/abstract/binanceusdm.d.ts +3 -3
- package/js/src/alpaca.d.ts +4 -0
- package/js/src/alpaca.js +209 -48
- package/js/src/binance.js +3 -3
- package/js/src/kucoinfutures.js +34 -13
- package/js/src/pro/poloniex.d.ts +8 -1
- package/js/src/pro/poloniex.js +206 -3
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -173,7 +173,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
173
173
|
|
|
174
174
|
//-----------------------------------------------------------------------------
|
|
175
175
|
// this is updated by vss.js when building
|
|
176
|
-
const version = '4.1.
|
|
176
|
+
const version = '4.1.63';
|
|
177
177
|
Exchange["default"].ccxtVersion = version;
|
|
178
178
|
const exchanges = {
|
|
179
179
|
'ace': ace,
|
package/dist/cjs/src/alpaca.js
CHANGED
|
@@ -50,7 +50,7 @@ class alpaca extends alpaca$1 {
|
|
|
50
50
|
'createOrder': true,
|
|
51
51
|
'fetchBalance': true,
|
|
52
52
|
'fetchBidsAsks': false,
|
|
53
|
-
'fetchClosedOrders':
|
|
53
|
+
'fetchClosedOrders': true,
|
|
54
54
|
'fetchCurrencies': false,
|
|
55
55
|
'fetchDepositAddress': false,
|
|
56
56
|
'fetchDepositAddressesByNetwork': false,
|
|
@@ -68,12 +68,12 @@ class alpaca extends alpaca$1 {
|
|
|
68
68
|
'fetchOpenOrders': true,
|
|
69
69
|
'fetchOrder': true,
|
|
70
70
|
'fetchOrderBook': true,
|
|
71
|
-
'fetchOrders':
|
|
71
|
+
'fetchOrders': true,
|
|
72
72
|
'fetchPositions': false,
|
|
73
73
|
'fetchStatus': false,
|
|
74
74
|
'fetchTicker': false,
|
|
75
75
|
'fetchTickers': false,
|
|
76
|
-
'fetchTime':
|
|
76
|
+
'fetchTime': true,
|
|
77
77
|
'fetchTrades': true,
|
|
78
78
|
'fetchTradingFee': false,
|
|
79
79
|
'fetchTradingFees': false,
|
|
@@ -261,42 +261,90 @@ class alpaca extends alpaca$1 {
|
|
|
261
261
|
},
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
+
async fetchTime(params = {}) {
|
|
265
|
+
/**
|
|
266
|
+
* @method
|
|
267
|
+
* @name alpaca#fetchTime
|
|
268
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
269
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
270
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
271
|
+
*/
|
|
272
|
+
const response = await this.traderPrivateGetV2Clock(params);
|
|
273
|
+
//
|
|
274
|
+
// {
|
|
275
|
+
// timestamp: '2023-11-22T08:07:57.654738097-05:00',
|
|
276
|
+
// is_open: false,
|
|
277
|
+
// next_open: '2023-11-22T09:30:00-05:00',
|
|
278
|
+
// next_close: '2023-11-22T16:00:00-05:00'
|
|
279
|
+
// }
|
|
280
|
+
//
|
|
281
|
+
const timestamp = this.safeString(response, 'timestamp');
|
|
282
|
+
const localTime = timestamp.slice(0, 23);
|
|
283
|
+
const jetlagStrStart = timestamp.length - 6;
|
|
284
|
+
const jetlagStrEnd = timestamp.length - 3;
|
|
285
|
+
const jetlag = timestamp.slice(jetlagStrStart, jetlagStrEnd);
|
|
286
|
+
const iso = this.parse8601(localTime) - this.parseToNumeric(jetlag) * 3600 * 1000;
|
|
287
|
+
return iso;
|
|
288
|
+
}
|
|
264
289
|
async fetchMarkets(params = {}) {
|
|
265
290
|
/**
|
|
266
291
|
* @method
|
|
267
292
|
* @name alpaca#fetchMarkets
|
|
268
293
|
* @description retrieves data on all markets for alpaca
|
|
294
|
+
* @see https://docs.alpaca.markets/reference/get-v2-assets
|
|
269
295
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
270
296
|
* @returns {object[]} an array of objects representing market data
|
|
271
297
|
*/
|
|
272
298
|
const request = {
|
|
273
299
|
'asset_class': 'crypto',
|
|
274
|
-
'
|
|
300
|
+
'status': 'active',
|
|
275
301
|
};
|
|
276
302
|
const assets = await this.traderPrivateGetV2Assets(this.extend(request, params));
|
|
277
303
|
//
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
//
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
304
|
+
// [
|
|
305
|
+
// {
|
|
306
|
+
// "id": "c150e086-1e75-44e6-9c2c-093bb1e93139",
|
|
307
|
+
// "class": "crypto",
|
|
308
|
+
// "exchange": "CRYPTO",
|
|
309
|
+
// "symbol": "BTC/USDT",
|
|
310
|
+
// "name": "Bitcoin / USD Tether",
|
|
311
|
+
// "status": "active",
|
|
312
|
+
// "tradable": true,
|
|
313
|
+
// "marginable": false,
|
|
314
|
+
// "maintenance_margin_requirement": 100,
|
|
315
|
+
// "shortable": false,
|
|
316
|
+
// "easy_to_borrow": false,
|
|
317
|
+
// "fractionable": true,
|
|
318
|
+
// "attributes": [],
|
|
319
|
+
// "min_order_size": "0.000026873",
|
|
320
|
+
// "min_trade_increment": "0.000000001",
|
|
321
|
+
// "price_increment": "1"
|
|
322
|
+
// }
|
|
323
|
+
// ]
|
|
296
324
|
//
|
|
297
325
|
return this.parseMarkets(assets);
|
|
298
326
|
}
|
|
299
327
|
parseMarket(asset) {
|
|
328
|
+
//
|
|
329
|
+
// {
|
|
330
|
+
// "id": "c150e086-1e75-44e6-9c2c-093bb1e93139",
|
|
331
|
+
// "class": "crypto",
|
|
332
|
+
// "exchange": "CRYPTO",
|
|
333
|
+
// "symbol": "BTC/USDT",
|
|
334
|
+
// "name": "Bitcoin / USD Tether",
|
|
335
|
+
// "status": "active",
|
|
336
|
+
// "tradable": true,
|
|
337
|
+
// "marginable": false,
|
|
338
|
+
// "maintenance_margin_requirement": 100,
|
|
339
|
+
// "shortable": false,
|
|
340
|
+
// "easy_to_borrow": false,
|
|
341
|
+
// "fractionable": true,
|
|
342
|
+
// "attributes": [],
|
|
343
|
+
// "min_order_size": "0.000026873",
|
|
344
|
+
// "min_trade_increment": "0.000000001",
|
|
345
|
+
// "price_increment": "1"
|
|
346
|
+
// }
|
|
347
|
+
//
|
|
300
348
|
const marketId = this.safeString(asset, 'symbol');
|
|
301
349
|
const parts = marketId.split('/');
|
|
302
350
|
const baseId = this.safeString(parts, 0);
|
|
@@ -436,21 +484,17 @@ class alpaca extends alpaca$1 {
|
|
|
436
484
|
return this.parseTrades(symbolTrades, market, since, limit);
|
|
437
485
|
}
|
|
438
486
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
// =======
|
|
451
|
-
// @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
452
|
-
// >>>>>>> f68b1b599ee41469fefa424f0efc9b6891549278
|
|
453
|
-
//
|
|
487
|
+
/**
|
|
488
|
+
* @method
|
|
489
|
+
* @name alpaca#fetchOrderBook
|
|
490
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
491
|
+
* @see https://docs.alpaca.markets/reference/cryptolatestorderbooks
|
|
492
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
493
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
494
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
495
|
+
* @param {string} [params.loc] crypto location, default: us
|
|
496
|
+
* @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
497
|
+
*/
|
|
454
498
|
await this.loadMarkets();
|
|
455
499
|
const market = this.market(symbol);
|
|
456
500
|
const id = market['id'];
|
|
@@ -625,6 +669,7 @@ class alpaca extends alpaca$1 {
|
|
|
625
669
|
* @method
|
|
626
670
|
* @name alpaca#createOrder
|
|
627
671
|
* @description create a trade order
|
|
672
|
+
* @see https://docs.alpaca.markets/reference/postorder
|
|
628
673
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
629
674
|
* @param {string} type 'market', 'limit' or 'stop_limit'
|
|
630
675
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -713,6 +758,7 @@ class alpaca extends alpaca$1 {
|
|
|
713
758
|
* @method
|
|
714
759
|
* @name alpaca#cancelOrder
|
|
715
760
|
* @description cancels an open order
|
|
761
|
+
* @see https://docs.alpaca.markets/reference/deleteorderbyorderid
|
|
716
762
|
* @param {string} id order id
|
|
717
763
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
718
764
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
@@ -730,11 +776,31 @@ class alpaca extends alpaca$1 {
|
|
|
730
776
|
//
|
|
731
777
|
return this.safeValue(response, 'message', {});
|
|
732
778
|
}
|
|
779
|
+
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
780
|
+
/**
|
|
781
|
+
* @method
|
|
782
|
+
* @name alpaca#cancelAllOrders
|
|
783
|
+
* @description cancel all open orders in a market
|
|
784
|
+
* @see https://docs.alpaca.markets/reference/deleteallorders
|
|
785
|
+
* @param {string} symbol alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
|
|
786
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
787
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
788
|
+
*/
|
|
789
|
+
await this.loadMarkets();
|
|
790
|
+
const response = await this.traderPrivateDeleteV2Orders(params);
|
|
791
|
+
if (Array.isArray(response)) {
|
|
792
|
+
return this.parseOrders(response, undefined);
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
return response;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
733
798
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
734
799
|
/**
|
|
735
800
|
* @method
|
|
736
801
|
* @name alpaca#fetchOrder
|
|
737
802
|
* @description fetches information on an order made by the user
|
|
803
|
+
* @see https://docs.alpaca.markets/reference/getorderbyorderid
|
|
738
804
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
739
805
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
740
806
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -748,24 +814,117 @@ class alpaca extends alpaca$1 {
|
|
|
748
814
|
const market = this.safeMarket(marketId);
|
|
749
815
|
return this.parseOrder(order, market);
|
|
750
816
|
}
|
|
751
|
-
async
|
|
817
|
+
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
752
818
|
/**
|
|
753
819
|
* @method
|
|
754
|
-
* @name alpaca#
|
|
755
|
-
* @description
|
|
756
|
-
* @
|
|
757
|
-
* @param {
|
|
758
|
-
* @param {int} [
|
|
820
|
+
* @name alpaca#fetchOrders
|
|
821
|
+
* @description fetches information on multiple orders made by the user
|
|
822
|
+
* @see https://docs.alpaca.markets/reference/getallorders
|
|
823
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
824
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
825
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
759
826
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
827
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
760
828
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
761
829
|
*/
|
|
762
830
|
await this.loadMarkets();
|
|
831
|
+
const request = {
|
|
832
|
+
'status': 'all',
|
|
833
|
+
};
|
|
763
834
|
let market = undefined;
|
|
764
835
|
if (symbol !== undefined) {
|
|
765
836
|
market = this.market(symbol);
|
|
837
|
+
request['symbols'] = market['id'];
|
|
766
838
|
}
|
|
767
|
-
const
|
|
768
|
-
|
|
839
|
+
const until = this.safeInteger(params, 'until');
|
|
840
|
+
if (until !== undefined) {
|
|
841
|
+
params = this.omit(params, 'until');
|
|
842
|
+
request['endTime'] = until;
|
|
843
|
+
}
|
|
844
|
+
if (since !== undefined) {
|
|
845
|
+
request['after'] = since;
|
|
846
|
+
}
|
|
847
|
+
if (limit !== undefined) {
|
|
848
|
+
request['limit'] = limit;
|
|
849
|
+
}
|
|
850
|
+
const response = await this.traderPrivateGetV2Orders(this.extend(request, params));
|
|
851
|
+
//
|
|
852
|
+
// [
|
|
853
|
+
// {
|
|
854
|
+
// "id": "cbaf12d7-69b8-49c0-a31b-b46af35c755c",
|
|
855
|
+
// "client_order_id": "ccxt_b36156ae6fd44d098ac9c179bab33efd",
|
|
856
|
+
// "created_at": "2023-11-17T04:21:42.234579Z",
|
|
857
|
+
// "updated_at": "2023-11-17T04:22:34.442765Z",
|
|
858
|
+
// "submitted_at": "2023-11-17T04:21:42.233357Z",
|
|
859
|
+
// "filled_at": null,
|
|
860
|
+
// "expired_at": null,
|
|
861
|
+
// "canceled_at": "2023-11-17T04:22:34.399019Z",
|
|
862
|
+
// "failed_at": null,
|
|
863
|
+
// "replaced_at": null,
|
|
864
|
+
// "replaced_by": null,
|
|
865
|
+
// "replaces": null,
|
|
866
|
+
// "asset_id": "77c6f47f-0939-4b23-b41e-47b4469c4bc8",
|
|
867
|
+
// "symbol": "LTC/USDT",
|
|
868
|
+
// "asset_class": "crypto",
|
|
869
|
+
// "notional": null,
|
|
870
|
+
// "qty": "0.001",
|
|
871
|
+
// "filled_qty": "0",
|
|
872
|
+
// "filled_avg_price": null,
|
|
873
|
+
// "order_class": "",
|
|
874
|
+
// "order_type": "limit",
|
|
875
|
+
// "type": "limit",
|
|
876
|
+
// "side": "sell",
|
|
877
|
+
// "time_in_force": "gtc",
|
|
878
|
+
// "limit_price": "1000",
|
|
879
|
+
// "stop_price": null,
|
|
880
|
+
// "status": "canceled",
|
|
881
|
+
// "extended_hours": false,
|
|
882
|
+
// "legs": null,
|
|
883
|
+
// "trail_percent": null,
|
|
884
|
+
// "trail_price": null,
|
|
885
|
+
// "hwm": null,
|
|
886
|
+
// "subtag": null,
|
|
887
|
+
// "source": "access_key"
|
|
888
|
+
// }
|
|
889
|
+
// ]
|
|
890
|
+
//
|
|
891
|
+
return this.parseOrders(response, market, since, limit);
|
|
892
|
+
}
|
|
893
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
894
|
+
/**
|
|
895
|
+
* @method
|
|
896
|
+
* @name alpaca#fetchOpenOrders
|
|
897
|
+
* @description fetch all unfilled currently open orders
|
|
898
|
+
* @see https://docs.alpaca.markets/reference/getallorders
|
|
899
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
900
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
901
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
902
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
903
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
904
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
905
|
+
*/
|
|
906
|
+
const request = {
|
|
907
|
+
'status': 'open',
|
|
908
|
+
};
|
|
909
|
+
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
910
|
+
}
|
|
911
|
+
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
912
|
+
/**
|
|
913
|
+
* @method
|
|
914
|
+
* @name alpaca#fetchClosedOrders
|
|
915
|
+
* @description fetches information on multiple closed orders made by the user
|
|
916
|
+
* @see https://docs.alpaca.markets/reference/getallorders
|
|
917
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
918
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
919
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
920
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
921
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
922
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
923
|
+
*/
|
|
924
|
+
const request = {
|
|
925
|
+
'status': 'closed',
|
|
926
|
+
};
|
|
927
|
+
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
769
928
|
}
|
|
770
929
|
parseOrder(order, market = undefined) {
|
|
771
930
|
//
|
|
@@ -820,9 +979,11 @@ class alpaca extends alpaca$1 {
|
|
|
820
979
|
};
|
|
821
980
|
}
|
|
822
981
|
let orderType = this.safeString(order, 'order_type');
|
|
823
|
-
if (orderType
|
|
824
|
-
|
|
825
|
-
|
|
982
|
+
if (orderType !== undefined) {
|
|
983
|
+
if (orderType.indexOf('limit') >= 0) {
|
|
984
|
+
// might be limit or stop-limit
|
|
985
|
+
orderType = 'limit';
|
|
986
|
+
}
|
|
826
987
|
}
|
|
827
988
|
const datetime = this.safeString(order, 'submitted_at');
|
|
828
989
|
const timestamp = this.parse8601(datetime);
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -967,7 +967,7 @@ class binance extends binance$1 {
|
|
|
967
967
|
'cm/income': 30,
|
|
968
968
|
'um/account': 5,
|
|
969
969
|
'cm/account': 5,
|
|
970
|
-
'
|
|
970
|
+
'repay-futures-switch': 3,
|
|
971
971
|
'um/adlQuantile': 5,
|
|
972
972
|
'cm/adlQuantile': 5,
|
|
973
973
|
},
|
|
@@ -986,8 +986,8 @@ class binance extends binance$1 {
|
|
|
986
986
|
'cm/positionSide/dual': 1,
|
|
987
987
|
'auto-collection': 0.6667,
|
|
988
988
|
'bnb-transfer': 0.6667,
|
|
989
|
-
'
|
|
990
|
-
'
|
|
989
|
+
'repay-futures-switch': 150,
|
|
990
|
+
'repay-futures-negative-balance': 150,
|
|
991
991
|
'listenKey': 1,
|
|
992
992
|
'asset-collection': 3,
|
|
993
993
|
},
|
|
@@ -96,12 +96,6 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
96
96
|
'futuresPublic': 'https://api-futures.kucoin.com',
|
|
97
97
|
'webExchange': 'https://futures.kucoin.com/_api/web-front',
|
|
98
98
|
},
|
|
99
|
-
'test': {
|
|
100
|
-
'public': 'https://openapi-sandbox.kucoin.com',
|
|
101
|
-
'private': 'https://openapi-sandbox.kucoin.com',
|
|
102
|
-
'futuresPrivate': 'https://api-sandbox-futures.kucoin.com',
|
|
103
|
-
'futuresPublic': 'https://api-sandbox-futures.kucoin.com',
|
|
104
|
-
},
|
|
105
99
|
},
|
|
106
100
|
'requiredCredentials': {
|
|
107
101
|
'apiKey': true,
|
|
@@ -326,6 +320,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
326
320
|
* @method
|
|
327
321
|
* @name kucoinfutures#fetchStatus
|
|
328
322
|
* @description the latest known information on the availability of the exchange API
|
|
323
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-service-status
|
|
329
324
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
330
325
|
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
331
326
|
*/
|
|
@@ -354,6 +349,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
354
349
|
* @method
|
|
355
350
|
* @name kucoinfutures#fetchMarkets
|
|
356
351
|
* @description retrieves data on all markets for kucoinfutures
|
|
352
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
|
|
357
353
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
358
354
|
* @returns {object[]} an array of objects representing market data
|
|
359
355
|
*/
|
|
@@ -518,6 +514,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
518
514
|
* @method
|
|
519
515
|
* @name kucoinfutures#fetchTime
|
|
520
516
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
517
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-server-time
|
|
521
518
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
522
519
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
523
520
|
*/
|
|
@@ -535,6 +532,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
535
532
|
* @method
|
|
536
533
|
* @name kucoinfutures#fetchOHLCV
|
|
537
534
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
535
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-klines
|
|
538
536
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
539
537
|
* @param {string} timeframe the length of time each candle represents
|
|
540
538
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -615,6 +613,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
615
613
|
* @method
|
|
616
614
|
* @name kucoinfutures#fetchDepositAddress
|
|
617
615
|
* @description fetch the deposit address for a currency associated with this account
|
|
616
|
+
* @see https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-address
|
|
618
617
|
* @param {string} code unified currency code
|
|
619
618
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
620
619
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -654,6 +653,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
654
653
|
* @method
|
|
655
654
|
* @name kucoinfutures#fetchOrderBook
|
|
656
655
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
656
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-part-order-book-level-2
|
|
657
657
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
658
658
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
659
659
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
@@ -712,6 +712,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
712
712
|
* @method
|
|
713
713
|
* @name kucoinfutures#fetchTicker
|
|
714
714
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
715
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-ticker
|
|
715
716
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
716
717
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
717
718
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -793,6 +794,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
793
794
|
* @method
|
|
794
795
|
* @name kucoinfutures#fetchFundingHistory
|
|
795
796
|
* @description fetch the history of funding payments paid and received on this account
|
|
797
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-funding-history
|
|
796
798
|
* @param {string} symbol unified market symbol
|
|
797
799
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
798
800
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
@@ -1229,6 +1231,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1229
1231
|
* @method
|
|
1230
1232
|
* @name kucoinfutures#cancelOrder
|
|
1231
1233
|
* @description cancels an open order
|
|
1234
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-futures-order-by-orderid
|
|
1232
1235
|
* @param {string} id order id
|
|
1233
1236
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1234
1237
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
@@ -1256,6 +1259,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1256
1259
|
* @method
|
|
1257
1260
|
* @name kucoinfutures#cancelAllOrders
|
|
1258
1261
|
* @description cancel all open orders
|
|
1262
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-limit-orders
|
|
1263
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders
|
|
1259
1264
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1260
1265
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
1261
1266
|
* @param {object} [params.stop] When true, all the trigger orders will be cancelled
|
|
@@ -1267,8 +1272,14 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1267
1272
|
request['symbol'] = this.marketId(symbol);
|
|
1268
1273
|
}
|
|
1269
1274
|
const stop = this.safeValue(params, 'stop');
|
|
1270
|
-
|
|
1271
|
-
|
|
1275
|
+
params = this.omit(params, 'stop');
|
|
1276
|
+
let response = undefined;
|
|
1277
|
+
if (stop) {
|
|
1278
|
+
response = await this.futuresPrivateDeleteStopOrders(this.extend(request, params));
|
|
1279
|
+
}
|
|
1280
|
+
else {
|
|
1281
|
+
response = await this.futuresPrivateDeleteOrders(this.extend(request, params));
|
|
1282
|
+
}
|
|
1272
1283
|
//
|
|
1273
1284
|
// {
|
|
1274
1285
|
// "code": "200000",
|
|
@@ -1286,6 +1297,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1286
1297
|
* @method
|
|
1287
1298
|
* @name kucoinfutures#addMargin
|
|
1288
1299
|
* @description add margin
|
|
1300
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/add-margin-manually
|
|
1289
1301
|
* @param {string} symbol unified market symbol
|
|
1290
1302
|
* @param {float} amount amount of margin to add
|
|
1291
1303
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
@@ -1469,8 +1481,13 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1469
1481
|
if (until !== undefined) {
|
|
1470
1482
|
request['endAt'] = until;
|
|
1471
1483
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1484
|
+
let response = undefined;
|
|
1485
|
+
if (stop) {
|
|
1486
|
+
response = await this.futuresPrivateGetStopOrders(this.extend(request, params));
|
|
1487
|
+
}
|
|
1488
|
+
else {
|
|
1489
|
+
response = await this.futuresPrivateGetOrders(this.extend(request, params));
|
|
1490
|
+
}
|
|
1474
1491
|
//
|
|
1475
1492
|
// {
|
|
1476
1493
|
// "code": "200000",
|
|
@@ -1562,20 +1579,20 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1562
1579
|
*/
|
|
1563
1580
|
await this.loadMarkets();
|
|
1564
1581
|
const request = {};
|
|
1565
|
-
let
|
|
1582
|
+
let response = undefined;
|
|
1566
1583
|
if (id === undefined) {
|
|
1567
1584
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
1568
1585
|
if (clientOrderId === undefined) {
|
|
1569
1586
|
throw new errors.InvalidOrder(this.id + ' fetchOrder() requires parameter id or params.clientOid');
|
|
1570
1587
|
}
|
|
1571
1588
|
request['clientOid'] = clientOrderId;
|
|
1572
|
-
method = 'futuresPrivateGetOrdersByClientOid';
|
|
1573
1589
|
params = this.omit(params, ['clientOid', 'clientOrderId']);
|
|
1590
|
+
response = await this.futuresPrivateGetOrdersByClientOid(this.extend(request, params));
|
|
1574
1591
|
}
|
|
1575
1592
|
else {
|
|
1576
1593
|
request['orderId'] = id;
|
|
1594
|
+
response = await this.futuresPrivateGetOrdersOrderId(this.extend(request, params));
|
|
1577
1595
|
}
|
|
1578
|
-
const response = await this[method](this.extend(request, params));
|
|
1579
1596
|
//
|
|
1580
1597
|
// {
|
|
1581
1598
|
// "code": "200000",
|
|
@@ -1740,6 +1757,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1740
1757
|
* @method
|
|
1741
1758
|
* @name kucoinfutures#fetchFundingRate
|
|
1742
1759
|
* @description fetch the current funding rate
|
|
1760
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-funding-rate
|
|
1743
1761
|
* @param {string} symbol unified market symbol
|
|
1744
1762
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
1745
1763
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -1805,6 +1823,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1805
1823
|
* @method
|
|
1806
1824
|
* @name kucoinfutures#fetchBalance
|
|
1807
1825
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
1826
|
+
* @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-futures
|
|
1808
1827
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
1809
1828
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1810
1829
|
*/
|
|
@@ -1982,6 +2001,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1982
2001
|
* @method
|
|
1983
2002
|
* @name kucoinfutures#fetchTrades
|
|
1984
2003
|
* @description get the list of most recent trades for a particular symbol
|
|
2004
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-transaction-history
|
|
1985
2005
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1986
2006
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1987
2007
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -2264,6 +2284,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2264
2284
|
* @method
|
|
2265
2285
|
* @name kucoinfutures#fetchMarketLeverageTiers
|
|
2266
2286
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
2287
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/risk-limit/get-futures-risk-limit-level
|
|
2267
2288
|
* @param {string} symbol unified market symbol
|
|
2268
2289
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
2269
2290
|
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|