ccxt 4.1.5 → 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 +1106 -55
- 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/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 +17 -3
- 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/okx.js +66 -4
- package/dist/cjs/src/poloniex.js +18 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- 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/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 +1 -1
- package/js/src/kraken.js +17 -3
- 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/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/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 =
|
|
34175
|
-
}
|
|
34176
|
-
if (since === undefined) {
|
|
34177
|
-
const duration = this.parseTimeframe(timeframe);
|
|
34178
|
-
since = this.milliseconds() - duration * limit * 1000;
|
|
34525
|
+
limit = 10000; // default 100, max 5000
|
|
34179
34526
|
}
|
|
34180
|
-
|
|
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());
|
|
82624
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());
|
|
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) {
|
|
@@ -96583,9 +97281,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
96583
97281
|
* @param {int} [limit] the maximum number of order structures to retrieve, default 100 max 100
|
|
96584
97282
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
96585
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)
|
|
96586
97285
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
96587
97286
|
*/
|
|
96588
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
|
+
}
|
|
96589
97293
|
let market = undefined;
|
|
96590
97294
|
const request = {};
|
|
96591
97295
|
if (symbol !== undefined) {
|
|
@@ -96658,9 +97362,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
96658
97362
|
* @param {int} [limit] the maximum number of trades to fetch
|
|
96659
97363
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
96660
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)
|
|
96661
97366
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
96662
97367
|
*/
|
|
96663
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
|
+
}
|
|
96664
97374
|
const market = this.market(symbol);
|
|
96665
97375
|
const request = {
|
|
96666
97376
|
'instrument_name': market['id'],
|
|
@@ -96712,9 +97422,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
96712
97422
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
96713
97423
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
96714
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)
|
|
96715
97426
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
96716
97427
|
*/
|
|
96717
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
|
+
}
|
|
96718
97434
|
const market = this.market(symbol);
|
|
96719
97435
|
const request = {
|
|
96720
97436
|
'instrument_name': market['id'],
|
|
@@ -97204,9 +97920,15 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
97204
97920
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
97205
97921
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
97206
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)
|
|
97207
97924
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
97208
97925
|
*/
|
|
97209
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
|
+
}
|
|
97210
97932
|
const request = {};
|
|
97211
97933
|
let market = undefined;
|
|
97212
97934
|
if (symbol !== undefined) {
|
|
@@ -98693,10 +99415,16 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
98693
99415
|
* @param {int} [limit] the maximum amount of [funding rate structures] to fetch
|
|
98694
99416
|
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
98695
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)
|
|
98696
99419
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
98697
99420
|
*/
|
|
98698
99421
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
98699
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
|
+
}
|
|
98700
99428
|
const market = this.market(symbol);
|
|
98701
99429
|
if (!market['swap']) {
|
|
98702
99430
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' fetchFundingRateHistory() supports swap contracts only');
|
|
@@ -116459,10 +117187,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116459
117187
|
* @param {object} [params] extra parameters specific to the gateio api endpoint
|
|
116460
117188
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
116461
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)
|
|
116462
117191
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume (units in quote currency)
|
|
116463
117192
|
*/
|
|
116464
117193
|
await this.loadMarkets();
|
|
116465
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
|
+
}
|
|
116466
117200
|
if (market['option']) {
|
|
116467
117201
|
return await this.fetchOptionOHLCV(symbol, timeframe, since, limit, params);
|
|
116468
117202
|
}
|
|
@@ -116628,9 +117362,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116628
117362
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
116629
117363
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
116630
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)
|
|
116631
117367
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
116632
117368
|
*/
|
|
116633
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
|
+
}
|
|
116634
117375
|
const market = this.market(symbol);
|
|
116635
117376
|
//
|
|
116636
117377
|
// spot
|
|
@@ -116661,6 +117402,11 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116661
117402
|
'future': 'publicDeliveryGetSettleTrades',
|
|
116662
117403
|
'option': 'publicOptionsGetTrades',
|
|
116663
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
|
+
}
|
|
116664
117410
|
if (limit !== undefined) {
|
|
116665
117411
|
request['limit'] = limit; // default 100, max 1000
|
|
116666
117412
|
}
|
|
@@ -116768,9 +117514,15 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
116768
117514
|
* @param {int} [params.offset] *contract only* list offset, starting from 0
|
|
116769
117515
|
* @param {string} [params.last_id] *contract only* specify list staring point using the id of last record in previous list-query results
|
|
116770
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)
|
|
116771
117518
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
116772
117519
|
*/
|
|
116773
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
|
+
}
|
|
116774
117526
|
let type = undefined;
|
|
116775
117527
|
let marginMode = undefined;
|
|
116776
117528
|
let request = {};
|
|
@@ -117029,11 +117781,18 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117029
117781
|
* @param {string} code unified currency code
|
|
117030
117782
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
117031
117783
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
117784
|
+
* @param {int} [params.until] end time in ms
|
|
117032
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)
|
|
117033
117787
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
117034
117788
|
*/
|
|
117035
117789
|
await this.loadMarkets();
|
|
117036
|
-
|
|
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 = {};
|
|
117037
117796
|
let currency = undefined;
|
|
117038
117797
|
if (code !== undefined) {
|
|
117039
117798
|
currency = this.currency(code);
|
|
@@ -117047,6 +117806,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117047
117806
|
request['from'] = start;
|
|
117048
117807
|
request['to'] = this.sum(start, 30 * 24 * 60 * 60);
|
|
117049
117808
|
}
|
|
117809
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
117050
117810
|
const response = await this.privateWalletGetDeposits(this.extend(request, params));
|
|
117051
117811
|
return this.parseTransactions(response, currency);
|
|
117052
117812
|
}
|
|
@@ -117059,10 +117819,17 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117059
117819
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
117060
117820
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
117061
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)
|
|
117062
117824
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
117063
117825
|
*/
|
|
117064
117826
|
await this.loadMarkets();
|
|
117065
|
-
|
|
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 = {};
|
|
117066
117833
|
let currency = undefined;
|
|
117067
117834
|
if (code !== undefined) {
|
|
117068
117835
|
currency = this.currency(code);
|
|
@@ -117076,6 +117843,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
117076
117843
|
request['from'] = start;
|
|
117077
117844
|
request['to'] = this.sum(start, 30 * 24 * 60 * 60);
|
|
117078
117845
|
}
|
|
117846
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
117079
117847
|
const response = await this.privateWalletGetWithdrawals(this.extend(request, params));
|
|
117080
117848
|
return this.parseTransactions(response, currency);
|
|
117081
117849
|
}
|
|
@@ -119364,6 +120132,11 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119364
120132
|
* @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
|
|
119365
120133
|
*/
|
|
119366
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
|
+
}
|
|
119367
120140
|
const market = this.market(symbol);
|
|
119368
120141
|
if (!market['swap']) {
|
|
119369
120142
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenInterest() supports swap markets only');
|
|
@@ -119622,13 +120395,20 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119622
120395
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
119623
120396
|
* @param {int} [limit] max number of ledger entries to return
|
|
119624
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)
|
|
119625
120400
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
119626
120401
|
*/
|
|
119627
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
|
+
}
|
|
119628
120408
|
let type = undefined;
|
|
119629
120409
|
let currency = undefined;
|
|
119630
120410
|
let response = undefined;
|
|
119631
|
-
|
|
120411
|
+
let request = {};
|
|
119632
120412
|
[type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
|
|
119633
120413
|
if ((type === 'spot') || (type === 'margin')) {
|
|
119634
120414
|
if (code !== undefined) {
|
|
@@ -119648,6 +120428,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119648
120428
|
if (limit !== undefined) {
|
|
119649
120429
|
request['limit'] = limit;
|
|
119650
120430
|
}
|
|
120431
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
119651
120432
|
if (type === 'spot') {
|
|
119652
120433
|
response = await this.privateSpotGetAccountBook(this.extend(request, params));
|
|
119653
120434
|
}
|
|
@@ -129139,21 +129920,31 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129139
129920
|
/**
|
|
129140
129921
|
* @method
|
|
129141
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
|
|
129142
129926
|
* @description fetch all trades made by the user
|
|
129143
129927
|
* @param {string} symbol unified market symbol
|
|
129144
129928
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
129145
129929
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
129146
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)
|
|
129147
129933
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
129148
129934
|
*/
|
|
129149
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
|
+
}
|
|
129150
129941
|
let market = undefined;
|
|
129151
129942
|
if (symbol !== undefined) {
|
|
129152
129943
|
market = this.market(symbol);
|
|
129153
129944
|
}
|
|
129154
129945
|
let marketType = undefined;
|
|
129155
129946
|
[marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
129156
|
-
|
|
129947
|
+
let request = {
|
|
129157
129948
|
// spot -----------------------------------------------------------
|
|
129158
129949
|
// 'symbol': market['id'],
|
|
129159
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',
|
|
@@ -129185,6 +129976,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129185
129976
|
request['start-time'] = since; // a date within 120 days from today
|
|
129186
129977
|
// request['end-time'] = this.sum (since, 172800000); // 48 hours window
|
|
129187
129978
|
}
|
|
129979
|
+
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
129188
129980
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
129189
129981
|
}
|
|
129190
129982
|
else {
|
|
@@ -129195,6 +129987,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129195
129987
|
request['start_time'] = since; // a date within 120 days from today
|
|
129196
129988
|
// request['end_time'] = this.sum (request['start_time'], 172800000); // 48 hours window
|
|
129197
129989
|
}
|
|
129990
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
129198
129991
|
if (limit !== undefined) {
|
|
129199
129992
|
request['page_size'] = limit; // default 100, max 500
|
|
129200
129993
|
}
|
|
@@ -129299,6 +130092,10 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129299
130092
|
/**
|
|
129300
130093
|
* @method
|
|
129301
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
|
|
129302
130099
|
* @description get the list of most recent trades for a particular symbol
|
|
129303
130100
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
129304
130101
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -129409,9 +130206,15 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
129409
130206
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
129410
130207
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
129411
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)
|
|
129412
130210
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
129413
130211
|
*/
|
|
129414
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
|
+
}
|
|
129415
130218
|
const market = this.market(symbol);
|
|
129416
130219
|
const request = {
|
|
129417
130220
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
@@ -130324,7 +131127,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130324
131127
|
}
|
|
130325
131128
|
await this.loadMarkets();
|
|
130326
131129
|
let market = undefined;
|
|
130327
|
-
|
|
131130
|
+
let request = {
|
|
130328
131131
|
// spot_private_get_v1_order_orders GET /v1/order/orders ----------
|
|
130329
131132
|
// 'symbol': market['id'], // required
|
|
130330
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',
|
|
@@ -130349,6 +131152,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130349
131152
|
request['start-time'] = since; // a window of 48 hours within 180 days
|
|
130350
131153
|
request['end-time'] = this.sum(since, 48 * 60 * 60 * 1000);
|
|
130351
131154
|
}
|
|
131155
|
+
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
130352
131156
|
if (limit !== undefined) {
|
|
130353
131157
|
request['size'] = limit;
|
|
130354
131158
|
}
|
|
@@ -130392,7 +131196,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130392
131196
|
this.checkRequiredSymbol('fetchContractOrders', symbol);
|
|
130393
131197
|
await this.loadMarkets();
|
|
130394
131198
|
const market = this.market(symbol);
|
|
130395
|
-
|
|
131199
|
+
let request = {
|
|
130396
131200
|
// POST /api/v1/contract_hisorders inverse futures ----------------
|
|
130397
131201
|
// 'symbol': market['settleId'], // BTC, ETH, ...
|
|
130398
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
|
|
@@ -130421,6 +131225,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130421
131225
|
request['contract'] = market['id'];
|
|
130422
131226
|
request['type'] = 1; // 1:All Orders,2:Order in Finished Status
|
|
130423
131227
|
}
|
|
131228
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
130424
131229
|
if (market['linear']) {
|
|
130425
131230
|
let marginMode = undefined;
|
|
130426
131231
|
[marginMode, params] = this.handleMarginModeAndParams('fetchContractOrders', params);
|
|
@@ -130631,6 +131436,12 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130631
131436
|
/**
|
|
130632
131437
|
* @method
|
|
130633
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
|
|
130634
131445
|
* @description fetches information on multiple orders made by the user
|
|
130635
131446
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
130636
131447
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -130638,6 +131449,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130638
131449
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
130639
131450
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
130640
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
|
|
130641
131453
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
130642
131454
|
*/
|
|
130643
131455
|
await this.loadMarkets();
|
|
@@ -130664,14 +131476,27 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130664
131476
|
/**
|
|
130665
131477
|
* @method
|
|
130666
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
|
|
130667
131485
|
* @description fetches information on multiple closed orders made by the user
|
|
130668
131486
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
130669
131487
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
130670
131488
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
130671
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)
|
|
130672
131492
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
130673
131493
|
*/
|
|
130674
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
|
+
}
|
|
130675
131500
|
let market = undefined;
|
|
130676
131501
|
if (symbol !== undefined) {
|
|
130677
131502
|
market = this.market(symbol);
|
|
@@ -130691,6 +131516,9 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
130691
131516
|
/**
|
|
130692
131517
|
* @method
|
|
130693
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
|
|
130694
131522
|
* @description fetch all unfilled currently open orders
|
|
130695
131523
|
* @param {string} symbol unified market symbol
|
|
130696
131524
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
@@ -132801,6 +133629,8 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
132801
133629
|
/**
|
|
132802
133630
|
* @method
|
|
132803
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
|
|
132804
133634
|
* @description fetches historical funding rate prices
|
|
132805
133635
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
132806
133636
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
@@ -132809,6 +133639,11 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
132809
133639
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
132810
133640
|
*/
|
|
132811
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
|
+
}
|
|
132812
133647
|
await this.loadMarkets();
|
|
132813
133648
|
const market = this.market(symbol);
|
|
132814
133649
|
const request = {
|
|
@@ -132848,10 +133683,12 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
132848
133683
|
// }
|
|
132849
133684
|
//
|
|
132850
133685
|
const data = this.safeValue(response, 'data');
|
|
133686
|
+
const cursor = this.safeValue(data, 'current_page');
|
|
132851
133687
|
const result = this.safeValue(data, 'data', []);
|
|
132852
133688
|
const rates = [];
|
|
132853
133689
|
for (let i = 0; i < result.length; i++) {
|
|
132854
133690
|
const entry = result[i];
|
|
133691
|
+
entry['current_page'] = cursor;
|
|
132855
133692
|
const marketId = this.safeString(entry, 'contract_code');
|
|
132856
133693
|
const symbolInner = this.safeSymbol(marketId);
|
|
132857
133694
|
const timestamp = this.safeInteger(entry, 'funding_time');
|
|
@@ -134012,16 +134849,24 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
134012
134849
|
/**
|
|
134013
134850
|
* @method
|
|
134014
134851
|
* @name huobi#fetchLedger
|
|
134852
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
|
|
134015
134853
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
134016
134854
|
* @param {string} code unified currency code, default is undefined
|
|
134017
134855
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
134018
134856
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
134019
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)
|
|
134020
134860
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
134021
134861
|
*/
|
|
134022
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
|
+
}
|
|
134023
134868
|
const accountId = await this.fetchAccountIdByType('spot', undefined, undefined, params);
|
|
134024
|
-
|
|
134869
|
+
let request = {
|
|
134025
134870
|
'accountId': accountId,
|
|
134026
134871
|
// 'currency': code,
|
|
134027
134872
|
// 'transactTypes': 'all', // default all
|
|
@@ -134042,6 +134887,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
134042
134887
|
if (limit !== undefined) {
|
|
134043
134888
|
request['limit'] = limit; // max 500
|
|
134044
134889
|
}
|
|
134890
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
134045
134891
|
const response = await this.spotPrivateGetV2AccountLedger(this.extend(request, params));
|
|
134046
134892
|
//
|
|
134047
134893
|
// {
|
|
@@ -141353,9 +142199,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141353
142199
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
141354
142200
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
141355
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)
|
|
141356
142203
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
141357
142204
|
*/
|
|
141358
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
|
+
}
|
|
141359
142211
|
const market = this.market(symbol);
|
|
141360
142212
|
const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
|
|
141361
142213
|
const request = {
|
|
@@ -141455,17 +142307,19 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141455
142307
|
/**
|
|
141456
142308
|
* @method
|
|
141457
142309
|
* @name kraken#fetchLedger
|
|
142310
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
141458
142311
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
141459
142312
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
141460
142313
|
* @param {string} code unified currency code, default is undefined
|
|
141461
142314
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
141462
142315
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
141463
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
|
|
141464
142318
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
141465
142319
|
*/
|
|
141466
142320
|
// https://www.kraken.com/features/api#get-ledgers-info
|
|
141467
142321
|
await this.loadMarkets();
|
|
141468
|
-
|
|
142322
|
+
let request = {};
|
|
141469
142323
|
let currency = undefined;
|
|
141470
142324
|
if (code !== undefined) {
|
|
141471
142325
|
currency = this.currency(code);
|
|
@@ -141474,6 +142328,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141474
142328
|
if (since !== undefined) {
|
|
141475
142329
|
request['start'] = this.parseToInt(since / 1000);
|
|
141476
142330
|
}
|
|
142331
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
141477
142332
|
const response = await this.privatePostLedgers(this.extend(request, params));
|
|
141478
142333
|
// { error: [],
|
|
141479
142334
|
// result: { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
|
|
@@ -141952,7 +142807,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
141952
142807
|
id = this.safeString(txid, 0);
|
|
141953
142808
|
}
|
|
141954
142809
|
const clientOrderId = this.safeString(order, 'userref');
|
|
141955
|
-
const rawTrades = this.safeValue(order, 'trades');
|
|
142810
|
+
const rawTrades = this.safeValue(order, 'trades', []);
|
|
141956
142811
|
const trades = [];
|
|
141957
142812
|
for (let i = 0; i < rawTrades.length; i++) {
|
|
141958
142813
|
const rawTrade = rawTrades[i];
|
|
@@ -142420,6 +143275,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142420
143275
|
/**
|
|
142421
143276
|
* @method
|
|
142422
143277
|
* @name kraken#fetchOpenOrders
|
|
143278
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
142423
143279
|
* @description fetch all unfilled currently open orders
|
|
142424
143280
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
142425
143281
|
* @param {string} symbol unified market symbol
|
|
@@ -142452,16 +143308,18 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142452
143308
|
/**
|
|
142453
143309
|
* @method
|
|
142454
143310
|
* @name kraken#fetchClosedOrders
|
|
143311
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
142455
143312
|
* @description fetches information on multiple closed orders made by the user
|
|
142456
143313
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
142457
143314
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
142458
143315
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
142459
143316
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
142460
143317
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
143318
|
+
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
142461
143319
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
142462
143320
|
*/
|
|
142463
143321
|
await this.loadMarkets();
|
|
142464
|
-
|
|
143322
|
+
let request = {};
|
|
142465
143323
|
if (since !== undefined) {
|
|
142466
143324
|
request['start'] = this.parseToInt(since / 1000);
|
|
142467
143325
|
}
|
|
@@ -142471,6 +143329,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142471
143329
|
request['userref'] = clientOrderId;
|
|
142472
143330
|
query = this.omit(params, ['userref', 'clientOrderId']);
|
|
142473
143331
|
}
|
|
143332
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
142474
143333
|
const response = await this.privatePostClosedOrders(this.extend(request, query));
|
|
142475
143334
|
//
|
|
142476
143335
|
// {
|
|
@@ -142650,6 +143509,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
142650
143509
|
/**
|
|
142651
143510
|
* @method
|
|
142652
143511
|
* @name kraken#fetchDeposits
|
|
143512
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
142653
143513
|
* @description fetch all deposits made to an account
|
|
142654
143514
|
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
142655
143515
|
* @param {string} code unified currency code
|
|
@@ -143729,8 +144589,26 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
143729
144589
|
});
|
|
143730
144590
|
}
|
|
143731
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
|
+
*/
|
|
143732
144605
|
await this.loadMarkets();
|
|
143733
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
|
+
}
|
|
143734
144612
|
const request = {
|
|
143735
144613
|
'symbol': market['id'],
|
|
143736
144614
|
'price_type': this.safeString(params, 'price', 'trade'),
|
|
@@ -143807,9 +144685,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
143807
144685
|
* @param {int} [limit] Total number of trades, cannot exceed 100
|
|
143808
144686
|
* @param {object} [params] Exchange specific params
|
|
143809
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)
|
|
143810
144689
|
* @returns An array of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
143811
144690
|
*/
|
|
143812
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
|
+
}
|
|
143813
144697
|
const market = this.market(symbol);
|
|
143814
144698
|
const request = {
|
|
143815
144699
|
'symbol': market['id'],
|
|
@@ -146885,9 +147769,15 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
146885
147769
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
146886
147770
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
146887
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)
|
|
146888
147773
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
146889
147774
|
*/
|
|
146890
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
|
+
}
|
|
146891
147781
|
const market = this.market(symbol);
|
|
146892
147782
|
const marketId = market['id'];
|
|
146893
147783
|
const request = {
|
|
@@ -147543,8 +148433,15 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147543
148433
|
* @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
|
|
147544
148434
|
* @param {bool} [params.stop] True if fetching a stop order
|
|
147545
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)
|
|
147546
148437
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
147547
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
|
+
}
|
|
147548
148445
|
return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
|
|
147549
148446
|
}
|
|
147550
148447
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -147569,8 +148466,15 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147569
148466
|
* @param {string} [params.orderIds] *stop orders only* comma seperated order ID list
|
|
147570
148467
|
* @param {bool} [params.stop] True if fetching a stop order
|
|
147571
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)
|
|
147572
148470
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
147573
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
|
+
}
|
|
147574
148478
|
return await this.fetchOrdersByStatus('active', symbol, since, limit, params);
|
|
147575
148479
|
}
|
|
147576
148480
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -147857,11 +148761,18 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147857
148761
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
147858
148762
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
147859
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
|
|
147860
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)
|
|
147861
148767
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
147862
148768
|
*/
|
|
147863
148769
|
await this.loadMarkets();
|
|
147864
|
-
|
|
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 = {};
|
|
147865
148776
|
const hf = this.safeValue(params, 'hf', false);
|
|
147866
148777
|
if (hf && symbol === undefined) {
|
|
147867
148778
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
|
|
@@ -147903,6 +148814,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147903
148814
|
else {
|
|
147904
148815
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
|
|
147905
148816
|
}
|
|
148817
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
147906
148818
|
const response = await this[method](this.extend(request, params));
|
|
147907
148819
|
//
|
|
147908
148820
|
// {
|
|
@@ -148344,6 +149256,8 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148344
149256
|
/**
|
|
148345
149257
|
* @method
|
|
148346
149258
|
* @name kucoin#fetchDeposits
|
|
149259
|
+
* @see https://docs.kucoin.com/#get-deposit-list
|
|
149260
|
+
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
148347
149261
|
* @description fetch all deposits made to an account
|
|
148348
149262
|
* @see https://docs.kucoin.com/#get-deposit-list
|
|
148349
149263
|
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
@@ -148351,10 +149265,17 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148351
149265
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
148352
149266
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
148353
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)
|
|
148354
149270
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
148355
149271
|
*/
|
|
148356
149272
|
await this.loadMarkets();
|
|
148357
|
-
|
|
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 = {};
|
|
148358
149279
|
let currency = undefined;
|
|
148359
149280
|
if (code !== undefined) {
|
|
148360
149281
|
currency = this.currency(code);
|
|
@@ -148374,6 +149295,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148374
149295
|
request['startAt'] = since;
|
|
148375
149296
|
}
|
|
148376
149297
|
}
|
|
149298
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
148377
149299
|
const response = await this[method](this.extend(request, params));
|
|
148378
149300
|
//
|
|
148379
149301
|
// {
|
|
@@ -148427,10 +149349,17 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148427
149349
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
148428
149350
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
148429
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)
|
|
148430
149354
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
148431
149355
|
*/
|
|
148432
149356
|
await this.loadMarkets();
|
|
148433
|
-
|
|
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 = {};
|
|
148434
149363
|
let currency = undefined;
|
|
148435
149364
|
if (code !== undefined) {
|
|
148436
149365
|
currency = this.currency(code);
|
|
@@ -148450,6 +149379,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148450
149379
|
request['startAt'] = since;
|
|
148451
149380
|
}
|
|
148452
149381
|
}
|
|
149382
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
148453
149383
|
const response = await this[method](this.extend(request, params));
|
|
148454
149384
|
//
|
|
148455
149385
|
// {
|
|
@@ -148936,17 +149866,25 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148936
149866
|
/**
|
|
148937
149867
|
* @method
|
|
148938
149868
|
* @name kucoin#fetchLedger
|
|
149869
|
+
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
148939
149870
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
148940
149871
|
* @see https://docs.kucoin.com/#get-account-ledgers
|
|
148941
149872
|
* @param {string} code unified currency code, default is undefined
|
|
148942
149873
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
148943
149874
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
148944
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)
|
|
148945
149878
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
148946
149879
|
*/
|
|
148947
149880
|
await this.loadMarkets();
|
|
148948
149881
|
await this.loadAccounts();
|
|
148949
|
-
|
|
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 = {
|
|
148950
149888
|
// 'currency': currency['id'], // can choose up to 10, if not provided returns for all currencies by default
|
|
148951
149889
|
// 'direction': 'in', // 'out'
|
|
148952
149890
|
// 'bizType': 'DEPOSIT', // DEPOSIT, WITHDRAW, TRANSFER, SUB_TRANSFER,TRADE_EXCHANGE, MARGIN_EXCHANGE, KUCOIN_BONUS (optional)
|
|
@@ -148962,6 +149900,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
148962
149900
|
currency = this.currency(code);
|
|
148963
149901
|
request['currency'] = currency['id'];
|
|
148964
149902
|
}
|
|
149903
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
148965
149904
|
const response = await this.privateGetAccountsLedgers(this.extend(request, params));
|
|
148966
149905
|
//
|
|
148967
149906
|
// {
|
|
@@ -150059,9 +150998,15 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
150059
150998
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
150060
150999
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
150061
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)
|
|
150062
151002
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
150063
151003
|
*/
|
|
150064
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
|
+
}
|
|
150065
151010
|
const market = this.market(symbol);
|
|
150066
151011
|
const marketId = market['id'];
|
|
150067
151012
|
const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
|
|
@@ -150941,9 +151886,15 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
150941
151886
|
* @param {int} [params.until] End time in ms
|
|
150942
151887
|
* @param {string} [params.side] buy or sell
|
|
150943
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)
|
|
150944
151890
|
* @returns An [array of order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
150945
151891
|
*/
|
|
150946
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
|
+
}
|
|
150947
151898
|
const stop = this.safeValue(params, 'stop');
|
|
150948
151899
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
150949
151900
|
params = this.omit(params, ['stop', 'until', 'till']);
|
|
@@ -151041,8 +151992,15 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151041
151992
|
* @param {int} [params.till] end time in ms
|
|
151042
151993
|
* @param {string} [params.side] buy or sell
|
|
151043
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)
|
|
151044
151996
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
151045
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
|
+
}
|
|
151046
152004
|
return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
|
|
151047
152005
|
}
|
|
151048
152006
|
async fetchOrder(id = undefined, symbol = undefined, params = {}) {
|
|
@@ -151401,15 +152359,23 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151401
152359
|
/**
|
|
151402
152360
|
* @method
|
|
151403
152361
|
* @name kucoinfutures#fetchMyTrades
|
|
152362
|
+
* @see https://docs.kucoin.com/futures/#get-fills
|
|
151404
152363
|
* @description fetch all trades made by the user
|
|
151405
152364
|
* @param {string} symbol unified market symbol
|
|
151406
152365
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
151407
152366
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
151408
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)
|
|
151409
152370
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
151410
152371
|
*/
|
|
151411
152372
|
await this.loadMarkets();
|
|
151412
|
-
|
|
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 = {
|
|
151413
152379
|
// orderId (String) [optional] Fills for a specific order (other parameters can be ignored if specified)
|
|
151414
152380
|
// symbol (String) [optional] Symbol of the contract
|
|
151415
152381
|
// side (String) [optional] buy or sell
|
|
@@ -151425,6 +152391,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151425
152391
|
if (since !== undefined) {
|
|
151426
152392
|
request['startAt'] = since;
|
|
151427
152393
|
}
|
|
152394
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
151428
152395
|
const response = await this.futuresPrivateGetFills(this.extend(request, params));
|
|
151429
152396
|
//
|
|
151430
152397
|
// {
|
|
@@ -151825,12 +152792,18 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151825
152792
|
* @param {int} [since] not used by kucuoinfutures
|
|
151826
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
|
|
151827
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)
|
|
151828
152796
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
151829
152797
|
*/
|
|
151830
152798
|
if (symbol === undefined) {
|
|
151831
152799
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
151832
152800
|
}
|
|
151833
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
|
+
}
|
|
151834
152807
|
const market = this.market(symbol);
|
|
151835
152808
|
const request = {
|
|
151836
152809
|
'symbol': market['id'],
|
|
@@ -177719,9 +178692,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177719
178692
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
177720
178693
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
177721
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
|
|
177722
178696
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
177723
178697
|
*/
|
|
177724
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
|
+
}
|
|
177725
178704
|
const market = this.market(symbol);
|
|
177726
178705
|
const request = {
|
|
177727
178706
|
'instId': market['id'],
|
|
@@ -177824,10 +178803,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177824
178803
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
177825
178804
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
177826
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)
|
|
177827
178807
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
177828
178808
|
*/
|
|
177829
178809
|
await this.loadMarkets();
|
|
177830
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
|
+
}
|
|
177831
178816
|
const price = this.safeString(params, 'price');
|
|
177832
178817
|
params = this.omit(params, 'price');
|
|
177833
178818
|
const options = this.safeValue(this.options, 'fetchOHLCV', {});
|
|
@@ -177918,12 +178903,18 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
177918
178903
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
177919
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
|
|
177920
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)
|
|
177921
178907
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
177922
178908
|
*/
|
|
177923
178909
|
if (symbol === undefined) {
|
|
177924
178910
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
177925
178911
|
}
|
|
177926
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
|
+
}
|
|
177927
178918
|
const market = this.market(symbol);
|
|
177928
178919
|
const request = {
|
|
177929
178920
|
'instId': market['id'],
|
|
@@ -179156,9 +180147,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179156
180147
|
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
179157
180148
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
179158
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)
|
|
179159
180151
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
179160
180152
|
*/
|
|
179161
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
|
+
}
|
|
179162
180159
|
const request = {
|
|
179163
180160
|
// 'instType': 'SPOT', // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
179164
180161
|
// 'uly': currency['id'],
|
|
@@ -179482,9 +180479,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179482
180479
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
179483
180480
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
179484
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)
|
|
179485
180483
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
179486
180484
|
*/
|
|
179487
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
|
+
}
|
|
179488
180491
|
const request = {
|
|
179489
180492
|
// 'instType': type.toUpperCase (), // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
179490
180493
|
// 'uly': currency['id'],
|
|
@@ -179644,10 +180647,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179644
180647
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
179645
180648
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
179646
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)
|
|
179647
180652
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
179648
180653
|
*/
|
|
179649
180654
|
await this.loadMarkets();
|
|
179650
|
-
|
|
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 = {
|
|
179651
180661
|
// 'instType': 'SPOT', // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
179652
180662
|
// 'uly': currency['id'],
|
|
179653
180663
|
// 'instId': market['id'],
|
|
@@ -179661,6 +180671,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179661
180671
|
market = this.market(symbol);
|
|
179662
180672
|
request['instId'] = market['id'];
|
|
179663
180673
|
}
|
|
180674
|
+
[request, params] = this.handleUntilOption('end', params, request);
|
|
179664
180675
|
const [type, query] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
179665
180676
|
request['instType'] = this.convertToInstrumentType(type);
|
|
179666
180677
|
if (limit !== undefined) {
|
|
@@ -179730,14 +180741,21 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179730
180741
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
179731
180742
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
179732
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)
|
|
179733
180746
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
179734
180747
|
*/
|
|
179735
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
|
+
}
|
|
179736
180754
|
const options = this.safeValue(this.options, 'fetchLedger', {});
|
|
179737
180755
|
let method = this.safeString(options, 'method');
|
|
179738
180756
|
method = this.safeString(params, 'method', method);
|
|
179739
180757
|
params = this.omit(params, 'method');
|
|
179740
|
-
|
|
180758
|
+
let request = {
|
|
179741
180759
|
// 'instType': undefined, // 'SPOT', 'MARGIN', 'SWAP', 'FUTURES", 'OPTION'
|
|
179742
180760
|
// 'ccy': undefined, // currency['id'],
|
|
179743
180761
|
// 'mgnMode': undefined, // 'isolated', 'cross'
|
|
@@ -179772,6 +180790,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179772
180790
|
currency = this.currency(code);
|
|
179773
180791
|
request['ccy'] = currency['id'];
|
|
179774
180792
|
}
|
|
180793
|
+
[request, params] = this.handleUntilOption('end', params, request);
|
|
179775
180794
|
const response = await this[method](this.extend(request, query));
|
|
179776
180795
|
//
|
|
179777
180796
|
// privateGetAccountBills, privateGetAccountBillsArchive
|
|
@@ -180186,10 +181205,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180186
181205
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
180187
181206
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
180188
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)
|
|
180189
181210
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
180190
181211
|
*/
|
|
180191
181212
|
await this.loadMarkets();
|
|
180192
|
-
|
|
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 = {
|
|
180193
181219
|
// 'ccy': currency['id'],
|
|
180194
181220
|
// 'state': 2, // 0 waiting for confirmation, 1 deposit credited, 2 deposit successful
|
|
180195
181221
|
// 'after': since,
|
|
@@ -180207,6 +181233,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180207
181233
|
if (limit !== undefined) {
|
|
180208
181234
|
request['limit'] = limit; // default 100, max 100
|
|
180209
181235
|
}
|
|
181236
|
+
[request, params] = this.handleUntilOption('after', params, request);
|
|
180210
181237
|
const response = await this.privateGetAssetDepositHistory(this.extend(request, params));
|
|
180211
181238
|
//
|
|
180212
181239
|
// {
|
|
@@ -180284,10 +181311,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180284
181311
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
180285
181312
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
180286
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)
|
|
180287
181316
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
180288
181317
|
*/
|
|
180289
181318
|
await this.loadMarkets();
|
|
180290
|
-
|
|
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 = {
|
|
180291
181325
|
// 'ccy': currency['id'],
|
|
180292
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
|
|
180293
181327
|
// 'after': since,
|
|
@@ -180305,6 +181339,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
180305
181339
|
if (limit !== undefined) {
|
|
180306
181340
|
request['limit'] = limit; // default 100, max 100
|
|
180307
181341
|
}
|
|
181342
|
+
[request, params] = this.handleUntilOption('after', request, params);
|
|
180308
181343
|
const response = await this.privateGetAssetWithdrawalHistory(this.extend(request, params));
|
|
180309
181344
|
//
|
|
180310
181345
|
// {
|
|
@@ -188057,11 +189092,18 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
188057
189092
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
188058
189093
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
188059
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)
|
|
188060
189097
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
188061
189098
|
*/
|
|
188062
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
|
+
}
|
|
188063
189105
|
const market = this.market(symbol);
|
|
188064
|
-
|
|
189106
|
+
let request = {
|
|
188065
189107
|
'symbol': market['id'],
|
|
188066
189108
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
188067
189109
|
};
|
|
@@ -188072,6 +189114,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
188072
189114
|
// limit should in between 100 and 500
|
|
188073
189115
|
request['limit'] = limit;
|
|
188074
189116
|
}
|
|
189117
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
188075
189118
|
const response = await this.publicGetMarketsSymbolCandles(this.extend(request, params));
|
|
188076
189119
|
//
|
|
188077
189120
|
// [
|
|
@@ -188611,14 +189654,21 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
188611
189654
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
188612
189655
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
188613
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)
|
|
188614
189659
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
188615
189660
|
*/
|
|
188616
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
|
+
}
|
|
188617
189667
|
let market = undefined;
|
|
188618
189668
|
if (symbol !== undefined) {
|
|
188619
189669
|
market = this.market(symbol);
|
|
188620
189670
|
}
|
|
188621
|
-
|
|
189671
|
+
let request = {
|
|
188622
189672
|
// 'from': 12345678, // A 'trade Id'. The query begins at ‘from'.
|
|
188623
189673
|
// 'direction': 'PRE', // PRE, NEXT The direction before or after ‘from'.
|
|
188624
189674
|
};
|
|
@@ -188628,6 +189678,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
188628
189678
|
if (limit !== undefined) {
|
|
188629
189679
|
request['limit'] = limit;
|
|
188630
189680
|
}
|
|
189681
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
188631
189682
|
const response = await this.privateGetTrades(this.extend(request, params));
|
|
188632
189683
|
//
|
|
188633
189684
|
// [
|
|
@@ -274168,7 +275219,7 @@ SOFTWARE.
|
|
|
274168
275219
|
|
|
274169
275220
|
//-----------------------------------------------------------------------------
|
|
274170
275221
|
// this is updated by vss.js when building
|
|
274171
|
-
const version = '4.1.
|
|
275222
|
+
const version = '4.1.6';
|
|
274172
275223
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
274173
275224
|
//-----------------------------------------------------------------------------
|
|
274174
275225
|
|