ccxt 4.1.4 → 4.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +1231 -81
- package/dist/ccxt.browser.min.js +12 -12
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +216 -0
- package/dist/cjs/src/binance.js +96 -1
- package/dist/cjs/src/bingx.js +24 -0
- package/dist/cjs/src/bitfinex2.js +55 -11
- package/dist/cjs/src/bitget.js +132 -12
- package/dist/cjs/src/bitmex.js +49 -0
- package/dist/cjs/src/bybit.js +56 -3
- package/dist/cjs/src/coinbase.js +85 -6
- package/dist/cjs/src/coinbasepro.js +18 -0
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/coinsph.js +1 -2
- package/dist/cjs/src/cryptocom.js +30 -0
- package/dist/cjs/src/gate.js +56 -3
- package/dist/cjs/src/huobi.js +69 -4
- package/dist/cjs/src/kraken.js +18 -8
- package/dist/cjs/src/krakenfutures.js +24 -0
- package/dist/cjs/src/kucoin.js +59 -4
- package/dist/cjs/src/kucoinfutures.js +35 -1
- package/dist/cjs/src/kuna.js +97 -10
- package/dist/cjs/src/okx.js +66 -4
- package/dist/cjs/src/poloniex.js +18 -2
- package/dist/cjs/src/pro/bitget.js +22 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kuna.d.ts +34 -0
- package/js/src/base/Exchange.d.ts +7 -0
- package/js/src/base/Exchange.js +216 -0
- package/js/src/binance.d.ts +5 -5
- package/js/src/binance.js +96 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +24 -0
- package/js/src/bitfinex2.d.ts +3 -3
- package/js/src/bitfinex2.js +56 -12
- package/js/src/bitget.d.ts +7 -6
- package/js/src/bitget.js +132 -12
- package/js/src/bitmex.d.ts +6 -6
- package/js/src/bitmex.js +49 -0
- package/js/src/bybit.d.ts +6 -6
- package/js/src/bybit.js +56 -3
- package/js/src/coinbase.d.ts +5 -5
- package/js/src/coinbase.js +86 -7
- package/js/src/coinbasepro.d.ts +5 -5
- package/js/src/coinbasepro.js +18 -0
- package/js/src/coinex.js +1 -1
- package/js/src/coinsph.js +1 -2
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/cryptocom.js +30 -0
- package/js/src/gate.d.ts +4 -4
- package/js/src/gate.js +56 -3
- package/js/src/huobi.d.ts +2 -2
- package/js/src/huobi.js +69 -4
- package/js/src/kraken.d.ts +2 -2
- package/js/src/kraken.js +18 -8
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/krakenfutures.js +24 -0
- package/js/src/kucoin.d.ts +5 -5
- package/js/src/kucoin.js +59 -4
- package/js/src/kucoinfutures.d.ts +4 -4
- package/js/src/kucoinfutures.js +35 -1
- package/js/src/kuna.d.ts +1 -0
- package/js/src/kuna.js +97 -10
- package/js/src/okx.d.ts +6 -6
- package/js/src/okx.js +66 -4
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/poloniex.js +18 -2
- package/js/src/pro/bitget.d.ts +5 -0
- package/js/src/pro/bitget.js +22 -6
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -179,7 +179,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
179
179
|
|
|
180
180
|
//-----------------------------------------------------------------------------
|
|
181
181
|
// this is updated by vss.js when building
|
|
182
|
-
const version = '4.1.
|
|
182
|
+
const version = '4.1.6';
|
|
183
183
|
Exchange["default"].ccxtVersion = version;
|
|
184
184
|
const exchanges = {
|
|
185
185
|
'ace': ace,
|
|
@@ -4100,6 +4100,222 @@ class Exchange {
|
|
|
4100
4100
|
res[symbol][timeframe] = data;
|
|
4101
4101
|
return res;
|
|
4102
4102
|
}
|
|
4103
|
+
handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest = undefined, params = {}) {
|
|
4104
|
+
let newMaxEntriesPerRequest = undefined;
|
|
4105
|
+
[newMaxEntriesPerRequest, params] = this.handleOptionAndParams(params, method, 'maxEntriesPerRequest');
|
|
4106
|
+
if ((newMaxEntriesPerRequest !== undefined) && (newMaxEntriesPerRequest !== maxEntriesPerRequest)) {
|
|
4107
|
+
maxEntriesPerRequest = newMaxEntriesPerRequest;
|
|
4108
|
+
}
|
|
4109
|
+
if (maxEntriesPerRequest === undefined) {
|
|
4110
|
+
maxEntriesPerRequest = 1000; // default to 1000
|
|
4111
|
+
}
|
|
4112
|
+
return [maxEntriesPerRequest, params];
|
|
4113
|
+
}
|
|
4114
|
+
async fetchPaginatedCallDynamic(method, symbol = undefined, since = undefined, limit = undefined, params = {}, maxEntriesPerRequest = undefined) {
|
|
4115
|
+
let maxCalls = undefined;
|
|
4116
|
+
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
4117
|
+
let maxRetries = undefined;
|
|
4118
|
+
[maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
|
|
4119
|
+
let paginationDirection = undefined;
|
|
4120
|
+
[paginationDirection, params] = this.handleOptionAndParams(params, method, 'paginationDirection', 'backward');
|
|
4121
|
+
let paginationTimestamp = undefined;
|
|
4122
|
+
let calls = 0;
|
|
4123
|
+
let result = [];
|
|
4124
|
+
let errors$1 = 0;
|
|
4125
|
+
const until = this.safeInteger2(params, 'untill', 'till'); // do not omit it from params here
|
|
4126
|
+
[maxEntriesPerRequest, params] = this.handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest, params);
|
|
4127
|
+
if ((paginationDirection === 'forward')) {
|
|
4128
|
+
if (since === undefined) {
|
|
4129
|
+
throw new errors.ArgumentsRequired(this.id + ' pagination requires a since argument when paginationDirection set to forward');
|
|
4130
|
+
}
|
|
4131
|
+
paginationTimestamp = since;
|
|
4132
|
+
}
|
|
4133
|
+
while ((calls < maxCalls)) {
|
|
4134
|
+
calls += 1;
|
|
4135
|
+
try {
|
|
4136
|
+
if (paginationDirection === 'backward') {
|
|
4137
|
+
// do it backwards, starting from the last
|
|
4138
|
+
// UNTIL filtering is required in order to work
|
|
4139
|
+
if (paginationTimestamp !== undefined) {
|
|
4140
|
+
params['until'] = paginationTimestamp - 1;
|
|
4141
|
+
}
|
|
4142
|
+
const response = await this[method](symbol, undefined, maxEntriesPerRequest, params);
|
|
4143
|
+
const responseLength = response.length;
|
|
4144
|
+
if (this.verbose) {
|
|
4145
|
+
this.log('Dynamic pagination call', calls, 'method', method, 'response length', responseLength, 'timestamp', paginationTimestamp);
|
|
4146
|
+
}
|
|
4147
|
+
if (responseLength === 0) {
|
|
4148
|
+
break;
|
|
4149
|
+
}
|
|
4150
|
+
errors$1 = 0;
|
|
4151
|
+
result = this.arrayConcat(result, response);
|
|
4152
|
+
const firstElement = this.safeValue(response, 0);
|
|
4153
|
+
paginationTimestamp = this.safeInteger2(firstElement, 'timestamp', 0);
|
|
4154
|
+
if ((since !== undefined) && (paginationTimestamp <= since)) {
|
|
4155
|
+
break;
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
else {
|
|
4159
|
+
// do it forwards, starting from the since
|
|
4160
|
+
const response = await this[method](symbol, paginationTimestamp, maxEntriesPerRequest, params);
|
|
4161
|
+
const responseLength = response.length;
|
|
4162
|
+
if (this.verbose) {
|
|
4163
|
+
this.log('Dynamic pagination call', calls, 'method', method, 'response length', responseLength, 'timestamp', paginationTimestamp);
|
|
4164
|
+
}
|
|
4165
|
+
if (responseLength === 0) {
|
|
4166
|
+
break;
|
|
4167
|
+
}
|
|
4168
|
+
errors$1 = 0;
|
|
4169
|
+
result = this.arrayConcat(result, response);
|
|
4170
|
+
const last = this.safeValue(response, responseLength - 1);
|
|
4171
|
+
paginationTimestamp = this.safeInteger(last, 'timestamp') - 1;
|
|
4172
|
+
if ((until !== undefined) && (paginationTimestamp >= until)) {
|
|
4173
|
+
break;
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
catch (e) {
|
|
4178
|
+
errors$1 += 1;
|
|
4179
|
+
if (errors$1 > maxRetries) {
|
|
4180
|
+
throw e;
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
return this.removeRepeatedElementsFromArray(result);
|
|
4185
|
+
}
|
|
4186
|
+
async safeDeterministicCall(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}) {
|
|
4187
|
+
let maxRetries = undefined;
|
|
4188
|
+
[maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
|
|
4189
|
+
let errors$1 = 0;
|
|
4190
|
+
try {
|
|
4191
|
+
if (timeframe && method !== 'fetchFundingRateHistory') {
|
|
4192
|
+
return await this[method](symbol, timeframe, since, limit, params);
|
|
4193
|
+
}
|
|
4194
|
+
else {
|
|
4195
|
+
return await this[method](symbol, since, limit, params);
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
catch (e) {
|
|
4199
|
+
if (e instanceof errors.RateLimitExceeded) {
|
|
4200
|
+
throw e; // if we are rate limited, we should not retry and fail fast
|
|
4201
|
+
}
|
|
4202
|
+
errors$1 += 1;
|
|
4203
|
+
if (errors$1 > maxRetries) {
|
|
4204
|
+
throw e;
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
async fetchPaginatedCallDeterministic(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}, maxEntriesPerRequest = undefined) {
|
|
4209
|
+
let maxCalls = undefined;
|
|
4210
|
+
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
4211
|
+
[maxEntriesPerRequest, params] = this.handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest, params);
|
|
4212
|
+
const current = this.milliseconds();
|
|
4213
|
+
const tasks = [];
|
|
4214
|
+
const time = this.parseTimeframe(timeframe) * 1000;
|
|
4215
|
+
const step = time * maxEntriesPerRequest;
|
|
4216
|
+
let currentSince = current - (maxCalls * step) - 1;
|
|
4217
|
+
if (since !== undefined) {
|
|
4218
|
+
currentSince = Math.max(currentSince, since);
|
|
4219
|
+
}
|
|
4220
|
+
const until = this.safeInteger2(params, 'until', 'till'); // do not omit it here
|
|
4221
|
+
if (until !== undefined) {
|
|
4222
|
+
const requiredCalls = Math.ceil((until - since) / step);
|
|
4223
|
+
if (requiredCalls > maxCalls) {
|
|
4224
|
+
throw new errors.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());
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
for (let i = 0; i < maxCalls; i++) {
|
|
4228
|
+
if ((until !== undefined) && (currentSince >= until)) {
|
|
4229
|
+
break;
|
|
4230
|
+
}
|
|
4231
|
+
tasks.push(this.safeDeterministicCall(method, symbol, currentSince, maxEntriesPerRequest, timeframe, params));
|
|
4232
|
+
currentSince = this.sum(currentSince, step) - 1;
|
|
4233
|
+
}
|
|
4234
|
+
const results = await Promise.all(tasks);
|
|
4235
|
+
let result = [];
|
|
4236
|
+
for (let i = 0; i < results.length; i++) {
|
|
4237
|
+
result = this.arrayConcat(result, results[i]);
|
|
4238
|
+
}
|
|
4239
|
+
return this.removeRepeatedElementsFromArray(result);
|
|
4240
|
+
}
|
|
4241
|
+
async fetchPaginatedCallCursor(method, symbol = undefined, since = undefined, limit = undefined, params = {}, cursorReceived = undefined, cursorSent = undefined, cursorIncrement = undefined, maxEntriesPerRequest = undefined) {
|
|
4242
|
+
let maxCalls = undefined;
|
|
4243
|
+
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
4244
|
+
let maxRetries = undefined;
|
|
4245
|
+
[maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
|
|
4246
|
+
[maxEntriesPerRequest, params] = this.handleMaxEntriesPerRequestAndParams(method, maxEntriesPerRequest, params);
|
|
4247
|
+
let cursorValue = undefined;
|
|
4248
|
+
let i = 0;
|
|
4249
|
+
let errors = 0;
|
|
4250
|
+
let result = [];
|
|
4251
|
+
while (i < maxCalls) {
|
|
4252
|
+
try {
|
|
4253
|
+
if (cursorValue !== undefined) {
|
|
4254
|
+
if (cursorIncrement !== undefined) {
|
|
4255
|
+
cursorValue = this.parseToInt(cursorValue) + cursorIncrement;
|
|
4256
|
+
}
|
|
4257
|
+
params[cursorSent] = cursorValue;
|
|
4258
|
+
}
|
|
4259
|
+
const response = await this[method](symbol, since, maxEntriesPerRequest, params);
|
|
4260
|
+
errors = 0;
|
|
4261
|
+
const responseLength = response.length;
|
|
4262
|
+
if (this.verbose) {
|
|
4263
|
+
this.log('Cursor pagination call', i + 1, 'method', method, 'response length', responseLength, 'cursor', cursorValue);
|
|
4264
|
+
}
|
|
4265
|
+
if (responseLength === 0) {
|
|
4266
|
+
break;
|
|
4267
|
+
}
|
|
4268
|
+
result = this.arrayConcat(result, response);
|
|
4269
|
+
const last = this.safeValue(response, responseLength - 1);
|
|
4270
|
+
cursorValue = this.safeValue(last['info'], cursorReceived);
|
|
4271
|
+
if (cursorValue === undefined) {
|
|
4272
|
+
break;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
catch (e) {
|
|
4276
|
+
errors += 1;
|
|
4277
|
+
if (errors > maxRetries) {
|
|
4278
|
+
throw e;
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
i += 1;
|
|
4282
|
+
}
|
|
4283
|
+
return result;
|
|
4284
|
+
}
|
|
4285
|
+
removeRepeatedElementsFromArray(input) {
|
|
4286
|
+
const uniqueResult = {};
|
|
4287
|
+
for (let i = 0; i < input.length; i++) {
|
|
4288
|
+
const entry = input[i];
|
|
4289
|
+
const id = this.safeString(entry, 'id');
|
|
4290
|
+
if (id !== undefined) {
|
|
4291
|
+
if (this.safeString(uniqueResult, id) === undefined) {
|
|
4292
|
+
uniqueResult[id] = entry;
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
else {
|
|
4296
|
+
const timestamp = this.safeInteger2(entry, 'timestamp', 0);
|
|
4297
|
+
if (timestamp !== undefined) {
|
|
4298
|
+
if (this.safeString(uniqueResult, timestamp) === undefined) {
|
|
4299
|
+
uniqueResult[timestamp] = entry;
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
const values = Object.values(uniqueResult);
|
|
4305
|
+
const valuesLength = values.length;
|
|
4306
|
+
if (valuesLength > 0) {
|
|
4307
|
+
return values;
|
|
4308
|
+
}
|
|
4309
|
+
return input;
|
|
4310
|
+
}
|
|
4311
|
+
handleUntilOption(key, request, params, multiplier = 1) {
|
|
4312
|
+
const until = this.safeValue2(params, 'until', 'till');
|
|
4313
|
+
if (until !== undefined) {
|
|
4314
|
+
request[key] = this.parseToInt(until * multiplier);
|
|
4315
|
+
params = this.omit(params, ['until', 'till']);
|
|
4316
|
+
}
|
|
4317
|
+
return [request, params];
|
|
4318
|
+
}
|
|
4103
4319
|
}
|
|
4104
4320
|
|
|
4105
4321
|
exports.Exchange = Exchange;
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -3321,9 +3321,15 @@ class binance extends binance$1 {
|
|
|
3321
3321
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3322
3322
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
3323
3323
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
3324
|
+
* @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)
|
|
3324
3325
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
3325
3326
|
*/
|
|
3326
3327
|
await this.loadMarkets();
|
|
3328
|
+
let paginate = false;
|
|
3329
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
3330
|
+
if (paginate) {
|
|
3331
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
3332
|
+
}
|
|
3327
3333
|
const market = this.market(symbol);
|
|
3328
3334
|
// binance docs say that the default limit 500, max 1500 for futures, max 1000 for spot markets
|
|
3329
3335
|
// the reality is that the time range wider than 500 candles won't work right
|
|
@@ -3658,12 +3664,18 @@ class binance extends binance$1 {
|
|
|
3658
3664
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3659
3665
|
* @param {int} [params.until] only used when fetchTradesMethod is 'publicGetAggTrades', 'fapiPublicGetAggTrades', or 'dapiPublicGetAggTrades'
|
|
3660
3666
|
* @param {int} [params.fetchTradesMethod] 'publicGetAggTrades' (spot default), 'fapiPublicGetAggTrades' (swap default), 'dapiPublicGetAggTrades' (future default), 'eapiPublicGetTrades' (option default), 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', 'publicGetHistoricalTrades', 'fapiPublicGetHistoricalTrades', 'dapiPublicGetHistoricalTrades', 'eapiPublicGetHistoricalTrades'
|
|
3667
|
+
* @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)
|
|
3661
3668
|
*
|
|
3662
3669
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
3663
3670
|
* @param {int} [params.fromId] trade id to fetch from, default gets most recent trades, not used when fetchTradesMethod is 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', or 'eapiPublicGetTrades'
|
|
3664
3671
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
3665
3672
|
*/
|
|
3666
3673
|
await this.loadMarkets();
|
|
3674
|
+
let paginate = false;
|
|
3675
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
3676
|
+
if (paginate) {
|
|
3677
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
3678
|
+
}
|
|
3667
3679
|
const market = this.market(symbol);
|
|
3668
3680
|
const request = {
|
|
3669
3681
|
'symbol': market['id'],
|
|
@@ -4695,10 +4707,17 @@ class binance extends binance$1 {
|
|
|
4695
4707
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4696
4708
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4697
4709
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
4710
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
4711
|
+
* @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)
|
|
4698
4712
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4699
4713
|
*/
|
|
4700
4714
|
this.checkRequiredSymbol('fetchOrders', symbol);
|
|
4701
4715
|
await this.loadMarkets();
|
|
4716
|
+
let paginate = false;
|
|
4717
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
4718
|
+
if (paginate) {
|
|
4719
|
+
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
4720
|
+
}
|
|
4702
4721
|
const market = this.market(symbol);
|
|
4703
4722
|
const defaultType = this.safeString2(this.options, 'fetchOrders', 'defaultType', 'spot');
|
|
4704
4723
|
const type = this.safeString(params, 'type', defaultType);
|
|
@@ -4722,6 +4741,11 @@ class binance extends binance$1 {
|
|
|
4722
4741
|
request['isIsolated'] = true;
|
|
4723
4742
|
}
|
|
4724
4743
|
}
|
|
4744
|
+
const until = this.safeInteger(params, 'until');
|
|
4745
|
+
if (until !== undefined) {
|
|
4746
|
+
params = this.omit(params, 'until');
|
|
4747
|
+
request['endTime'] = until;
|
|
4748
|
+
}
|
|
4725
4749
|
if (since !== undefined) {
|
|
4726
4750
|
request['startTime'] = since;
|
|
4727
4751
|
}
|
|
@@ -4809,6 +4833,10 @@ class binance extends binance$1 {
|
|
|
4809
4833
|
/**
|
|
4810
4834
|
* @method
|
|
4811
4835
|
* @name binance#fetchOpenOrders
|
|
4836
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
|
|
4837
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
4838
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
4839
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
4812
4840
|
* @description fetch all unfilled currently open orders
|
|
4813
4841
|
* @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
|
4814
4842
|
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
@@ -4891,6 +4919,7 @@ class binance extends binance$1 {
|
|
|
4891
4919
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4892
4920
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4893
4921
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4922
|
+
* @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)
|
|
4894
4923
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4895
4924
|
*/
|
|
4896
4925
|
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
@@ -4908,6 +4937,7 @@ class binance extends binance$1 {
|
|
|
4908
4937
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4909
4938
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4910
4939
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4940
|
+
* @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)
|
|
4911
4941
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4912
4942
|
*/
|
|
4913
4943
|
this.checkRequiredSymbol('fetchCanceledOrders', symbol);
|
|
@@ -5141,9 +5171,16 @@ class binance extends binance$1 {
|
|
|
5141
5171
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
5142
5172
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
5143
5173
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5174
|
+
* @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)
|
|
5175
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5144
5176
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
5145
5177
|
*/
|
|
5146
5178
|
await this.loadMarkets();
|
|
5179
|
+
let paginate = false;
|
|
5180
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
5181
|
+
if (paginate) {
|
|
5182
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
5183
|
+
}
|
|
5147
5184
|
const request = {};
|
|
5148
5185
|
let market = undefined;
|
|
5149
5186
|
let type = undefined;
|
|
@@ -5414,6 +5451,7 @@ class binance extends binance$1 {
|
|
|
5414
5451
|
/**
|
|
5415
5452
|
* @method
|
|
5416
5453
|
* @name binance#fetchDeposits
|
|
5454
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
5417
5455
|
* @description fetch all deposits made to an account
|
|
5418
5456
|
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
5419
5457
|
* @see https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
|
|
@@ -5422,10 +5460,16 @@ class binance extends binance$1 {
|
|
|
5422
5460
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5423
5461
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5424
5462
|
* @param {bool} [params.fiat] if true, only fiat deposits will be returned
|
|
5425
|
-
* @param {int} [params.until] the latest time in ms to fetch
|
|
5463
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5464
|
+
* @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)
|
|
5426
5465
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
5427
5466
|
*/
|
|
5428
5467
|
await this.loadMarkets();
|
|
5468
|
+
let paginate = false;
|
|
5469
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
5470
|
+
if (paginate) {
|
|
5471
|
+
return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
|
|
5472
|
+
}
|
|
5429
5473
|
let currency = undefined;
|
|
5430
5474
|
let response = undefined;
|
|
5431
5475
|
const request = {};
|
|
@@ -5433,6 +5477,7 @@ class binance extends binance$1 {
|
|
|
5433
5477
|
const fiatOnly = this.safeValue(params, 'fiat', false);
|
|
5434
5478
|
params = this.omit(params, 'fiatOnly');
|
|
5435
5479
|
const until = this.safeInteger(params, 'until');
|
|
5480
|
+
params = this.omit(params, 'until');
|
|
5436
5481
|
if (fiatOnly || (code in legalMoney)) {
|
|
5437
5482
|
if (code !== undefined) {
|
|
5438
5483
|
currency = this.currency(code);
|
|
@@ -5520,6 +5565,8 @@ class binance extends binance$1 {
|
|
|
5520
5565
|
/**
|
|
5521
5566
|
* @method
|
|
5522
5567
|
* @name binance#fetchWithdrawals
|
|
5568
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
5569
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
|
5523
5570
|
* @description fetch all withdrawals made from an account
|
|
5524
5571
|
* @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
|
|
5525
5572
|
* @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
|
@@ -5528,13 +5575,25 @@ class binance extends binance$1 {
|
|
|
5528
5575
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5529
5576
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5530
5577
|
* @param {bool} [params.fiat] if true, only fiat withdrawals will be returned
|
|
5578
|
+
* @param {int} [params.until] the latest time in ms to fetch withdrawals for
|
|
5579
|
+
* @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)
|
|
5531
5580
|
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
5532
5581
|
*/
|
|
5533
5582
|
await this.loadMarkets();
|
|
5583
|
+
let paginate = false;
|
|
5584
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
5585
|
+
if (paginate) {
|
|
5586
|
+
return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
|
|
5587
|
+
}
|
|
5534
5588
|
const legalMoney = this.safeValue(this.options, 'legalMoney', {});
|
|
5535
5589
|
const fiatOnly = this.safeValue(params, 'fiat', false);
|
|
5536
5590
|
params = this.omit(params, 'fiatOnly');
|
|
5537
5591
|
const request = {};
|
|
5592
|
+
const until = this.safeInteger(params, 'until');
|
|
5593
|
+
if (until !== undefined) {
|
|
5594
|
+
params = this.omit(params, 'until');
|
|
5595
|
+
request['endTime'] = until;
|
|
5596
|
+
}
|
|
5538
5597
|
let response = undefined;
|
|
5539
5598
|
let currency = undefined;
|
|
5540
5599
|
if (fiatOnly || (code in legalMoney)) {
|
|
@@ -5986,15 +6045,23 @@ class binance extends binance$1 {
|
|
|
5986
6045
|
/**
|
|
5987
6046
|
* @method
|
|
5988
6047
|
* @name binance#fetchTransfers
|
|
6048
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
|
|
5989
6049
|
* @description fetch a history of internal transfers made on an account
|
|
5990
6050
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
|
|
5991
6051
|
* @param {string} code unified currency code of the currency transferred
|
|
5992
6052
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5993
6053
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5994
6054
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6055
|
+
* @param {int} [params.until] the latest time in ms to fetch transfers for
|
|
6056
|
+
* @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)
|
|
5995
6057
|
* @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
|
|
5996
6058
|
*/
|
|
5997
6059
|
await this.loadMarkets();
|
|
6060
|
+
let paginate = false;
|
|
6061
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
|
|
6062
|
+
if (paginate) {
|
|
6063
|
+
return await this.fetchPaginatedCallDynamic('fetchTransfers', code, since, limit, params);
|
|
6064
|
+
}
|
|
5998
6065
|
let currency = undefined;
|
|
5999
6066
|
if (code !== undefined) {
|
|
6000
6067
|
currency = this.currency(code);
|
|
@@ -6027,6 +6094,11 @@ class binance extends binance$1 {
|
|
|
6027
6094
|
if (limit !== undefined) {
|
|
6028
6095
|
request['size'] = limit;
|
|
6029
6096
|
}
|
|
6097
|
+
const until = this.safeInteger(params, 'until');
|
|
6098
|
+
if (until !== undefined) {
|
|
6099
|
+
params = this.omit(params, 'until');
|
|
6100
|
+
request['endTime'] = until;
|
|
6101
|
+
}
|
|
6030
6102
|
const response = await this.sapiGetAssetTransfer(this.extend(request, params));
|
|
6031
6103
|
//
|
|
6032
6104
|
// {
|
|
@@ -6711,11 +6783,17 @@ class binance extends binance$1 {
|
|
|
6711
6783
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
6712
6784
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6713
6785
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
6786
|
+
* @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)
|
|
6714
6787
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
6715
6788
|
*/
|
|
6716
6789
|
await this.loadMarkets();
|
|
6717
6790
|
const request = {};
|
|
6718
6791
|
let method = undefined;
|
|
6792
|
+
let paginate = false;
|
|
6793
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
6794
|
+
if (paginate) {
|
|
6795
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
6796
|
+
}
|
|
6719
6797
|
const defaultType = this.safeString2(this.options, 'fetchFundingRateHistory', 'defaultType', 'future');
|
|
6720
6798
|
const type = this.safeString(params, 'type', defaultType);
|
|
6721
6799
|
let market = undefined;
|
|
@@ -8119,9 +8197,16 @@ class binance extends binance$1 {
|
|
|
8119
8197
|
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
8120
8198
|
* @param {int} [limit] max number of ledger entrys to return
|
|
8121
8199
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8200
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
8201
|
+
* @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)
|
|
8122
8202
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
8123
8203
|
*/
|
|
8124
8204
|
await this.loadMarkets();
|
|
8205
|
+
let paginate = false;
|
|
8206
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
8207
|
+
if (paginate) {
|
|
8208
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
8209
|
+
}
|
|
8125
8210
|
let type = undefined;
|
|
8126
8211
|
let subType = undefined;
|
|
8127
8212
|
let currency = undefined;
|
|
@@ -8150,6 +8235,11 @@ class binance extends binance$1 {
|
|
|
8150
8235
|
if (limit !== undefined) {
|
|
8151
8236
|
request['limit'] = limit;
|
|
8152
8237
|
}
|
|
8238
|
+
const until = this.safeInteger(params, 'until');
|
|
8239
|
+
if (until !== undefined) {
|
|
8240
|
+
params = this.omit(params, 'until');
|
|
8241
|
+
request['endTime'] = until;
|
|
8242
|
+
}
|
|
8153
8243
|
const response = await this[method](this.extend(request, params));
|
|
8154
8244
|
//
|
|
8155
8245
|
// options (eapi)
|
|
@@ -8939,6 +9029,11 @@ class binance extends binance$1 {
|
|
|
8939
9029
|
throw new errors.BadRequest(this.id + 'fetchOpenInterestHistory cannot use the 1m timeframe');
|
|
8940
9030
|
}
|
|
8941
9031
|
await this.loadMarkets();
|
|
9032
|
+
let paginate = false;
|
|
9033
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate', false);
|
|
9034
|
+
if (paginate) {
|
|
9035
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500);
|
|
9036
|
+
}
|
|
8942
9037
|
const market = this.market(symbol);
|
|
8943
9038
|
const request = {
|
|
8944
9039
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -295,6 +295,7 @@ class bingx extends bingx$1 {
|
|
|
295
295
|
'100001': errors.AuthenticationError,
|
|
296
296
|
'100412': errors.AuthenticationError,
|
|
297
297
|
'100202': errors.InsufficientFunds,
|
|
298
|
+
'100204': errors.BadRequest,
|
|
298
299
|
'100400': errors.BadRequest,
|
|
299
300
|
'100440': errors.ExchangeError,
|
|
300
301
|
'100500': errors.ExchangeError,
|
|
@@ -625,9 +626,15 @@ class bingx extends bingx$1 {
|
|
|
625
626
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
626
627
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
627
628
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
629
|
+
* @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)
|
|
628
630
|
* @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
629
631
|
*/
|
|
630
632
|
await this.loadMarkets();
|
|
633
|
+
let paginate = false;
|
|
634
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
635
|
+
if (paginate) {
|
|
636
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
637
|
+
}
|
|
631
638
|
const market = this.market(symbol);
|
|
632
639
|
const request = {
|
|
633
640
|
'symbol': market['id'],
|
|
@@ -642,6 +649,11 @@ class bingx extends bingx$1 {
|
|
|
642
649
|
else {
|
|
643
650
|
request['limit'] = 50;
|
|
644
651
|
}
|
|
652
|
+
const until = this.safeInteger2(params, 'until', 'startTime');
|
|
653
|
+
if (until !== undefined) {
|
|
654
|
+
params = this.omit(params, ['until']);
|
|
655
|
+
request['startTime'] = until;
|
|
656
|
+
}
|
|
645
657
|
let response = undefined;
|
|
646
658
|
if (market['spot']) {
|
|
647
659
|
response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
|
|
@@ -1021,10 +1033,17 @@ class bingx extends bingx$1 {
|
|
|
1021
1033
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
1022
1034
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
1023
1035
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
1036
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate to fetch
|
|
1037
|
+
* @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)
|
|
1024
1038
|
* @returns {[object]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
1025
1039
|
*/
|
|
1026
1040
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
1027
1041
|
await this.loadMarkets();
|
|
1042
|
+
let paginate = false;
|
|
1043
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
1044
|
+
if (paginate) {
|
|
1045
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
1046
|
+
}
|
|
1028
1047
|
const market = this.market(symbol);
|
|
1029
1048
|
const request = {
|
|
1030
1049
|
'symbol': market['id'],
|
|
@@ -1035,6 +1054,11 @@ class bingx extends bingx$1 {
|
|
|
1035
1054
|
if (limit !== undefined) {
|
|
1036
1055
|
request['limit'] = limit;
|
|
1037
1056
|
}
|
|
1057
|
+
const until = this.safeInteger2(params, 'until', 'startTime');
|
|
1058
|
+
if (until !== undefined) {
|
|
1059
|
+
params = this.omit(params, ['until']);
|
|
1060
|
+
request['startTime'] = until;
|
|
1061
|
+
}
|
|
1038
1062
|
const response = await this.swapV2PublicGetQuoteFundingRate(this.extend(request, params));
|
|
1039
1063
|
//
|
|
1040
1064
|
// {
|