ccxt 4.1.62 → 4.1.64
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 +4 -4
- package/dist/ccxt.browser.js +678 -201
- package/dist/ccxt.browser.min.js +3 -3
- 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/binanceus.js +33 -4
- package/dist/cjs/src/kraken.js +20 -2
- package/dist/cjs/src/krakenfutures.js +7 -7
- package/dist/cjs/src/kucoinfutures.js +34 -13
- package/dist/cjs/src/luno.js +10 -11
- package/dist/cjs/src/phemex.js +130 -91
- package/dist/cjs/src/pro/krakenfutures.js +4 -1
- package/dist/cjs/src/pro/poloniex.js +205 -2
- package/dist/cjs/src/tokocrypto.js +1 -3
- package/dist/cjs/src/wazirx.js +7 -1
- package/doc/manual.rst +1 -1
- package/doc/readme.rst +1 -1
- 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/binanceus.js +33 -4
- package/js/src/kraken.js +20 -2
- package/js/src/krakenfutures.js +7 -7
- package/js/src/kucoinfutures.js +34 -13
- package/js/src/luno.js +10 -11
- package/js/src/phemex.js +130 -91
- package/js/src/pro/krakenfutures.js +4 -1
- package/js/src/pro/poloniex.d.ts +8 -1
- package/js/src/pro/poloniex.js +206 -3
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/tokocrypto.js +1 -3
- package/js/src/wazirx.js +7 -1
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -2550,7 +2550,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2550
2550
|
'createOrder': true,
|
|
2551
2551
|
'fetchBalance': true,
|
|
2552
2552
|
'fetchBidsAsks': false,
|
|
2553
|
-
'fetchClosedOrders':
|
|
2553
|
+
'fetchClosedOrders': true,
|
|
2554
2554
|
'fetchCurrencies': false,
|
|
2555
2555
|
'fetchDepositAddress': false,
|
|
2556
2556
|
'fetchDepositAddressesByNetwork': false,
|
|
@@ -2568,12 +2568,12 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2568
2568
|
'fetchOpenOrders': true,
|
|
2569
2569
|
'fetchOrder': true,
|
|
2570
2570
|
'fetchOrderBook': true,
|
|
2571
|
-
'fetchOrders':
|
|
2571
|
+
'fetchOrders': true,
|
|
2572
2572
|
'fetchPositions': false,
|
|
2573
2573
|
'fetchStatus': false,
|
|
2574
2574
|
'fetchTicker': false,
|
|
2575
2575
|
'fetchTickers': false,
|
|
2576
|
-
'fetchTime':
|
|
2576
|
+
'fetchTime': true,
|
|
2577
2577
|
'fetchTrades': true,
|
|
2578
2578
|
'fetchTradingFee': false,
|
|
2579
2579
|
'fetchTradingFees': false,
|
|
@@ -2761,42 +2761,90 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2761
2761
|
},
|
|
2762
2762
|
});
|
|
2763
2763
|
}
|
|
2764
|
+
async fetchTime(params = {}) {
|
|
2765
|
+
/**
|
|
2766
|
+
* @method
|
|
2767
|
+
* @name alpaca#fetchTime
|
|
2768
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
2769
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
2770
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
2771
|
+
*/
|
|
2772
|
+
const response = await this.traderPrivateGetV2Clock(params);
|
|
2773
|
+
//
|
|
2774
|
+
// {
|
|
2775
|
+
// timestamp: '2023-11-22T08:07:57.654738097-05:00',
|
|
2776
|
+
// is_open: false,
|
|
2777
|
+
// next_open: '2023-11-22T09:30:00-05:00',
|
|
2778
|
+
// next_close: '2023-11-22T16:00:00-05:00'
|
|
2779
|
+
// }
|
|
2780
|
+
//
|
|
2781
|
+
const timestamp = this.safeString(response, 'timestamp');
|
|
2782
|
+
const localTime = timestamp.slice(0, 23);
|
|
2783
|
+
const jetlagStrStart = timestamp.length - 6;
|
|
2784
|
+
const jetlagStrEnd = timestamp.length - 3;
|
|
2785
|
+
const jetlag = timestamp.slice(jetlagStrStart, jetlagStrEnd);
|
|
2786
|
+
const iso = this.parse8601(localTime) - this.parseToNumeric(jetlag) * 3600 * 1000;
|
|
2787
|
+
return iso;
|
|
2788
|
+
}
|
|
2764
2789
|
async fetchMarkets(params = {}) {
|
|
2765
2790
|
/**
|
|
2766
2791
|
* @method
|
|
2767
2792
|
* @name alpaca#fetchMarkets
|
|
2768
2793
|
* @description retrieves data on all markets for alpaca
|
|
2794
|
+
* @see https://docs.alpaca.markets/reference/get-v2-assets
|
|
2769
2795
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
2770
2796
|
* @returns {object[]} an array of objects representing market data
|
|
2771
2797
|
*/
|
|
2772
2798
|
const request = {
|
|
2773
2799
|
'asset_class': 'crypto',
|
|
2774
|
-
'
|
|
2800
|
+
'status': 'active',
|
|
2775
2801
|
};
|
|
2776
2802
|
const assets = await this.traderPrivateGetV2Assets(this.extend(request, params));
|
|
2777
2803
|
//
|
|
2778
|
-
//
|
|
2779
|
-
//
|
|
2780
|
-
//
|
|
2781
|
-
//
|
|
2782
|
-
//
|
|
2783
|
-
//
|
|
2784
|
-
//
|
|
2785
|
-
//
|
|
2786
|
-
//
|
|
2787
|
-
//
|
|
2788
|
-
//
|
|
2789
|
-
//
|
|
2790
|
-
//
|
|
2791
|
-
//
|
|
2792
|
-
//
|
|
2793
|
-
//
|
|
2794
|
-
//
|
|
2795
|
-
//
|
|
2804
|
+
// [
|
|
2805
|
+
// {
|
|
2806
|
+
// "id": "c150e086-1e75-44e6-9c2c-093bb1e93139",
|
|
2807
|
+
// "class": "crypto",
|
|
2808
|
+
// "exchange": "CRYPTO",
|
|
2809
|
+
// "symbol": "BTC/USDT",
|
|
2810
|
+
// "name": "Bitcoin / USD Tether",
|
|
2811
|
+
// "status": "active",
|
|
2812
|
+
// "tradable": true,
|
|
2813
|
+
// "marginable": false,
|
|
2814
|
+
// "maintenance_margin_requirement": 100,
|
|
2815
|
+
// "shortable": false,
|
|
2816
|
+
// "easy_to_borrow": false,
|
|
2817
|
+
// "fractionable": true,
|
|
2818
|
+
// "attributes": [],
|
|
2819
|
+
// "min_order_size": "0.000026873",
|
|
2820
|
+
// "min_trade_increment": "0.000000001",
|
|
2821
|
+
// "price_increment": "1"
|
|
2822
|
+
// }
|
|
2823
|
+
// ]
|
|
2796
2824
|
//
|
|
2797
2825
|
return this.parseMarkets(assets);
|
|
2798
2826
|
}
|
|
2799
2827
|
parseMarket(asset) {
|
|
2828
|
+
//
|
|
2829
|
+
// {
|
|
2830
|
+
// "id": "c150e086-1e75-44e6-9c2c-093bb1e93139",
|
|
2831
|
+
// "class": "crypto",
|
|
2832
|
+
// "exchange": "CRYPTO",
|
|
2833
|
+
// "symbol": "BTC/USDT",
|
|
2834
|
+
// "name": "Bitcoin / USD Tether",
|
|
2835
|
+
// "status": "active",
|
|
2836
|
+
// "tradable": true,
|
|
2837
|
+
// "marginable": false,
|
|
2838
|
+
// "maintenance_margin_requirement": 100,
|
|
2839
|
+
// "shortable": false,
|
|
2840
|
+
// "easy_to_borrow": false,
|
|
2841
|
+
// "fractionable": true,
|
|
2842
|
+
// "attributes": [],
|
|
2843
|
+
// "min_order_size": "0.000026873",
|
|
2844
|
+
// "min_trade_increment": "0.000000001",
|
|
2845
|
+
// "price_increment": "1"
|
|
2846
|
+
// }
|
|
2847
|
+
//
|
|
2800
2848
|
const marketId = this.safeString(asset, 'symbol');
|
|
2801
2849
|
const parts = marketId.split('/');
|
|
2802
2850
|
const baseId = this.safeString(parts, 0);
|
|
@@ -2936,21 +2984,17 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2936
2984
|
return this.parseTrades(symbolTrades, market, since, limit);
|
|
2937
2985
|
}
|
|
2938
2986
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
// =======
|
|
2951
|
-
// @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
2952
|
-
// >>>>>>> f68b1b599ee41469fefa424f0efc9b6891549278
|
|
2953
|
-
//
|
|
2987
|
+
/**
|
|
2988
|
+
* @method
|
|
2989
|
+
* @name alpaca#fetchOrderBook
|
|
2990
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
2991
|
+
* @see https://docs.alpaca.markets/reference/cryptolatestorderbooks
|
|
2992
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2993
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2994
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
2995
|
+
* @param {string} [params.loc] crypto location, default: us
|
|
2996
|
+
* @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
2997
|
+
*/
|
|
2954
2998
|
await this.loadMarkets();
|
|
2955
2999
|
const market = this.market(symbol);
|
|
2956
3000
|
const id = market['id'];
|
|
@@ -3125,6 +3169,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3125
3169
|
* @method
|
|
3126
3170
|
* @name alpaca#createOrder
|
|
3127
3171
|
* @description create a trade order
|
|
3172
|
+
* @see https://docs.alpaca.markets/reference/postorder
|
|
3128
3173
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
3129
3174
|
* @param {string} type 'market', 'limit' or 'stop_limit'
|
|
3130
3175
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -3213,6 +3258,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3213
3258
|
* @method
|
|
3214
3259
|
* @name alpaca#cancelOrder
|
|
3215
3260
|
* @description cancels an open order
|
|
3261
|
+
* @see https://docs.alpaca.markets/reference/deleteorderbyorderid
|
|
3216
3262
|
* @param {string} id order id
|
|
3217
3263
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3218
3264
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
@@ -3230,11 +3276,31 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3230
3276
|
//
|
|
3231
3277
|
return this.safeValue(response, 'message', {});
|
|
3232
3278
|
}
|
|
3279
|
+
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
3280
|
+
/**
|
|
3281
|
+
* @method
|
|
3282
|
+
* @name alpaca#cancelAllOrders
|
|
3283
|
+
* @description cancel all open orders in a market
|
|
3284
|
+
* @see https://docs.alpaca.markets/reference/deleteallorders
|
|
3285
|
+
* @param {string} symbol alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
|
|
3286
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
3287
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3288
|
+
*/
|
|
3289
|
+
await this.loadMarkets();
|
|
3290
|
+
const response = await this.traderPrivateDeleteV2Orders(params);
|
|
3291
|
+
if (Array.isArray(response)) {
|
|
3292
|
+
return this.parseOrders(response, undefined);
|
|
3293
|
+
}
|
|
3294
|
+
else {
|
|
3295
|
+
return response;
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3233
3298
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
3234
3299
|
/**
|
|
3235
3300
|
* @method
|
|
3236
3301
|
* @name alpaca#fetchOrder
|
|
3237
3302
|
* @description fetches information on an order made by the user
|
|
3303
|
+
* @see https://docs.alpaca.markets/reference/getorderbyorderid
|
|
3238
3304
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3239
3305
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
3240
3306
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -3248,24 +3314,117 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3248
3314
|
const market = this.safeMarket(marketId);
|
|
3249
3315
|
return this.parseOrder(order, market);
|
|
3250
3316
|
}
|
|
3251
|
-
async
|
|
3317
|
+
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3252
3318
|
/**
|
|
3253
3319
|
* @method
|
|
3254
|
-
* @name alpaca#
|
|
3255
|
-
* @description
|
|
3256
|
-
* @
|
|
3257
|
-
* @param {
|
|
3258
|
-
* @param {int} [
|
|
3320
|
+
* @name alpaca#fetchOrders
|
|
3321
|
+
* @description fetches information on multiple orders made by the user
|
|
3322
|
+
* @see https://docs.alpaca.markets/reference/getallorders
|
|
3323
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3324
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3325
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3259
3326
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
3327
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
3260
3328
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3261
3329
|
*/
|
|
3262
3330
|
await this.loadMarkets();
|
|
3331
|
+
const request = {
|
|
3332
|
+
'status': 'all',
|
|
3333
|
+
};
|
|
3263
3334
|
let market = undefined;
|
|
3264
3335
|
if (symbol !== undefined) {
|
|
3265
3336
|
market = this.market(symbol);
|
|
3337
|
+
request['symbols'] = market['id'];
|
|
3266
3338
|
}
|
|
3267
|
-
const
|
|
3268
|
-
|
|
3339
|
+
const until = this.safeInteger(params, 'until');
|
|
3340
|
+
if (until !== undefined) {
|
|
3341
|
+
params = this.omit(params, 'until');
|
|
3342
|
+
request['endTime'] = until;
|
|
3343
|
+
}
|
|
3344
|
+
if (since !== undefined) {
|
|
3345
|
+
request['after'] = since;
|
|
3346
|
+
}
|
|
3347
|
+
if (limit !== undefined) {
|
|
3348
|
+
request['limit'] = limit;
|
|
3349
|
+
}
|
|
3350
|
+
const response = await this.traderPrivateGetV2Orders(this.extend(request, params));
|
|
3351
|
+
//
|
|
3352
|
+
// [
|
|
3353
|
+
// {
|
|
3354
|
+
// "id": "cbaf12d7-69b8-49c0-a31b-b46af35c755c",
|
|
3355
|
+
// "client_order_id": "ccxt_b36156ae6fd44d098ac9c179bab33efd",
|
|
3356
|
+
// "created_at": "2023-11-17T04:21:42.234579Z",
|
|
3357
|
+
// "updated_at": "2023-11-17T04:22:34.442765Z",
|
|
3358
|
+
// "submitted_at": "2023-11-17T04:21:42.233357Z",
|
|
3359
|
+
// "filled_at": null,
|
|
3360
|
+
// "expired_at": null,
|
|
3361
|
+
// "canceled_at": "2023-11-17T04:22:34.399019Z",
|
|
3362
|
+
// "failed_at": null,
|
|
3363
|
+
// "replaced_at": null,
|
|
3364
|
+
// "replaced_by": null,
|
|
3365
|
+
// "replaces": null,
|
|
3366
|
+
// "asset_id": "77c6f47f-0939-4b23-b41e-47b4469c4bc8",
|
|
3367
|
+
// "symbol": "LTC/USDT",
|
|
3368
|
+
// "asset_class": "crypto",
|
|
3369
|
+
// "notional": null,
|
|
3370
|
+
// "qty": "0.001",
|
|
3371
|
+
// "filled_qty": "0",
|
|
3372
|
+
// "filled_avg_price": null,
|
|
3373
|
+
// "order_class": "",
|
|
3374
|
+
// "order_type": "limit",
|
|
3375
|
+
// "type": "limit",
|
|
3376
|
+
// "side": "sell",
|
|
3377
|
+
// "time_in_force": "gtc",
|
|
3378
|
+
// "limit_price": "1000",
|
|
3379
|
+
// "stop_price": null,
|
|
3380
|
+
// "status": "canceled",
|
|
3381
|
+
// "extended_hours": false,
|
|
3382
|
+
// "legs": null,
|
|
3383
|
+
// "trail_percent": null,
|
|
3384
|
+
// "trail_price": null,
|
|
3385
|
+
// "hwm": null,
|
|
3386
|
+
// "subtag": null,
|
|
3387
|
+
// "source": "access_key"
|
|
3388
|
+
// }
|
|
3389
|
+
// ]
|
|
3390
|
+
//
|
|
3391
|
+
return this.parseOrders(response, market, since, limit);
|
|
3392
|
+
}
|
|
3393
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3394
|
+
/**
|
|
3395
|
+
* @method
|
|
3396
|
+
* @name alpaca#fetchOpenOrders
|
|
3397
|
+
* @description fetch all unfilled currently open orders
|
|
3398
|
+
* @see https://docs.alpaca.markets/reference/getallorders
|
|
3399
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3400
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3401
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3402
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
3403
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
3404
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3405
|
+
*/
|
|
3406
|
+
const request = {
|
|
3407
|
+
'status': 'open',
|
|
3408
|
+
};
|
|
3409
|
+
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
3410
|
+
}
|
|
3411
|
+
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3412
|
+
/**
|
|
3413
|
+
* @method
|
|
3414
|
+
* @name alpaca#fetchClosedOrders
|
|
3415
|
+
* @description fetches information on multiple closed orders made by the user
|
|
3416
|
+
* @see https://docs.alpaca.markets/reference/getallorders
|
|
3417
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3418
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3419
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3420
|
+
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
3421
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
3422
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3423
|
+
*/
|
|
3424
|
+
const request = {
|
|
3425
|
+
'status': 'closed',
|
|
3426
|
+
};
|
|
3427
|
+
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
3269
3428
|
}
|
|
3270
3429
|
parseOrder(order, market = undefined) {
|
|
3271
3430
|
//
|
|
@@ -3320,9 +3479,11 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
3320
3479
|
};
|
|
3321
3480
|
}
|
|
3322
3481
|
let orderType = this.safeString(order, 'order_type');
|
|
3323
|
-
if (orderType
|
|
3324
|
-
|
|
3325
|
-
|
|
3482
|
+
if (orderType !== undefined) {
|
|
3483
|
+
if (orderType.indexOf('limit') >= 0) {
|
|
3484
|
+
// might be limit or stop-limit
|
|
3485
|
+
orderType = 'limit';
|
|
3486
|
+
}
|
|
3326
3487
|
}
|
|
3327
3488
|
const datetime = this.safeString(order, 'submitted_at');
|
|
3328
3489
|
const timestamp = this.parse8601(datetime);
|
|
@@ -17543,7 +17704,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17543
17704
|
'cm/income': 30,
|
|
17544
17705
|
'um/account': 5,
|
|
17545
17706
|
'cm/account': 5,
|
|
17546
|
-
'
|
|
17707
|
+
'repay-futures-switch': 3,
|
|
17547
17708
|
'um/adlQuantile': 5,
|
|
17548
17709
|
'cm/adlQuantile': 5,
|
|
17549
17710
|
},
|
|
@@ -17562,8 +17723,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17562
17723
|
'cm/positionSide/dual': 1,
|
|
17563
17724
|
'auto-collection': 0.6667,
|
|
17564
17725
|
'bnb-transfer': 0.6667,
|
|
17565
|
-
'
|
|
17566
|
-
'
|
|
17726
|
+
'repay-futures-switch': 150,
|
|
17727
|
+
'repay-futures-negative-balance': 150,
|
|
17567
17728
|
'listenKey': 1,
|
|
17568
17729
|
'asset-collection': 3,
|
|
17569
17730
|
},
|
|
@@ -26379,10 +26540,39 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
26379
26540
|
'has': {
|
|
26380
26541
|
'CORS': undefined,
|
|
26381
26542
|
'spot': true,
|
|
26382
|
-
'margin':
|
|
26383
|
-
'swap':
|
|
26384
|
-
'
|
|
26385
|
-
'
|
|
26543
|
+
'margin': false,
|
|
26544
|
+
'swap': false,
|
|
26545
|
+
'option': false,
|
|
26546
|
+
'addMargin': false,
|
|
26547
|
+
'borrowMargin': false,
|
|
26548
|
+
'createReduceOnlyOrder': false,
|
|
26549
|
+
'fetchBorrowInterest': false,
|
|
26550
|
+
'fetchBorrowRate': false,
|
|
26551
|
+
'fetchBorrowRateHistories': false,
|
|
26552
|
+
'fetchBorrowRateHistory': false,
|
|
26553
|
+
'fetchBorrowRates': false,
|
|
26554
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
26555
|
+
'fetchFundingHistory': false,
|
|
26556
|
+
'fetchFundingRate': false,
|
|
26557
|
+
'fetchFundingRateHistory': false,
|
|
26558
|
+
'fetchFundingRates': false,
|
|
26559
|
+
'fetchIndexOHLCV': false,
|
|
26560
|
+
'fetchIsolatedPositions': false,
|
|
26561
|
+
'fetchLeverage': false,
|
|
26562
|
+
'fetchLeverageTiers': false,
|
|
26563
|
+
'fetchMarketLeverageTiers': false,
|
|
26564
|
+
'fetchMarkOHLCV': false,
|
|
26565
|
+
'fetchOpenInterestHistory': false,
|
|
26566
|
+
'fetchPosition': false,
|
|
26567
|
+
'fetchPositions': false,
|
|
26568
|
+
'fetchPositionsRisk': false,
|
|
26569
|
+
'fetchPremiumIndexOHLCV': false,
|
|
26570
|
+
'reduceMargin': false,
|
|
26571
|
+
'repayMargin': false,
|
|
26572
|
+
'setLeverage': false,
|
|
26573
|
+
'setMargin': false,
|
|
26574
|
+
'setMarginMode': false,
|
|
26575
|
+
'setPositionMode': false,
|
|
26386
26576
|
},
|
|
26387
26577
|
});
|
|
26388
26578
|
}
|
|
@@ -150600,8 +150790,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
150600
150790
|
//
|
|
150601
150791
|
// market
|
|
150602
150792
|
// limit (price = limit price)
|
|
150603
|
-
// stop-loss (price = stop loss price)
|
|
150604
|
-
// take-profit (price = take profit price)
|
|
150793
|
+
// stop-loss (price = stop loss trigger price)
|
|
150794
|
+
// take-profit (price = take profit trigger price)
|
|
150605
150795
|
// stop-loss-limit (price = stop loss trigger price, price2 = triggered limit price)
|
|
150606
150796
|
// take-profit-limit (price = take profit trigger price, price2 = triggered limit price)
|
|
150607
150797
|
// settle-position
|
|
@@ -150872,6 +151062,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
150872
151062
|
return result;
|
|
150873
151063
|
}
|
|
150874
151064
|
async fetchOrdersByIds(ids, symbol = undefined, params = {}) {
|
|
151065
|
+
/**
|
|
151066
|
+
* @method
|
|
151067
|
+
* @name kraken#fetchOrdersByIds
|
|
151068
|
+
* @description fetch orders by the list of order id
|
|
151069
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
151070
|
+
* @param {string[]|undefined} ids list of order id
|
|
151071
|
+
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
151072
|
+
* @returns {object[]} a list of [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
151073
|
+
*/
|
|
150875
151074
|
await this.loadMarkets();
|
|
150876
151075
|
const response = await this.privatePostQueryOrders(this.extend({
|
|
150877
151076
|
'trades': true,
|
|
@@ -151367,6 +151566,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151367
151566
|
return await this.fetchDepositAddress(code, this.extend(request, params));
|
|
151368
151567
|
}
|
|
151369
151568
|
async fetchDepositMethods(code, params = {}) {
|
|
151569
|
+
/**
|
|
151570
|
+
* @method
|
|
151571
|
+
* @name kraken#fetchDepositMethods
|
|
151572
|
+
* @description fetch deposit methods for a currency associated with this account
|
|
151573
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositMethods
|
|
151574
|
+
* @param {string} code unified currency code
|
|
151575
|
+
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
151576
|
+
* @returns {object} of deposit methods
|
|
151577
|
+
*/
|
|
151370
151578
|
await this.loadMarkets();
|
|
151371
151579
|
const currency = this.currency(code);
|
|
151372
151580
|
const request = {
|
|
@@ -151862,7 +152070,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151862
152070
|
},
|
|
151863
152071
|
'www': 'https://futures.kraken.com/',
|
|
151864
152072
|
'doc': [
|
|
151865
|
-
'https://
|
|
152073
|
+
'https://docs.futures.kraken.com/#introduction',
|
|
151866
152074
|
],
|
|
151867
152075
|
'fees': 'https://support.kraken.com/hc/en-us/articles/360022835771-Transaction-fees-and-rebates-for-Kraken-Futures',
|
|
151868
152076
|
'referral': undefined,
|
|
@@ -154005,26 +154213,26 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
154005
154213
|
*/
|
|
154006
154214
|
await this.loadMarkets();
|
|
154007
154215
|
const currency = this.currency(code);
|
|
154008
|
-
let method = 'privatePostTransfer';
|
|
154009
|
-
const request = {
|
|
154010
|
-
'amount': amount,
|
|
154011
|
-
};
|
|
154012
154216
|
if (fromAccount === 'spot') {
|
|
154013
154217
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' transfer does not yet support transfers from spot');
|
|
154014
154218
|
}
|
|
154219
|
+
const request = {
|
|
154220
|
+
'amount': amount,
|
|
154221
|
+
};
|
|
154222
|
+
let response = undefined;
|
|
154015
154223
|
if (toAccount === 'spot') {
|
|
154016
154224
|
if (this.parseAccount(fromAccount) !== 'cash') {
|
|
154017
154225
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' transfer cannot transfer from ' + fromAccount + ' to ' + toAccount);
|
|
154018
154226
|
}
|
|
154019
|
-
method = 'privatePostWithdrawal';
|
|
154020
154227
|
request['currency'] = currency['id'];
|
|
154228
|
+
response = await this.privatePostWithdrawal(this.extend(request, params));
|
|
154021
154229
|
}
|
|
154022
154230
|
else {
|
|
154023
154231
|
request['fromAccount'] = this.parseAccount(fromAccount);
|
|
154024
154232
|
request['toAccount'] = this.parseAccount(toAccount);
|
|
154025
154233
|
request['unit'] = currency['id'];
|
|
154234
|
+
response = await this.privatePostTransfer(this.extend(request, params));
|
|
154026
154235
|
}
|
|
154027
|
-
const response = await this[method](this.extend(request, params));
|
|
154028
154236
|
//
|
|
154029
154237
|
// {
|
|
154030
154238
|
// "result": "success",
|
|
@@ -158667,12 +158875,6 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
158667
158875
|
'futuresPublic': 'https://api-futures.kucoin.com',
|
|
158668
158876
|
'webExchange': 'https://futures.kucoin.com/_api/web-front',
|
|
158669
158877
|
},
|
|
158670
|
-
'test': {
|
|
158671
|
-
'public': 'https://openapi-sandbox.kucoin.com',
|
|
158672
|
-
'private': 'https://openapi-sandbox.kucoin.com',
|
|
158673
|
-
'futuresPrivate': 'https://api-sandbox-futures.kucoin.com',
|
|
158674
|
-
'futuresPublic': 'https://api-sandbox-futures.kucoin.com',
|
|
158675
|
-
},
|
|
158676
158878
|
},
|
|
158677
158879
|
'requiredCredentials': {
|
|
158678
158880
|
'apiKey': true,
|
|
@@ -158897,6 +159099,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
158897
159099
|
* @method
|
|
158898
159100
|
* @name kucoinfutures#fetchStatus
|
|
158899
159101
|
* @description the latest known information on the availability of the exchange API
|
|
159102
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-service-status
|
|
158900
159103
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
158901
159104
|
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
158902
159105
|
*/
|
|
@@ -158925,6 +159128,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
158925
159128
|
* @method
|
|
158926
159129
|
* @name kucoinfutures#fetchMarkets
|
|
158927
159130
|
* @description retrieves data on all markets for kucoinfutures
|
|
159131
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
|
|
158928
159132
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
158929
159133
|
* @returns {object[]} an array of objects representing market data
|
|
158930
159134
|
*/
|
|
@@ -159089,6 +159293,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159089
159293
|
* @method
|
|
159090
159294
|
* @name kucoinfutures#fetchTime
|
|
159091
159295
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
159296
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-server-time
|
|
159092
159297
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
159093
159298
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
159094
159299
|
*/
|
|
@@ -159106,6 +159311,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159106
159311
|
* @method
|
|
159107
159312
|
* @name kucoinfutures#fetchOHLCV
|
|
159108
159313
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
159314
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-klines
|
|
159109
159315
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
159110
159316
|
* @param {string} timeframe the length of time each candle represents
|
|
159111
159317
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -159186,6 +159392,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159186
159392
|
* @method
|
|
159187
159393
|
* @name kucoinfutures#fetchDepositAddress
|
|
159188
159394
|
* @description fetch the deposit address for a currency associated with this account
|
|
159395
|
+
* @see https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-address
|
|
159189
159396
|
* @param {string} code unified currency code
|
|
159190
159397
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
159191
159398
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -159225,6 +159432,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159225
159432
|
* @method
|
|
159226
159433
|
* @name kucoinfutures#fetchOrderBook
|
|
159227
159434
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
159435
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-part-order-book-level-2
|
|
159228
159436
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
159229
159437
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
159230
159438
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
@@ -159283,6 +159491,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159283
159491
|
* @method
|
|
159284
159492
|
* @name kucoinfutures#fetchTicker
|
|
159285
159493
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
159494
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-ticker
|
|
159286
159495
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
159287
159496
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
159288
159497
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -159364,6 +159573,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159364
159573
|
* @method
|
|
159365
159574
|
* @name kucoinfutures#fetchFundingHistory
|
|
159366
159575
|
* @description fetch the history of funding payments paid and received on this account
|
|
159576
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-funding-history
|
|
159367
159577
|
* @param {string} symbol unified market symbol
|
|
159368
159578
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
159369
159579
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
@@ -159800,6 +160010,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159800
160010
|
* @method
|
|
159801
160011
|
* @name kucoinfutures#cancelOrder
|
|
159802
160012
|
* @description cancels an open order
|
|
160013
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-futures-order-by-orderid
|
|
159803
160014
|
* @param {string} id order id
|
|
159804
160015
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
159805
160016
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
@@ -159827,6 +160038,8 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159827
160038
|
* @method
|
|
159828
160039
|
* @name kucoinfutures#cancelAllOrders
|
|
159829
160040
|
* @description cancel all open orders
|
|
160041
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-limit-orders
|
|
160042
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders
|
|
159830
160043
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
159831
160044
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
159832
160045
|
* @param {object} [params.stop] When true, all the trigger orders will be cancelled
|
|
@@ -159838,8 +160051,14 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159838
160051
|
request['symbol'] = this.marketId(symbol);
|
|
159839
160052
|
}
|
|
159840
160053
|
const stop = this.safeValue(params, 'stop');
|
|
159841
|
-
|
|
159842
|
-
|
|
160054
|
+
params = this.omit(params, 'stop');
|
|
160055
|
+
let response = undefined;
|
|
160056
|
+
if (stop) {
|
|
160057
|
+
response = await this.futuresPrivateDeleteStopOrders(this.extend(request, params));
|
|
160058
|
+
}
|
|
160059
|
+
else {
|
|
160060
|
+
response = await this.futuresPrivateDeleteOrders(this.extend(request, params));
|
|
160061
|
+
}
|
|
159843
160062
|
//
|
|
159844
160063
|
// {
|
|
159845
160064
|
// "code": "200000",
|
|
@@ -159857,6 +160076,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159857
160076
|
* @method
|
|
159858
160077
|
* @name kucoinfutures#addMargin
|
|
159859
160078
|
* @description add margin
|
|
160079
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/add-margin-manually
|
|
159860
160080
|
* @param {string} symbol unified market symbol
|
|
159861
160081
|
* @param {float} amount amount of margin to add
|
|
159862
160082
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
@@ -160040,8 +160260,13 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160040
160260
|
if (until !== undefined) {
|
|
160041
160261
|
request['endAt'] = until;
|
|
160042
160262
|
}
|
|
160043
|
-
|
|
160044
|
-
|
|
160263
|
+
let response = undefined;
|
|
160264
|
+
if (stop) {
|
|
160265
|
+
response = await this.futuresPrivateGetStopOrders(this.extend(request, params));
|
|
160266
|
+
}
|
|
160267
|
+
else {
|
|
160268
|
+
response = await this.futuresPrivateGetOrders(this.extend(request, params));
|
|
160269
|
+
}
|
|
160045
160270
|
//
|
|
160046
160271
|
// {
|
|
160047
160272
|
// "code": "200000",
|
|
@@ -160133,20 +160358,20 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160133
160358
|
*/
|
|
160134
160359
|
await this.loadMarkets();
|
|
160135
160360
|
const request = {};
|
|
160136
|
-
let
|
|
160361
|
+
let response = undefined;
|
|
160137
160362
|
if (id === undefined) {
|
|
160138
160363
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
160139
160364
|
if (clientOrderId === undefined) {
|
|
160140
160365
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' fetchOrder() requires parameter id or params.clientOid');
|
|
160141
160366
|
}
|
|
160142
160367
|
request['clientOid'] = clientOrderId;
|
|
160143
|
-
method = 'futuresPrivateGetOrdersByClientOid';
|
|
160144
160368
|
params = this.omit(params, ['clientOid', 'clientOrderId']);
|
|
160369
|
+
response = await this.futuresPrivateGetOrdersByClientOid(this.extend(request, params));
|
|
160145
160370
|
}
|
|
160146
160371
|
else {
|
|
160147
160372
|
request['orderId'] = id;
|
|
160373
|
+
response = await this.futuresPrivateGetOrdersOrderId(this.extend(request, params));
|
|
160148
160374
|
}
|
|
160149
|
-
const response = await this[method](this.extend(request, params));
|
|
160150
160375
|
//
|
|
160151
160376
|
// {
|
|
160152
160377
|
// "code": "200000",
|
|
@@ -160311,6 +160536,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160311
160536
|
* @method
|
|
160312
160537
|
* @name kucoinfutures#fetchFundingRate
|
|
160313
160538
|
* @description fetch the current funding rate
|
|
160539
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-funding-rate
|
|
160314
160540
|
* @param {string} symbol unified market symbol
|
|
160315
160541
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
160316
160542
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -160376,6 +160602,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160376
160602
|
* @method
|
|
160377
160603
|
* @name kucoinfutures#fetchBalance
|
|
160378
160604
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
160605
|
+
* @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-futures
|
|
160379
160606
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
160380
160607
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
160381
160608
|
*/
|
|
@@ -160553,6 +160780,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160553
160780
|
* @method
|
|
160554
160781
|
* @name kucoinfutures#fetchTrades
|
|
160555
160782
|
* @description get the list of most recent trades for a particular symbol
|
|
160783
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-transaction-history
|
|
160556
160784
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
160557
160785
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
160558
160786
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -160835,6 +161063,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160835
161063
|
* @method
|
|
160836
161064
|
* @name kucoinfutures#fetchMarketLeverageTiers
|
|
160837
161065
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
161066
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/risk-limit/get-futures-risk-limit-level
|
|
160838
161067
|
* @param {string} symbol unified market symbol
|
|
160839
161068
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
160840
161069
|
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
@@ -167805,17 +168034,17 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
167805
168034
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
167806
168035
|
*/
|
|
167807
168036
|
await this.loadMarkets();
|
|
167808
|
-
let method = 'publicGetOrderbook';
|
|
167809
|
-
if (limit !== undefined) {
|
|
167810
|
-
if (limit <= 100) {
|
|
167811
|
-
method += 'Top'; // get just the top of the orderbook when limit is low
|
|
167812
|
-
}
|
|
167813
|
-
}
|
|
167814
168037
|
const market = this.market(symbol);
|
|
167815
168038
|
const request = {
|
|
167816
168039
|
'pair': market['id'],
|
|
167817
168040
|
};
|
|
167818
|
-
|
|
168041
|
+
let response = undefined;
|
|
168042
|
+
if (limit !== undefined && limit <= 100) {
|
|
168043
|
+
response = await this.publicGetOrderbookTop(this.extend(request, params));
|
|
168044
|
+
}
|
|
168045
|
+
else {
|
|
168046
|
+
response = await this.publicGetOrderbook(this.extend(request, params));
|
|
168047
|
+
}
|
|
167819
168048
|
const timestamp = this.safeInteger(response, 'timestamp');
|
|
167820
168049
|
return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
|
|
167821
168050
|
}
|
|
@@ -168283,13 +168512,12 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
168283
168512
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
168284
168513
|
*/
|
|
168285
168514
|
await this.loadMarkets();
|
|
168286
|
-
let method = 'privatePost';
|
|
168287
168515
|
const market = this.market(symbol);
|
|
168288
168516
|
const request = {
|
|
168289
168517
|
'pair': market['id'],
|
|
168290
168518
|
};
|
|
168519
|
+
let response = undefined;
|
|
168291
168520
|
if (type === 'market') {
|
|
168292
|
-
method += 'Marketorder';
|
|
168293
168521
|
request['type'] = side.toUpperCase();
|
|
168294
168522
|
// todo add createMarketBuyOrderRequires price logic as it is implemented in the other exchanges
|
|
168295
168523
|
if (side === 'buy') {
|
|
@@ -168298,14 +168526,14 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
168298
168526
|
else {
|
|
168299
168527
|
request['base_volume'] = this.amountToPrecision(market['symbol'], amount);
|
|
168300
168528
|
}
|
|
168529
|
+
response = await this.privatePostMarketorder(this.extend(request, params));
|
|
168301
168530
|
}
|
|
168302
168531
|
else {
|
|
168303
|
-
method += 'Postorder';
|
|
168304
168532
|
request['volume'] = this.amountToPrecision(market['symbol'], amount);
|
|
168305
168533
|
request['price'] = this.priceToPrecision(market['symbol'], price);
|
|
168306
168534
|
request['type'] = (side === 'buy') ? 'BID' : 'ASK';
|
|
168535
|
+
response = await this.privatePostPostorder(this.extend(request, params));
|
|
168307
168536
|
}
|
|
168308
|
-
const response = await this[method](this.extend(request, params));
|
|
168309
168537
|
return this.safeOrder({
|
|
168310
168538
|
'info': response,
|
|
168311
168539
|
'id': response['order_id'],
|
|
@@ -194077,11 +194305,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194077
194305
|
'symbol': market['id'],
|
|
194078
194306
|
// 'id': 123456789, // optional request id
|
|
194079
194307
|
};
|
|
194080
|
-
let
|
|
194308
|
+
let response = undefined;
|
|
194081
194309
|
if (market['linear'] && market['settle'] === 'USDT') {
|
|
194082
|
-
|
|
194310
|
+
response = await this.v2GetMdV2Orderbook(this.extend(request, params));
|
|
194311
|
+
}
|
|
194312
|
+
else {
|
|
194313
|
+
response = await this.v1GetMdOrderbook(this.extend(request, params));
|
|
194083
194314
|
}
|
|
194084
|
-
const response = await this[method](this.extend(request, params));
|
|
194085
194315
|
//
|
|
194086
194316
|
// {
|
|
194087
194317
|
// "error": null,
|
|
@@ -194386,16 +194616,18 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194386
194616
|
'symbol': market['id'],
|
|
194387
194617
|
// 'id': 123456789, // optional request id
|
|
194388
194618
|
};
|
|
194389
|
-
let
|
|
194619
|
+
let response = undefined;
|
|
194390
194620
|
if (market['swap']) {
|
|
194391
194621
|
if (market['inverse'] || market['settle'] === 'USD') {
|
|
194392
|
-
|
|
194622
|
+
response = await this.v1GetMdTicker24hr(this.extend(request, params));
|
|
194393
194623
|
}
|
|
194394
194624
|
else {
|
|
194395
|
-
|
|
194625
|
+
response = await this.v2GetMdV2Ticker24hr(this.extend(request, params));
|
|
194396
194626
|
}
|
|
194397
194627
|
}
|
|
194398
|
-
|
|
194628
|
+
else {
|
|
194629
|
+
response = await this.v1GetMdSpotTicker24hr(this.extend(request, params));
|
|
194630
|
+
}
|
|
194399
194631
|
//
|
|
194400
194632
|
// spot
|
|
194401
194633
|
//
|
|
@@ -194466,18 +194698,16 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194466
194698
|
let subType = undefined;
|
|
194467
194699
|
[subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
|
|
194468
194700
|
const query = this.omit(params, 'type');
|
|
194469
|
-
let
|
|
194701
|
+
let response = undefined;
|
|
194470
194702
|
if (type === 'spot') {
|
|
194471
|
-
|
|
194703
|
+
response = await this.v1GetMdSpotTicker24hrAll(query);
|
|
194472
194704
|
}
|
|
194473
|
-
else if (subType === 'inverse') {
|
|
194474
|
-
|
|
194705
|
+
else if (subType === 'inverse' || market['settle'] === 'USD') {
|
|
194706
|
+
response = await this.v1GetMdTicker24hrAll(query);
|
|
194475
194707
|
}
|
|
194476
194708
|
else {
|
|
194477
|
-
|
|
194709
|
+
response = await this.v2GetMdV2Ticker24hrAll(query);
|
|
194478
194710
|
}
|
|
194479
|
-
const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
|
|
194480
|
-
const response = await this[method](query);
|
|
194481
194711
|
const result = this.safeValue(response, 'result', []);
|
|
194482
194712
|
return this.parseTickers(result, symbols);
|
|
194483
194713
|
}
|
|
@@ -194499,11 +194729,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194499
194729
|
'symbol': market['id'],
|
|
194500
194730
|
// 'id': 123456789, // optional request id
|
|
194501
194731
|
};
|
|
194502
|
-
let
|
|
194732
|
+
let response = undefined;
|
|
194503
194733
|
if (market['linear'] && market['settle'] === 'USDT') {
|
|
194504
|
-
|
|
194734
|
+
response = await this.v2GetMdV2Trade(this.extend(request, params));
|
|
194735
|
+
}
|
|
194736
|
+
else {
|
|
194737
|
+
response = await this.v1GetMdTrade(this.extend(request, params));
|
|
194505
194738
|
}
|
|
194506
|
-
const response = await this[method](this.extend(request, params));
|
|
194507
194739
|
//
|
|
194508
194740
|
// {
|
|
194509
194741
|
// "error": null,
|
|
@@ -194900,18 +195132,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194900
195132
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
194901
195133
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
|
|
194902
195134
|
* @param {object} [params] extra parameters specific to the phemex api endpoint
|
|
195135
|
+
* @param {string} [params.type] spot or swap
|
|
194903
195136
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
194904
195137
|
*/
|
|
194905
195138
|
await this.loadMarkets();
|
|
194906
195139
|
let type = undefined;
|
|
194907
195140
|
[type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
194908
|
-
|
|
195141
|
+
const code = this.safeString(params, 'code');
|
|
195142
|
+
params = this.omit(params, ['type', 'code']);
|
|
195143
|
+
let response = undefined;
|
|
194909
195144
|
const request = {};
|
|
194910
195145
|
if ((type !== 'spot') && (type !== 'swap')) {
|
|
194911
195146
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' does not support ' + type + ' markets, only spot and swap');
|
|
194912
195147
|
}
|
|
194913
195148
|
if (type === 'swap') {
|
|
194914
|
-
const code = this.safeString(params, 'code');
|
|
194915
195149
|
let settle = undefined;
|
|
194916
195150
|
[settle, params] = this.handleOptionAndParams(params, 'fetchBalance', 'settle');
|
|
194917
195151
|
if (code !== undefined || settle !== undefined) {
|
|
@@ -194925,10 +195159,10 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194925
195159
|
const currency = this.currency(coin);
|
|
194926
195160
|
request['currency'] = currency['id'];
|
|
194927
195161
|
if (currency['id'] === 'USDT') {
|
|
194928
|
-
|
|
195162
|
+
response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
|
|
194929
195163
|
}
|
|
194930
195164
|
else {
|
|
194931
|
-
|
|
195165
|
+
response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
|
|
194932
195166
|
}
|
|
194933
195167
|
}
|
|
194934
195168
|
else {
|
|
@@ -194936,10 +195170,12 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194936
195170
|
if (currency === undefined) {
|
|
194937
195171
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchBalance() requires a code parameter or a currency or settle parameter for ' + type + ' type');
|
|
194938
195172
|
}
|
|
195173
|
+
response = await this.privateGetSpotWallets(this.extend(request, params));
|
|
194939
195174
|
}
|
|
194940
195175
|
}
|
|
194941
|
-
|
|
194942
|
-
|
|
195176
|
+
else {
|
|
195177
|
+
response = await this.privateGetSpotWallets(this.extend(request, params));
|
|
195178
|
+
}
|
|
194943
195179
|
//
|
|
194944
195180
|
// usdt
|
|
194945
195181
|
// {
|
|
@@ -195466,7 +195702,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195466
195702
|
request['clOrdID'] = clientOrderId;
|
|
195467
195703
|
params = this.omit(params, ['clOrdID', 'clientOrderId']);
|
|
195468
195704
|
}
|
|
195469
|
-
const stopPrice = this.
|
|
195705
|
+
const stopPrice = this.safeStringN(params, ['stopPx', 'stopPrice', 'triggerPrice']);
|
|
195470
195706
|
if (stopPrice !== undefined) {
|
|
195471
195707
|
if (market['settle'] === 'USDT') {
|
|
195472
195708
|
request['stopPxRp'] = this.priceToPrecision(symbol, stopPrice);
|
|
@@ -195475,7 +195711,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195475
195711
|
request['stopPxEp'] = this.toEp(stopPrice, market);
|
|
195476
195712
|
}
|
|
195477
195713
|
}
|
|
195478
|
-
params = this.omit(params, ['stopPx', 'stopPrice', 'stopLoss', 'takeProfit']);
|
|
195714
|
+
params = this.omit(params, ['stopPx', 'stopPrice', 'stopLoss', 'takeProfit', 'triggerPrice']);
|
|
195479
195715
|
if (market['spot']) {
|
|
195480
195716
|
let qtyType = this.safeValue(params, 'qtyType', 'ByBase');
|
|
195481
195717
|
if ((type === 'Market') || (type === 'Stop') || (type === 'MarketIfTouched')) {
|
|
@@ -195611,15 +195847,17 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195611
195847
|
}
|
|
195612
195848
|
params = this.omit(params, 'stopLossPrice');
|
|
195613
195849
|
}
|
|
195614
|
-
|
|
195850
|
+
params = this.omit(params, 'reduceOnly');
|
|
195851
|
+
let response = undefined;
|
|
195615
195852
|
if (market['settle'] === 'USDT') {
|
|
195616
|
-
|
|
195853
|
+
response = await this.privatePostGOrders(this.extend(request, params));
|
|
195617
195854
|
}
|
|
195618
195855
|
else if (market['contract']) {
|
|
195619
|
-
|
|
195856
|
+
response = await this.privatePostOrders(this.extend(request, params));
|
|
195857
|
+
}
|
|
195858
|
+
else {
|
|
195859
|
+
response = await this.privatePostSpotOrders(this.extend(request, params));
|
|
195620
195860
|
}
|
|
195621
|
-
params = this.omit(params, 'reduceOnly');
|
|
195622
|
-
const response = await this[method](this.extend(request, params));
|
|
195623
195861
|
//
|
|
195624
195862
|
// spot
|
|
195625
195863
|
//
|
|
@@ -195761,18 +195999,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195761
195999
|
}
|
|
195762
196000
|
}
|
|
195763
196001
|
params = this.omit(params, ['stopPx', 'stopPrice']);
|
|
195764
|
-
let
|
|
196002
|
+
let response = undefined;
|
|
195765
196003
|
if (isUSDTSettled) {
|
|
195766
|
-
method = 'privatePutGOrdersReplace';
|
|
195767
196004
|
const posSide = this.safeString(params, 'posSide');
|
|
195768
196005
|
if (posSide === undefined) {
|
|
195769
196006
|
request['posSide'] = 'Merged';
|
|
195770
196007
|
}
|
|
196008
|
+
response = await this.privatePutGOrdersReplace(this.extend(request, params));
|
|
195771
196009
|
}
|
|
195772
196010
|
else if (market['swap']) {
|
|
195773
|
-
|
|
196011
|
+
response = await this.privatePutOrdersReplace(this.extend(request, params));
|
|
196012
|
+
}
|
|
196013
|
+
else {
|
|
196014
|
+
response = await this.privatePutSpotOrders(this.extend(request, params));
|
|
195774
196015
|
}
|
|
195775
|
-
const response = await this[method](this.extend(request, params));
|
|
195776
196016
|
const data = this.safeValue(response, 'data', {});
|
|
195777
196017
|
return this.parseOrder(data, market);
|
|
195778
196018
|
}
|
|
@@ -195804,18 +196044,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195804
196044
|
else {
|
|
195805
196045
|
request['orderID'] = id;
|
|
195806
196046
|
}
|
|
195807
|
-
let
|
|
196047
|
+
let response = undefined;
|
|
195808
196048
|
if (market['settle'] === 'USDT') {
|
|
195809
|
-
method = 'privateDeleteGOrdersCancel';
|
|
195810
196049
|
const posSide = this.safeString(params, 'posSide');
|
|
195811
196050
|
if (posSide === undefined) {
|
|
195812
196051
|
request['posSide'] = 'Merged';
|
|
195813
196052
|
}
|
|
196053
|
+
response = await this.privateDeleteGOrdersCancel(this.extend(request, params));
|
|
195814
196054
|
}
|
|
195815
196055
|
else if (market['swap']) {
|
|
195816
|
-
|
|
196056
|
+
response = await this.privateDeleteOrdersCancel(this.extend(request, params));
|
|
196057
|
+
}
|
|
196058
|
+
else {
|
|
196059
|
+
response = await this.privateDeleteSpotOrders(this.extend(request, params));
|
|
195817
196060
|
}
|
|
195818
|
-
const response = await this[method](this.extend(request, params));
|
|
195819
196061
|
const data = this.safeValue(response, 'data', {});
|
|
195820
196062
|
return this.parseOrder(data, market);
|
|
195821
196063
|
}
|
|
@@ -195833,21 +196075,23 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195833
196075
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
195834
196076
|
}
|
|
195835
196077
|
await this.loadMarkets();
|
|
196078
|
+
const market = this.market(symbol);
|
|
195836
196079
|
const request = {
|
|
195837
|
-
|
|
195838
|
-
|
|
195839
|
-
|
|
196080
|
+
'symbol': market['id'],
|
|
196081
|
+
// 'untriggerred': false, // false to cancel non-conditional orders, true to cancel conditional orders
|
|
196082
|
+
// 'text': 'up to 40 characters max',
|
|
195840
196083
|
};
|
|
195841
|
-
|
|
195842
|
-
let method = 'privateDeleteSpotOrdersAll';
|
|
196084
|
+
let response = undefined;
|
|
195843
196085
|
if (market['settle'] === 'USDT') {
|
|
195844
|
-
|
|
196086
|
+
response = await this.privateDeleteGOrdersAll(this.extend(request, params));
|
|
195845
196087
|
}
|
|
195846
196088
|
else if (market['swap']) {
|
|
195847
|
-
|
|
196089
|
+
response = await this.privateDeleteOrdersAll(this.extend(request, params));
|
|
195848
196090
|
}
|
|
195849
|
-
|
|
195850
|
-
|
|
196091
|
+
else {
|
|
196092
|
+
response = await this.privateDeleteSpotOrdersAll(this.extend(request, params));
|
|
196093
|
+
}
|
|
196094
|
+
return response;
|
|
195851
196095
|
}
|
|
195852
196096
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
195853
196097
|
/**
|
|
@@ -195866,7 +196110,6 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195866
196110
|
if (market['settle'] === 'USDT') {
|
|
195867
196111
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + 'fetchOrder() is not supported yet for USDT settled swap markets'); // https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-order-by-orderid-or-query-user-order-by-client-order-id
|
|
195868
196112
|
}
|
|
195869
|
-
const method = market['spot'] ? 'privateGetSpotOrdersActive' : 'privateGetExchangeOrder';
|
|
195870
196113
|
const request = {
|
|
195871
196114
|
'symbol': market['id'],
|
|
195872
196115
|
};
|
|
@@ -195878,7 +196121,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195878
196121
|
else {
|
|
195879
196122
|
request['orderID'] = id;
|
|
195880
196123
|
}
|
|
195881
|
-
|
|
196124
|
+
let response = undefined;
|
|
196125
|
+
if (market['spot']) {
|
|
196126
|
+
response = await this.privateGetSpotOrdersActive(this.extend(request, params));
|
|
196127
|
+
}
|
|
196128
|
+
else {
|
|
196129
|
+
response = await this.privateGetExchangeOrder(this.extend(request, params));
|
|
196130
|
+
}
|
|
195882
196131
|
const data = this.safeValue(response, 'data', {});
|
|
195883
196132
|
let order = data;
|
|
195884
196133
|
if (Array.isArray(data)) {
|
|
@@ -195915,21 +196164,23 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195915
196164
|
const request = {
|
|
195916
196165
|
'symbol': market['id'],
|
|
195917
196166
|
};
|
|
195918
|
-
let method = 'privateGetSpotOrders';
|
|
195919
|
-
if (market['settle'] === 'USDT') {
|
|
195920
|
-
request['currency'] = market['settle'];
|
|
195921
|
-
method = 'privateGetExchangeOrderV2OrderList';
|
|
195922
|
-
}
|
|
195923
|
-
else if (market['swap']) {
|
|
195924
|
-
method = 'privateGetExchangeOrderList';
|
|
195925
|
-
}
|
|
195926
196167
|
if (since !== undefined) {
|
|
195927
196168
|
request['start'] = since;
|
|
195928
196169
|
}
|
|
195929
196170
|
if (limit !== undefined) {
|
|
195930
196171
|
request['limit'] = limit;
|
|
195931
196172
|
}
|
|
195932
|
-
|
|
196173
|
+
let response = undefined;
|
|
196174
|
+
if (market['settle'] === 'USDT') {
|
|
196175
|
+
request['currency'] = market['settle'];
|
|
196176
|
+
response = await this.privateGetExchangeOrderV2OrderList(this.extend(request, params));
|
|
196177
|
+
}
|
|
196178
|
+
else if (market['swap']) {
|
|
196179
|
+
response = await this.privateGetExchangeOrderList(this.extend(request, params));
|
|
196180
|
+
}
|
|
196181
|
+
else {
|
|
196182
|
+
response = await this.privateGetSpotOrders(this.extend(request, params));
|
|
196183
|
+
}
|
|
195933
196184
|
const data = this.safeValue(response, 'data', {});
|
|
195934
196185
|
const rows = this.safeValue(data, 'rows', data);
|
|
195935
196186
|
return this.parseOrders(rows, market, since, limit);
|
|
@@ -195952,19 +196203,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
195952
196203
|
}
|
|
195953
196204
|
await this.loadMarkets();
|
|
195954
196205
|
const market = this.market(symbol);
|
|
195955
|
-
let method = 'privateGetSpotOrders';
|
|
195956
|
-
if (market['settle'] === 'USDT') {
|
|
195957
|
-
method = 'privateGetGOrdersActiveList';
|
|
195958
|
-
}
|
|
195959
|
-
else if (market['swap']) {
|
|
195960
|
-
method = 'privateGetOrdersActiveList';
|
|
195961
|
-
}
|
|
195962
196206
|
const request = {
|
|
195963
196207
|
'symbol': market['id'],
|
|
195964
196208
|
};
|
|
195965
196209
|
let response = undefined;
|
|
195966
196210
|
try {
|
|
195967
|
-
|
|
196211
|
+
if (market['settle'] === 'USDT') {
|
|
196212
|
+
response = await this.privateGetGOrdersActiveList(this.extend(request, params));
|
|
196213
|
+
}
|
|
196214
|
+
else if (market['swap']) {
|
|
196215
|
+
response = await this.privateGetOrdersActiveList(this.extend(request, params));
|
|
196216
|
+
}
|
|
196217
|
+
else {
|
|
196218
|
+
response = await this.privateGetSpotOrders(this.extend(request, params));
|
|
196219
|
+
}
|
|
195968
196220
|
}
|
|
195969
196221
|
catch (e) {
|
|
195970
196222
|
if (e instanceof _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound) {
|
|
@@ -196001,21 +196253,23 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196001
196253
|
const request = {
|
|
196002
196254
|
'symbol': market['id'],
|
|
196003
196255
|
};
|
|
196004
|
-
let method = 'privateGetExchangeSpotOrder';
|
|
196005
|
-
if (market['settle'] === 'USDT') {
|
|
196006
|
-
request['currency'] = market['settle'];
|
|
196007
|
-
method = 'privateGetExchangeOrderV2OrderList';
|
|
196008
|
-
}
|
|
196009
|
-
else if (market['swap']) {
|
|
196010
|
-
method = 'privateGetExchangeOrderList';
|
|
196011
|
-
}
|
|
196012
196256
|
if (since !== undefined) {
|
|
196013
196257
|
request['start'] = since;
|
|
196014
196258
|
}
|
|
196015
196259
|
if (limit !== undefined) {
|
|
196016
196260
|
request['limit'] = limit;
|
|
196017
196261
|
}
|
|
196018
|
-
|
|
196262
|
+
let response = undefined;
|
|
196263
|
+
if (market['settle'] === 'USDT') {
|
|
196264
|
+
request['currency'] = market['settle'];
|
|
196265
|
+
response = await this.privateGetExchangeOrderV2OrderList(this.extend(request, params));
|
|
196266
|
+
}
|
|
196267
|
+
else if (market['swap']) {
|
|
196268
|
+
response = await this.privateGetExchangeOrderList(this.extend(request, params));
|
|
196269
|
+
}
|
|
196270
|
+
else {
|
|
196271
|
+
response = await this.privateGetExchangeSpotOrder(this.extend(request, params));
|
|
196272
|
+
}
|
|
196019
196273
|
//
|
|
196020
196274
|
// spot
|
|
196021
196275
|
//
|
|
@@ -196079,13 +196333,6 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196079
196333
|
}
|
|
196080
196334
|
await this.loadMarkets();
|
|
196081
196335
|
const market = this.market(symbol);
|
|
196082
|
-
let method = 'privateGetExchangeSpotOrderTrades';
|
|
196083
|
-
if (market['swap']) {
|
|
196084
|
-
method = 'privateGetExchangeOrderTrade';
|
|
196085
|
-
if (market['settle'] === 'USDT') {
|
|
196086
|
-
method = 'privateGetExchangeOrderV2TradingList';
|
|
196087
|
-
}
|
|
196088
|
-
}
|
|
196089
196336
|
const request = {};
|
|
196090
196337
|
if (limit !== undefined) {
|
|
196091
196338
|
limit = Math.min(200, limit);
|
|
@@ -196107,7 +196354,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196107
196354
|
if (market['swap'] && (limit !== undefined)) {
|
|
196108
196355
|
request['limit'] = limit;
|
|
196109
196356
|
}
|
|
196110
|
-
const
|
|
196357
|
+
const isUSDTSettled = market['settle'] === 'USDT';
|
|
196358
|
+
let response = undefined;
|
|
196359
|
+
if (market['swap']) {
|
|
196360
|
+
if (isUSDTSettled) {
|
|
196361
|
+
response = await this.privateGetExchangeOrderV2TradingList(this.extend(request, params));
|
|
196362
|
+
}
|
|
196363
|
+
else {
|
|
196364
|
+
response = await this.privateGetExchangeOrderTrade(this.extend(request, params));
|
|
196365
|
+
}
|
|
196366
|
+
}
|
|
196367
|
+
else {
|
|
196368
|
+
response = await this.privateGetExchangeSpotOrderTrades(this.extend(request, params));
|
|
196369
|
+
}
|
|
196111
196370
|
//
|
|
196112
196371
|
// spot
|
|
196113
196372
|
//
|
|
@@ -196212,10 +196471,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196212
196471
|
// }
|
|
196213
196472
|
// }
|
|
196214
196473
|
//
|
|
196215
|
-
|
|
196216
|
-
if (
|
|
196217
|
-
|
|
196218
|
-
|
|
196474
|
+
let data = undefined;
|
|
196475
|
+
if (isUSDTSettled) {
|
|
196476
|
+
data = this.safeValue(response, 'data', []);
|
|
196477
|
+
}
|
|
196478
|
+
else {
|
|
196479
|
+
data = this.safeValue(response, 'data', {});
|
|
196480
|
+
data = this.safeValue(data, 'rows', []);
|
|
196219
196481
|
}
|
|
196220
196482
|
return this.parseTrades(data, market, since, limit);
|
|
196221
196483
|
}
|
|
@@ -196447,7 +196709,6 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196447
196709
|
await this.loadMarkets();
|
|
196448
196710
|
symbols = this.marketSymbols(symbols);
|
|
196449
196711
|
let subType = undefined;
|
|
196450
|
-
let method = 'privateGetAccountsAccountPositions';
|
|
196451
196712
|
let code = this.safeString(params, 'currency');
|
|
196452
196713
|
let settle = undefined;
|
|
196453
196714
|
let market = undefined;
|
|
@@ -196461,9 +196722,9 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196461
196722
|
[settle, params] = this.handleOptionAndParams(params, 'fetchPositions', 'settle', 'USD');
|
|
196462
196723
|
}
|
|
196463
196724
|
[subType, params] = this.handleSubTypeAndParams('fetchPositions', market, params);
|
|
196464
|
-
|
|
196725
|
+
const isUSDTSettled = settle === 'USDT';
|
|
196726
|
+
if (isUSDTSettled) {
|
|
196465
196727
|
code = 'USDT';
|
|
196466
|
-
method = 'privateGetGAccountsAccountPositions';
|
|
196467
196728
|
}
|
|
196468
196729
|
else if (code === undefined) {
|
|
196469
196730
|
code = (subType === 'linear') ? 'USD' : 'BTC';
|
|
@@ -196475,7 +196736,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
196475
196736
|
const request = {
|
|
196476
196737
|
'currency': currency['id'],
|
|
196477
196738
|
};
|
|
196478
|
-
|
|
196739
|
+
let response = undefined;
|
|
196740
|
+
if (isUSDTSettled) {
|
|
196741
|
+
response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
|
|
196742
|
+
}
|
|
196743
|
+
else {
|
|
196744
|
+
response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
|
|
196745
|
+
}
|
|
196479
196746
|
//
|
|
196480
196747
|
// {
|
|
196481
196748
|
// "code":0,"msg":"",
|
|
@@ -236781,7 +237048,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
236781
237048
|
* @param {int} [limit] not used by krakenfutures watchBalance
|
|
236782
237049
|
* @param {object} [params] extra parameters specific to the krakenfutures api endpoint
|
|
236783
237050
|
* @param {string} [params.account] can be either 'futures' or 'flex_futures'
|
|
236784
|
-
* @returns {object
|
|
237051
|
+
* @returns {object} a object of wallet types each with a balance structure {@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
236785
237052
|
*/
|
|
236786
237053
|
await this.loadMarkets();
|
|
236787
237054
|
const name = 'balances';
|
|
@@ -237646,6 +237913,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
237646
237913
|
holdingResult[code] = newAccount;
|
|
237647
237914
|
}
|
|
237648
237915
|
this.balance['cash'] = holdingResult;
|
|
237916
|
+
this.balance['cash'] = this.safeBalance(this.balance['cash']);
|
|
237649
237917
|
client.resolve(holdingResult, messageHash);
|
|
237650
237918
|
}
|
|
237651
237919
|
if (futures !== undefined) {
|
|
@@ -237669,6 +237937,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
237669
237937
|
futuresResult[symbol][code] = newAccount;
|
|
237670
237938
|
}
|
|
237671
237939
|
this.balance['margin'] = futuresResult;
|
|
237940
|
+
this.balance['margin'] = this.safeBalance(this.balance['margin']);
|
|
237672
237941
|
client.resolve(this.balance['margin'], messageHash + 'futures');
|
|
237673
237942
|
}
|
|
237674
237943
|
if (flexFutures !== undefined) {
|
|
@@ -237690,6 +237959,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
237690
237959
|
flexFuturesResult[code] = newAccount;
|
|
237691
237960
|
}
|
|
237692
237961
|
this.balance['flex'] = flexFuturesResult;
|
|
237962
|
+
this.balance['flex'] = this.safeBalance(this.balance['flex']);
|
|
237693
237963
|
client.resolve(this.balance['flex'], messageHash + 'flex_futures');
|
|
237694
237964
|
}
|
|
237695
237965
|
client.resolve(this.balance, messageHash);
|
|
@@ -245842,8 +246112,8 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
245842
246112
|
/* harmony export */ });
|
|
245843
246113
|
/* harmony import */ var _poloniex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8891);
|
|
245844
246114
|
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
|
|
245845
|
-
/* harmony import */ var
|
|
245846
|
-
/* harmony import */ var
|
|
246115
|
+
/* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3020);
|
|
246116
|
+
/* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2194);
|
|
245847
246117
|
/* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1372);
|
|
245848
246118
|
// ---------------------------------------------------------------------------
|
|
245849
246119
|
|
|
@@ -245866,6 +246136,15 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
245866
246136
|
'watchStatus': false,
|
|
245867
246137
|
'watchOrders': true,
|
|
245868
246138
|
'watchMyTrades': true,
|
|
246139
|
+
'createOrderWs': true,
|
|
246140
|
+
'editOrderWs': false,
|
|
246141
|
+
'fetchOpenOrdersWs': false,
|
|
246142
|
+
'fetchOrderWs': false,
|
|
246143
|
+
'cancelOrderWs': true,
|
|
246144
|
+
'cancelOrdersWs': true,
|
|
246145
|
+
'cancelAllOrdersWs': true,
|
|
246146
|
+
'fetchTradesWs': false,
|
|
246147
|
+
'fetchBalanceWs': false,
|
|
245869
246148
|
},
|
|
245870
246149
|
'urls': {
|
|
245871
246150
|
'api': {
|
|
@@ -245876,6 +246155,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
245876
246155
|
},
|
|
245877
246156
|
},
|
|
245878
246157
|
'options': {
|
|
246158
|
+
'createMarketBuyOrderRequiresPrice': true,
|
|
245879
246159
|
'tradesLimit': 1000,
|
|
245880
246160
|
'ordersLimit': 1000,
|
|
245881
246161
|
'OHLCVLimit': 1000,
|
|
@@ -245995,6 +246275,164 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
245995
246275
|
const request = this.extend(subscribe, params);
|
|
245996
246276
|
return await this.watch(url, messageHash, request, messageHash);
|
|
245997
246277
|
}
|
|
246278
|
+
async tradeRequest(name, params = {}) {
|
|
246279
|
+
/**
|
|
246280
|
+
* @ignore
|
|
246281
|
+
* @method
|
|
246282
|
+
* @description Connects to a websocket channel
|
|
246283
|
+
* @param {string} name name of the channel
|
|
246284
|
+
* @param {string[]|undefined} symbols CCXT market symbols
|
|
246285
|
+
* @param {object} [params] extra parameters specific to the poloniex api
|
|
246286
|
+
* @returns {object} data from the websocket stream
|
|
246287
|
+
*/
|
|
246288
|
+
const url = this.urls['api']['ws']['private'];
|
|
246289
|
+
const messageHash = this.nonce();
|
|
246290
|
+
const subscribe = {
|
|
246291
|
+
'id': messageHash,
|
|
246292
|
+
'event': name,
|
|
246293
|
+
'params': params,
|
|
246294
|
+
};
|
|
246295
|
+
return await this.watch(url, messageHash, subscribe, messageHash);
|
|
246296
|
+
}
|
|
246297
|
+
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
246298
|
+
/**
|
|
246299
|
+
* @method
|
|
246300
|
+
* @name poloniex#createOrderWs
|
|
246301
|
+
* @see https://docs.poloniex.com/#authenticated-channels-trade-requests-create-order
|
|
246302
|
+
* @description create a trade order
|
|
246303
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
246304
|
+
* @param {string} type 'market' or 'limit'
|
|
246305
|
+
* @param {string} side 'buy' or 'sell'
|
|
246306
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
246307
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
246308
|
+
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
246309
|
+
* @param {string} [params.timeInForce] GTC (default), IOC, FOK
|
|
246310
|
+
* @param {string} [params.clientOrderId] Maximum 64-character length.*
|
|
246311
|
+
*
|
|
246312
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
246313
|
+
* @param {string} [params.amount] quote units for the order
|
|
246314
|
+
* @param {boolean} [params.allowBorrow] allow order to be placed by borrowing funds (Default: false)
|
|
246315
|
+
* @param {string} [params.stpMode] self-trade prevention, defaults to expire_taker, none: enable self-trade; expire_taker: taker order will be canceled when self-trade happens
|
|
246316
|
+
* @param {string} [params.slippageTolerance] used to control the maximum slippage ratio, the value range is greater than 0 and less than 1
|
|
246317
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
246318
|
+
*/
|
|
246319
|
+
await this.loadMarkets();
|
|
246320
|
+
await this.authenticate();
|
|
246321
|
+
const market = this.market(symbol);
|
|
246322
|
+
let uppercaseType = type.toUpperCase();
|
|
246323
|
+
const uppercaseSide = side.toUpperCase();
|
|
246324
|
+
const isPostOnly = this.isPostOnly(uppercaseType === 'MARKET', uppercaseType === 'LIMIT_MAKER', params);
|
|
246325
|
+
if (isPostOnly) {
|
|
246326
|
+
uppercaseType = 'LIMIT_MAKER';
|
|
246327
|
+
}
|
|
246328
|
+
const request = {
|
|
246329
|
+
'symbol': market['id'],
|
|
246330
|
+
'side': side.toUpperCase(),
|
|
246331
|
+
'type': type.toUpperCase(),
|
|
246332
|
+
};
|
|
246333
|
+
if ((uppercaseType === 'MARKET') && (uppercaseSide === 'BUY')) {
|
|
246334
|
+
let quoteAmount = this.safeString(params, 'amount');
|
|
246335
|
+
if ((quoteAmount === undefined) && (this.options['createMarketBuyOrderRequiresPrice'])) {
|
|
246336
|
+
const cost = this.safeNumber(params, 'cost');
|
|
246337
|
+
params = this.omit(params, 'cost');
|
|
246338
|
+
if (price === undefined && cost === undefined) {
|
|
246339
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
|
|
246340
|
+
}
|
|
246341
|
+
else {
|
|
246342
|
+
const amountString = this.numberToString(amount);
|
|
246343
|
+
const priceString = this.numberToString(price);
|
|
246344
|
+
const quote = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
246345
|
+
amount = (cost !== undefined) ? cost : this.parseNumber(quote);
|
|
246346
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
246347
|
+
}
|
|
246348
|
+
}
|
|
246349
|
+
else {
|
|
246350
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
246351
|
+
}
|
|
246352
|
+
request['amount'] = this.amountToPrecision(market['symbol'], quoteAmount);
|
|
246353
|
+
}
|
|
246354
|
+
else {
|
|
246355
|
+
request['quantity'] = this.amountToPrecision(market['symbol'], amount);
|
|
246356
|
+
if (price !== undefined) {
|
|
246357
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
246358
|
+
}
|
|
246359
|
+
}
|
|
246360
|
+
return await this.tradeRequest('createOrder', this.extend(request, params));
|
|
246361
|
+
}
|
|
246362
|
+
async cancelOrderWs(id, symbol = undefined, params = {}) {
|
|
246363
|
+
/**
|
|
246364
|
+
* @method
|
|
246365
|
+
* @name poloniex#cancelOrderWs
|
|
246366
|
+
* @see https://docs.poloniex.com/#authenticated-channels-trade-requests-cancel-multiple-orders
|
|
246367
|
+
* @description cancel multiple orders
|
|
246368
|
+
* @param {string} id order id
|
|
246369
|
+
* @param {string} [symbol] unified market symbol
|
|
246370
|
+
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
246371
|
+
* @param {string} [params.clientOrderId] client order id
|
|
246372
|
+
* @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
246373
|
+
*/
|
|
246374
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
246375
|
+
if (clientOrderId !== undefined) {
|
|
246376
|
+
const clientOrderIds = this.safeValue(params, 'clientOrderId', []);
|
|
246377
|
+
params['clientOrderIds'] = this.arrayConcat(clientOrderIds, [clientOrderId]);
|
|
246378
|
+
}
|
|
246379
|
+
return await this.cancelOrdersWs([id], symbol, params);
|
|
246380
|
+
}
|
|
246381
|
+
async cancelOrdersWs(ids, symbol = undefined, params = {}) {
|
|
246382
|
+
/**
|
|
246383
|
+
* @method
|
|
246384
|
+
* @name poloniex#cancelOrdersWs
|
|
246385
|
+
* @see https://docs.poloniex.com/#authenticated-channels-trade-requests-cancel-multiple-orders
|
|
246386
|
+
* @description cancel multiple orders
|
|
246387
|
+
* @param {string[]} ids order ids
|
|
246388
|
+
* @param {string} symbol unified market symbol, default is undefined
|
|
246389
|
+
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
246390
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
246391
|
+
* @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
246392
|
+
*/
|
|
246393
|
+
await this.loadMarkets();
|
|
246394
|
+
await this.authenticate();
|
|
246395
|
+
const request = {
|
|
246396
|
+
'orderIds': ids,
|
|
246397
|
+
};
|
|
246398
|
+
return await this.tradeRequest('cancelOrders', this.extend(request, params));
|
|
246399
|
+
}
|
|
246400
|
+
async cancelAllOrdersWs(symbol = undefined, params = {}) {
|
|
246401
|
+
/**
|
|
246402
|
+
* @method
|
|
246403
|
+
* @name poloniex#cancelAllOrdersWs
|
|
246404
|
+
* @see https://docs.poloniex.com/#authenticated-channels-trade-requests-cancel-all-orders
|
|
246405
|
+
* @description cancel all open orders of a type. Only applicable to Option in Portfolio Margin mode, and MMP privilege is required.
|
|
246406
|
+
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
246407
|
+
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
246408
|
+
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
246409
|
+
*/
|
|
246410
|
+
await this.loadMarkets();
|
|
246411
|
+
await this.authenticate();
|
|
246412
|
+
return await this.tradeRequest('cancelAllOrders', params);
|
|
246413
|
+
}
|
|
246414
|
+
handleOrderRequest(client, message) {
|
|
246415
|
+
//
|
|
246416
|
+
// {
|
|
246417
|
+
// "id": "1234567",
|
|
246418
|
+
// "data": [{
|
|
246419
|
+
// "orderId": 205343650954092544,
|
|
246420
|
+
// "clientOrderId": "",
|
|
246421
|
+
// "message": "",
|
|
246422
|
+
// "code": 200
|
|
246423
|
+
// }]
|
|
246424
|
+
// }
|
|
246425
|
+
//
|
|
246426
|
+
const messageHash = this.safeInteger(message, 'id');
|
|
246427
|
+
const data = this.safeValue(message, 'data', []);
|
|
246428
|
+
const orders = [];
|
|
246429
|
+
for (let i = 0; i < data.length; i++) {
|
|
246430
|
+
const order = data[i];
|
|
246431
|
+
const parsedOrder = this.parseWsOrder(order);
|
|
246432
|
+
orders.push(parsedOrder);
|
|
246433
|
+
}
|
|
246434
|
+
client.resolve(orders, messageHash);
|
|
246435
|
+
}
|
|
245998
246436
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
245999
246437
|
/**
|
|
246000
246438
|
* @method
|
|
@@ -246218,7 +246656,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246218
246656
|
if (symbol !== undefined) {
|
|
246219
246657
|
if (stored === undefined) {
|
|
246220
246658
|
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
246221
|
-
stored = new
|
|
246659
|
+
stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCacheByTimestamp */ .Py(limit);
|
|
246222
246660
|
this.ohlcvs[symbol][timeframe] = stored;
|
|
246223
246661
|
}
|
|
246224
246662
|
stored.append(parsed);
|
|
@@ -246256,7 +246694,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246256
246694
|
let tradesArray = this.safeValue(this.trades, symbol);
|
|
246257
246695
|
if (tradesArray === undefined) {
|
|
246258
246696
|
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
246259
|
-
tradesArray = new
|
|
246697
|
+
tradesArray = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCache */ .ZL(tradesLimit);
|
|
246260
246698
|
this.trades[symbol] = tradesArray;
|
|
246261
246699
|
}
|
|
246262
246700
|
tradesArray.append(trade);
|
|
@@ -246435,7 +246873,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246435
246873
|
let orders = this.orders;
|
|
246436
246874
|
if (orders === undefined) {
|
|
246437
246875
|
const limit = this.safeInteger(this.options, 'ordersLimit');
|
|
246438
|
-
orders = new
|
|
246876
|
+
orders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
246439
246877
|
this.orders = orders;
|
|
246440
246878
|
}
|
|
246441
246879
|
const marketIds = [];
|
|
@@ -246468,21 +246906,21 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246468
246906
|
const previousOrderTrade = previousOrderTrades[j];
|
|
246469
246907
|
const cost = this.numberToString(previousOrderTrade['cost']);
|
|
246470
246908
|
const amount = this.numberToString(previousOrderTrade['amount']);
|
|
246471
|
-
totalCost =
|
|
246472
|
-
totalAmount =
|
|
246909
|
+
totalCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(totalCost, cost);
|
|
246910
|
+
totalAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(totalAmount, amount);
|
|
246473
246911
|
}
|
|
246474
|
-
if (
|
|
246475
|
-
previousOrder['average'] = this.parseNumber(
|
|
246912
|
+
if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringGt(totalAmount, '0')) {
|
|
246913
|
+
previousOrder['average'] = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(totalCost, totalAmount));
|
|
246476
246914
|
}
|
|
246477
246915
|
previousOrder['cost'] = this.parseNumber(totalCost);
|
|
246478
246916
|
if (previousOrder['filled'] !== undefined) {
|
|
246479
246917
|
const tradeAmount = this.numberToString(trade['amount']);
|
|
246480
246918
|
let previousOrderFilled = this.numberToString(previousOrder['filled']);
|
|
246481
|
-
previousOrderFilled =
|
|
246919
|
+
previousOrderFilled = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(previousOrderFilled, tradeAmount);
|
|
246482
246920
|
previousOrder['filled'] = previousOrderFilled;
|
|
246483
246921
|
if (previousOrder['amount'] !== undefined) {
|
|
246484
246922
|
const previousOrderAmount = this.numberToString(previousOrder['amount']);
|
|
246485
|
-
previousOrder['remaining'] = this.parseNumber(
|
|
246923
|
+
previousOrder['remaining'] = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringSub(previousOrderAmount, previousOrderFilled));
|
|
246486
246924
|
}
|
|
246487
246925
|
}
|
|
246488
246926
|
if (previousOrder['fee'] === undefined) {
|
|
@@ -246495,7 +246933,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246495
246933
|
if ((previousOrder['fee']['cost'] !== undefined) && (trade['fee']['cost'] !== undefined)) {
|
|
246496
246934
|
const stringOrderCost = this.numberToString(previousOrder['fee']['cost']);
|
|
246497
246935
|
const stringTradeCost = this.numberToString(trade['fee']['cost']);
|
|
246498
|
-
previousOrder['fee']['cost'] =
|
|
246936
|
+
previousOrder['fee']['cost'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(stringOrderCost, stringTradeCost);
|
|
246499
246937
|
}
|
|
246500
246938
|
const rawState = this.safeString(order, 'state');
|
|
246501
246939
|
const state = this.parseStatus(rawState);
|
|
@@ -246552,7 +246990,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246552
246990
|
const filledAmount = this.safeString(order, 'filledAmount');
|
|
246553
246991
|
const status = this.safeString(order, 'state');
|
|
246554
246992
|
let trades = undefined;
|
|
246555
|
-
if (!
|
|
246993
|
+
if (!_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringEq(filledAmount, '0')) {
|
|
246556
246994
|
trades = [];
|
|
246557
246995
|
const trade = this.parseWsOrderTrade(order);
|
|
246558
246996
|
trades.push(trade);
|
|
@@ -246793,7 +247231,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246793
247231
|
const symbol = parsedTrade['symbol'];
|
|
246794
247232
|
if (this.myTrades === undefined) {
|
|
246795
247233
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
246796
|
-
this.myTrades = new
|
|
247234
|
+
this.myTrades = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
246797
247235
|
}
|
|
246798
247236
|
const trades = this.myTrades;
|
|
246799
247237
|
trades.append(parsedTrade);
|
|
@@ -246801,6 +247239,9 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246801
247239
|
const symbolMessageHash = messageHash + ':' + symbol;
|
|
246802
247240
|
client.resolve(trades, symbolMessageHash);
|
|
246803
247241
|
}
|
|
247242
|
+
handlePong(client) {
|
|
247243
|
+
client.lastPong = this.milliseconds();
|
|
247244
|
+
}
|
|
246804
247245
|
handleMessage(client, message) {
|
|
246805
247246
|
if (this.handleErrorMessage(client, message)) {
|
|
246806
247247
|
return;
|
|
@@ -246831,11 +247272,26 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246831
247272
|
'trades': this.handleTrade,
|
|
246832
247273
|
'orders': this.handleOrder,
|
|
246833
247274
|
'balances': this.handleBalance,
|
|
247275
|
+
'createOrder': this.handleOrderRequest,
|
|
247276
|
+
'cancelOrder': this.handleOrderRequest,
|
|
247277
|
+
'cancelAllOrders': this.handleOrderRequest,
|
|
247278
|
+
'auth': this.handleAuthenticate,
|
|
246834
247279
|
};
|
|
246835
247280
|
const method = this.safeValue(methods, type);
|
|
246836
247281
|
if (type === 'auth') {
|
|
246837
247282
|
this.handleAuthenticate(client, message);
|
|
246838
247283
|
}
|
|
247284
|
+
else if (type === undefined) {
|
|
247285
|
+
const data = this.safeValue(message, 'data');
|
|
247286
|
+
const item = this.safeValue(data, 0);
|
|
247287
|
+
const orderId = this.safeString(item, 'orderId');
|
|
247288
|
+
if (orderId === '0') {
|
|
247289
|
+
this.handleErrorMessage(client, item);
|
|
247290
|
+
}
|
|
247291
|
+
else {
|
|
247292
|
+
return this.handleOrderRequest(client, message);
|
|
247293
|
+
}
|
|
247294
|
+
}
|
|
246839
247295
|
else {
|
|
246840
247296
|
const data = this.safeValue(message, 'data', []);
|
|
246841
247297
|
const dataLength = data.length;
|
|
@@ -246846,9 +247302,26 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
246846
247302
|
}
|
|
246847
247303
|
handleErrorMessage(client, message) {
|
|
246848
247304
|
//
|
|
246849
|
-
//
|
|
247305
|
+
// {
|
|
247306
|
+
// message: 'Invalid channel value ["ordersss"]',
|
|
247307
|
+
// event: 'error'
|
|
247308
|
+
// }
|
|
247309
|
+
//
|
|
247310
|
+
// {
|
|
247311
|
+
// "orderId": 0,
|
|
247312
|
+
// "clientOrderId": null,
|
|
247313
|
+
// "message": "Currency trade disabled",
|
|
247314
|
+
// "code": 21352
|
|
247315
|
+
// }
|
|
247316
|
+
//
|
|
247317
|
+
// {
|
|
247318
|
+
// "event": "error",
|
|
247319
|
+
// "message": "Platform in maintenance mode"
|
|
247320
|
+
// }
|
|
247321
|
+
//
|
|
246850
247322
|
const event = this.safeString(message, 'event');
|
|
246851
|
-
|
|
247323
|
+
const orderId = this.safeString(message, 'orderId');
|
|
247324
|
+
if ((event === 'error') || (orderId === '0')) {
|
|
246852
247325
|
const error = this.safeString(message, 'message');
|
|
246853
247326
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' error: ' + this.json(error));
|
|
246854
247327
|
}
|
|
@@ -265859,9 +266332,7 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
265859
266332
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
265860
266333
|
*/
|
|
265861
266334
|
await this.loadMarkets();
|
|
265862
|
-
const
|
|
265863
|
-
const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
|
|
265864
|
-
const response = await this[method](params);
|
|
266335
|
+
const response = await this.binanceGetTicker24hr(params);
|
|
265865
266336
|
return this.parseTickers(response, symbols);
|
|
265866
266337
|
}
|
|
265867
266338
|
getMarketIdByType(market) {
|
|
@@ -272161,7 +272632,13 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
272161
272632
|
request['limit'] = Math.min(limit, 1000); // Default 500; max 1000.
|
|
272162
272633
|
}
|
|
272163
272634
|
const method = this.safeString(this.options, 'fetchTradesMethod', 'publicGetTrades');
|
|
272164
|
-
|
|
272635
|
+
let response = undefined;
|
|
272636
|
+
if (method === 'privateGetHistoricalTrades') {
|
|
272637
|
+
response = await this.privateGetHistoricalTrades(this.extend(request, params));
|
|
272638
|
+
}
|
|
272639
|
+
else {
|
|
272640
|
+
response = await this.publicGetTrades(this.extend(request, params));
|
|
272641
|
+
}
|
|
272165
272642
|
// [
|
|
272166
272643
|
// {
|
|
272167
272644
|
// "id":322307791,
|
|
@@ -287082,7 +287559,7 @@ SOFTWARE.
|
|
|
287082
287559
|
|
|
287083
287560
|
//-----------------------------------------------------------------------------
|
|
287084
287561
|
// this is updated by vss.js when building
|
|
287085
|
-
const version = '4.1.
|
|
287562
|
+
const version = '4.1.64';
|
|
287086
287563
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
287087
287564
|
//-----------------------------------------------------------------------------
|
|
287088
287565
|
|