ccxt 4.1.4 → 4.1.6
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 +1231 -81
- package/dist/ccxt.browser.min.js +12 -12
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +216 -0
- package/dist/cjs/src/binance.js +96 -1
- package/dist/cjs/src/bingx.js +24 -0
- package/dist/cjs/src/bitfinex2.js +55 -11
- package/dist/cjs/src/bitget.js +132 -12
- package/dist/cjs/src/bitmex.js +49 -0
- package/dist/cjs/src/bybit.js +56 -3
- package/dist/cjs/src/coinbase.js +85 -6
- package/dist/cjs/src/coinbasepro.js +18 -0
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/coinsph.js +1 -2
- package/dist/cjs/src/cryptocom.js +30 -0
- package/dist/cjs/src/gate.js +56 -3
- package/dist/cjs/src/huobi.js +69 -4
- package/dist/cjs/src/kraken.js +18 -8
- package/dist/cjs/src/krakenfutures.js +24 -0
- package/dist/cjs/src/kucoin.js +59 -4
- package/dist/cjs/src/kucoinfutures.js +35 -1
- package/dist/cjs/src/kuna.js +97 -10
- package/dist/cjs/src/okx.js +66 -4
- package/dist/cjs/src/poloniex.js +18 -2
- package/dist/cjs/src/pro/bitget.js +22 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kuna.d.ts +34 -0
- package/js/src/base/Exchange.d.ts +7 -0
- package/js/src/base/Exchange.js +216 -0
- package/js/src/binance.d.ts +5 -5
- package/js/src/binance.js +96 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +24 -0
- package/js/src/bitfinex2.d.ts +3 -3
- package/js/src/bitfinex2.js +56 -12
- package/js/src/bitget.d.ts +7 -6
- package/js/src/bitget.js +132 -12
- package/js/src/bitmex.d.ts +6 -6
- package/js/src/bitmex.js +49 -0
- package/js/src/bybit.d.ts +6 -6
- package/js/src/bybit.js +56 -3
- package/js/src/coinbase.d.ts +5 -5
- package/js/src/coinbase.js +86 -7
- package/js/src/coinbasepro.d.ts +5 -5
- package/js/src/coinbasepro.js +18 -0
- package/js/src/coinex.js +1 -1
- package/js/src/coinsph.js +1 -2
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/cryptocom.js +30 -0
- package/js/src/gate.d.ts +4 -4
- package/js/src/gate.js +56 -3
- package/js/src/huobi.d.ts +2 -2
- package/js/src/huobi.js +69 -4
- package/js/src/kraken.d.ts +2 -2
- package/js/src/kraken.js +18 -8
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/krakenfutures.js +24 -0
- package/js/src/kucoin.d.ts +5 -5
- package/js/src/kucoin.js +59 -4
- package/js/src/kucoinfutures.d.ts +4 -4
- package/js/src/kucoinfutures.js +35 -1
- package/js/src/kuna.d.ts +1 -0
- package/js/src/kuna.js +97 -10
- package/js/src/okx.d.ts +6 -6
- package/js/src/okx.js +66 -4
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/poloniex.js +18 -2
- package/js/src/pro/bitget.d.ts +5 -0
- package/js/src/pro/bitget.js +22 -6
- package/package.json +1 -1
package/dist/cjs/src/gate.js
CHANGED
|
@@ -2824,10 +2824,16 @@ class gate extends gate$1 {
|
|
|
2824
2824
|
* @param {object} [params] extra parameters specific to the gateio api endpoint
|
|
2825
2825
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
2826
2826
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
2827
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2827
2828
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume (units in quote currency)
|
|
2828
2829
|
*/
|
|
2829
2830
|
await this.loadMarkets();
|
|
2830
2831
|
const market = this.market(symbol);
|
|
2832
|
+
let paginate = false;
|
|
2833
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
2834
|
+
if (paginate) {
|
|
2835
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
2836
|
+
}
|
|
2831
2837
|
if (market['option']) {
|
|
2832
2838
|
return await this.fetchOptionOHLCV(symbol, timeframe, since, limit, params);
|
|
2833
2839
|
}
|
|
@@ -2993,9 +2999,16 @@ class gate extends gate$1 {
|
|
|
2993
2999
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2994
3000
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2995
3001
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
3002
|
+
* @param {int} [params.until] timestamp in ms of the latest trade to fetch
|
|
3003
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2996
3004
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
2997
3005
|
*/
|
|
2998
3006
|
await this.loadMarkets();
|
|
3007
|
+
let paginate = false;
|
|
3008
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
3009
|
+
if (paginate) {
|
|
3010
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
3011
|
+
}
|
|
2999
3012
|
const market = this.market(symbol);
|
|
3000
3013
|
//
|
|
3001
3014
|
// spot
|
|
@@ -3026,6 +3039,11 @@ class gate extends gate$1 {
|
|
|
3026
3039
|
'future': 'publicDeliveryGetSettleTrades',
|
|
3027
3040
|
'option': 'publicOptionsGetTrades',
|
|
3028
3041
|
});
|
|
3042
|
+
const until = this.safeInteger2(params, 'to', 'until');
|
|
3043
|
+
if (until !== undefined) {
|
|
3044
|
+
params = this.omit(params, ['until']);
|
|
3045
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
3046
|
+
}
|
|
3029
3047
|
if (limit !== undefined) {
|
|
3030
3048
|
request['limit'] = limit; // default 100, max 1000
|
|
3031
3049
|
}
|
|
@@ -3133,9 +3151,15 @@ class gate extends gate$1 {
|
|
|
3133
3151
|
* @param {int} [params.offset] *contract only* list offset, starting from 0
|
|
3134
3152
|
* @param {string} [params.last_id] *contract only* specify list staring point using the id of last record in previous list-query results
|
|
3135
3153
|
* @param {int} [params.count_total] *contract only* whether to return total number matched, default to 0(no return)
|
|
3154
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3136
3155
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
3137
3156
|
*/
|
|
3138
3157
|
await this.loadMarkets();
|
|
3158
|
+
let paginate = false;
|
|
3159
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
3160
|
+
if (paginate) {
|
|
3161
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
3162
|
+
}
|
|
3139
3163
|
let type = undefined;
|
|
3140
3164
|
let marginMode = undefined;
|
|
3141
3165
|
let request = {};
|
|
@@ -3394,11 +3418,18 @@ class gate extends gate$1 {
|
|
|
3394
3418
|
* @param {string} code unified currency code
|
|
3395
3419
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
3396
3420
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
3421
|
+
* @param {int} [params.until] end time in ms
|
|
3397
3422
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
3423
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3398
3424
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
3399
3425
|
*/
|
|
3400
3426
|
await this.loadMarkets();
|
|
3401
|
-
|
|
3427
|
+
let paginate = false;
|
|
3428
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
3429
|
+
if (paginate) {
|
|
3430
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
3431
|
+
}
|
|
3432
|
+
let request = {};
|
|
3402
3433
|
let currency = undefined;
|
|
3403
3434
|
if (code !== undefined) {
|
|
3404
3435
|
currency = this.currency(code);
|
|
@@ -3412,6 +3443,7 @@ class gate extends gate$1 {
|
|
|
3412
3443
|
request['from'] = start;
|
|
3413
3444
|
request['to'] = this.sum(start, 30 * 24 * 60 * 60);
|
|
3414
3445
|
}
|
|
3446
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
3415
3447
|
const response = await this.privateWalletGetDeposits(this.extend(request, params));
|
|
3416
3448
|
return this.parseTransactions(response, currency);
|
|
3417
3449
|
}
|
|
@@ -3424,10 +3456,17 @@ class gate extends gate$1 {
|
|
|
3424
3456
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
3425
3457
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
3426
3458
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
3459
|
+
* @param {int} [params.until] end time in ms
|
|
3460
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3427
3461
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
3428
3462
|
*/
|
|
3429
3463
|
await this.loadMarkets();
|
|
3430
|
-
|
|
3464
|
+
let paginate = false;
|
|
3465
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
3466
|
+
if (paginate) {
|
|
3467
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
3468
|
+
}
|
|
3469
|
+
let request = {};
|
|
3431
3470
|
let currency = undefined;
|
|
3432
3471
|
if (code !== undefined) {
|
|
3433
3472
|
currency = this.currency(code);
|
|
@@ -3441,6 +3480,7 @@ class gate extends gate$1 {
|
|
|
3441
3480
|
request['from'] = start;
|
|
3442
3481
|
request['to'] = this.sum(start, 30 * 24 * 60 * 60);
|
|
3443
3482
|
}
|
|
3483
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
3444
3484
|
const response = await this.privateWalletGetWithdrawals(this.extend(request, params));
|
|
3445
3485
|
return this.parseTransactions(response, currency);
|
|
3446
3486
|
}
|
|
@@ -5729,6 +5769,11 @@ class gate extends gate$1 {
|
|
|
5729
5769
|
* @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
|
|
5730
5770
|
*/
|
|
5731
5771
|
await this.loadMarkets();
|
|
5772
|
+
let paginate = false;
|
|
5773
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate', false);
|
|
5774
|
+
if (paginate) {
|
|
5775
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 100);
|
|
5776
|
+
}
|
|
5732
5777
|
const market = this.market(symbol);
|
|
5733
5778
|
if (!market['swap']) {
|
|
5734
5779
|
throw new errors.BadRequest(this.id + ' fetchOpenInterest() supports swap markets only');
|
|
@@ -5987,13 +6032,20 @@ class gate extends gate$1 {
|
|
|
5987
6032
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
5988
6033
|
* @param {int} [limit] max number of ledger entries to return
|
|
5989
6034
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
6035
|
+
* @param {int} [params.until] end time in ms
|
|
6036
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5990
6037
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
5991
6038
|
*/
|
|
5992
6039
|
await this.loadMarkets();
|
|
6040
|
+
let paginate = false;
|
|
6041
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
6042
|
+
if (paginate) {
|
|
6043
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
6044
|
+
}
|
|
5993
6045
|
let type = undefined;
|
|
5994
6046
|
let currency = undefined;
|
|
5995
6047
|
let response = undefined;
|
|
5996
|
-
|
|
6048
|
+
let request = {};
|
|
5997
6049
|
[type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
|
|
5998
6050
|
if ((type === 'spot') || (type === 'margin')) {
|
|
5999
6051
|
if (code !== undefined) {
|
|
@@ -6013,6 +6065,7 @@ class gate extends gate$1 {
|
|
|
6013
6065
|
if (limit !== undefined) {
|
|
6014
6066
|
request['limit'] = limit;
|
|
6015
6067
|
}
|
|
6068
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
6016
6069
|
if (type === 'spot') {
|
|
6017
6070
|
response = await this.privateSpotGetAccountBook(this.extend(request, params));
|
|
6018
6071
|
}
|
package/dist/cjs/src/huobi.js
CHANGED
|
@@ -2356,21 +2356,31 @@ class huobi extends huobi$1 {
|
|
|
2356
2356
|
/**
|
|
2357
2357
|
* @method
|
|
2358
2358
|
* @name huobi#fetchMyTrades
|
|
2359
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-match-results-via-multiple-fields-new
|
|
2360
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-match-results-via-multiple-fields-new
|
|
2361
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-match-results
|
|
2359
2362
|
* @description fetch all trades made by the user
|
|
2360
2363
|
* @param {string} symbol unified market symbol
|
|
2361
2364
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2362
2365
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
2363
2366
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2367
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
2368
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2364
2369
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
2365
2370
|
*/
|
|
2366
2371
|
await this.loadMarkets();
|
|
2372
|
+
let paginate = false;
|
|
2373
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
2374
|
+
if (paginate) {
|
|
2375
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
2376
|
+
}
|
|
2367
2377
|
let market = undefined;
|
|
2368
2378
|
if (symbol !== undefined) {
|
|
2369
2379
|
market = this.market(symbol);
|
|
2370
2380
|
}
|
|
2371
2381
|
let marketType = undefined;
|
|
2372
2382
|
[marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
2373
|
-
|
|
2383
|
+
let request = {
|
|
2374
2384
|
// spot -----------------------------------------------------------
|
|
2375
2385
|
// 'symbol': market['id'],
|
|
2376
2386
|
// 'types': 'buy-market,sell-market,buy-limit,sell-limit,buy-ioc,sell-ioc,buy-limit-maker,sell-limit-maker,buy-stop-limit,sell-stop-limit',
|
|
@@ -2402,6 +2412,7 @@ class huobi extends huobi$1 {
|
|
|
2402
2412
|
request['start-time'] = since; // a date within 120 days from today
|
|
2403
2413
|
// request['end-time'] = this.sum (since, 172800000); // 48 hours window
|
|
2404
2414
|
}
|
|
2415
|
+
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
2405
2416
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
2406
2417
|
}
|
|
2407
2418
|
else {
|
|
@@ -2412,6 +2423,7 @@ class huobi extends huobi$1 {
|
|
|
2412
2423
|
request['start_time'] = since; // a date within 120 days from today
|
|
2413
2424
|
// request['end_time'] = this.sum (request['start_time'], 172800000); // 48 hours window
|
|
2414
2425
|
}
|
|
2426
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
2415
2427
|
if (limit !== undefined) {
|
|
2416
2428
|
request['page_size'] = limit; // default 100, max 500
|
|
2417
2429
|
}
|
|
@@ -2516,6 +2528,10 @@ class huobi extends huobi$1 {
|
|
|
2516
2528
|
/**
|
|
2517
2529
|
* @method
|
|
2518
2530
|
* @name huobi#fetchTrades
|
|
2531
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-most-recent-trades
|
|
2532
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#query-a-batch-of-trade-records-of-a-contract
|
|
2533
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-trade-records-of-a-contract
|
|
2534
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-trade-records-of-a-contract
|
|
2519
2535
|
* @description get the list of most recent trades for a particular symbol
|
|
2520
2536
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
2521
2537
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -2626,9 +2642,15 @@ class huobi extends huobi$1 {
|
|
|
2626
2642
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
2627
2643
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
2628
2644
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2645
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2629
2646
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2630
2647
|
*/
|
|
2631
2648
|
await this.loadMarkets();
|
|
2649
|
+
let paginate = false;
|
|
2650
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
2651
|
+
if (paginate) {
|
|
2652
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
2653
|
+
}
|
|
2632
2654
|
const market = this.market(symbol);
|
|
2633
2655
|
const request = {
|
|
2634
2656
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
@@ -3541,7 +3563,7 @@ class huobi extends huobi$1 {
|
|
|
3541
3563
|
}
|
|
3542
3564
|
await this.loadMarkets();
|
|
3543
3565
|
let market = undefined;
|
|
3544
|
-
|
|
3566
|
+
let request = {
|
|
3545
3567
|
// spot_private_get_v1_order_orders GET /v1/order/orders ----------
|
|
3546
3568
|
// 'symbol': market['id'], // required
|
|
3547
3569
|
// 'types': 'buy-market,sell-market,buy-limit,sell-limit,buy-ioc,sell-ioc,buy-stop-limit,sell-stop-limit,buy-limit-fok,sell-limit-fok,buy-stop-limit-fok,sell-stop-limit-fok',
|
|
@@ -3566,6 +3588,7 @@ class huobi extends huobi$1 {
|
|
|
3566
3588
|
request['start-time'] = since; // a window of 48 hours within 180 days
|
|
3567
3589
|
request['end-time'] = this.sum(since, 48 * 60 * 60 * 1000);
|
|
3568
3590
|
}
|
|
3591
|
+
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
3569
3592
|
if (limit !== undefined) {
|
|
3570
3593
|
request['size'] = limit;
|
|
3571
3594
|
}
|
|
@@ -3609,7 +3632,7 @@ class huobi extends huobi$1 {
|
|
|
3609
3632
|
this.checkRequiredSymbol('fetchContractOrders', symbol);
|
|
3610
3633
|
await this.loadMarkets();
|
|
3611
3634
|
const market = this.market(symbol);
|
|
3612
|
-
|
|
3635
|
+
let request = {
|
|
3613
3636
|
// POST /api/v1/contract_hisorders inverse futures ----------------
|
|
3614
3637
|
// 'symbol': market['settleId'], // BTC, ETH, ...
|
|
3615
3638
|
// 'order_type': '1', // 1 limit,3 opponent,4 lightning, 5 trigger order, 6 pst_only, 7 optimal_5, 8 optimal_10, 9 optimal_20, 10 fok, 11 ioc
|
|
@@ -3638,6 +3661,7 @@ class huobi extends huobi$1 {
|
|
|
3638
3661
|
request['contract'] = market['id'];
|
|
3639
3662
|
request['type'] = 1; // 1:All Orders,2:Order in Finished Status
|
|
3640
3663
|
}
|
|
3664
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
3641
3665
|
if (market['linear']) {
|
|
3642
3666
|
let marginMode = undefined;
|
|
3643
3667
|
[marginMode, params] = this.handleMarginModeAndParams('fetchContractOrders', params);
|
|
@@ -3848,6 +3872,12 @@ class huobi extends huobi$1 {
|
|
|
3848
3872
|
/**
|
|
3849
3873
|
* @method
|
|
3850
3874
|
* @name huobi#fetchOrders
|
|
3875
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
|
|
3876
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
|
|
3877
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
|
|
3878
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
|
|
3879
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
|
|
3880
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
|
|
3851
3881
|
* @description fetches information on multiple orders made by the user
|
|
3852
3882
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3853
3883
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -3855,6 +3885,7 @@ class huobi extends huobi$1 {
|
|
|
3855
3885
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3856
3886
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
3857
3887
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
3888
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
3858
3889
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
3859
3890
|
*/
|
|
3860
3891
|
await this.loadMarkets();
|
|
@@ -3881,14 +3912,27 @@ class huobi extends huobi$1 {
|
|
|
3881
3912
|
/**
|
|
3882
3913
|
* @method
|
|
3883
3914
|
* @name huobi#fetchClosedOrders
|
|
3915
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
|
|
3916
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
|
|
3917
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
|
|
3918
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
|
|
3919
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
|
|
3920
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
|
|
3884
3921
|
* @description fetches information on multiple closed orders made by the user
|
|
3885
3922
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3886
3923
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3887
3924
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
3888
3925
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3926
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
3927
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3889
3928
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
3890
3929
|
*/
|
|
3891
3930
|
await this.loadMarkets();
|
|
3931
|
+
let paginate = false;
|
|
3932
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
3933
|
+
if (paginate) {
|
|
3934
|
+
return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params, 100);
|
|
3935
|
+
}
|
|
3892
3936
|
let market = undefined;
|
|
3893
3937
|
if (symbol !== undefined) {
|
|
3894
3938
|
market = this.market(symbol);
|
|
@@ -3908,6 +3952,9 @@ class huobi extends huobi$1 {
|
|
|
3908
3952
|
/**
|
|
3909
3953
|
* @method
|
|
3910
3954
|
* @name huobi#fetchOpenOrders
|
|
3955
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-open-orders
|
|
3956
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-current-unfilled-order-acquisition
|
|
3957
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-current-unfilled-order-acquisition
|
|
3911
3958
|
* @description fetch all unfilled currently open orders
|
|
3912
3959
|
* @param {string} symbol unified market symbol
|
|
3913
3960
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
@@ -6018,6 +6065,8 @@ class huobi extends huobi$1 {
|
|
|
6018
6065
|
/**
|
|
6019
6066
|
* @method
|
|
6020
6067
|
* @name huobi#fetchFundingRateHistory
|
|
6068
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-funding-rate
|
|
6069
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-funding-rate
|
|
6021
6070
|
* @description fetches historical funding rate prices
|
|
6022
6071
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
6023
6072
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
@@ -6026,6 +6075,11 @@ class huobi extends huobi$1 {
|
|
|
6026
6075
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
6027
6076
|
*/
|
|
6028
6077
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
6078
|
+
let paginate = false;
|
|
6079
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
6080
|
+
if (paginate) {
|
|
6081
|
+
return await this.fetchPaginatedCallCursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50);
|
|
6082
|
+
}
|
|
6029
6083
|
await this.loadMarkets();
|
|
6030
6084
|
const market = this.market(symbol);
|
|
6031
6085
|
const request = {
|
|
@@ -6065,10 +6119,12 @@ class huobi extends huobi$1 {
|
|
|
6065
6119
|
// }
|
|
6066
6120
|
//
|
|
6067
6121
|
const data = this.safeValue(response, 'data');
|
|
6122
|
+
const cursor = this.safeValue(data, 'current_page');
|
|
6068
6123
|
const result = this.safeValue(data, 'data', []);
|
|
6069
6124
|
const rates = [];
|
|
6070
6125
|
for (let i = 0; i < result.length; i++) {
|
|
6071
6126
|
const entry = result[i];
|
|
6127
|
+
entry['current_page'] = cursor;
|
|
6072
6128
|
const marketId = this.safeString(entry, 'contract_code');
|
|
6073
6129
|
const symbolInner = this.safeSymbol(marketId);
|
|
6074
6130
|
const timestamp = this.safeInteger(entry, 'funding_time');
|
|
@@ -7229,16 +7285,24 @@ class huobi extends huobi$1 {
|
|
|
7229
7285
|
/**
|
|
7230
7286
|
* @method
|
|
7231
7287
|
* @name huobi#fetchLedger
|
|
7288
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
|
|
7232
7289
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
7233
7290
|
* @param {string} code unified currency code, default is undefined
|
|
7234
7291
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
7235
7292
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
7236
7293
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7294
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
7295
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
7237
7296
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
7238
7297
|
*/
|
|
7239
7298
|
await this.loadMarkets();
|
|
7299
|
+
let paginate = false;
|
|
7300
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
7301
|
+
if (paginate) {
|
|
7302
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 500);
|
|
7303
|
+
}
|
|
7240
7304
|
const accountId = await this.fetchAccountIdByType('spot', undefined, undefined, params);
|
|
7241
|
-
|
|
7305
|
+
let request = {
|
|
7242
7306
|
'accountId': accountId,
|
|
7243
7307
|
// 'currency': code,
|
|
7244
7308
|
// 'transactTypes': 'all', // default all
|
|
@@ -7259,6 +7323,7 @@ class huobi extends huobi$1 {
|
|
|
7259
7323
|
if (limit !== undefined) {
|
|
7260
7324
|
request['limit'] = limit; // max 500
|
|
7261
7325
|
}
|
|
7326
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
7262
7327
|
const response = await this.spotPrivateGetV2AccountLedger(this.extend(request, params));
|
|
7263
7328
|
//
|
|
7264
7329
|
// {
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -860,9 +860,15 @@ class kraken extends kraken$1 {
|
|
|
860
860
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
861
861
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
862
862
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
863
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
863
864
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
864
865
|
*/
|
|
865
866
|
await this.loadMarkets();
|
|
867
|
+
let paginate = false;
|
|
868
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
869
|
+
if (paginate) {
|
|
870
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 720);
|
|
871
|
+
}
|
|
866
872
|
const market = this.market(symbol);
|
|
867
873
|
const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
|
|
868
874
|
const request = {
|
|
@@ -936,11 +942,7 @@ class kraken extends kraken$1 {
|
|
|
936
942
|
else {
|
|
937
943
|
direction = 'in';
|
|
938
944
|
}
|
|
939
|
-
const
|
|
940
|
-
let timestamp = undefined;
|
|
941
|
-
if (time !== undefined) {
|
|
942
|
-
timestamp = this.parseToInt(time * 1000);
|
|
943
|
-
}
|
|
945
|
+
const timestamp = this.safeIntegerProduct(item, 'time', 1000);
|
|
944
946
|
return {
|
|
945
947
|
'info': item,
|
|
946
948
|
'id': id,
|
|
@@ -966,17 +968,19 @@ class kraken extends kraken$1 {
|
|
|
966
968
|
/**
|
|
967
969
|
* @method
|
|
968
970
|
* @name kraken#fetchLedger
|
|
971
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
969
972
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
970
973
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
971
974
|
* @param {string} code unified currency code, default is undefined
|
|
972
975
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
973
976
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
974
977
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
978
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
975
979
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
976
980
|
*/
|
|
977
981
|
// https://www.kraken.com/features/api#get-ledgers-info
|
|
978
982
|
await this.loadMarkets();
|
|
979
|
-
|
|
983
|
+
let request = {};
|
|
980
984
|
let currency = undefined;
|
|
981
985
|
if (code !== undefined) {
|
|
982
986
|
currency = this.currency(code);
|
|
@@ -985,6 +989,7 @@ class kraken extends kraken$1 {
|
|
|
985
989
|
if (since !== undefined) {
|
|
986
990
|
request['start'] = this.parseToInt(since / 1000);
|
|
987
991
|
}
|
|
992
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
988
993
|
const response = await this.privatePostLedgers(this.extend(request, params));
|
|
989
994
|
// { error: [],
|
|
990
995
|
// result: { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
|
|
@@ -1463,7 +1468,7 @@ class kraken extends kraken$1 {
|
|
|
1463
1468
|
id = this.safeString(txid, 0);
|
|
1464
1469
|
}
|
|
1465
1470
|
const clientOrderId = this.safeString(order, 'userref');
|
|
1466
|
-
const rawTrades = this.safeValue(order, 'trades');
|
|
1471
|
+
const rawTrades = this.safeValue(order, 'trades', []);
|
|
1467
1472
|
const trades = [];
|
|
1468
1473
|
for (let i = 0; i < rawTrades.length; i++) {
|
|
1469
1474
|
const rawTrade = rawTrades[i];
|
|
@@ -1931,6 +1936,7 @@ class kraken extends kraken$1 {
|
|
|
1931
1936
|
/**
|
|
1932
1937
|
* @method
|
|
1933
1938
|
* @name kraken#fetchOpenOrders
|
|
1939
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
1934
1940
|
* @description fetch all unfilled currently open orders
|
|
1935
1941
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
1936
1942
|
* @param {string} symbol unified market symbol
|
|
@@ -1963,16 +1969,18 @@ class kraken extends kraken$1 {
|
|
|
1963
1969
|
/**
|
|
1964
1970
|
* @method
|
|
1965
1971
|
* @name kraken#fetchClosedOrders
|
|
1972
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
1966
1973
|
* @description fetches information on multiple closed orders made by the user
|
|
1967
1974
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
1968
1975
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1969
1976
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1970
1977
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
1971
1978
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
1979
|
+
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
1972
1980
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1973
1981
|
*/
|
|
1974
1982
|
await this.loadMarkets();
|
|
1975
|
-
|
|
1983
|
+
let request = {};
|
|
1976
1984
|
if (since !== undefined) {
|
|
1977
1985
|
request['start'] = this.parseToInt(since / 1000);
|
|
1978
1986
|
}
|
|
@@ -1982,6 +1990,7 @@ class kraken extends kraken$1 {
|
|
|
1982
1990
|
request['userref'] = clientOrderId;
|
|
1983
1991
|
query = this.omit(params, ['userref', 'clientOrderId']);
|
|
1984
1992
|
}
|
|
1993
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1985
1994
|
const response = await this.privatePostClosedOrders(this.extend(request, query));
|
|
1986
1995
|
//
|
|
1987
1996
|
// {
|
|
@@ -2161,6 +2170,7 @@ class kraken extends kraken$1 {
|
|
|
2161
2170
|
/**
|
|
2162
2171
|
* @method
|
|
2163
2172
|
* @name kraken#fetchDeposits
|
|
2173
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
2164
2174
|
* @description fetch all deposits made to an account
|
|
2165
2175
|
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
2166
2176
|
* @param {string} code unified currency code
|
|
@@ -561,8 +561,26 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
564
|
+
/**
|
|
565
|
+
* @method
|
|
566
|
+
* @name kraken#fetchOHLCV
|
|
567
|
+
* @see https://docs.futures.kraken.com/#http-api-charts-candles
|
|
568
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
569
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
570
|
+
* @param {string} timeframe the length of time each candle represents
|
|
571
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
572
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
573
|
+
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
574
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
575
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
576
|
+
*/
|
|
564
577
|
await this.loadMarkets();
|
|
565
578
|
const market = this.market(symbol);
|
|
579
|
+
let paginate = false;
|
|
580
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
581
|
+
if (paginate) {
|
|
582
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000);
|
|
583
|
+
}
|
|
566
584
|
const request = {
|
|
567
585
|
'symbol': market['id'],
|
|
568
586
|
'price_type': this.safeString(params, 'price', 'trade'),
|
|
@@ -639,9 +657,15 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
639
657
|
* @param {int} [limit] Total number of trades, cannot exceed 100
|
|
640
658
|
* @param {object} [params] Exchange specific params
|
|
641
659
|
* @param {int} [params.until] Timestamp in ms of latest trade
|
|
660
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
642
661
|
* @returns An array of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
643
662
|
*/
|
|
644
663
|
await this.loadMarkets();
|
|
664
|
+
let paginate = false;
|
|
665
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
666
|
+
if (paginate) {
|
|
667
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
668
|
+
}
|
|
645
669
|
const market = this.market(symbol);
|
|
646
670
|
const request = {
|
|
647
671
|
'symbol': market['id'],
|