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/ccxt.browser.js
CHANGED
|
@@ -10626,6 +10626,222 @@ class Exchange {
|
|
|
10626
10626
|
res[symbol][timeframe] = data;
|
|
10627
10627
|
return res;
|
|
10628
10628
|
}
|
|
10629
|
+
handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest = undefined, params = {}) {
|
|
10630
|
+
let newMaxEntriesPerRequest = undefined;
|
|
10631
|
+
[newMaxEntriesPerRequest, params] = this.handleOptionAndParams(params, method, 'maxEntriesPerRequest');
|
|
10632
|
+
if ((newMaxEntriesPerRequest !== undefined) && (newMaxEntriesPerRequest !== maxEntriesPerRequest)) {
|
|
10633
|
+
maxEntriesPerRequest = newMaxEntriesPerRequest;
|
|
10634
|
+
}
|
|
10635
|
+
if (maxEntriesPerRequest === undefined) {
|
|
10636
|
+
maxEntriesPerRequest = 1000; // default to 1000
|
|
10637
|
+
}
|
|
10638
|
+
return [maxEntriesPerRequest, params];
|
|
10639
|
+
}
|
|
10640
|
+
async fetchPaginatedCallDynamic(method, symbol = undefined, since = undefined, limit = undefined, params = {}, maxEntriesPerRequest = undefined) {
|
|
10641
|
+
let maxCalls = undefined;
|
|
10642
|
+
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
10643
|
+
let maxRetries = undefined;
|
|
10644
|
+
[maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
|
|
10645
|
+
let paginationDirection = undefined;
|
|
10646
|
+
[paginationDirection, params] = this.handleOptionAndParams(params, method, 'paginationDirection', 'backward');
|
|
10647
|
+
let paginationTimestamp = undefined;
|
|
10648
|
+
let calls = 0;
|
|
10649
|
+
let result = [];
|
|
10650
|
+
let errors = 0;
|
|
10651
|
+
const until = this.safeInteger2(params, 'untill', 'till'); // do not omit it from params here
|
|
10652
|
+
[maxEntriesPerRequest, params] = this.handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest, params);
|
|
10653
|
+
if ((paginationDirection === 'forward')) {
|
|
10654
|
+
if (since === undefined) {
|
|
10655
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' pagination requires a since argument when paginationDirection set to forward');
|
|
10656
|
+
}
|
|
10657
|
+
paginationTimestamp = since;
|
|
10658
|
+
}
|
|
10659
|
+
while ((calls < maxCalls)) {
|
|
10660
|
+
calls += 1;
|
|
10661
|
+
try {
|
|
10662
|
+
if (paginationDirection === 'backward') {
|
|
10663
|
+
// do it backwards, starting from the last
|
|
10664
|
+
// UNTIL filtering is required in order to work
|
|
10665
|
+
if (paginationTimestamp !== undefined) {
|
|
10666
|
+
params['until'] = paginationTimestamp - 1;
|
|
10667
|
+
}
|
|
10668
|
+
const response = await this[method](symbol, undefined, maxEntriesPerRequest, params);
|
|
10669
|
+
const responseLength = response.length;
|
|
10670
|
+
if (this.verbose) {
|
|
10671
|
+
this.log('Dynamic pagination call', calls, 'method', method, 'response length', responseLength, 'timestamp', paginationTimestamp);
|
|
10672
|
+
}
|
|
10673
|
+
if (responseLength === 0) {
|
|
10674
|
+
break;
|
|
10675
|
+
}
|
|
10676
|
+
errors = 0;
|
|
10677
|
+
result = this.arrayConcat(result, response);
|
|
10678
|
+
const firstElement = this.safeValue(response, 0);
|
|
10679
|
+
paginationTimestamp = this.safeInteger2(firstElement, 'timestamp', 0);
|
|
10680
|
+
if ((since !== undefined) && (paginationTimestamp <= since)) {
|
|
10681
|
+
break;
|
|
10682
|
+
}
|
|
10683
|
+
}
|
|
10684
|
+
else {
|
|
10685
|
+
// do it forwards, starting from the since
|
|
10686
|
+
const response = await this[method](symbol, paginationTimestamp, maxEntriesPerRequest, params);
|
|
10687
|
+
const responseLength = response.length;
|
|
10688
|
+
if (this.verbose) {
|
|
10689
|
+
this.log('Dynamic pagination call', calls, 'method', method, 'response length', responseLength, 'timestamp', paginationTimestamp);
|
|
10690
|
+
}
|
|
10691
|
+
if (responseLength === 0) {
|
|
10692
|
+
break;
|
|
10693
|
+
}
|
|
10694
|
+
errors = 0;
|
|
10695
|
+
result = this.arrayConcat(result, response);
|
|
10696
|
+
const last = this.safeValue(response, responseLength - 1);
|
|
10697
|
+
paginationTimestamp = this.safeInteger(last, 'timestamp') - 1;
|
|
10698
|
+
if ((until !== undefined) && (paginationTimestamp >= until)) {
|
|
10699
|
+
break;
|
|
10700
|
+
}
|
|
10701
|
+
}
|
|
10702
|
+
}
|
|
10703
|
+
catch (e) {
|
|
10704
|
+
errors += 1;
|
|
10705
|
+
if (errors > maxRetries) {
|
|
10706
|
+
throw e;
|
|
10707
|
+
}
|
|
10708
|
+
}
|
|
10709
|
+
}
|
|
10710
|
+
return this.removeRepeatedElementsFromArray(result);
|
|
10711
|
+
}
|
|
10712
|
+
async safeDeterministicCall(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}) {
|
|
10713
|
+
let maxRetries = undefined;
|
|
10714
|
+
[maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
|
|
10715
|
+
let errors = 0;
|
|
10716
|
+
try {
|
|
10717
|
+
if (timeframe && method !== 'fetchFundingRateHistory') {
|
|
10718
|
+
return await this[method](symbol, timeframe, since, limit, params);
|
|
10719
|
+
}
|
|
10720
|
+
else {
|
|
10721
|
+
return await this[method](symbol, since, limit, params);
|
|
10722
|
+
}
|
|
10723
|
+
}
|
|
10724
|
+
catch (e) {
|
|
10725
|
+
if (e instanceof _errors_js__WEBPACK_IMPORTED_MODULE_3__.RateLimitExceeded) {
|
|
10726
|
+
throw e; // if we are rate limited, we should not retry and fail fast
|
|
10727
|
+
}
|
|
10728
|
+
errors += 1;
|
|
10729
|
+
if (errors > maxRetries) {
|
|
10730
|
+
throw e;
|
|
10731
|
+
}
|
|
10732
|
+
}
|
|
10733
|
+
}
|
|
10734
|
+
async fetchPaginatedCallDeterministic(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}, maxEntriesPerRequest = undefined) {
|
|
10735
|
+
let maxCalls = undefined;
|
|
10736
|
+
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
10737
|
+
[maxEntriesPerRequest, params] = this.handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest, params);
|
|
10738
|
+
const current = this.milliseconds();
|
|
10739
|
+
const tasks = [];
|
|
10740
|
+
const time = this.parseTimeframe(timeframe) * 1000;
|
|
10741
|
+
const step = time * maxEntriesPerRequest;
|
|
10742
|
+
let currentSince = current - (maxCalls * step) - 1;
|
|
10743
|
+
if (since !== undefined) {
|
|
10744
|
+
currentSince = Math.max(currentSince, since);
|
|
10745
|
+
}
|
|
10746
|
+
const until = this.safeInteger2(params, 'until', 'till'); // do not omit it here
|
|
10747
|
+
if (until !== undefined) {
|
|
10748
|
+
const requiredCalls = Math.ceil((until - since) / step);
|
|
10749
|
+
if (requiredCalls > maxCalls) {
|
|
10750
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadRequest(this.id + ' the number of required calls is greater than the max number of calls allowed, either increase the paginationCalls or decrease the since-until gap. Current paginationCalls limit is ' + maxCalls.toString() + ' required calls is ' + requiredCalls.toString());
|
|
10751
|
+
}
|
|
10752
|
+
}
|
|
10753
|
+
for (let i = 0; i < maxCalls; i++) {
|
|
10754
|
+
if ((until !== undefined) && (currentSince >= until)) {
|
|
10755
|
+
break;
|
|
10756
|
+
}
|
|
10757
|
+
tasks.push(this.safeDeterministicCall(method, symbol, currentSince, maxEntriesPerRequest, timeframe, params));
|
|
10758
|
+
currentSince = this.sum(currentSince, step) - 1;
|
|
10759
|
+
}
|
|
10760
|
+
const results = await Promise.all(tasks);
|
|
10761
|
+
let result = [];
|
|
10762
|
+
for (let i = 0; i < results.length; i++) {
|
|
10763
|
+
result = this.arrayConcat(result, results[i]);
|
|
10764
|
+
}
|
|
10765
|
+
return this.removeRepeatedElementsFromArray(result);
|
|
10766
|
+
}
|
|
10767
|
+
async fetchPaginatedCallCursor(method, symbol = undefined, since = undefined, limit = undefined, params = {}, cursorReceived = undefined, cursorSent = undefined, cursorIncrement = undefined, maxEntriesPerRequest = undefined) {
|
|
10768
|
+
let maxCalls = undefined;
|
|
10769
|
+
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
10770
|
+
let maxRetries = undefined;
|
|
10771
|
+
[maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
|
|
10772
|
+
[maxEntriesPerRequest, params] = this.handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest, params);
|
|
10773
|
+
let cursorValue = undefined;
|
|
10774
|
+
let i = 0;
|
|
10775
|
+
let errors = 0;
|
|
10776
|
+
let result = [];
|
|
10777
|
+
while (i < maxCalls) {
|
|
10778
|
+
try {
|
|
10779
|
+
if (cursorValue !== undefined) {
|
|
10780
|
+
if (cursorIncrement !== undefined) {
|
|
10781
|
+
cursorValue = this.parseToInt(cursorValue) + cursorIncrement;
|
|
10782
|
+
}
|
|
10783
|
+
params[cursorSent] = cursorValue;
|
|
10784
|
+
}
|
|
10785
|
+
const response = await this[method](symbol, since, maxEntriesPerRequest, params);
|
|
10786
|
+
errors = 0;
|
|
10787
|
+
const responseLength = response.length;
|
|
10788
|
+
if (this.verbose) {
|
|
10789
|
+
this.log('Cursor pagination call', i + 1, 'method', method, 'response length', responseLength, 'cursor', cursorValue);
|
|
10790
|
+
}
|
|
10791
|
+
if (responseLength === 0) {
|
|
10792
|
+
break;
|
|
10793
|
+
}
|
|
10794
|
+
result = this.arrayConcat(result, response);
|
|
10795
|
+
const last = this.safeValue(response, responseLength - 1);
|
|
10796
|
+
cursorValue = this.safeValue(last['info'], cursorReceived);
|
|
10797
|
+
if (cursorValue === undefined) {
|
|
10798
|
+
break;
|
|
10799
|
+
}
|
|
10800
|
+
}
|
|
10801
|
+
catch (e) {
|
|
10802
|
+
errors += 1;
|
|
10803
|
+
if (errors > maxRetries) {
|
|
10804
|
+
throw e;
|
|
10805
|
+
}
|
|
10806
|
+
}
|
|
10807
|
+
i += 1;
|
|
10808
|
+
}
|
|
10809
|
+
return result;
|
|
10810
|
+
}
|
|
10811
|
+
removeRepeatedElementsFromArray(input) {
|
|
10812
|
+
const uniqueResult = {};
|
|
10813
|
+
for (let i = 0; i < input.length; i++) {
|
|
10814
|
+
const entry = input[i];
|
|
10815
|
+
const id = this.safeString(entry, 'id');
|
|
10816
|
+
if (id !== undefined) {
|
|
10817
|
+
if (this.safeString(uniqueResult, id) === undefined) {
|
|
10818
|
+
uniqueResult[id] = entry;
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10821
|
+
else {
|
|
10822
|
+
const timestamp = this.safeInteger2(entry, 'timestamp', 0);
|
|
10823
|
+
if (timestamp !== undefined) {
|
|
10824
|
+
if (this.safeString(uniqueResult, timestamp) === undefined) {
|
|
10825
|
+
uniqueResult[timestamp] = entry;
|
|
10826
|
+
}
|
|
10827
|
+
}
|
|
10828
|
+
}
|
|
10829
|
+
}
|
|
10830
|
+
const values = Object.values(uniqueResult);
|
|
10831
|
+
const valuesLength = values.length;
|
|
10832
|
+
if (valuesLength > 0) {
|
|
10833
|
+
return values;
|
|
10834
|
+
}
|
|
10835
|
+
return input;
|
|
10836
|
+
}
|
|
10837
|
+
handleUntilOption(key, request, params, multiplier = 1) {
|
|
10838
|
+
const until = this.safeValue2(params, 'until', 'till');
|
|
10839
|
+
if (until !== undefined) {
|
|
10840
|
+
request[key] = this.parseToInt(until * multiplier);
|
|
10841
|
+
params = this.omit(params, ['until', 'till']);
|
|
10842
|
+
}
|
|
10843
|
+
return [request, params];
|
|
10844
|
+
}
|
|
10629
10845
|
}
|
|
10630
10846
|
|
|
10631
10847
|
|
|
@@ -19003,9 +19219,15 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19003
19219
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
19004
19220
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
19005
19221
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
19222
|
+
* @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)
|
|
19006
19223
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
19007
19224
|
*/
|
|
19008
19225
|
await this.loadMarkets();
|
|
19226
|
+
let paginate = false;
|
|
19227
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
19228
|
+
if (paginate) {
|
|
19229
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
19230
|
+
}
|
|
19009
19231
|
const market = this.market(symbol);
|
|
19010
19232
|
// binance docs say that the default limit 500, max 1500 for futures, max 1000 for spot markets
|
|
19011
19233
|
// the reality is that the time range wider than 500 candles won't work right
|
|
@@ -19340,12 +19562,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19340
19562
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
19341
19563
|
* @param {int} [params.until] only used when fetchTradesMethod is 'publicGetAggTrades', 'fapiPublicGetAggTrades', or 'dapiPublicGetAggTrades'
|
|
19342
19564
|
* @param {int} [params.fetchTradesMethod] 'publicGetAggTrades' (spot default), 'fapiPublicGetAggTrades' (swap default), 'dapiPublicGetAggTrades' (future default), 'eapiPublicGetTrades' (option default), 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', 'publicGetHistoricalTrades', 'fapiPublicGetHistoricalTrades', 'dapiPublicGetHistoricalTrades', 'eapiPublicGetHistoricalTrades'
|
|
19565
|
+
* @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)
|
|
19343
19566
|
*
|
|
19344
19567
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
19345
19568
|
* @param {int} [params.fromId] trade id to fetch from, default gets most recent trades, not used when fetchTradesMethod is 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', or 'eapiPublicGetTrades'
|
|
19346
19569
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
19347
19570
|
*/
|
|
19348
19571
|
await this.loadMarkets();
|
|
19572
|
+
let paginate = false;
|
|
19573
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
19574
|
+
if (paginate) {
|
|
19575
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
19576
|
+
}
|
|
19349
19577
|
const market = this.market(symbol);
|
|
19350
19578
|
const request = {
|
|
19351
19579
|
'symbol': market['id'],
|
|
@@ -20377,10 +20605,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20377
20605
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
20378
20606
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
20379
20607
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
20608
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
20609
|
+
* @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)
|
|
20380
20610
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
20381
20611
|
*/
|
|
20382
20612
|
this.checkRequiredSymbol('fetchOrders', symbol);
|
|
20383
20613
|
await this.loadMarkets();
|
|
20614
|
+
let paginate = false;
|
|
20615
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
20616
|
+
if (paginate) {
|
|
20617
|
+
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
20618
|
+
}
|
|
20384
20619
|
const market = this.market(symbol);
|
|
20385
20620
|
const defaultType = this.safeString2(this.options, 'fetchOrders', 'defaultType', 'spot');
|
|
20386
20621
|
const type = this.safeString(params, 'type', defaultType);
|
|
@@ -20404,6 +20639,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20404
20639
|
request['isIsolated'] = true;
|
|
20405
20640
|
}
|
|
20406
20641
|
}
|
|
20642
|
+
const until = this.safeInteger(params, 'until');
|
|
20643
|
+
if (until !== undefined) {
|
|
20644
|
+
params = this.omit(params, 'until');
|
|
20645
|
+
request['endTime'] = until;
|
|
20646
|
+
}
|
|
20407
20647
|
if (since !== undefined) {
|
|
20408
20648
|
request['startTime'] = since;
|
|
20409
20649
|
}
|
|
@@ -20491,6 +20731,10 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20491
20731
|
/**
|
|
20492
20732
|
* @method
|
|
20493
20733
|
* @name binance#fetchOpenOrders
|
|
20734
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
|
|
20735
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
20736
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
20737
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
20494
20738
|
* @description fetch all unfilled currently open orders
|
|
20495
20739
|
* @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
|
20496
20740
|
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
@@ -20573,6 +20817,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20573
20817
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
20574
20818
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
20575
20819
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
20820
|
+
* @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)
|
|
20576
20821
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
20577
20822
|
*/
|
|
20578
20823
|
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
@@ -20590,6 +20835,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20590
20835
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
20591
20836
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
20592
20837
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
20838
|
+
* @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)
|
|
20593
20839
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
20594
20840
|
*/
|
|
20595
20841
|
this.checkRequiredSymbol('fetchCanceledOrders', symbol);
|
|
@@ -20823,9 +21069,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20823
21069
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
20824
21070
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
20825
21071
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21072
|
+
* @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)
|
|
21073
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
20826
21074
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
20827
21075
|
*/
|
|
20828
21076
|
await this.loadMarkets();
|
|
21077
|
+
let paginate = false;
|
|
21078
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
21079
|
+
if (paginate) {
|
|
21080
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
21081
|
+
}
|
|
20829
21082
|
const request = {};
|
|
20830
21083
|
let market = undefined;
|
|
20831
21084
|
let type = undefined;
|
|
@@ -21096,6 +21349,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21096
21349
|
/**
|
|
21097
21350
|
* @method
|
|
21098
21351
|
* @name binance#fetchDeposits
|
|
21352
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
21099
21353
|
* @description fetch all deposits made to an account
|
|
21100
21354
|
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
21101
21355
|
* @see https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
|
|
@@ -21104,10 +21358,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21104
21358
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
21105
21359
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21106
21360
|
* @param {bool} [params.fiat] if true, only fiat deposits will be returned
|
|
21107
|
-
* @param {int} [params.until] the latest time in ms to fetch
|
|
21361
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
21362
|
+
* @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)
|
|
21108
21363
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
21109
21364
|
*/
|
|
21110
21365
|
await this.loadMarkets();
|
|
21366
|
+
let paginate = false;
|
|
21367
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
21368
|
+
if (paginate) {
|
|
21369
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
21370
|
+
}
|
|
21111
21371
|
let currency = undefined;
|
|
21112
21372
|
let response = undefined;
|
|
21113
21373
|
const request = {};
|
|
@@ -21115,6 +21375,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21115
21375
|
const fiatOnly = this.safeValue(params, 'fiat', false);
|
|
21116
21376
|
params = this.omit(params, 'fiatOnly');
|
|
21117
21377
|
const until = this.safeInteger(params, 'until');
|
|
21378
|
+
params = this.omit(params, 'until');
|
|
21118
21379
|
if (fiatOnly || (code in legalMoney)) {
|
|
21119
21380
|
if (code !== undefined) {
|
|
21120
21381
|
currency = this.currency(code);
|
|
@@ -21202,6 +21463,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21202
21463
|
/**
|
|
21203
21464
|
* @method
|
|
21204
21465
|
* @name binance#fetchWithdrawals
|
|
21466
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
21467
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
|
21205
21468
|
* @description fetch all withdrawals made from an account
|
|
21206
21469
|
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
21207
21470
|
* @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
|
@@ -21210,13 +21473,25 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21210
21473
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
21211
21474
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21212
21475
|
* @param {bool} [params.fiat] if true, only fiat withdrawals will be returned
|
|
21476
|
+
* @param {int} [params.until] the latest time in ms to fetch withdrawals for
|
|
21477
|
+
* @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)
|
|
21213
21478
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
21214
21479
|
*/
|
|
21215
21480
|
await this.loadMarkets();
|
|
21481
|
+
let paginate = false;
|
|
21482
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
21483
|
+
if (paginate) {
|
|
21484
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
21485
|
+
}
|
|
21216
21486
|
const legalMoney = this.safeValue(this.options, 'legalMoney', {});
|
|
21217
21487
|
const fiatOnly = this.safeValue(params, 'fiat', false);
|
|
21218
21488
|
params = this.omit(params, 'fiatOnly');
|
|
21219
21489
|
const request = {};
|
|
21490
|
+
const until = this.safeInteger(params, 'until');
|
|
21491
|
+
if (until !== undefined) {
|
|
21492
|
+
params = this.omit(params, 'until');
|
|
21493
|
+
request['endTime'] = until;
|
|
21494
|
+
}
|
|
21220
21495
|
let response = undefined;
|
|
21221
21496
|
let currency = undefined;
|
|
21222
21497
|
if (fiatOnly || (code in legalMoney)) {
|
|
@@ -21668,15 +21943,23 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21668
21943
|
/**
|
|
21669
21944
|
* @method
|
|
21670
21945
|
* @name binance#fetchTransfers
|
|
21946
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
|
|
21671
21947
|
* @description fetch a history of internal transfers made on an account
|
|
21672
21948
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
|
|
21673
21949
|
* @param {string} code unified currency code of the currency transferred
|
|
21674
21950
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
21675
21951
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
21676
21952
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
21953
|
+
* @param {int} [params.until] the latest time in ms to fetch transfers for
|
|
21954
|
+
* @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)
|
|
21677
21955
|
* @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
|
|
21678
21956
|
*/
|
|
21679
21957
|
await this.loadMarkets();
|
|
21958
|
+
let paginate = false;
|
|
21959
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
|
|
21960
|
+
if (paginate) {
|
|
21961
|
+
return await this.fetchPaginatedCallDynamic('fetchTransfers', code, since, limit, params);
|
|
21962
|
+
}
|
|
21680
21963
|
let currency = undefined;
|
|
21681
21964
|
if (code !== undefined) {
|
|
21682
21965
|
currency = this.currency(code);
|
|
@@ -21709,6 +21992,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21709
21992
|
if (limit !== undefined) {
|
|
21710
21993
|
request['size'] = limit;
|
|
21711
21994
|
}
|
|
21995
|
+
const until = this.safeInteger(params, 'until');
|
|
21996
|
+
if (until !== undefined) {
|
|
21997
|
+
params = this.omit(params, 'until');
|
|
21998
|
+
request['endTime'] = until;
|
|
21999
|
+
}
|
|
21712
22000
|
const response = await this.sapiGetAssetTransfer(this.extend(request, params));
|
|
21713
22001
|
//
|
|
21714
22002
|
// {
|
|
@@ -22393,11 +22681,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22393
22681
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
22394
22682
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22395
22683
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
22684
|
+
* @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)
|
|
22396
22685
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
22397
22686
|
*/
|
|
22398
22687
|
await this.loadMarkets();
|
|
22399
22688
|
const request = {};
|
|
22400
22689
|
let method = undefined;
|
|
22690
|
+
let paginate = false;
|
|
22691
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
22692
|
+
if (paginate) {
|
|
22693
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
22694
|
+
}
|
|
22401
22695
|
const defaultType = this.safeString2(this.options, 'fetchFundingRateHistory', 'defaultType', 'future');
|
|
22402
22696
|
const type = this.safeString(params, 'type', defaultType);
|
|
22403
22697
|
let market = undefined;
|
|
@@ -23801,9 +24095,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23801
24095
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
23802
24096
|
* @param {int} [limit] max number of ledger entrys to return
|
|
23803
24097
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
24098
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
24099
|
+
* @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)
|
|
23804
24100
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
23805
24101
|
*/
|
|
23806
24102
|
await this.loadMarkets();
|
|
24103
|
+
let paginate = false;
|
|
24104
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
24105
|
+
if (paginate) {
|
|
24106
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
24107
|
+
}
|
|
23807
24108
|
let type = undefined;
|
|
23808
24109
|
let subType = undefined;
|
|
23809
24110
|
let currency = undefined;
|
|
@@ -23832,6 +24133,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23832
24133
|
if (limit !== undefined) {
|
|
23833
24134
|
request['limit'] = limit;
|
|
23834
24135
|
}
|
|
24136
|
+
const until = this.safeInteger(params, 'until');
|
|
24137
|
+
if (until !== undefined) {
|
|
24138
|
+
params = this.omit(params, 'until');
|
|
24139
|
+
request['endTime'] = until;
|
|
24140
|
+
}
|
|
23835
24141
|
const response = await this[method](this.extend(request, params));
|
|
23836
24142
|
//
|
|
23837
24143
|
// options (eapi)
|
|
@@ -24621,6 +24927,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24621
24927
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + 'fetchOpenInterestHistory cannot use the 1m timeframe');
|
|
24622
24928
|
}
|
|
24623
24929
|
await this.loadMarkets();
|
|
24930
|
+
let paginate = false;
|
|
24931
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate', false);
|
|
24932
|
+
if (paginate) {
|
|
24933
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500);
|
|
24934
|
+
}
|
|
24624
24935
|
const market = this.market(symbol);
|
|
24625
24936
|
const request = {
|
|
24626
24937
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
@@ -25238,6 +25549,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
25238
25549
|
'100001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
25239
25550
|
'100412': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
25240
25551
|
'100202': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
25552
|
+
'100204': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
25241
25553
|
'100400': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
25242
25554
|
'100440': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
25243
25555
|
'100500': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
@@ -25568,9 +25880,15 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
25568
25880
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
25569
25881
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
25570
25882
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
25883
|
+
* @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)
|
|
25571
25884
|
* @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
25572
25885
|
*/
|
|
25573
25886
|
await this.loadMarkets();
|
|
25887
|
+
let paginate = false;
|
|
25888
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
25889
|
+
if (paginate) {
|
|
25890
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
25891
|
+
}
|
|
25574
25892
|
const market = this.market(symbol);
|
|
25575
25893
|
const request = {
|
|
25576
25894
|
'symbol': market['id'],
|
|
@@ -25585,6 +25903,11 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
25585
25903
|
else {
|
|
25586
25904
|
request['limit'] = 50;
|
|
25587
25905
|
}
|
|
25906
|
+
const until = this.safeInteger2(params, 'until', 'startTime');
|
|
25907
|
+
if (until !== undefined) {
|
|
25908
|
+
params = this.omit(params, ['until']);
|
|
25909
|
+
request['startTime'] = until;
|
|
25910
|
+
}
|
|
25588
25911
|
let response = undefined;
|
|
25589
25912
|
if (market['spot']) {
|
|
25590
25913
|
response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
|
|
@@ -25964,10 +26287,17 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
25964
26287
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
25965
26288
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
25966
26289
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
26290
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate to fetch
|
|
26291
|
+
* @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)
|
|
25967
26292
|
* @returns {[object]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
25968
26293
|
*/
|
|
25969
26294
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
25970
26295
|
await this.loadMarkets();
|
|
26296
|
+
let paginate = false;
|
|
26297
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
26298
|
+
if (paginate) {
|
|
26299
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
26300
|
+
}
|
|
25971
26301
|
const market = this.market(symbol);
|
|
25972
26302
|
const request = {
|
|
25973
26303
|
'symbol': market['id'],
|
|
@@ -25978,6 +26308,11 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
25978
26308
|
if (limit !== undefined) {
|
|
25979
26309
|
request['limit'] = limit;
|
|
25980
26310
|
}
|
|
26311
|
+
const until = this.safeInteger2(params, 'until', 'startTime');
|
|
26312
|
+
if (until !== undefined) {
|
|
26313
|
+
params = this.omit(params, ['until']);
|
|
26314
|
+
request['startTime'] = until;
|
|
26315
|
+
}
|
|
25981
26316
|
const response = await this.swapV2PublicGetQuoteFundingRate(this.extend(request, params));
|
|
25982
26317
|
//
|
|
25983
26318
|
// {
|
|
@@ -33195,6 +33530,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
33195
33530
|
},
|
|
33196
33531
|
'exceptions': {
|
|
33197
33532
|
'exact': {
|
|
33533
|
+
'11010': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.RateLimitExceeded,
|
|
33198
33534
|
'10001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
33199
33535
|
'10020': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
33200
33536
|
'10100': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
@@ -34120,17 +34456,24 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
34120
34456
|
* @method
|
|
34121
34457
|
* @name bitfinex2#fetchTrades
|
|
34122
34458
|
* @description get the list of most recent trades for a particular symbol
|
|
34123
|
-
* @see https://docs.bitfinex.com/reference/rest-public-
|
|
34459
|
+
* @see https://docs.bitfinex.com/reference/rest-public-trades
|
|
34124
34460
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
34125
34461
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
34126
34462
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
34127
34463
|
* @param {object} [params] extra parameters specific to the bitfinex2 api endpoint
|
|
34464
|
+
* @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)
|
|
34465
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
34128
34466
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
34129
34467
|
*/
|
|
34130
34468
|
await this.loadMarkets();
|
|
34469
|
+
let paginate = false;
|
|
34470
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
34471
|
+
if (paginate) {
|
|
34472
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params, 10000);
|
|
34473
|
+
}
|
|
34131
34474
|
const market = this.market(symbol);
|
|
34132
34475
|
let sort = '-1';
|
|
34133
|
-
|
|
34476
|
+
let request = {
|
|
34134
34477
|
'symbol': market['id'],
|
|
34135
34478
|
};
|
|
34136
34479
|
if (since !== undefined) {
|
|
@@ -34141,6 +34484,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
34141
34484
|
request['limit'] = Math.min(limit, 10000); // default 120, max 10000
|
|
34142
34485
|
}
|
|
34143
34486
|
request['sort'] = sort;
|
|
34487
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
34144
34488
|
const response = await this.publicGetTradesSymbolHist(this.extend(request, params));
|
|
34145
34489
|
//
|
|
34146
34490
|
// [
|
|
@@ -34167,23 +34511,27 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
34167
34511
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
34168
34512
|
* @param {object} [params] extra parameters specific to the bitfinex2 api endpoint
|
|
34169
34513
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
34514
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
34515
|
+
* @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)
|
|
34170
34516
|
*/
|
|
34171
34517
|
await this.loadMarkets();
|
|
34518
|
+
let paginate = false;
|
|
34519
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
34520
|
+
if (paginate) {
|
|
34521
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 10000);
|
|
34522
|
+
}
|
|
34172
34523
|
const market = this.market(symbol);
|
|
34173
34524
|
if (limit === undefined) {
|
|
34174
|
-
limit =
|
|
34525
|
+
limit = 10000; // default 100, max 5000
|
|
34175
34526
|
}
|
|
34176
|
-
|
|
34177
|
-
const duration = this.parseTimeframe(timeframe);
|
|
34178
|
-
since = this.milliseconds() - duration * limit * 1000;
|
|
34179
|
-
}
|
|
34180
|
-
const request = {
|
|
34527
|
+
let request = {
|
|
34181
34528
|
'symbol': market['id'],
|
|
34182
34529
|
'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
|
|
34183
34530
|
'sort': 1,
|
|
34184
34531
|
'start': since,
|
|
34185
34532
|
'limit': limit,
|
|
34186
34533
|
};
|
|
34534
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
34187
34535
|
const response = await this.publicGetCandlesTradeTimeframeSymbolHist(this.extend(request, params));
|
|
34188
34536
|
//
|
|
34189
34537
|
// [
|
|
@@ -34657,17 +35005,25 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
34657
35005
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
34658
35006
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
34659
35007
|
* @param {object} [params] extra parameters specific to the bitfinex2 api endpoint
|
|
35008
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
35009
|
+
* @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)
|
|
34660
35010
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
34661
35011
|
*/
|
|
34662
35012
|
// returns the most recent closed or canceled orders up to circa two weeks ago
|
|
34663
35013
|
await this.loadMarkets();
|
|
34664
|
-
|
|
35014
|
+
let paginate = false;
|
|
35015
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
35016
|
+
if (paginate) {
|
|
35017
|
+
return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
|
|
35018
|
+
}
|
|
35019
|
+
let request = {};
|
|
34665
35020
|
if (since !== undefined) {
|
|
34666
35021
|
request['start'] = since;
|
|
34667
35022
|
}
|
|
34668
35023
|
if (limit !== undefined) {
|
|
34669
35024
|
request['limit'] = limit; // default 25, max 2500
|
|
34670
35025
|
}
|
|
35026
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
34671
35027
|
let market = undefined;
|
|
34672
35028
|
let response = undefined;
|
|
34673
35029
|
if (symbol === undefined) {
|
|
@@ -35428,6 +35784,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
35428
35784
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
35429
35785
|
}
|
|
35430
35786
|
handleErrors(statusCode, statusText, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
35787
|
+
// ['error', 11010, 'ratelimit: error']
|
|
35431
35788
|
if (response !== undefined) {
|
|
35432
35789
|
if (!Array.isArray(response)) {
|
|
35433
35790
|
const message = this.safeString2(response, 'message', 'error');
|
|
@@ -35440,6 +35797,9 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
35440
35797
|
else if (response === '') {
|
|
35441
35798
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' returned empty response');
|
|
35442
35799
|
}
|
|
35800
|
+
if (statusCode === 429) {
|
|
35801
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.RateLimitExceeded(this.id + ' ' + body);
|
|
35802
|
+
}
|
|
35443
35803
|
if (statusCode === 500) {
|
|
35444
35804
|
// See https://docs.bitfinex.com/docs/abbreviations-glossary#section-errorinfo-codes
|
|
35445
35805
|
const errorCode = this.safeString(response, 1, '');
|
|
@@ -35535,18 +35895,26 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
35535
35895
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
35536
35896
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
35537
35897
|
* @param {object} [params] extra parameters specific to the bitfinex2 api endpoint
|
|
35898
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
35899
|
+
* @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)
|
|
35538
35900
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
35539
35901
|
*/
|
|
35540
35902
|
await this.loadMarkets();
|
|
35541
35903
|
await this.loadMarkets();
|
|
35904
|
+
let paginate = false;
|
|
35905
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
35906
|
+
if (paginate) {
|
|
35907
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 2500);
|
|
35908
|
+
}
|
|
35542
35909
|
let currency = undefined;
|
|
35543
|
-
|
|
35910
|
+
let request = {};
|
|
35544
35911
|
if (since !== undefined) {
|
|
35545
35912
|
request['start'] = since;
|
|
35546
35913
|
}
|
|
35547
35914
|
if (limit !== undefined) {
|
|
35548
35915
|
request['limit'] = limit; // max 2500
|
|
35549
35916
|
}
|
|
35917
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
35550
35918
|
let response = undefined;
|
|
35551
35919
|
if (code !== undefined) {
|
|
35552
35920
|
currency = this.currency(code);
|
|
@@ -35644,14 +36012,25 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
35644
36012
|
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status-history
|
|
35645
36013
|
* @param {string} symbol unified market symbol
|
|
35646
36014
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
36015
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
36016
|
+
* @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)
|
|
35647
36017
|
* @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
|
|
35648
36018
|
*/
|
|
35649
36019
|
await this.loadMarkets();
|
|
35650
36020
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
36021
|
+
let paginate = false;
|
|
36022
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
36023
|
+
if (paginate) {
|
|
36024
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 5000);
|
|
36025
|
+
}
|
|
35651
36026
|
const market = this.market(symbol);
|
|
35652
|
-
|
|
36027
|
+
let request = {
|
|
35653
36028
|
'symbol': market['id'],
|
|
35654
36029
|
};
|
|
36030
|
+
if (since !== undefined) {
|
|
36031
|
+
request['start'] = since;
|
|
36032
|
+
}
|
|
36033
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
35655
36034
|
const response = await this.publicGetStatusDerivSymbolHist(this.extend(request, params));
|
|
35656
36035
|
//
|
|
35657
36036
|
// [
|
|
@@ -39251,9 +39630,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39251
39630
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
39252
39631
|
* @param {string} [params.pageNo] pageNo default 1
|
|
39253
39632
|
* @param {string} [params.pageSize] pageSize default 20. Max 100
|
|
39633
|
+
* @param {int} [params.until] end tim in ms
|
|
39634
|
+
* @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)
|
|
39254
39635
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
39255
39636
|
*/
|
|
39256
39637
|
await this.loadMarkets();
|
|
39638
|
+
let paginate = false;
|
|
39639
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
39640
|
+
if (paginate) {
|
|
39641
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
39642
|
+
}
|
|
39257
39643
|
if (code === undefined) {
|
|
39258
39644
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchDeposits() requires a `code` argument');
|
|
39259
39645
|
}
|
|
@@ -39261,7 +39647,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39261
39647
|
if (since === undefined) {
|
|
39262
39648
|
since = this.milliseconds() - 31556952000; // 1yr
|
|
39263
39649
|
}
|
|
39264
|
-
|
|
39650
|
+
let request = {
|
|
39265
39651
|
'coin': currency['code'],
|
|
39266
39652
|
'startTime': since,
|
|
39267
39653
|
'endTime': this.milliseconds(),
|
|
@@ -39269,6 +39655,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39269
39655
|
if (limit !== undefined) {
|
|
39270
39656
|
request['pageSize'] = limit;
|
|
39271
39657
|
}
|
|
39658
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
39272
39659
|
const response = await this.privateSpotGetWalletDepositList(this.extend(request, params));
|
|
39273
39660
|
//
|
|
39274
39661
|
// {
|
|
@@ -39381,9 +39768,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39381
39768
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
39382
39769
|
* @param {string} [params.pageNo] pageNo default 1
|
|
39383
39770
|
* @param {string} [params.pageSize] pageSize default 20. Max 100
|
|
39771
|
+
* @param {int} [params.until] end time in ms
|
|
39772
|
+
* @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)
|
|
39384
39773
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
39385
39774
|
*/
|
|
39386
39775
|
await this.loadMarkets();
|
|
39776
|
+
let paginate = false;
|
|
39777
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
39778
|
+
if (paginate) {
|
|
39779
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
39780
|
+
}
|
|
39387
39781
|
if (code === undefined) {
|
|
39388
39782
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchWithdrawals() requires a `code` argument');
|
|
39389
39783
|
}
|
|
@@ -39391,11 +39785,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39391
39785
|
if (since === undefined) {
|
|
39392
39786
|
since = this.milliseconds() - 31556952000; // 1yr
|
|
39393
39787
|
}
|
|
39394
|
-
|
|
39788
|
+
let request = {
|
|
39395
39789
|
'coin': currency['code'],
|
|
39396
39790
|
'startTime': since,
|
|
39397
39791
|
'endTime': this.milliseconds(),
|
|
39398
39792
|
};
|
|
39793
|
+
[request, params] = this.handleUntilOption('endTime', params, request);
|
|
39399
39794
|
if (limit !== undefined) {
|
|
39400
39795
|
request['pageSize'] = limit;
|
|
39401
39796
|
}
|
|
@@ -39940,9 +40335,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39940
40335
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
39941
40336
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
39942
40337
|
* @param {int} [params.until] the latest time in ms to fetch deposits for
|
|
40338
|
+
* @param {boolean} [params.paginate] *only applies to publicSpotGetMarketFillsHistory and publicMixGetMarketFillsHistory* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
39943
40339
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
39944
40340
|
*/
|
|
39945
40341
|
await this.loadMarkets();
|
|
40342
|
+
let paginate = false;
|
|
40343
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
40344
|
+
if (paginate) {
|
|
40345
|
+
return await this.fetchPaginatedCallCursor('fetchTrades', symbol, since, limit, params, 'tradeId', 'tradeId');
|
|
40346
|
+
}
|
|
39946
40347
|
const market = this.market(symbol);
|
|
39947
40348
|
const request = {
|
|
39948
40349
|
'symbol': market['id'],
|
|
@@ -39959,10 +40360,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39959
40360
|
}
|
|
39960
40361
|
}
|
|
39961
40362
|
if (until !== undefined) {
|
|
39962
|
-
this.
|
|
40363
|
+
params = this.omit(params, 'until');
|
|
39963
40364
|
request['endTime'] = until;
|
|
39964
40365
|
}
|
|
39965
|
-
params = this.omit(params, 'until');
|
|
39966
40366
|
const options = this.safeValue(this.options, 'fetchTrades', {});
|
|
39967
40367
|
let response = undefined;
|
|
39968
40368
|
if (market['spot']) {
|
|
@@ -40184,9 +40584,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40184
40584
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
40185
40585
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
40186
40586
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
40587
|
+
* @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)
|
|
40187
40588
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
40188
40589
|
*/
|
|
40189
40590
|
await this.loadMarkets();
|
|
40591
|
+
let paginate = false;
|
|
40592
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
40593
|
+
if (paginate) {
|
|
40594
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
40595
|
+
}
|
|
40190
40596
|
const market = this.market(symbol);
|
|
40191
40597
|
const request = {
|
|
40192
40598
|
'symbol': market['id'],
|
|
@@ -41282,9 +41688,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41282
41688
|
if (typeof response === 'string') {
|
|
41283
41689
|
response = JSON.parse(response);
|
|
41284
41690
|
}
|
|
41285
|
-
|
|
41691
|
+
const data = this.safeValue(response, 'data', []);
|
|
41286
41692
|
if (!Array.isArray(data)) {
|
|
41287
|
-
|
|
41693
|
+
const result = this.safeValue(data, 'orderList', []);
|
|
41694
|
+
return this.addPaginationCursorToResult(data, result);
|
|
41288
41695
|
}
|
|
41289
41696
|
return this.parseOrders(data, market, since, limit);
|
|
41290
41697
|
}
|
|
@@ -41295,15 +41702,26 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41295
41702
|
* @description fetches information on multiple closed orders made by the user
|
|
41296
41703
|
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
|
|
41297
41704
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders
|
|
41705
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl
|
|
41706
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-history-plan-orders
|
|
41298
41707
|
* @param {string} symbol unified market symbol of the closed orders
|
|
41299
41708
|
* @param {int} [since] timestamp in ms of the earliest order
|
|
41300
41709
|
* @param {int} [limit] the max number of closed orders to return
|
|
41301
41710
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
41711
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
41302
41712
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
41303
41713
|
*/
|
|
41304
41714
|
await this.loadMarkets();
|
|
41305
41715
|
this.checkRequiredSymbol('fetchClosedOrders', symbol);
|
|
41306
41716
|
const market = this.market(symbol);
|
|
41717
|
+
let paginate = false;
|
|
41718
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
41719
|
+
if (paginate) {
|
|
41720
|
+
const isStop = this.safeValue2(params, 'stop', 'trigger', false);
|
|
41721
|
+
const cursorReceived = (market['spot'] && !isStop) ? 'orderId' : 'endId';
|
|
41722
|
+
const cursorSent = (market['spot'] && !isStop) ? 'after' : 'lastEndId';
|
|
41723
|
+
return await this.fetchPaginatedCallCursor('fetchClosedOrders', symbol, since, limit, params, cursorReceived, cursorSent, undefined, 50);
|
|
41724
|
+
}
|
|
41307
41725
|
const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
|
|
41308
41726
|
const result = [];
|
|
41309
41727
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -41322,15 +41740,26 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41322
41740
|
* @description fetches information on multiple canceled orders made by the user
|
|
41323
41741
|
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
|
|
41324
41742
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders
|
|
41743
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl
|
|
41744
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-history-plan-orders
|
|
41325
41745
|
* @param {string} symbol unified market symbol of the canceled orders
|
|
41326
41746
|
* @param {int} [since] timestamp in ms of the earliest order
|
|
41327
41747
|
* @param {int} [limit] the max number of canceled orders to return
|
|
41328
41748
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
41749
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
41329
41750
|
* @returns {object} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
41330
41751
|
*/
|
|
41331
41752
|
await this.loadMarkets();
|
|
41332
41753
|
this.checkRequiredSymbol('fetchCanceledOrders', symbol);
|
|
41333
41754
|
const market = this.market(symbol);
|
|
41755
|
+
let paginate = false;
|
|
41756
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledOrders', 'paginate');
|
|
41757
|
+
if (paginate) {
|
|
41758
|
+
const isStop = this.safeValue2(params, 'stop', 'trigger', false);
|
|
41759
|
+
const cursorReceived = (market['spot'] && !isStop) ? 'orderId' : 'endId';
|
|
41760
|
+
const cursorSent = (market['spot'] && !isStop) ? 'after' : 'lastEndId';
|
|
41761
|
+
return await this.fetchPaginatedCallCursor('fetchCanceledOrders', symbol, since, limit, params, cursorReceived, cursorSent, undefined, 50);
|
|
41762
|
+
}
|
|
41334
41763
|
const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
|
|
41335
41764
|
const result = [];
|
|
41336
41765
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -41347,9 +41776,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41347
41776
|
const market = this.market(symbol);
|
|
41348
41777
|
let marketType = undefined;
|
|
41349
41778
|
[marketType, params] = this.handleMarketTypeAndParams('fetchCanceledAndClosedOrders', market, params);
|
|
41779
|
+
const endTime = this.safeIntegerN(params, ['endTime', 'until', 'till']);
|
|
41780
|
+
params = this.omit(params, ['until', 'till']);
|
|
41350
41781
|
const request = {
|
|
41351
41782
|
'symbol': market['id'],
|
|
41352
41783
|
};
|
|
41784
|
+
if (since !== undefined) {
|
|
41785
|
+
request['startTime'] = since;
|
|
41786
|
+
}
|
|
41353
41787
|
let method = this.getSupportedMapping(marketType, {
|
|
41354
41788
|
'spot': 'privateSpotPostTradeHistory',
|
|
41355
41789
|
'swap': 'privateMixGetOrderHistory',
|
|
@@ -41374,7 +41808,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41374
41808
|
since = 0;
|
|
41375
41809
|
}
|
|
41376
41810
|
request['startTime'] = since;
|
|
41377
|
-
|
|
41811
|
+
if (endTime === undefined) {
|
|
41812
|
+
request['endTime'] = this.milliseconds();
|
|
41813
|
+
}
|
|
41814
|
+
else {
|
|
41815
|
+
request['endTime'] = endTime;
|
|
41816
|
+
}
|
|
41817
|
+
}
|
|
41818
|
+
else {
|
|
41819
|
+
if (limit !== undefined) {
|
|
41820
|
+
request['pageSize'] = limit;
|
|
41821
|
+
}
|
|
41822
|
+
if (endTime !== undefined) {
|
|
41823
|
+
request['endTime'] = endTime;
|
|
41824
|
+
}
|
|
41378
41825
|
}
|
|
41379
41826
|
const response = await this[method](this.extend(request, params));
|
|
41380
41827
|
//
|
|
@@ -41495,30 +41942,57 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41495
41942
|
//
|
|
41496
41943
|
const data = this.safeValue(response, 'data');
|
|
41497
41944
|
if (data !== undefined) {
|
|
41498
|
-
|
|
41945
|
+
const result = this.safeValue(data, 'orderList', data);
|
|
41946
|
+
return this.addPaginationCursorToResult(data, result);
|
|
41499
41947
|
}
|
|
41500
41948
|
const parsedData = JSON.parse(response);
|
|
41501
41949
|
return this.safeValue(parsedData, 'data', []);
|
|
41502
41950
|
}
|
|
41951
|
+
addPaginationCursorToResult(response, data) {
|
|
41952
|
+
const endId = this.safeValue(response, 'endId');
|
|
41953
|
+
if (endId !== undefined) {
|
|
41954
|
+
const dataLength = data.length;
|
|
41955
|
+
if (dataLength > 0) {
|
|
41956
|
+
const first = data[0];
|
|
41957
|
+
const last = data[dataLength - 1];
|
|
41958
|
+
first['endId'] = endId;
|
|
41959
|
+
last['endId'] = endId;
|
|
41960
|
+
data[0] = first;
|
|
41961
|
+
data[dataLength - 1] = last;
|
|
41962
|
+
}
|
|
41963
|
+
}
|
|
41964
|
+
return data;
|
|
41965
|
+
}
|
|
41503
41966
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
41504
41967
|
/**
|
|
41505
41968
|
* @method
|
|
41506
41969
|
* @name bitget#fetchLedger
|
|
41507
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
41508
41970
|
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-bills
|
|
41971
|
+
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
41509
41972
|
* @param {string} code unified currency code, default is undefined
|
|
41510
41973
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
41511
41974
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
41512
41975
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
41976
|
+
* @param {int} [params.until] end tim in ms
|
|
41977
|
+
* @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)
|
|
41513
41978
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
41514
41979
|
*/
|
|
41515
41980
|
await this.loadMarkets();
|
|
41981
|
+
let paginate = false;
|
|
41982
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
41983
|
+
if (paginate) {
|
|
41984
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 500);
|
|
41985
|
+
}
|
|
41516
41986
|
let currency = undefined;
|
|
41517
|
-
|
|
41987
|
+
let request = {};
|
|
41518
41988
|
if (code !== undefined) {
|
|
41519
41989
|
currency = this.currency(code);
|
|
41520
41990
|
request['coinId'] = currency['id'];
|
|
41521
41991
|
}
|
|
41992
|
+
if (since !== undefined) {
|
|
41993
|
+
request['before'] = since;
|
|
41994
|
+
}
|
|
41995
|
+
[request, params] = this.handleUntilOption('after', params, request);
|
|
41522
41996
|
const response = await this.privateSpotPostAccountBills(this.extend(request, params));
|
|
41523
41997
|
//
|
|
41524
41998
|
// {
|
|
@@ -41600,12 +42074,24 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41600
42074
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
41601
42075
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
41602
42076
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
42077
|
+
* @param {int} [params.until] *swap only* the latest time in ms to fetch entries for
|
|
42078
|
+
* @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)
|
|
41603
42079
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
41604
42080
|
*/
|
|
41605
42081
|
this.checkRequiredSymbol('fetchMyTrades', symbol);
|
|
41606
42082
|
await this.loadMarkets();
|
|
41607
42083
|
const market = this.market(symbol);
|
|
41608
|
-
|
|
42084
|
+
let paginate = false;
|
|
42085
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
42086
|
+
if (paginate) {
|
|
42087
|
+
if (market['spot']) {
|
|
42088
|
+
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, 'orderId', 'after', undefined, 50);
|
|
42089
|
+
}
|
|
42090
|
+
else {
|
|
42091
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params, 500);
|
|
42092
|
+
}
|
|
42093
|
+
}
|
|
42094
|
+
let request = {
|
|
41609
42095
|
'symbol': market['id'],
|
|
41610
42096
|
};
|
|
41611
42097
|
if (limit !== undefined) {
|
|
@@ -41616,6 +42102,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41616
42102
|
response = await this.privateSpotPostTradeFills(this.extend(request, params));
|
|
41617
42103
|
}
|
|
41618
42104
|
else {
|
|
42105
|
+
if (since !== undefined) {
|
|
42106
|
+
request['startTime'] = since;
|
|
42107
|
+
}
|
|
42108
|
+
[request, params] = this.handleUntilOption('endTime', params, request);
|
|
41619
42109
|
response = await this.privateMixGetOrderFills(this.extend(request, params));
|
|
41620
42110
|
}
|
|
41621
42111
|
//
|
|
@@ -42013,6 +42503,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42013
42503
|
/**
|
|
42014
42504
|
* @method
|
|
42015
42505
|
* @name bitget#fetchFundingRateHistory
|
|
42506
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-funding-rate
|
|
42016
42507
|
* @description fetches historical funding rate prices
|
|
42017
42508
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-funding-rate
|
|
42018
42509
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
@@ -42489,16 +42980,23 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42489
42980
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
42490
42981
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
42491
42982
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
42983
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
42984
|
+
* @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)
|
|
42492
42985
|
* @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
|
|
42493
42986
|
*/
|
|
42494
42987
|
await this.loadMarkets();
|
|
42988
|
+
let paginate = false;
|
|
42989
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
|
|
42990
|
+
if (paginate) {
|
|
42991
|
+
return await this.fetchPaginatedCallDynamic('fetchTransfers', code, since, limit, params);
|
|
42992
|
+
}
|
|
42495
42993
|
let type = undefined;
|
|
42496
42994
|
[type, params] = this.handleMarketTypeAndParams('fetchTransfers', undefined, params);
|
|
42497
42995
|
const fromAccount = this.safeString(params, 'fromAccount', type);
|
|
42498
42996
|
params = this.omit(params, 'fromAccount');
|
|
42499
42997
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
42500
42998
|
type = this.safeString(accountsByType, fromAccount);
|
|
42501
|
-
|
|
42999
|
+
let request = {
|
|
42502
43000
|
'fromType': type,
|
|
42503
43001
|
};
|
|
42504
43002
|
let currency = undefined;
|
|
@@ -42512,6 +43010,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42512
43010
|
if (limit !== undefined) {
|
|
42513
43011
|
request['limit'] = limit;
|
|
42514
43012
|
}
|
|
43013
|
+
[request, params] = this.handleUntilOption('after', params, request);
|
|
42515
43014
|
const response = await this.privateSpotGetAccountTransferRecords(this.extend(request, params));
|
|
42516
43015
|
//
|
|
42517
43016
|
// {
|
|
@@ -48820,14 +49319,22 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48820
49319
|
/**
|
|
48821
49320
|
* @method
|
|
48822
49321
|
* @name bitmex#fetchOrders
|
|
49322
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
48823
49323
|
* @description fetches information on multiple orders made by the user
|
|
48824
49324
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
48825
49325
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
48826
49326
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
48827
49327
|
* @param {object} [params] extra parameters specific to the bitmex api endpoint
|
|
49328
|
+
* @param {int} [params.until] the earliest time in ms to fetch orders for
|
|
49329
|
+
* @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)
|
|
48828
49330
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
48829
49331
|
*/
|
|
48830
49332
|
await this.loadMarkets();
|
|
49333
|
+
let paginate = false;
|
|
49334
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
49335
|
+
if (paginate) {
|
|
49336
|
+
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params, 100);
|
|
49337
|
+
}
|
|
48831
49338
|
let market = undefined;
|
|
48832
49339
|
let request = {};
|
|
48833
49340
|
if (symbol !== undefined) {
|
|
@@ -48840,6 +49347,11 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48840
49347
|
if (limit !== undefined) {
|
|
48841
49348
|
request['count'] = limit;
|
|
48842
49349
|
}
|
|
49350
|
+
const until = this.safeInteger2(params, 'until', 'endTime');
|
|
49351
|
+
if (until !== undefined) {
|
|
49352
|
+
params = this.omit(params, ['until']);
|
|
49353
|
+
request['endTime'] = this.iso8601(until);
|
|
49354
|
+
}
|
|
48843
49355
|
request = this.deepExtend(request, params);
|
|
48844
49356
|
// why the hassle? urlencode in python is kinda broken for nested dicts.
|
|
48845
49357
|
// E.g. self.urlencode({"filter": {"open": True}}) will return "filter={'open':+True}"
|
|
@@ -48887,14 +49399,21 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48887
49399
|
/**
|
|
48888
49400
|
* @method
|
|
48889
49401
|
* @name bitmex#fetchMyTrades
|
|
49402
|
+
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
48890
49403
|
* @description fetch all trades made by the user
|
|
48891
49404
|
* @param {string} symbol unified market symbol
|
|
48892
49405
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
48893
49406
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
48894
49407
|
* @param {object} [params] extra parameters specific to the bitmex api endpoint
|
|
49408
|
+
* @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)
|
|
48895
49409
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
48896
49410
|
*/
|
|
48897
49411
|
await this.loadMarkets();
|
|
49412
|
+
let paginate = false;
|
|
49413
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
49414
|
+
if (paginate) {
|
|
49415
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params, 100);
|
|
49416
|
+
}
|
|
48898
49417
|
let market = undefined;
|
|
48899
49418
|
let request = {};
|
|
48900
49419
|
if (symbol !== undefined) {
|
|
@@ -48907,6 +49426,11 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48907
49426
|
if (limit !== undefined) {
|
|
48908
49427
|
request['count'] = limit;
|
|
48909
49428
|
}
|
|
49429
|
+
const until = this.safeInteger2(params, 'until', 'endTime');
|
|
49430
|
+
if (until !== undefined) {
|
|
49431
|
+
params = this.omit(params, ['until']);
|
|
49432
|
+
request['endTime'] = this.iso8601(until);
|
|
49433
|
+
}
|
|
48910
49434
|
request = this.deepExtend(request, params);
|
|
48911
49435
|
// why the hassle? urlencode in python is kinda broken for nested dicts.
|
|
48912
49436
|
// E.g. self.urlencode({"filter": {"open": True}}) will return "filter={'open':+True}"
|
|
@@ -49355,15 +49879,22 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49355
49879
|
/**
|
|
49356
49880
|
* @method
|
|
49357
49881
|
* @name bitmex#fetchOHLCV
|
|
49882
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
49358
49883
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
49359
49884
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
49360
49885
|
* @param {string} timeframe the length of time each candle represents
|
|
49361
49886
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
49362
49887
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
49363
49888
|
* @param {object} [params] extra parameters specific to the bitmex api endpoint
|
|
49889
|
+
* @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)
|
|
49364
49890
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
49365
49891
|
*/
|
|
49366
49892
|
await this.loadMarkets();
|
|
49893
|
+
let paginate = false;
|
|
49894
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
49895
|
+
if (paginate) {
|
|
49896
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params);
|
|
49897
|
+
}
|
|
49367
49898
|
// send JSON key/value pairs, such as {"key": "value"}
|
|
49368
49899
|
// filter by individual fields and do advanced queries on timestamps
|
|
49369
49900
|
// let filter = { 'key': 'value' };
|
|
@@ -49384,6 +49915,11 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49384
49915
|
if (limit !== undefined) {
|
|
49385
49916
|
request['count'] = limit; // default 100, max 500
|
|
49386
49917
|
}
|
|
49918
|
+
const until = this.safeInteger2(params, 'until', 'endTime');
|
|
49919
|
+
if (until !== undefined) {
|
|
49920
|
+
params = this.omit(params, ['until']);
|
|
49921
|
+
request['endTime'] = this.iso8601(until);
|
|
49922
|
+
}
|
|
49387
49923
|
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
49388
49924
|
const fetchOHLCVOpenTimestamp = this.safeValue(this.options, 'fetchOHLCVOpenTimestamp', true);
|
|
49389
49925
|
// if since is not set, they will return candles starting from 2017-01-01
|
|
@@ -49667,14 +50203,21 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49667
50203
|
/**
|
|
49668
50204
|
* @method
|
|
49669
50205
|
* @name bitmex#fetchTrades
|
|
50206
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
49670
50207
|
* @description get the list of most recent trades for a particular symbol
|
|
49671
50208
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
49672
50209
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
49673
50210
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
49674
50211
|
* @param {object} [params] extra parameters specific to the bitmex api endpoint
|
|
50212
|
+
* @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)
|
|
49675
50213
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
49676
50214
|
*/
|
|
49677
50215
|
await this.loadMarkets();
|
|
50216
|
+
let paginate = false;
|
|
50217
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
50218
|
+
if (paginate) {
|
|
50219
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
50220
|
+
}
|
|
49678
50221
|
const market = this.market(symbol);
|
|
49679
50222
|
const request = {
|
|
49680
50223
|
'symbol': market['id'],
|
|
@@ -49689,6 +50232,11 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
49689
50232
|
if (limit !== undefined) {
|
|
49690
50233
|
request['count'] = Math.min(limit, 1000); // api maximum 1000
|
|
49691
50234
|
}
|
|
50235
|
+
const until = this.safeInteger2(params, 'until', 'endTime');
|
|
50236
|
+
if (until !== undefined) {
|
|
50237
|
+
params = this.omit(params, ['until']);
|
|
50238
|
+
request['endTime'] = this.iso8601(until);
|
|
50239
|
+
}
|
|
49692
50240
|
const response = await this.publicGetTrade(this.extend(request, params));
|
|
49693
50241
|
//
|
|
49694
50242
|
// [
|
|
@@ -73289,10 +73837,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73289
73837
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
73290
73838
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
73291
73839
|
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
73840
|
+
* @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)
|
|
73292
73841
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
73293
73842
|
*/
|
|
73294
73843
|
this.checkRequiredSymbol('fetchOHLCV', symbol);
|
|
73295
73844
|
await this.loadMarkets();
|
|
73845
|
+
let paginate = false;
|
|
73846
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
73847
|
+
if (paginate) {
|
|
73848
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
73849
|
+
}
|
|
73296
73850
|
const market = this.market(symbol);
|
|
73297
73851
|
const request = {
|
|
73298
73852
|
'symbol': market['id'],
|
|
@@ -73527,6 +74081,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73527
74081
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
73528
74082
|
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
73529
74083
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
74084
|
+
* @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)
|
|
73530
74085
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
73531
74086
|
*/
|
|
73532
74087
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
@@ -73534,6 +74089,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73534
74089
|
if (limit === undefined) {
|
|
73535
74090
|
limit = 200;
|
|
73536
74091
|
}
|
|
74092
|
+
let paginate = false;
|
|
74093
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
74094
|
+
if (paginate) {
|
|
74095
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 200);
|
|
74096
|
+
}
|
|
73537
74097
|
const request = {
|
|
73538
74098
|
// 'category': '', // Product type. linear,inverse
|
|
73539
74099
|
// 'symbol': '', // Symbol name
|
|
@@ -75353,9 +75913,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75353
75913
|
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
75354
75914
|
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
75355
75915
|
* @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
|
|
75916
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
75917
|
+
* @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)
|
|
75356
75918
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
75357
75919
|
*/
|
|
75358
75920
|
await this.loadMarkets();
|
|
75921
|
+
let paginate = false;
|
|
75922
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
75923
|
+
if (paginate) {
|
|
75924
|
+
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
|
|
75925
|
+
}
|
|
75359
75926
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
75360
75927
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
75361
75928
|
const request = {};
|
|
@@ -75727,9 +76294,15 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75727
76294
|
* @param {boolean} [params.stop] true if stop order
|
|
75728
76295
|
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
75729
76296
|
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
76297
|
+
* @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)
|
|
75730
76298
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
75731
76299
|
*/
|
|
75732
76300
|
await this.loadMarkets();
|
|
76301
|
+
let paginate = false;
|
|
76302
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
76303
|
+
if (paginate) {
|
|
76304
|
+
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 100);
|
|
76305
|
+
}
|
|
75733
76306
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
75734
76307
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
75735
76308
|
const request = {};
|
|
@@ -75943,11 +76516,17 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75943
76516
|
* @param {int} [params.until] the latest time in ms to fetch deposits for, default = 30 days after since
|
|
75944
76517
|
*
|
|
75945
76518
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
76519
|
+
* @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)
|
|
75946
76520
|
* @param {string} [params.cursor] used for pagination
|
|
75947
76521
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
75948
76522
|
*/
|
|
75949
76523
|
await this.loadMarkets();
|
|
75950
|
-
|
|
76524
|
+
let paginate = false;
|
|
76525
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
76526
|
+
if (paginate) {
|
|
76527
|
+
return await this.fetchPaginatedCallCursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
|
|
76528
|
+
}
|
|
76529
|
+
let request = {
|
|
75951
76530
|
// 'coin': currency['id'],
|
|
75952
76531
|
// 'limit': 20, // max 50
|
|
75953
76532
|
// 'cursor': '',
|
|
@@ -75963,6 +76542,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75963
76542
|
if (limit !== undefined) {
|
|
75964
76543
|
request['limit'] = limit;
|
|
75965
76544
|
}
|
|
76545
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
75966
76546
|
const response = await this.privateGetV5AssetDepositQueryRecord(this.extend(request, params));
|
|
75967
76547
|
//
|
|
75968
76548
|
// {
|
|
@@ -76004,10 +76584,17 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76004
76584
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
76005
76585
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
76006
76586
|
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
76587
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
76588
|
+
* @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)
|
|
76007
76589
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
76008
76590
|
*/
|
|
76009
76591
|
await this.loadMarkets();
|
|
76010
|
-
|
|
76592
|
+
let paginate = false;
|
|
76593
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
76594
|
+
if (paginate) {
|
|
76595
|
+
return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
|
|
76596
|
+
}
|
|
76597
|
+
let request = {
|
|
76011
76598
|
// 'coin': currency['id'],
|
|
76012
76599
|
// 'limit': 20, // max 50
|
|
76013
76600
|
// 'cusor': '',
|
|
@@ -76023,6 +76610,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76023
76610
|
if (limit !== undefined) {
|
|
76024
76611
|
request['limit'] = limit;
|
|
76025
76612
|
}
|
|
76613
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
76026
76614
|
const response = await this.privateGetV5AssetWithdrawQueryRecord(this.extend(request, params));
|
|
76027
76615
|
//
|
|
76028
76616
|
// {
|
|
@@ -77288,6 +77876,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77288
77876
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + 'fetchOpenInterestHistory cannot use the 1m timeframe');
|
|
77289
77877
|
}
|
|
77290
77878
|
await this.loadMarkets();
|
|
77879
|
+
const paginate = this.safeValue(params, 'paginate');
|
|
77880
|
+
if (paginate) {
|
|
77881
|
+
params = this.omit(params, 'paginate');
|
|
77882
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500);
|
|
77883
|
+
}
|
|
77291
77884
|
const market = this.market(symbol);
|
|
77292
77885
|
if (market['spot'] || market['option']) {
|
|
77293
77886
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOpenInterestHistory() symbol does not support market ' + symbol);
|
|
@@ -77503,11 +78096,18 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77503
78096
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
77504
78097
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
77505
78098
|
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
78099
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
78100
|
+
* @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)
|
|
77506
78101
|
* @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
|
|
77507
78102
|
*/
|
|
77508
78103
|
await this.loadMarkets();
|
|
78104
|
+
let paginate = false;
|
|
78105
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
|
|
78106
|
+
if (paginate) {
|
|
78107
|
+
return await this.fetchPaginatedCallCursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
|
|
78108
|
+
}
|
|
77509
78109
|
let currency = undefined;
|
|
77510
|
-
|
|
78110
|
+
let request = {};
|
|
77511
78111
|
if (code !== undefined) {
|
|
77512
78112
|
currency = this.safeCurrencyCode(code);
|
|
77513
78113
|
request['coin'] = currency;
|
|
@@ -77518,6 +78118,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77518
78118
|
if (limit !== undefined) {
|
|
77519
78119
|
request['limit'] = limit;
|
|
77520
78120
|
}
|
|
78121
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
77521
78122
|
const response = await this.privateGetV5AssetTransferQueryInterTransferList(this.extend(request, params));
|
|
77522
78123
|
//
|
|
77523
78124
|
// {
|
|
@@ -82423,9 +83024,16 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82423
83024
|
* @param {int} [since] the earliest time in ms to fetch orders
|
|
82424
83025
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
82425
83026
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83027
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
83028
|
+
* @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)
|
|
82426
83029
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
82427
83030
|
*/
|
|
82428
83031
|
await this.loadMarkets();
|
|
83032
|
+
let paginate = false;
|
|
83033
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
83034
|
+
if (paginate) {
|
|
83035
|
+
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 100);
|
|
83036
|
+
}
|
|
82429
83037
|
let market = undefined;
|
|
82430
83038
|
if (symbol !== undefined) {
|
|
82431
83039
|
market = this.market(symbol);
|
|
@@ -82440,6 +83048,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82440
83048
|
if (since !== undefined) {
|
|
82441
83049
|
request['start_date'] = this.iso8601(since);
|
|
82442
83050
|
}
|
|
83051
|
+
const until = this.safeValueN(params, ['until', 'till']);
|
|
83052
|
+
if (until !== undefined) {
|
|
83053
|
+
params = this.omit(params, ['until', 'till']);
|
|
83054
|
+
request['end_date'] = this.iso8601(until);
|
|
83055
|
+
}
|
|
82443
83056
|
const response = await this.v3PrivateGetBrokerageOrdersHistoricalBatch(this.extend(request, params));
|
|
82444
83057
|
//
|
|
82445
83058
|
// {
|
|
@@ -82484,6 +83097,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82484
83097
|
// }
|
|
82485
83098
|
//
|
|
82486
83099
|
const orders = this.safeValue(response, 'orders', []);
|
|
83100
|
+
const first = this.safeValue(orders, 0);
|
|
83101
|
+
const cursor = this.safeString(response, 'cursor');
|
|
83102
|
+
if ((cursor !== undefined) && (cursor !== '')) {
|
|
83103
|
+
first['cursor'] = cursor;
|
|
83104
|
+
orders[0] = first;
|
|
83105
|
+
}
|
|
82487
83106
|
return this.parseOrders(orders, market, since, limit);
|
|
82488
83107
|
}
|
|
82489
83108
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -82505,6 +83124,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82505
83124
|
if (since !== undefined) {
|
|
82506
83125
|
request['start_date'] = this.iso8601(since);
|
|
82507
83126
|
}
|
|
83127
|
+
const until = this.safeValueN(params, ['until', 'till']);
|
|
83128
|
+
if (until !== undefined) {
|
|
83129
|
+
params = this.omit(params, ['until', 'till']);
|
|
83130
|
+
request['end_date'] = this.iso8601(until);
|
|
83131
|
+
}
|
|
82508
83132
|
const response = await this.v3PrivateGetBrokerageOrdersHistoricalBatch(this.extend(request, params));
|
|
82509
83133
|
//
|
|
82510
83134
|
// {
|
|
@@ -82549,6 +83173,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82549
83173
|
// }
|
|
82550
83174
|
//
|
|
82551
83175
|
const orders = this.safeValue(response, 'orders', []);
|
|
83176
|
+
const first = this.safeValue(orders, 0);
|
|
83177
|
+
const cursor = this.safeString(response, 'cursor');
|
|
83178
|
+
if ((cursor !== undefined) && (cursor !== '')) {
|
|
83179
|
+
first['cursor'] = cursor;
|
|
83180
|
+
orders[0] = first;
|
|
83181
|
+
}
|
|
82552
83182
|
return this.parseOrders(orders, market, since, limit);
|
|
82553
83183
|
}
|
|
82554
83184
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -82561,8 +83191,16 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82561
83191
|
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
82562
83192
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
82563
83193
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83194
|
+
* @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)
|
|
83195
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
82564
83196
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
82565
83197
|
*/
|
|
83198
|
+
await this.loadMarkets();
|
|
83199
|
+
let paginate = false;
|
|
83200
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
83201
|
+
if (paginate) {
|
|
83202
|
+
return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 100);
|
|
83203
|
+
}
|
|
82566
83204
|
return await this.fetchOrdersByStatus('OPEN', symbol, since, limit, params);
|
|
82567
83205
|
}
|
|
82568
83206
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -82575,8 +83213,16 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82575
83213
|
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
82576
83214
|
* @param {int} [limit] the maximum number of closed order structures to retrieve
|
|
82577
83215
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83216
|
+
* @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)
|
|
83217
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
82578
83218
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
82579
83219
|
*/
|
|
83220
|
+
await this.loadMarkets();
|
|
83221
|
+
let paginate = false;
|
|
83222
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
83223
|
+
if (paginate) {
|
|
83224
|
+
return await this.fetchPaginatedCallCursor('fetchClosedOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 100);
|
|
83225
|
+
}
|
|
82580
83226
|
return await this.fetchOrdersByStatus('FILLED', symbol, since, limit, params);
|
|
82581
83227
|
}
|
|
82582
83228
|
async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -82604,24 +83250,40 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82604
83250
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
82605
83251
|
* @param {int} [limit] the maximum amount of candles to fetch, not used by coinbase
|
|
82606
83252
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83253
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
83254
|
+
* @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)
|
|
82607
83255
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
82608
83256
|
*/
|
|
82609
83257
|
await this.loadMarkets();
|
|
83258
|
+
let paginate = false;
|
|
83259
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
83260
|
+
if (paginate) {
|
|
83261
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 299);
|
|
83262
|
+
}
|
|
82610
83263
|
const market = this.market(symbol);
|
|
82611
|
-
const end = this.seconds().toString();
|
|
82612
83264
|
const request = {
|
|
82613
83265
|
'product_id': market['id'],
|
|
82614
83266
|
'granularity': this.safeString(this.timeframes, timeframe, timeframe),
|
|
82615
|
-
'end': end,
|
|
82616
83267
|
};
|
|
83268
|
+
const until = this.safeValueN(params, ['until', 'till', 'end']);
|
|
83269
|
+
params = this.omit(params, ['until', 'till']);
|
|
83270
|
+
const duration = this.parseTimeframe(timeframe);
|
|
83271
|
+
const candles300 = 300 * duration;
|
|
83272
|
+
let sinceString = undefined;
|
|
82617
83273
|
if (since !== undefined) {
|
|
82618
|
-
|
|
82619
|
-
const timeframeToSeconds = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(sinceString, '1000');
|
|
82620
|
-
request['start'] = this.decimalToPrecision(timeframeToSeconds, _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TRUNCATE */ .tk, 0, _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .DECIMAL_PLACES */ .nr);
|
|
83274
|
+
sinceString = this.numberToString(this.parseToInt(since / 1000));
|
|
82621
83275
|
}
|
|
82622
83276
|
else {
|
|
82623
|
-
|
|
83277
|
+
const now = this.seconds().toString();
|
|
83278
|
+
sinceString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(now, candles300.toString());
|
|
83279
|
+
}
|
|
83280
|
+
request['start'] = sinceString;
|
|
83281
|
+
let endString = this.numberToString(until);
|
|
83282
|
+
if (until === undefined) {
|
|
83283
|
+
// 300 candles max
|
|
83284
|
+
endString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(sinceString, candles300.toString());
|
|
82624
83285
|
}
|
|
83286
|
+
request['end'] = endString;
|
|
82625
83287
|
const response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
|
|
82626
83288
|
//
|
|
82627
83289
|
// {
|
|
@@ -82712,9 +83374,16 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82712
83374
|
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
82713
83375
|
* @param {int} [limit] the maximum number of trade structures to fetch
|
|
82714
83376
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
83377
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
83378
|
+
* @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)
|
|
82715
83379
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
82716
83380
|
*/
|
|
82717
83381
|
await this.loadMarkets();
|
|
83382
|
+
let paginate = false;
|
|
83383
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
83384
|
+
if (paginate) {
|
|
83385
|
+
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, 'cursor', 'cursor', undefined, 100);
|
|
83386
|
+
}
|
|
82718
83387
|
let market = undefined;
|
|
82719
83388
|
if (symbol !== undefined) {
|
|
82720
83389
|
market = this.market(symbol);
|
|
@@ -82729,6 +83398,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82729
83398
|
if (since !== undefined) {
|
|
82730
83399
|
request['start_sequence_timestamp'] = this.iso8601(since);
|
|
82731
83400
|
}
|
|
83401
|
+
const until = this.safeValueN(params, ['until', 'till']);
|
|
83402
|
+
if (until !== undefined) {
|
|
83403
|
+
params = this.omit(params, ['until', 'till']);
|
|
83404
|
+
request['end_sequence_timestamp'] = this.iso8601(until);
|
|
83405
|
+
}
|
|
82732
83406
|
const response = await this.v3PrivateGetBrokerageOrdersHistoricalFills(this.extend(request, params));
|
|
82733
83407
|
//
|
|
82734
83408
|
// {
|
|
@@ -82754,6 +83428,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
82754
83428
|
// }
|
|
82755
83429
|
//
|
|
82756
83430
|
const trades = this.safeValue(response, 'fills', []);
|
|
83431
|
+
const first = this.safeValue(trades, 0);
|
|
83432
|
+
const cursor = this.safeString(response, 'cursor');
|
|
83433
|
+
if ((cursor !== undefined) && (cursor !== '')) {
|
|
83434
|
+
first['cursor'] = cursor;
|
|
83435
|
+
trades[0] = first;
|
|
83436
|
+
}
|
|
82757
83437
|
return this.parseTrades(trades, market, since, limit);
|
|
82758
83438
|
}
|
|
82759
83439
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
@@ -83778,9 +84458,15 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
83778
84458
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
83779
84459
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
83780
84460
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
84461
|
+
* @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)
|
|
83781
84462
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
83782
84463
|
*/
|
|
83783
84464
|
this.checkRequiredSymbol('fetchMyTrades', symbol);
|
|
84465
|
+
let paginate = false;
|
|
84466
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
84467
|
+
if (paginate) {
|
|
84468
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params, 100);
|
|
84469
|
+
}
|
|
83784
84470
|
await this.loadMarkets();
|
|
83785
84471
|
const market = this.market(symbol);
|
|
83786
84472
|
const request = {
|
|
@@ -83899,9 +84585,15 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
83899
84585
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
83900
84586
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
83901
84587
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
84588
|
+
* @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)
|
|
83902
84589
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
83903
84590
|
*/
|
|
83904
84591
|
await this.loadMarkets();
|
|
84592
|
+
let paginate = false;
|
|
84593
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
84594
|
+
if (paginate) {
|
|
84595
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 300);
|
|
84596
|
+
}
|
|
83905
84597
|
const market = this.market(symbol);
|
|
83906
84598
|
const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
|
|
83907
84599
|
const request = {
|
|
@@ -84128,9 +84820,15 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
84128
84820
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
84129
84821
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
84130
84822
|
* @param {int} [params.until] the latest time in ms to fetch open orders for
|
|
84823
|
+
* @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)
|
|
84131
84824
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
84132
84825
|
*/
|
|
84133
84826
|
await this.loadMarkets();
|
|
84827
|
+
let paginate = false;
|
|
84828
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
84829
|
+
if (paginate) {
|
|
84830
|
+
return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params, 100);
|
|
84831
|
+
}
|
|
84134
84832
|
const request = {};
|
|
84135
84833
|
let market = undefined;
|
|
84136
84834
|
if (symbol !== undefined) {
|
|
@@ -86613,7 +87311,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
86613
87311
|
// message: 'OK'
|
|
86614
87312
|
// }
|
|
86615
87313
|
//
|
|
86616
|
-
return this.
|
|
87314
|
+
return this.safeInteger(response, 'data');
|
|
86617
87315
|
}
|
|
86618
87316
|
async fetchOrderBook(symbol, limit = 20, params = {}) {
|
|
86619
87317
|
/**
|
|
@@ -94069,7 +94767,6 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
94069
94767
|
const quoteId = this.safeString(market, 'quoteAsset');
|
|
94070
94768
|
const base = this.safeCurrencyCode(baseId);
|
|
94071
94769
|
const quote = this.safeCurrencyCode(quoteId);
|
|
94072
|
-
const isActive = this.safeString(market, 'status') === 'TRADING';
|
|
94073
94770
|
const limits = this.indexBy(this.safeValue(market, 'filters'), 'filterType');
|
|
94074
94771
|
const amountLimits = this.safeValue(limits, 'LOT_SIZE', {});
|
|
94075
94772
|
const priceLimits = this.safeValue(limits, 'PRICE_FILTER', {});
|
|
@@ -94089,7 +94786,7 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
94089
94786
|
'swap': false,
|
|
94090
94787
|
'future': false,
|
|
94091
94788
|
'option': false,
|
|
94092
|
-
'active':
|
|
94789
|
+
'active': this.safeStringLower(market, 'status') === 'trading',
|
|
94093
94790
|
'contract': false,
|
|
94094
94791
|
'linear': undefined,
|
|
94095
94792
|
'inverse': undefined,
|
|
@@ -96584,9 +97281,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
96584
97281
|
* @param {int} [limit] the maximum number of order structures to retrieve, default 100 max 100
|
|
96585
97282
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
96586
97283
|
* @param {int} [params.until] timestamp in ms for the ending date filter, default is the current time
|
|
97284
|
+
* @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)
|
|
96587
97285
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
96588
97286
|
*/
|
|
96589
97287
|
await this.loadMarkets();
|
|
97288
|
+
let paginate = false;
|
|
97289
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
97290
|
+
if (paginate) {
|
|
97291
|
+
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
97292
|
+
}
|
|
96590
97293
|
let market = undefined;
|
|
96591
97294
|
const request = {};
|
|
96592
97295
|
if (symbol !== undefined) {
|
|
@@ -96659,9 +97362,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
96659
97362
|
* @param {int} [limit] the maximum number of trades to fetch
|
|
96660
97363
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
96661
97364
|
* @param {int} [params.until] timestamp in ms for the ending date filter, default is the current time
|
|
97365
|
+
* @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)
|
|
96662
97366
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
96663
97367
|
*/
|
|
96664
97368
|
await this.loadMarkets();
|
|
97369
|
+
let paginate = false;
|
|
97370
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
97371
|
+
if (paginate) {
|
|
97372
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
97373
|
+
}
|
|
96665
97374
|
const market = this.market(symbol);
|
|
96666
97375
|
const request = {
|
|
96667
97376
|
'instrument_name': market['id'],
|
|
@@ -96713,9 +97422,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
96713
97422
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
96714
97423
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
96715
97424
|
* @param {int} [params.until] timestamp in ms for the ending date filter, default is the current time
|
|
97425
|
+
* @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)
|
|
96716
97426
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
96717
97427
|
*/
|
|
96718
97428
|
await this.loadMarkets();
|
|
97429
|
+
let paginate = false;
|
|
97430
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
97431
|
+
if (paginate) {
|
|
97432
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 300);
|
|
97433
|
+
}
|
|
96719
97434
|
const market = this.market(symbol);
|
|
96720
97435
|
const request = {
|
|
96721
97436
|
'instrument_name': market['id'],
|
|
@@ -97205,9 +97920,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
97205
97920
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
97206
97921
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
97207
97922
|
* @param {int} [params.until] timestamp in ms for the ending date filter, default is the current time
|
|
97923
|
+
* @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)
|
|
97208
97924
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
97209
97925
|
*/
|
|
97210
97926
|
await this.loadMarkets();
|
|
97927
|
+
let paginate = false;
|
|
97928
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
97929
|
+
if (paginate) {
|
|
97930
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
97931
|
+
}
|
|
97211
97932
|
const request = {};
|
|
97212
97933
|
let market = undefined;
|
|
97213
97934
|
if (symbol !== undefined) {
|
|
@@ -98694,10 +99415,16 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
98694
99415
|
* @param {int} [limit] the maximum amount of [funding rate structures] to fetch
|
|
98695
99416
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
98696
99417
|
* @param {int} [params.until] timestamp in ms for the ending date filter, default is the current time
|
|
99418
|
+
* @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)
|
|
98697
99419
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
98698
99420
|
*/
|
|
98699
99421
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
98700
99422
|
await this.loadMarkets();
|
|
99423
|
+
let paginate = false;
|
|
99424
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
99425
|
+
if (paginate) {
|
|
99426
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
99427
|
+
}
|
|
98701
99428
|
const market = this.market(symbol);
|
|
98702
99429
|
if (!market['swap']) {
|
|
98703
99430
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' fetchFundingRateHistory() supports swap contracts only');
|
|
@@ -116460,10 +117187,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116460
117187
|
* @param {object} [params] extra parameters specific to the gateio api endpoint
|
|
116461
117188
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
116462
117189
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
117190
|
+
* @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)
|
|
116463
117191
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume (units in quote currency)
|
|
116464
117192
|
*/
|
|
116465
117193
|
await this.loadMarkets();
|
|
116466
117194
|
const market = this.market(symbol);
|
|
117195
|
+
let paginate = false;
|
|
117196
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
117197
|
+
if (paginate) {
|
|
117198
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
117199
|
+
}
|
|
116467
117200
|
if (market['option']) {
|
|
116468
117201
|
return await this.fetchOptionOHLCV(symbol, timeframe, since, limit, params);
|
|
116469
117202
|
}
|
|
@@ -116629,9 +117362,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116629
117362
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
116630
117363
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
116631
117364
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
117365
|
+
* @param {int} [params.until] timestamp in ms of the latest trade to fetch
|
|
117366
|
+
* @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)
|
|
116632
117367
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
116633
117368
|
*/
|
|
116634
117369
|
await this.loadMarkets();
|
|
117370
|
+
let paginate = false;
|
|
117371
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
117372
|
+
if (paginate) {
|
|
117373
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
117374
|
+
}
|
|
116635
117375
|
const market = this.market(symbol);
|
|
116636
117376
|
//
|
|
116637
117377
|
// spot
|
|
@@ -116662,6 +117402,11 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116662
117402
|
'future': 'publicDeliveryGetSettleTrades',
|
|
116663
117403
|
'option': 'publicOptionsGetTrades',
|
|
116664
117404
|
});
|
|
117405
|
+
const until = this.safeInteger2(params, 'to', 'until');
|
|
117406
|
+
if (until !== undefined) {
|
|
117407
|
+
params = this.omit(params, ['until']);
|
|
117408
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
117409
|
+
}
|
|
116665
117410
|
if (limit !== undefined) {
|
|
116666
117411
|
request['limit'] = limit; // default 100, max 1000
|
|
116667
117412
|
}
|
|
@@ -116769,9 +117514,15 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116769
117514
|
* @param {int} [params.offset] *contract only* list offset, starting from 0
|
|
116770
117515
|
* @param {string} [params.last_id] *contract only* specify list staring point using the id of last record in previous list-query results
|
|
116771
117516
|
* @param {int} [params.count_total] *contract only* whether to return total number matched, default to 0(no return)
|
|
117517
|
+
* @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)
|
|
116772
117518
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
116773
117519
|
*/
|
|
116774
117520
|
await this.loadMarkets();
|
|
117521
|
+
let paginate = false;
|
|
117522
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
117523
|
+
if (paginate) {
|
|
117524
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
117525
|
+
}
|
|
116775
117526
|
let type = undefined;
|
|
116776
117527
|
let marginMode = undefined;
|
|
116777
117528
|
let request = {};
|
|
@@ -117030,11 +117781,18 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117030
117781
|
* @param {string} code unified currency code
|
|
117031
117782
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
117032
117783
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
117784
|
+
* @param {int} [params.until] end time in ms
|
|
117033
117785
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
117786
|
+
* @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)
|
|
117034
117787
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
117035
117788
|
*/
|
|
117036
117789
|
await this.loadMarkets();
|
|
117037
|
-
|
|
117790
|
+
let paginate = false;
|
|
117791
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
117792
|
+
if (paginate) {
|
|
117793
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
117794
|
+
}
|
|
117795
|
+
let request = {};
|
|
117038
117796
|
let currency = undefined;
|
|
117039
117797
|
if (code !== undefined) {
|
|
117040
117798
|
currency = this.currency(code);
|
|
@@ -117048,6 +117806,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117048
117806
|
request['from'] = start;
|
|
117049
117807
|
request['to'] = this.sum(start, 30 * 24 * 60 * 60);
|
|
117050
117808
|
}
|
|
117809
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
117051
117810
|
const response = await this.privateWalletGetDeposits(this.extend(request, params));
|
|
117052
117811
|
return this.parseTransactions(response, currency);
|
|
117053
117812
|
}
|
|
@@ -117060,10 +117819,17 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117060
117819
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
117061
117820
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
117062
117821
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
117822
|
+
* @param {int} [params.until] end time in ms
|
|
117823
|
+
* @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)
|
|
117063
117824
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
117064
117825
|
*/
|
|
117065
117826
|
await this.loadMarkets();
|
|
117066
|
-
|
|
117827
|
+
let paginate = false;
|
|
117828
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
117829
|
+
if (paginate) {
|
|
117830
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
117831
|
+
}
|
|
117832
|
+
let request = {};
|
|
117067
117833
|
let currency = undefined;
|
|
117068
117834
|
if (code !== undefined) {
|
|
117069
117835
|
currency = this.currency(code);
|
|
@@ -117077,6 +117843,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117077
117843
|
request['from'] = start;
|
|
117078
117844
|
request['to'] = this.sum(start, 30 * 24 * 60 * 60);
|
|
117079
117845
|
}
|
|
117846
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
117080
117847
|
const response = await this.privateWalletGetWithdrawals(this.extend(request, params));
|
|
117081
117848
|
return this.parseTransactions(response, currency);
|
|
117082
117849
|
}
|
|
@@ -119365,6 +120132,11 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119365
120132
|
* @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
|
|
119366
120133
|
*/
|
|
119367
120134
|
await this.loadMarkets();
|
|
120135
|
+
let paginate = false;
|
|
120136
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate', false);
|
|
120137
|
+
if (paginate) {
|
|
120138
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 100);
|
|
120139
|
+
}
|
|
119368
120140
|
const market = this.market(symbol);
|
|
119369
120141
|
if (!market['swap']) {
|
|
119370
120142
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenInterest() supports swap markets only');
|
|
@@ -119623,13 +120395,20 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119623
120395
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
119624
120396
|
* @param {int} [limit] max number of ledger entries to return
|
|
119625
120397
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
120398
|
+
* @param {int} [params.until] end time in ms
|
|
120399
|
+
* @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)
|
|
119626
120400
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
119627
120401
|
*/
|
|
119628
120402
|
await this.loadMarkets();
|
|
120403
|
+
let paginate = false;
|
|
120404
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
120405
|
+
if (paginate) {
|
|
120406
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
120407
|
+
}
|
|
119629
120408
|
let type = undefined;
|
|
119630
120409
|
let currency = undefined;
|
|
119631
120410
|
let response = undefined;
|
|
119632
|
-
|
|
120411
|
+
let request = {};
|
|
119633
120412
|
[type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
|
|
119634
120413
|
if ((type === 'spot') || (type === 'margin')) {
|
|
119635
120414
|
if (code !== undefined) {
|
|
@@ -119649,6 +120428,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119649
120428
|
if (limit !== undefined) {
|
|
119650
120429
|
request['limit'] = limit;
|
|
119651
120430
|
}
|
|
120431
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
119652
120432
|
if (type === 'spot') {
|
|
119653
120433
|
response = await this.privateSpotGetAccountBook(this.extend(request, params));
|
|
119654
120434
|
}
|
|
@@ -129140,21 +129920,31 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129140
129920
|
/**
|
|
129141
129921
|
* @method
|
|
129142
129922
|
* @name huobi#fetchMyTrades
|
|
129923
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-match-results-via-multiple-fields-new
|
|
129924
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-match-results-via-multiple-fields-new
|
|
129925
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-match-results
|
|
129143
129926
|
* @description fetch all trades made by the user
|
|
129144
129927
|
* @param {string} symbol unified market symbol
|
|
129145
129928
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
129146
129929
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
129147
129930
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
129931
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
129932
|
+
* @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)
|
|
129148
129933
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
129149
129934
|
*/
|
|
129150
129935
|
await this.loadMarkets();
|
|
129936
|
+
let paginate = false;
|
|
129937
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
129938
|
+
if (paginate) {
|
|
129939
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
129940
|
+
}
|
|
129151
129941
|
let market = undefined;
|
|
129152
129942
|
if (symbol !== undefined) {
|
|
129153
129943
|
market = this.market(symbol);
|
|
129154
129944
|
}
|
|
129155
129945
|
let marketType = undefined;
|
|
129156
129946
|
[marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
129157
|
-
|
|
129947
|
+
let request = {
|
|
129158
129948
|
// spot -----------------------------------------------------------
|
|
129159
129949
|
// 'symbol': market['id'],
|
|
129160
129950
|
// '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',
|
|
@@ -129186,6 +129976,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129186
129976
|
request['start-time'] = since; // a date within 120 days from today
|
|
129187
129977
|
// request['end-time'] = this.sum (since, 172800000); // 48 hours window
|
|
129188
129978
|
}
|
|
129979
|
+
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
129189
129980
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
129190
129981
|
}
|
|
129191
129982
|
else {
|
|
@@ -129196,6 +129987,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129196
129987
|
request['start_time'] = since; // a date within 120 days from today
|
|
129197
129988
|
// request['end_time'] = this.sum (request['start_time'], 172800000); // 48 hours window
|
|
129198
129989
|
}
|
|
129990
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
129199
129991
|
if (limit !== undefined) {
|
|
129200
129992
|
request['page_size'] = limit; // default 100, max 500
|
|
129201
129993
|
}
|
|
@@ -129300,6 +130092,10 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129300
130092
|
/**
|
|
129301
130093
|
* @method
|
|
129302
130094
|
* @name huobi#fetchTrades
|
|
130095
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-most-recent-trades
|
|
130096
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#query-a-batch-of-trade-records-of-a-contract
|
|
130097
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-trade-records-of-a-contract
|
|
130098
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-trade-records-of-a-contract
|
|
129303
130099
|
* @description get the list of most recent trades for a particular symbol
|
|
129304
130100
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
129305
130101
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -129410,9 +130206,15 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129410
130206
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
129411
130207
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
129412
130208
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
130209
|
+
* @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)
|
|
129413
130210
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
129414
130211
|
*/
|
|
129415
130212
|
await this.loadMarkets();
|
|
130213
|
+
let paginate = false;
|
|
130214
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
130215
|
+
if (paginate) {
|
|
130216
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
130217
|
+
}
|
|
129416
130218
|
const market = this.market(symbol);
|
|
129417
130219
|
const request = {
|
|
129418
130220
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
@@ -130325,7 +131127,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130325
131127
|
}
|
|
130326
131128
|
await this.loadMarkets();
|
|
130327
131129
|
let market = undefined;
|
|
130328
|
-
|
|
131130
|
+
let request = {
|
|
130329
131131
|
// spot_private_get_v1_order_orders GET /v1/order/orders ----------
|
|
130330
131132
|
// 'symbol': market['id'], // required
|
|
130331
131133
|
// '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',
|
|
@@ -130350,6 +131152,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130350
131152
|
request['start-time'] = since; // a window of 48 hours within 180 days
|
|
130351
131153
|
request['end-time'] = this.sum(since, 48 * 60 * 60 * 1000);
|
|
130352
131154
|
}
|
|
131155
|
+
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
130353
131156
|
if (limit !== undefined) {
|
|
130354
131157
|
request['size'] = limit;
|
|
130355
131158
|
}
|
|
@@ -130393,7 +131196,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130393
131196
|
this.checkRequiredSymbol('fetchContractOrders', symbol);
|
|
130394
131197
|
await this.loadMarkets();
|
|
130395
131198
|
const market = this.market(symbol);
|
|
130396
|
-
|
|
131199
|
+
let request = {
|
|
130397
131200
|
// POST /api/v1/contract_hisorders inverse futures ----------------
|
|
130398
131201
|
// 'symbol': market['settleId'], // BTC, ETH, ...
|
|
130399
131202
|
// '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
|
|
@@ -130422,6 +131225,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130422
131225
|
request['contract'] = market['id'];
|
|
130423
131226
|
request['type'] = 1; // 1:All Orders,2:Order in Finished Status
|
|
130424
131227
|
}
|
|
131228
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
130425
131229
|
if (market['linear']) {
|
|
130426
131230
|
let marginMode = undefined;
|
|
130427
131231
|
[marginMode, params] = this.handleMarginModeAndParams('fetchContractOrders', params);
|
|
@@ -130632,6 +131436,12 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130632
131436
|
/**
|
|
130633
131437
|
* @method
|
|
130634
131438
|
* @name huobi#fetchOrders
|
|
131439
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
|
|
131440
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
|
|
131441
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
|
|
131442
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
|
|
131443
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
|
|
131444
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
|
|
130635
131445
|
* @description fetches information on multiple orders made by the user
|
|
130636
131446
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
130637
131447
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -130639,6 +131449,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130639
131449
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
130640
131450
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
130641
131451
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
131452
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
130642
131453
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
130643
131454
|
*/
|
|
130644
131455
|
await this.loadMarkets();
|
|
@@ -130665,14 +131476,27 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130665
131476
|
/**
|
|
130666
131477
|
* @method
|
|
130667
131478
|
* @name huobi#fetchClosedOrders
|
|
131479
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
|
|
131480
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
|
|
131481
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
|
|
131482
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
|
|
131483
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
|
|
131484
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
|
|
130668
131485
|
* @description fetches information on multiple closed orders made by the user
|
|
130669
131486
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
130670
131487
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
130671
131488
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
130672
131489
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
131490
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
131491
|
+
* @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)
|
|
130673
131492
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
130674
131493
|
*/
|
|
130675
131494
|
await this.loadMarkets();
|
|
131495
|
+
let paginate = false;
|
|
131496
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
131497
|
+
if (paginate) {
|
|
131498
|
+
return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params, 100);
|
|
131499
|
+
}
|
|
130676
131500
|
let market = undefined;
|
|
130677
131501
|
if (symbol !== undefined) {
|
|
130678
131502
|
market = this.market(symbol);
|
|
@@ -130692,6 +131516,9 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130692
131516
|
/**
|
|
130693
131517
|
* @method
|
|
130694
131518
|
* @name huobi#fetchOpenOrders
|
|
131519
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-open-orders
|
|
131520
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-current-unfilled-order-acquisition
|
|
131521
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-current-unfilled-order-acquisition
|
|
130695
131522
|
* @description fetch all unfilled currently open orders
|
|
130696
131523
|
* @param {string} symbol unified market symbol
|
|
130697
131524
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
@@ -132802,6 +133629,8 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
132802
133629
|
/**
|
|
132803
133630
|
* @method
|
|
132804
133631
|
* @name huobi#fetchFundingRateHistory
|
|
133632
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-funding-rate
|
|
133633
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-funding-rate
|
|
132805
133634
|
* @description fetches historical funding rate prices
|
|
132806
133635
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
132807
133636
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
@@ -132810,6 +133639,11 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
132810
133639
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
132811
133640
|
*/
|
|
132812
133641
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
133642
|
+
let paginate = false;
|
|
133643
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
133644
|
+
if (paginate) {
|
|
133645
|
+
return await this.fetchPaginatedCallCursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50);
|
|
133646
|
+
}
|
|
132813
133647
|
await this.loadMarkets();
|
|
132814
133648
|
const market = this.market(symbol);
|
|
132815
133649
|
const request = {
|
|
@@ -132849,10 +133683,12 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
132849
133683
|
// }
|
|
132850
133684
|
//
|
|
132851
133685
|
const data = this.safeValue(response, 'data');
|
|
133686
|
+
const cursor = this.safeValue(data, 'current_page');
|
|
132852
133687
|
const result = this.safeValue(data, 'data', []);
|
|
132853
133688
|
const rates = [];
|
|
132854
133689
|
for (let i = 0; i < result.length; i++) {
|
|
132855
133690
|
const entry = result[i];
|
|
133691
|
+
entry['current_page'] = cursor;
|
|
132856
133692
|
const marketId = this.safeString(entry, 'contract_code');
|
|
132857
133693
|
const symbolInner = this.safeSymbol(marketId);
|
|
132858
133694
|
const timestamp = this.safeInteger(entry, 'funding_time');
|
|
@@ -134013,16 +134849,24 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
134013
134849
|
/**
|
|
134014
134850
|
* @method
|
|
134015
134851
|
* @name huobi#fetchLedger
|
|
134852
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
|
|
134016
134853
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
134017
134854
|
* @param {string} code unified currency code, default is undefined
|
|
134018
134855
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
134019
134856
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
134020
134857
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
134858
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
134859
|
+
* @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)
|
|
134021
134860
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
134022
134861
|
*/
|
|
134023
134862
|
await this.loadMarkets();
|
|
134863
|
+
let paginate = false;
|
|
134864
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
134865
|
+
if (paginate) {
|
|
134866
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 500);
|
|
134867
|
+
}
|
|
134024
134868
|
const accountId = await this.fetchAccountIdByType('spot', undefined, undefined, params);
|
|
134025
|
-
|
|
134869
|
+
let request = {
|
|
134026
134870
|
'accountId': accountId,
|
|
134027
134871
|
// 'currency': code,
|
|
134028
134872
|
// 'transactTypes': 'all', // default all
|
|
@@ -134043,6 +134887,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
134043
134887
|
if (limit !== undefined) {
|
|
134044
134888
|
request['limit'] = limit; // max 500
|
|
134045
134889
|
}
|
|
134890
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
134046
134891
|
const response = await this.spotPrivateGetV2AccountLedger(this.extend(request, params));
|
|
134047
134892
|
//
|
|
134048
134893
|
// {
|
|
@@ -141354,9 +142199,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141354
142199
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
141355
142200
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
141356
142201
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
142202
|
+
* @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)
|
|
141357
142203
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
141358
142204
|
*/
|
|
141359
142205
|
await this.loadMarkets();
|
|
142206
|
+
let paginate = false;
|
|
142207
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
142208
|
+
if (paginate) {
|
|
142209
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 720);
|
|
142210
|
+
}
|
|
141360
142211
|
const market = this.market(symbol);
|
|
141361
142212
|
const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
|
|
141362
142213
|
const request = {
|
|
@@ -141430,11 +142281,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141430
142281
|
else {
|
|
141431
142282
|
direction = 'in';
|
|
141432
142283
|
}
|
|
141433
|
-
const
|
|
141434
|
-
let timestamp = undefined;
|
|
141435
|
-
if (time !== undefined) {
|
|
141436
|
-
timestamp = this.parseToInt(time * 1000);
|
|
141437
|
-
}
|
|
142284
|
+
const timestamp = this.safeIntegerProduct(item, 'time', 1000);
|
|
141438
142285
|
return {
|
|
141439
142286
|
'info': item,
|
|
141440
142287
|
'id': id,
|
|
@@ -141460,17 +142307,19 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141460
142307
|
/**
|
|
141461
142308
|
* @method
|
|
141462
142309
|
* @name kraken#fetchLedger
|
|
142310
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
141463
142311
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
141464
142312
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
141465
142313
|
* @param {string} code unified currency code, default is undefined
|
|
141466
142314
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
141467
142315
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
141468
142316
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
142317
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
141469
142318
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
141470
142319
|
*/
|
|
141471
142320
|
// https://www.kraken.com/features/api#get-ledgers-info
|
|
141472
142321
|
await this.loadMarkets();
|
|
141473
|
-
|
|
142322
|
+
let request = {};
|
|
141474
142323
|
let currency = undefined;
|
|
141475
142324
|
if (code !== undefined) {
|
|
141476
142325
|
currency = this.currency(code);
|
|
@@ -141479,6 +142328,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141479
142328
|
if (since !== undefined) {
|
|
141480
142329
|
request['start'] = this.parseToInt(since / 1000);
|
|
141481
142330
|
}
|
|
142331
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
141482
142332
|
const response = await this.privatePostLedgers(this.extend(request, params));
|
|
141483
142333
|
// { error: [],
|
|
141484
142334
|
// result: { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
|
|
@@ -141957,7 +142807,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141957
142807
|
id = this.safeString(txid, 0);
|
|
141958
142808
|
}
|
|
141959
142809
|
const clientOrderId = this.safeString(order, 'userref');
|
|
141960
|
-
const rawTrades = this.safeValue(order, 'trades');
|
|
142810
|
+
const rawTrades = this.safeValue(order, 'trades', []);
|
|
141961
142811
|
const trades = [];
|
|
141962
142812
|
for (let i = 0; i < rawTrades.length; i++) {
|
|
141963
142813
|
const rawTrade = rawTrades[i];
|
|
@@ -142425,6 +143275,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142425
143275
|
/**
|
|
142426
143276
|
* @method
|
|
142427
143277
|
* @name kraken#fetchOpenOrders
|
|
143278
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
142428
143279
|
* @description fetch all unfilled currently open orders
|
|
142429
143280
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
142430
143281
|
* @param {string} symbol unified market symbol
|
|
@@ -142457,16 +143308,18 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142457
143308
|
/**
|
|
142458
143309
|
* @method
|
|
142459
143310
|
* @name kraken#fetchClosedOrders
|
|
143311
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
142460
143312
|
* @description fetches information on multiple closed orders made by the user
|
|
142461
143313
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
142462
143314
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
142463
143315
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
142464
143316
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
142465
143317
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
143318
|
+
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
142466
143319
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
142467
143320
|
*/
|
|
142468
143321
|
await this.loadMarkets();
|
|
142469
|
-
|
|
143322
|
+
let request = {};
|
|
142470
143323
|
if (since !== undefined) {
|
|
142471
143324
|
request['start'] = this.parseToInt(since / 1000);
|
|
142472
143325
|
}
|
|
@@ -142476,6 +143329,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142476
143329
|
request['userref'] = clientOrderId;
|
|
142477
143330
|
query = this.omit(params, ['userref', 'clientOrderId']);
|
|
142478
143331
|
}
|
|
143332
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
142479
143333
|
const response = await this.privatePostClosedOrders(this.extend(request, query));
|
|
142480
143334
|
//
|
|
142481
143335
|
// {
|
|
@@ -142655,6 +143509,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142655
143509
|
/**
|
|
142656
143510
|
* @method
|
|
142657
143511
|
* @name kraken#fetchDeposits
|
|
143512
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
142658
143513
|
* @description fetch all deposits made to an account
|
|
142659
143514
|
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
142660
143515
|
* @param {string} code unified currency code
|
|
@@ -143734,8 +144589,26 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
143734
144589
|
});
|
|
143735
144590
|
}
|
|
143736
144591
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
144592
|
+
/**
|
|
144593
|
+
* @method
|
|
144594
|
+
* @name kraken#fetchOHLCV
|
|
144595
|
+
* @see https://docs.futures.kraken.com/#http-api-charts-candles
|
|
144596
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
144597
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
144598
|
+
* @param {string} timeframe the length of time each candle represents
|
|
144599
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
144600
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
144601
|
+
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
144602
|
+
* @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)
|
|
144603
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
144604
|
+
*/
|
|
143737
144605
|
await this.loadMarkets();
|
|
143738
144606
|
const market = this.market(symbol);
|
|
144607
|
+
let paginate = false;
|
|
144608
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
144609
|
+
if (paginate) {
|
|
144610
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000);
|
|
144611
|
+
}
|
|
143739
144612
|
const request = {
|
|
143740
144613
|
'symbol': market['id'],
|
|
143741
144614
|
'price_type': this.safeString(params, 'price', 'trade'),
|
|
@@ -143812,9 +144685,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
143812
144685
|
* @param {int} [limit] Total number of trades, cannot exceed 100
|
|
143813
144686
|
* @param {object} [params] Exchange specific params
|
|
143814
144687
|
* @param {int} [params.until] Timestamp in ms of latest trade
|
|
144688
|
+
* @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)
|
|
143815
144689
|
* @returns An array of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
143816
144690
|
*/
|
|
143817
144691
|
await this.loadMarkets();
|
|
144692
|
+
let paginate = false;
|
|
144693
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
144694
|
+
if (paginate) {
|
|
144695
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
144696
|
+
}
|
|
143818
144697
|
const market = this.market(symbol);
|
|
143819
144698
|
const request = {
|
|
143820
144699
|
'symbol': market['id'],
|
|
@@ -146890,9 +147769,15 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
146890
147769
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
146891
147770
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
146892
147771
|
* @param {object} [params] extra parameters specific to the kucoin api endpoint
|
|
147772
|
+
* @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)
|
|
146893
147773
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
146894
147774
|
*/
|
|
146895
147775
|
await this.loadMarkets();
|
|
147776
|
+
let paginate = false;
|
|
147777
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
147778
|
+
if (paginate) {
|
|
147779
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1500);
|
|
147780
|
+
}
|
|
146896
147781
|
const market = this.market(symbol);
|
|
146897
147782
|
const marketId = market['id'];
|
|
146898
147783
|
const request = {
|
|
@@ -147548,8 +148433,15 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147548
148433
|
* @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
|
|
147549
148434
|
* @param {bool} [params.stop] True if fetching a stop order
|
|
147550
148435
|
* @param {bool} [params.hf] false, // true for hf order
|
|
148436
|
+
* @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)
|
|
147551
148437
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
147552
148438
|
*/
|
|
148439
|
+
await this.loadMarkets;
|
|
148440
|
+
let paginate = false;
|
|
148441
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
148442
|
+
if (paginate) {
|
|
148443
|
+
return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
|
|
148444
|
+
}
|
|
147553
148445
|
return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
|
|
147554
148446
|
}
|
|
147555
148447
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -147574,8 +148466,15 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147574
148466
|
* @param {string} [params.orderIds] *stop orders only* comma seperated order ID list
|
|
147575
148467
|
* @param {bool} [params.stop] True if fetching a stop order
|
|
147576
148468
|
* @param {bool} [params.hf] false, // true for hf order
|
|
148469
|
+
* @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)
|
|
147577
148470
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
147578
148471
|
*/
|
|
148472
|
+
await this.loadMarkets;
|
|
148473
|
+
let paginate = false;
|
|
148474
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
148475
|
+
if (paginate) {
|
|
148476
|
+
return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params);
|
|
148477
|
+
}
|
|
147579
148478
|
return await this.fetchOrdersByStatus('active', symbol, since, limit, params);
|
|
147580
148479
|
}
|
|
147581
148480
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -147862,11 +148761,18 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147862
148761
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
147863
148762
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
147864
148763
|
* @param {object} [params] extra parameters specific to the kucoin api endpoint
|
|
148764
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
147865
148765
|
* @param {bool} [params.hf] false, // true for hf order
|
|
148766
|
+
* @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)
|
|
147866
148767
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
147867
148768
|
*/
|
|
147868
148769
|
await this.loadMarkets();
|
|
147869
|
-
|
|
148770
|
+
let paginate = false;
|
|
148771
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
148772
|
+
if (paginate) {
|
|
148773
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
148774
|
+
}
|
|
148775
|
+
let request = {};
|
|
147870
148776
|
const hf = this.safeValue(params, 'hf', false);
|
|
147871
148777
|
if (hf && symbol === undefined) {
|
|
147872
148778
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
|
|
@@ -147908,6 +148814,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147908
148814
|
else {
|
|
147909
148815
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
|
|
147910
148816
|
}
|
|
148817
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
147911
148818
|
const response = await this[method](this.extend(request, params));
|
|
147912
148819
|
//
|
|
147913
148820
|
// {
|
|
@@ -148349,6 +149256,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148349
149256
|
/**
|
|
148350
149257
|
* @method
|
|
148351
149258
|
* @name kucoin#fetchDeposits
|
|
149259
|
+
* @see https://docs.kucoin.com/#get-deposit-list
|
|
149260
|
+
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
148352
149261
|
* @description fetch all deposits made to an account
|
|
148353
149262
|
* @see https://docs.kucoin.com/#get-deposit-list
|
|
148354
149263
|
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
@@ -148356,10 +149265,17 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148356
149265
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
148357
149266
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
148358
149267
|
* @param {object} [params] extra parameters specific to the kucoin api endpoint
|
|
149268
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
149269
|
+
* @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)
|
|
148359
149270
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
148360
149271
|
*/
|
|
148361
149272
|
await this.loadMarkets();
|
|
148362
|
-
|
|
149273
|
+
let paginate = false;
|
|
149274
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
149275
|
+
if (paginate) {
|
|
149276
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
149277
|
+
}
|
|
149278
|
+
let request = {};
|
|
148363
149279
|
let currency = undefined;
|
|
148364
149280
|
if (code !== undefined) {
|
|
148365
149281
|
currency = this.currency(code);
|
|
@@ -148379,6 +149295,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148379
149295
|
request['startAt'] = since;
|
|
148380
149296
|
}
|
|
148381
149297
|
}
|
|
149298
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
148382
149299
|
const response = await this[method](this.extend(request, params));
|
|
148383
149300
|
//
|
|
148384
149301
|
// {
|
|
@@ -148432,10 +149349,17 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148432
149349
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
148433
149350
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
148434
149351
|
* @param {object} [params] extra parameters specific to the kucoin api endpoint
|
|
149352
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
149353
|
+
* @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)
|
|
148435
149354
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
148436
149355
|
*/
|
|
148437
149356
|
await this.loadMarkets();
|
|
148438
|
-
|
|
149357
|
+
let paginate = false;
|
|
149358
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
149359
|
+
if (paginate) {
|
|
149360
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
149361
|
+
}
|
|
149362
|
+
let request = {};
|
|
148439
149363
|
let currency = undefined;
|
|
148440
149364
|
if (code !== undefined) {
|
|
148441
149365
|
currency = this.currency(code);
|
|
@@ -148455,6 +149379,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148455
149379
|
request['startAt'] = since;
|
|
148456
149380
|
}
|
|
148457
149381
|
}
|
|
149382
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
148458
149383
|
const response = await this[method](this.extend(request, params));
|
|
148459
149384
|
//
|
|
148460
149385
|
// {
|
|
@@ -148941,17 +149866,25 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148941
149866
|
/**
|
|
148942
149867
|
* @method
|
|
148943
149868
|
* @name kucoin#fetchLedger
|
|
149869
|
+
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
148944
149870
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
148945
149871
|
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
148946
149872
|
* @param {string} code unified currency code, default is undefined
|
|
148947
149873
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
148948
149874
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
148949
149875
|
* @param {object} [params] extra parameters specific to the kucoin api endpoint
|
|
149876
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
149877
|
+
* @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)
|
|
148950
149878
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
148951
149879
|
*/
|
|
148952
149880
|
await this.loadMarkets();
|
|
148953
149881
|
await this.loadAccounts();
|
|
148954
|
-
|
|
149882
|
+
let paginate = false;
|
|
149883
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
149884
|
+
if (paginate) {
|
|
149885
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
149886
|
+
}
|
|
149887
|
+
let request = {
|
|
148955
149888
|
// 'currency': currency['id'], // can choose up to 10, if not provided returns for all currencies by default
|
|
148956
149889
|
// 'direction': 'in', // 'out'
|
|
148957
149890
|
// 'bizType': 'DEPOSIT', // DEPOSIT, WITHDRAW, TRANSFER, SUB_TRANSFER,TRADE_EXCHANGE, MARGIN_EXCHANGE, KUCOIN_BONUS (optional)
|
|
@@ -148967,6 +149900,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148967
149900
|
currency = this.currency(code);
|
|
148968
149901
|
request['currency'] = currency['id'];
|
|
148969
149902
|
}
|
|
149903
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
148970
149904
|
const response = await this.privateGetAccountsLedgers(this.extend(request, params));
|
|
148971
149905
|
//
|
|
148972
149906
|
// {
|
|
@@ -150064,9 +150998,15 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
150064
150998
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
150065
150999
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
150066
151000
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
151001
|
+
* @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)
|
|
150067
151002
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
150068
151003
|
*/
|
|
150069
151004
|
await this.loadMarkets();
|
|
151005
|
+
let paginate = false;
|
|
151006
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
151007
|
+
if (paginate) {
|
|
151008
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
|
|
151009
|
+
}
|
|
150070
151010
|
const market = this.market(symbol);
|
|
150071
151011
|
const marketId = market['id'];
|
|
150072
151012
|
const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
|
|
@@ -150946,9 +151886,15 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
150946
151886
|
* @param {int} [params.until] End time in ms
|
|
150947
151887
|
* @param {string} [params.side] buy or sell
|
|
150948
151888
|
* @param {string} [params.type] limit or market
|
|
151889
|
+
* @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)
|
|
150949
151890
|
* @returns An [array of order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
150950
151891
|
*/
|
|
150951
151892
|
await this.loadMarkets();
|
|
151893
|
+
let paginate = false;
|
|
151894
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrdersByStatus', 'paginate');
|
|
151895
|
+
if (paginate) {
|
|
151896
|
+
return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
|
|
151897
|
+
}
|
|
150952
151898
|
const stop = this.safeValue(params, 'stop');
|
|
150953
151899
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
150954
151900
|
params = this.omit(params, ['stop', 'until', 'till']);
|
|
@@ -151046,8 +151992,15 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151046
151992
|
* @param {int} [params.till] end time in ms
|
|
151047
151993
|
* @param {string} [params.side] buy or sell
|
|
151048
151994
|
* @param {string} [params.type] limit, or market
|
|
151995
|
+
* @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)
|
|
151049
151996
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
151050
151997
|
*/
|
|
151998
|
+
await this.loadMarkets;
|
|
151999
|
+
let paginate = false;
|
|
152000
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
152001
|
+
if (paginate) {
|
|
152002
|
+
return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
|
|
152003
|
+
}
|
|
151051
152004
|
return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
|
|
151052
152005
|
}
|
|
151053
152006
|
async fetchOrder(id = undefined, symbol = undefined, params = {}) {
|
|
@@ -151406,15 +152359,23 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151406
152359
|
/**
|
|
151407
152360
|
* @method
|
|
151408
152361
|
* @name kucoinfutures#fetchMyTrades
|
|
152362
|
+
* @see https://docs.kucoin.com/futures/#get-fills
|
|
151409
152363
|
* @description fetch all trades made by the user
|
|
151410
152364
|
* @param {string} symbol unified market symbol
|
|
151411
152365
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
151412
152366
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
151413
152367
|
* @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
|
|
152368
|
+
* @param {int} [params.until] End time in ms
|
|
152369
|
+
* @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)
|
|
151414
152370
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
151415
152371
|
*/
|
|
151416
152372
|
await this.loadMarkets();
|
|
151417
|
-
|
|
152373
|
+
let paginate = false;
|
|
152374
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
152375
|
+
if (paginate) {
|
|
152376
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
152377
|
+
}
|
|
152378
|
+
let request = {
|
|
151418
152379
|
// orderId (String) [optional] Fills for a specific order (other parameters can be ignored if specified)
|
|
151419
152380
|
// symbol (String) [optional] Symbol of the contract
|
|
151420
152381
|
// side (String) [optional] buy or sell
|
|
@@ -151430,6 +152391,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151430
152391
|
if (since !== undefined) {
|
|
151431
152392
|
request['startAt'] = since;
|
|
151432
152393
|
}
|
|
152394
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
151433
152395
|
const response = await this.futuresPrivateGetFills(this.extend(request, params));
|
|
151434
152396
|
//
|
|
151435
152397
|
// {
|
|
@@ -151830,12 +152792,18 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151830
152792
|
* @param {int} [since] not used by kucuoinfutures
|
|
151831
152793
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
151832
152794
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
152795
|
+
* @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)
|
|
151833
152796
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
151834
152797
|
*/
|
|
151835
152798
|
if (symbol === undefined) {
|
|
151836
152799
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
151837
152800
|
}
|
|
151838
152801
|
await this.loadMarkets();
|
|
152802
|
+
let paginate = false;
|
|
152803
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
152804
|
+
if (paginate) {
|
|
152805
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
152806
|
+
}
|
|
151839
152807
|
const market = this.market(symbol);
|
|
151840
152808
|
const request = {
|
|
151841
152809
|
'symbol': market['id'],
|
|
@@ -151893,16 +152861,19 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151893
152861
|
/* harmony import */ var _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4722);
|
|
151894
152862
|
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
|
|
151895
152863
|
/* harmony import */ var _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9292);
|
|
151896
|
-
/* harmony import */ var
|
|
152864
|
+
/* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1372);
|
|
152865
|
+
/* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7110);
|
|
151897
152866
|
// ---------------------------------------------------------------------------
|
|
151898
152867
|
|
|
151899
152868
|
|
|
151900
152869
|
|
|
151901
152870
|
|
|
152871
|
+
|
|
151902
152872
|
// ---------------------------------------------------------------------------
|
|
151903
152873
|
/**
|
|
151904
152874
|
* @class kuna
|
|
151905
152875
|
* @extends Exchange
|
|
152876
|
+
* @description Use the public-key as your apiKey
|
|
151906
152877
|
*/
|
|
151907
152878
|
class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
151908
152879
|
describe() {
|
|
@@ -151960,6 +152931,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
151960
152931
|
'api': {
|
|
151961
152932
|
'xreserve': 'https://api.xreserve.fund',
|
|
151962
152933
|
'v3': 'https://api.kuna.io',
|
|
152934
|
+
'v4': 'https://api.kuna.io',
|
|
151963
152935
|
'public': 'https://kuna.io',
|
|
151964
152936
|
'private': 'https://kuna.io', // v2
|
|
151965
152937
|
},
|
|
@@ -151978,6 +152950,54 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
151978
152950
|
'delegate-transfer': 1,
|
|
151979
152951
|
},
|
|
151980
152952
|
},
|
|
152953
|
+
'v4': {
|
|
152954
|
+
'private': {
|
|
152955
|
+
'get': {
|
|
152956
|
+
'me': 1,
|
|
152957
|
+
'getBalance': 1,
|
|
152958
|
+
'active': 1,
|
|
152959
|
+
'order/history': 1,
|
|
152960
|
+
'order/private/{id}/trades': 1,
|
|
152961
|
+
'order/details/{id}?withTrades={withTrades}': 1,
|
|
152962
|
+
'trade/history': 1,
|
|
152963
|
+
'transaction/{hash}': 1,
|
|
152964
|
+
'deposit/preRequest': 1,
|
|
152965
|
+
'deposit/crypto/address': 1,
|
|
152966
|
+
'deposit/crypto/getMerchantAddress': 1,
|
|
152967
|
+
'deposit/history': 1,
|
|
152968
|
+
'deposit/details/{depositId}': 1,
|
|
152969
|
+
'withdraw/preRequest': 1,
|
|
152970
|
+
'withdraw/history': 1,
|
|
152971
|
+
'withdraw/details/{withdrawId}': 1,
|
|
152972
|
+
'kuna-code/{id}': 1,
|
|
152973
|
+
'kuna-code/{code}/check': 1,
|
|
152974
|
+
'kuna-code/issued-by-me': 1,
|
|
152975
|
+
'kuna-code/redeemed-by-me': 1,
|
|
152976
|
+
},
|
|
152977
|
+
'post': {
|
|
152978
|
+
'order/create': 1,
|
|
152979
|
+
'order/cancel': 1,
|
|
152980
|
+
'order/cancel/multi': 1,
|
|
152981
|
+
'deposit/crypto/generateAddress': 1,
|
|
152982
|
+
'deposit/crypto/generateMerchantAddress': 1,
|
|
152983
|
+
'withdraw/create': 1,
|
|
152984
|
+
'kuna-code': 1,
|
|
152985
|
+
},
|
|
152986
|
+
'put': {
|
|
152987
|
+
'kuna-code/redeem': 1,
|
|
152988
|
+
},
|
|
152989
|
+
},
|
|
152990
|
+
'public': {
|
|
152991
|
+
'get': {
|
|
152992
|
+
'timestamp': 1,
|
|
152993
|
+
'fees': 1,
|
|
152994
|
+
'currencies?type={type}': 1,
|
|
152995
|
+
'markets/getAll': 1,
|
|
152996
|
+
'markets/tickers?pairs={pairs}': 1,
|
|
152997
|
+
'order/book/{pairs}': 1,
|
|
152998
|
+
},
|
|
152999
|
+
},
|
|
153000
|
+
},
|
|
151981
153001
|
'v3': {
|
|
151982
153002
|
'public': {
|
|
151983
153003
|
'get': {
|
|
@@ -152185,6 +153205,9 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
152185
153205
|
'2002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
152186
153206
|
'2003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
152187
153207
|
},
|
|
153208
|
+
'options': {
|
|
153209
|
+
// 'account': 'pro' // Only for pro accounts
|
|
153210
|
+
},
|
|
152188
153211
|
});
|
|
152189
153212
|
}
|
|
152190
153213
|
async fetchTime(params = {}) {
|
|
@@ -152741,20 +153764,53 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
152741
153764
|
let url = undefined;
|
|
152742
153765
|
if (Array.isArray(api)) {
|
|
152743
153766
|
const [version, access] = api;
|
|
152744
|
-
|
|
152745
|
-
|
|
152746
|
-
if (
|
|
152747
|
-
if (
|
|
152748
|
-
|
|
153767
|
+
if (version === 'v3') {
|
|
153768
|
+
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
153769
|
+
if (access === 'public') {
|
|
153770
|
+
if (method === 'GET') {
|
|
153771
|
+
if (Object.keys(params).length) {
|
|
153772
|
+
url += '?' + this.urlencode(params);
|
|
153773
|
+
}
|
|
153774
|
+
}
|
|
153775
|
+
else if ((method === 'POST') || (method === 'PUT')) {
|
|
153776
|
+
headers = { 'Content-Type': 'application/json' };
|
|
153777
|
+
body = this.json(params);
|
|
152749
153778
|
}
|
|
152750
153779
|
}
|
|
152751
|
-
else if (
|
|
152752
|
-
|
|
152753
|
-
body = this.json(params);
|
|
153780
|
+
else if (access === 'private') {
|
|
153781
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' private v3 API is not supported yet');
|
|
152754
153782
|
}
|
|
152755
153783
|
}
|
|
152756
|
-
else if (
|
|
152757
|
-
|
|
153784
|
+
else if (version === 'v4') {
|
|
153785
|
+
const splitPath = path.split('/');
|
|
153786
|
+
const splitPathLength = splitPath.length;
|
|
153787
|
+
let urlPath = '';
|
|
153788
|
+
if ((splitPathLength > 1) && (splitPath[0] !== 'kuna-code')) {
|
|
153789
|
+
let pathTail = '';
|
|
153790
|
+
for (let i = 1; i < splitPathLength; i++) {
|
|
153791
|
+
pathTail += splitPath[i];
|
|
153792
|
+
}
|
|
153793
|
+
urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
|
|
153794
|
+
}
|
|
153795
|
+
else {
|
|
153796
|
+
urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
|
|
153797
|
+
}
|
|
153798
|
+
url = this.urls['api'][version] + urlPath;
|
|
153799
|
+
if (access === 'private') {
|
|
153800
|
+
const nonce = this.nonce();
|
|
153801
|
+
const auth = urlPath + nonce + this.json(params);
|
|
153802
|
+
headers = {
|
|
153803
|
+
'content-type': 'application/json',
|
|
153804
|
+
'accept': 'application/json',
|
|
153805
|
+
'nonce': nonce,
|
|
153806
|
+
'public-key': this.apiKey,
|
|
153807
|
+
'signature': this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__/* .sha384 */ .iC, 'hex'),
|
|
153808
|
+
};
|
|
153809
|
+
const account = this.safeString(this.options, 'account');
|
|
153810
|
+
if (account === 'pro') {
|
|
153811
|
+
headers['account'] = 'pro';
|
|
153812
|
+
}
|
|
153813
|
+
}
|
|
152758
153814
|
}
|
|
152759
153815
|
}
|
|
152760
153816
|
else {
|
|
@@ -152777,7 +153833,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
152777
153833
|
'tonce': nonce,
|
|
152778
153834
|
}, params));
|
|
152779
153835
|
const auth = method + '|' + request + '|' + queryInner;
|
|
152780
|
-
const signed = this.hmac(this.encode(auth), this.encode(this.secret),
|
|
153836
|
+
const signed = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
152781
153837
|
const suffix = query + '&signature=' + signed;
|
|
152782
153838
|
if (method === 'GET') {
|
|
152783
153839
|
url += '?' + suffix;
|
|
@@ -177636,9 +178692,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177636
178692
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
177637
178693
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
177638
178694
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
178695
|
+
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
177639
178696
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
177640
178697
|
*/
|
|
177641
178698
|
await this.loadMarkets();
|
|
178699
|
+
let paginate = false;
|
|
178700
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
178701
|
+
if (paginate) {
|
|
178702
|
+
return await this.fetchPaginatedCallCursor('fetchTrades', symbol, since, limit, params, 'tradeId', 'after', undefined, 100);
|
|
178703
|
+
}
|
|
177642
178704
|
const market = this.market(symbol);
|
|
177643
178705
|
const request = {
|
|
177644
178706
|
'instId': market['id'],
|
|
@@ -177741,10 +178803,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177741
178803
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
177742
178804
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
177743
178805
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
178806
|
+
* @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)
|
|
177744
178807
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
177745
178808
|
*/
|
|
177746
178809
|
await this.loadMarkets();
|
|
177747
178810
|
const market = this.market(symbol);
|
|
178811
|
+
let paginate = false;
|
|
178812
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
178813
|
+
if (paginate) {
|
|
178814
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
|
|
178815
|
+
}
|
|
177748
178816
|
const price = this.safeString(params, 'price');
|
|
177749
178817
|
params = this.omit(params, 'price');
|
|
177750
178818
|
const options = this.safeValue(this.options, 'fetchOHLCV', {});
|
|
@@ -177835,12 +178903,18 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177835
178903
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
177836
178904
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
177837
178905
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
178906
|
+
* @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)
|
|
177838
178907
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
177839
178908
|
*/
|
|
177840
178909
|
if (symbol === undefined) {
|
|
177841
178910
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
177842
178911
|
}
|
|
177843
178912
|
await this.loadMarkets();
|
|
178913
|
+
let paginate = false;
|
|
178914
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
178915
|
+
if (paginate) {
|
|
178916
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
178917
|
+
}
|
|
177844
178918
|
const market = this.market(symbol);
|
|
177845
178919
|
const request = {
|
|
177846
178920
|
'instId': market['id'],
|
|
@@ -179073,9 +180147,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179073
180147
|
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
179074
180148
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
179075
180149
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
180150
|
+
* @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)
|
|
179076
180151
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
179077
180152
|
*/
|
|
179078
180153
|
await this.loadMarkets();
|
|
180154
|
+
let paginate = false;
|
|
180155
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
180156
|
+
if (paginate) {
|
|
180157
|
+
return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params);
|
|
180158
|
+
}
|
|
179079
180159
|
const request = {
|
|
179080
180160
|
// 'instType': 'SPOT', // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
179081
180161
|
// 'uly': currency['id'],
|
|
@@ -179399,9 +180479,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179399
180479
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
179400
180480
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
179401
180481
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
180482
|
+
* @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)
|
|
179402
180483
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
179403
180484
|
*/
|
|
179404
180485
|
await this.loadMarkets();
|
|
180486
|
+
let paginate = false;
|
|
180487
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
180488
|
+
if (paginate) {
|
|
180489
|
+
return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
|
|
180490
|
+
}
|
|
179405
180491
|
const request = {
|
|
179406
180492
|
// 'instType': type.toUpperCase (), // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
179407
180493
|
// 'uly': currency['id'],
|
|
@@ -179561,10 +180647,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179561
180647
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
179562
180648
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
179563
180649
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
180650
|
+
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
180651
|
+
* @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)
|
|
179564
180652
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
179565
180653
|
*/
|
|
179566
180654
|
await this.loadMarkets();
|
|
179567
|
-
|
|
180655
|
+
let paginate = false;
|
|
180656
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
180657
|
+
if (paginate) {
|
|
180658
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
180659
|
+
}
|
|
180660
|
+
let request = {
|
|
179568
180661
|
// 'instType': 'SPOT', // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
179569
180662
|
// 'uly': currency['id'],
|
|
179570
180663
|
// 'instId': market['id'],
|
|
@@ -179578,6 +180671,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179578
180671
|
market = this.market(symbol);
|
|
179579
180672
|
request['instId'] = market['id'];
|
|
179580
180673
|
}
|
|
180674
|
+
[request, params] = this.handleUntilOption('end', params, request);
|
|
179581
180675
|
const [type, query] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
179582
180676
|
request['instType'] = this.convertToInstrumentType(type);
|
|
179583
180677
|
if (limit !== undefined) {
|
|
@@ -179647,14 +180741,21 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179647
180741
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
179648
180742
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
179649
180743
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
180744
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
180745
|
+
* @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)
|
|
179650
180746
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
179651
180747
|
*/
|
|
179652
180748
|
await this.loadMarkets();
|
|
180749
|
+
let paginate = false;
|
|
180750
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
180751
|
+
if (paginate) {
|
|
180752
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
180753
|
+
}
|
|
179653
180754
|
const options = this.safeValue(this.options, 'fetchLedger', {});
|
|
179654
180755
|
let method = this.safeString(options, 'method');
|
|
179655
180756
|
method = this.safeString(params, 'method', method);
|
|
179656
180757
|
params = this.omit(params, 'method');
|
|
179657
|
-
|
|
180758
|
+
let request = {
|
|
179658
180759
|
// 'instType': undefined, // 'SPOT', 'MARGIN', 'SWAP', 'FUTURES", 'OPTION'
|
|
179659
180760
|
// 'ccy': undefined, // currency['id'],
|
|
179660
180761
|
// 'mgnMode': undefined, // 'isolated', 'cross'
|
|
@@ -179689,6 +180790,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179689
180790
|
currency = this.currency(code);
|
|
179690
180791
|
request['ccy'] = currency['id'];
|
|
179691
180792
|
}
|
|
180793
|
+
[request, params] = this.handleUntilOption('end', params, request);
|
|
179692
180794
|
const response = await this[method](this.extend(request, query));
|
|
179693
180795
|
//
|
|
179694
180796
|
// privateGetAccountBills, privateGetAccountBillsArchive
|
|
@@ -180103,10 +181205,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180103
181205
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
180104
181206
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
180105
181207
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
181208
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
181209
|
+
* @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)
|
|
180106
181210
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
180107
181211
|
*/
|
|
180108
181212
|
await this.loadMarkets();
|
|
180109
|
-
|
|
181213
|
+
let paginate = false;
|
|
181214
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
181215
|
+
if (paginate) {
|
|
181216
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
181217
|
+
}
|
|
181218
|
+
let request = {
|
|
180110
181219
|
// 'ccy': currency['id'],
|
|
180111
181220
|
// 'state': 2, // 0 waiting for confirmation, 1 deposit credited, 2 deposit successful
|
|
180112
181221
|
// 'after': since,
|
|
@@ -180124,6 +181233,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180124
181233
|
if (limit !== undefined) {
|
|
180125
181234
|
request['limit'] = limit; // default 100, max 100
|
|
180126
181235
|
}
|
|
181236
|
+
[request, params] = this.handleUntilOption('after', params, request);
|
|
180127
181237
|
const response = await this.privateGetAssetDepositHistory(this.extend(request, params));
|
|
180128
181238
|
//
|
|
180129
181239
|
// {
|
|
@@ -180201,10 +181311,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180201
181311
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
180202
181312
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
180203
181313
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
181314
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
181315
|
+
* @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)
|
|
180204
181316
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
180205
181317
|
*/
|
|
180206
181318
|
await this.loadMarkets();
|
|
180207
|
-
|
|
181319
|
+
let paginate = false;
|
|
181320
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
181321
|
+
if (paginate) {
|
|
181322
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
181323
|
+
}
|
|
181324
|
+
let request = {
|
|
180208
181325
|
// 'ccy': currency['id'],
|
|
180209
181326
|
// 'state': 2, // -3: pending cancel, -2 canceled, -1 failed, 0, pending, 1 sending, 2 sent, 3 awaiting email verification, 4 awaiting manual verification, 5 awaiting identity verification
|
|
180210
181327
|
// 'after': since,
|
|
@@ -180222,6 +181339,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180222
181339
|
if (limit !== undefined) {
|
|
180223
181340
|
request['limit'] = limit; // default 100, max 100
|
|
180224
181341
|
}
|
|
181342
|
+
[request, params] = this.handleUntilOption('after', request, params);
|
|
180225
181343
|
const response = await this.privateGetAssetWithdrawalHistory(this.extend(request, params));
|
|
180226
181344
|
//
|
|
180227
181345
|
// {
|
|
@@ -187974,11 +189092,18 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
187974
189092
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
187975
189093
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
187976
189094
|
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
189095
|
+
* @param {int} [params.until] timestamp in ms
|
|
189096
|
+
* @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)
|
|
187977
189097
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
187978
189098
|
*/
|
|
187979
189099
|
await this.loadMarkets();
|
|
189100
|
+
let paginate = false;
|
|
189101
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
189102
|
+
if (paginate) {
|
|
189103
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 500);
|
|
189104
|
+
}
|
|
187980
189105
|
const market = this.market(symbol);
|
|
187981
|
-
|
|
189106
|
+
let request = {
|
|
187982
189107
|
'symbol': market['id'],
|
|
187983
189108
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
187984
189109
|
};
|
|
@@ -187989,6 +189114,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
187989
189114
|
// limit should in between 100 and 500
|
|
187990
189115
|
request['limit'] = limit;
|
|
187991
189116
|
}
|
|
189117
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
187992
189118
|
const response = await this.publicGetMarketsSymbolCandles(this.extend(request, params));
|
|
187993
189119
|
//
|
|
187994
189120
|
// [
|
|
@@ -188528,14 +189654,21 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
188528
189654
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
188529
189655
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
188530
189656
|
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
189657
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
189658
|
+
* @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)
|
|
188531
189659
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
188532
189660
|
*/
|
|
188533
189661
|
await this.loadMarkets();
|
|
189662
|
+
let paginate = false;
|
|
189663
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
189664
|
+
if (paginate) {
|
|
189665
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
189666
|
+
}
|
|
188534
189667
|
let market = undefined;
|
|
188535
189668
|
if (symbol !== undefined) {
|
|
188536
189669
|
market = this.market(symbol);
|
|
188537
189670
|
}
|
|
188538
|
-
|
|
189671
|
+
let request = {
|
|
188539
189672
|
// 'from': 12345678, // A 'trade Id'. The query begins at ‘from'.
|
|
188540
189673
|
// 'direction': 'PRE', // PRE, NEXT The direction before or after ‘from'.
|
|
188541
189674
|
};
|
|
@@ -188545,6 +189678,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
188545
189678
|
if (limit !== undefined) {
|
|
188546
189679
|
request['limit'] = limit;
|
|
188547
189680
|
}
|
|
189681
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
188548
189682
|
const response = await this.privateGetTrades(this.extend(request, params));
|
|
188549
189683
|
//
|
|
188550
189684
|
// [
|
|
@@ -198051,6 +199185,11 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
198051
199185
|
|
|
198052
199186
|
|
|
198053
199187
|
// ---------------------------------------------------------------------------
|
|
199188
|
+
/**
|
|
199189
|
+
* @class bitget
|
|
199190
|
+
* @extends Exchange
|
|
199191
|
+
* @description watching delivery future markets is not yet implemented (perpertual future / swap is implemented)
|
|
199192
|
+
*/
|
|
198054
199193
|
class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
198055
199194
|
describe() {
|
|
198056
199195
|
return this.deepExtend(super.describe(), {
|
|
@@ -198123,10 +199262,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
198123
199262
|
}
|
|
198124
199263
|
else {
|
|
198125
199264
|
if (!sandboxMode) {
|
|
198126
|
-
return market['id'].replace('_UMCBL', '');
|
|
199265
|
+
return market['id'].replace('_UMCBL', '').replace('_DMCBL', '').replace('_CMCBL', '');
|
|
198127
199266
|
}
|
|
198128
199267
|
else {
|
|
198129
|
-
return market['id'].replace('_SUMCBL', '');
|
|
199268
|
+
return market['id'].replace('_SUMCBL', '').replace('_SDMCBL', '').replace('_SCMCBL', '');
|
|
198130
199269
|
}
|
|
198131
199270
|
}
|
|
198132
199271
|
}
|
|
@@ -198138,15 +199277,24 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
198138
199277
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
198139
199278
|
let marketId = this.safeString(arg, 'instId');
|
|
198140
199279
|
if (instType === 'sp') {
|
|
198141
|
-
marketId
|
|
199280
|
+
marketId = marketId + '_SPBL';
|
|
198142
199281
|
}
|
|
198143
199282
|
else {
|
|
198144
|
-
|
|
198145
|
-
|
|
199283
|
+
let extension = sandboxMode ? '_S' : '_';
|
|
199284
|
+
const splitByUSDT = marketId.split('USDT');
|
|
199285
|
+
const splitByPERP = marketId.split('PERP');
|
|
199286
|
+
const splitByUSDTLength = splitByUSDT.length;
|
|
199287
|
+
const splitByPERPLength = splitByPERP.length;
|
|
199288
|
+
if (splitByUSDTLength > 1) {
|
|
199289
|
+
extension += 'UMCBL';
|
|
199290
|
+
}
|
|
199291
|
+
else if (splitByPERPLength > 1) {
|
|
199292
|
+
extension += 'CMCBL';
|
|
198146
199293
|
}
|
|
198147
199294
|
else {
|
|
198148
|
-
|
|
199295
|
+
extension += 'DMCBL';
|
|
198149
199296
|
}
|
|
199297
|
+
marketId = marketId + extension;
|
|
198150
199298
|
}
|
|
198151
199299
|
return marketId;
|
|
198152
199300
|
}
|
|
@@ -198649,6 +199797,8 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
198649
199797
|
* @method
|
|
198650
199798
|
* @name bitget#watchTrades
|
|
198651
199799
|
* @description get the list of most recent trades for a particular symbol
|
|
199800
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#trades-channel
|
|
199801
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#trades-channel
|
|
198652
199802
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
198653
199803
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
198654
199804
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -274069,7 +275219,7 @@ SOFTWARE.
|
|
|
274069
275219
|
|
|
274070
275220
|
//-----------------------------------------------------------------------------
|
|
274071
275221
|
// this is updated by vss.js when building
|
|
274072
|
-
const version = '4.1.
|
|
275222
|
+
const version = '4.1.6';
|
|
274073
275223
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
274074
275224
|
//-----------------------------------------------------------------------------
|
|
274075
275225
|
|