ccxt 4.2.12 → 4.2.13
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 +718 -240
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/js/ccxt.js +1 -1
- package/dist/cjs/js/src/bigone.js +89 -22
- package/dist/cjs/js/src/binance.js +34 -27
- package/dist/cjs/js/src/bingx.js +106 -36
- package/dist/cjs/js/src/bitget.js +13 -6
- package/dist/cjs/js/src/bitmart.js +3 -3
- package/dist/cjs/js/src/bybit.js +1 -1
- package/dist/cjs/js/src/coinbase.js +176 -26
- package/dist/cjs/js/src/coinlist.js +1 -1
- package/dist/cjs/js/src/coinone.js +1 -1
- package/dist/cjs/js/src/deribit.js +1 -1
- package/dist/cjs/js/src/gate.js +74 -56
- package/dist/cjs/js/src/gemini.js +1 -1
- package/dist/cjs/js/src/htx.js +26 -1
- package/dist/cjs/js/src/independentreserve.js +7 -5
- package/dist/cjs/js/src/kraken.js +3 -7
- package/dist/cjs/js/src/lbank.js +59 -33
- package/dist/cjs/js/src/oceanex.js +1 -1
- package/dist/cjs/js/src/okx.js +2 -1
- package/dist/cjs/js/src/phemex.js +9 -2
- package/dist/cjs/js/src/pro/kraken.js +1 -1
- package/dist/cjs/js/src/pro/okx.js +52 -2
- package/dist/cjs/js/src/probit.js +4 -2
- package/dist/cjs/js/src/wavesexchange.js +1 -1
- package/dist/cjs/js/src/woo.js +52 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/bigone.d.ts +2 -0
- package/js/src/bigone.js +89 -22
- package/js/src/binance.js +34 -27
- package/js/src/bingx.js +106 -36
- package/js/src/bitget.js +13 -6
- package/js/src/bitmart.js +3 -3
- package/js/src/bybit.js +1 -1
- package/js/src/coinbase.d.ts +26 -3
- package/js/src/coinbase.js +176 -26
- package/js/src/coinlist.js +1 -1
- package/js/src/coinone.js +1 -1
- package/js/src/deribit.js +1 -1
- package/js/src/gate.js +74 -56
- package/js/src/gemini.js +1 -1
- package/js/src/htx.d.ts +1 -0
- package/js/src/htx.js +26 -1
- package/js/src/independentreserve.js +7 -5
- package/js/src/kraken.js +3 -7
- package/js/src/lbank.js +59 -33
- package/js/src/oceanex.js +1 -1
- package/js/src/okx.js +2 -1
- package/js/src/phemex.js +9 -2
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/okx.d.ts +1 -0
- package/js/src/pro/okx.js +52 -2
- package/js/src/probit.js +4 -2
- package/js/src/wavesexchange.js +1 -1
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +52 -2
- package/package.json +1 -1
package/dist/cjs/js/src/lbank.js
CHANGED
|
@@ -929,13 +929,17 @@ class lbank extends lbank$1 {
|
|
|
929
929
|
else {
|
|
930
930
|
request['size'] = 600; // max
|
|
931
931
|
}
|
|
932
|
-
|
|
932
|
+
const options = this.safeValue(this.options, 'fetchTrades', {});
|
|
933
|
+
const defaultMethod = this.safeString(options, 'method', 'spotPublicGetTrades');
|
|
934
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
933
935
|
params = this.omit(params, 'method');
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
936
|
+
let response = undefined;
|
|
937
|
+
if (method === 'spotPublicGetSupplementTrades') {
|
|
938
|
+
response = await this.spotPublicGetSupplementTrades(this.extend(request, params));
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
response = await this.spotPublicGetTrades(this.extend(request, params));
|
|
937
942
|
}
|
|
938
|
-
const response = await this[method](this.extend(request, params));
|
|
939
943
|
//
|
|
940
944
|
// {
|
|
941
945
|
// "result":"true",
|
|
@@ -1172,12 +1176,19 @@ class lbank extends lbank$1 {
|
|
|
1172
1176
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1173
1177
|
*/
|
|
1174
1178
|
await this.loadMarkets();
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
+
const options = this.safeValue(this.options, 'fetchBalance', {});
|
|
1180
|
+
const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
|
|
1181
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
1182
|
+
let response = undefined;
|
|
1183
|
+
if (method === 'spotPrivatePostSupplementUserInfoAccount') {
|
|
1184
|
+
response = await this.spotPrivatePostSupplementUserInfoAccount();
|
|
1185
|
+
}
|
|
1186
|
+
else if (method === 'spotPrivatePostUserInfo') {
|
|
1187
|
+
response = await this.spotPrivatePostUserInfo();
|
|
1188
|
+
}
|
|
1189
|
+
else {
|
|
1190
|
+
response = await this.spotPrivatePostSupplementUserInfo();
|
|
1179
1191
|
}
|
|
1180
|
-
const response = await this[method]();
|
|
1181
1192
|
//
|
|
1182
1193
|
// {
|
|
1183
1194
|
// "result": "true",
|
|
@@ -1362,14 +1373,17 @@ class lbank extends lbank$1 {
|
|
|
1362
1373
|
if (clientOrderId !== undefined) {
|
|
1363
1374
|
request['custom_id'] = clientOrderId;
|
|
1364
1375
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1376
|
+
const options = this.safeValue(this.options, 'createOrder', {});
|
|
1377
|
+
const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
|
|
1378
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
1367
1379
|
params = this.omit(params, 'method');
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1380
|
+
let response = undefined;
|
|
1381
|
+
if (method === 'spotPrivatePostCreateOrder') {
|
|
1382
|
+
response = await this.spotPrivatePostCreateOrder(this.extend(request, params));
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
response = await this.spotPrivatePostSupplementCreateOrder(this.extend(request, params));
|
|
1371
1386
|
}
|
|
1372
|
-
const response = await this[method](this.extend(request, params));
|
|
1373
1387
|
//
|
|
1374
1388
|
// {
|
|
1375
1389
|
// "result":true,
|
|
@@ -1904,13 +1918,18 @@ class lbank extends lbank$1 {
|
|
|
1904
1918
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1905
1919
|
*/
|
|
1906
1920
|
await this.loadMarkets();
|
|
1907
|
-
|
|
1921
|
+
const options = this.safeValue(this.options, 'fetchDepositAddress', {});
|
|
1922
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchDepositAddressDefault');
|
|
1923
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
1908
1924
|
params = this.omit(params, 'method');
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1925
|
+
let response = undefined;
|
|
1926
|
+
if (method === 'fetchDepositAddressSupplement') {
|
|
1927
|
+
response = await this.fetchDepositAddressSupplement(code, params);
|
|
1912
1928
|
}
|
|
1913
|
-
|
|
1929
|
+
else {
|
|
1930
|
+
response = await this.fetchDepositAddressDefault(code, params);
|
|
1931
|
+
}
|
|
1932
|
+
return response;
|
|
1914
1933
|
}
|
|
1915
1934
|
async fetchDepositAddressDefault(code, params = {}) {
|
|
1916
1935
|
await this.loadMarkets();
|
|
@@ -2282,13 +2301,16 @@ class lbank extends lbank$1 {
|
|
|
2282
2301
|
const isAuthorized = this.checkRequiredCredentials(false);
|
|
2283
2302
|
let result = undefined;
|
|
2284
2303
|
if (isAuthorized === true) {
|
|
2285
|
-
|
|
2304
|
+
const options = this.safeValue(this.options, 'fetchTransactionFees', {});
|
|
2305
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
|
|
2306
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
2286
2307
|
params = this.omit(params, 'method');
|
|
2287
|
-
if (method ===
|
|
2288
|
-
|
|
2289
|
-
|
|
2308
|
+
if (method === 'fetchPublicTransactionFees') {
|
|
2309
|
+
result = await this.fetchPublicTransactionFees(params);
|
|
2310
|
+
}
|
|
2311
|
+
else {
|
|
2312
|
+
result = await this.fetchPrivateTransactionFees(params);
|
|
2290
2313
|
}
|
|
2291
|
-
result = await this[method](params);
|
|
2292
2314
|
}
|
|
2293
2315
|
else {
|
|
2294
2316
|
result = await this.fetchPublicTransactionFees(params);
|
|
@@ -2426,19 +2448,23 @@ class lbank extends lbank$1 {
|
|
|
2426
2448
|
*/
|
|
2427
2449
|
await this.loadMarkets();
|
|
2428
2450
|
const isAuthorized = this.checkRequiredCredentials(false);
|
|
2429
|
-
|
|
2451
|
+
const response = undefined;
|
|
2430
2452
|
if (isAuthorized === true) {
|
|
2431
|
-
|
|
2453
|
+
const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
|
|
2454
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
|
|
2455
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
2432
2456
|
params = this.omit(params, 'method');
|
|
2433
|
-
if (method ===
|
|
2434
|
-
|
|
2435
|
-
|
|
2457
|
+
if (method === 'fetchPublicDepositWithdrawFees') {
|
|
2458
|
+
await this.fetchPublicDepositWithdrawFees(codes, params);
|
|
2459
|
+
}
|
|
2460
|
+
else {
|
|
2461
|
+
await this.fetchPrivateDepositWithdrawFees(codes, params);
|
|
2436
2462
|
}
|
|
2437
2463
|
}
|
|
2438
2464
|
else {
|
|
2439
|
-
|
|
2465
|
+
await this.fetchPublicDepositWithdrawFees(codes, params);
|
|
2440
2466
|
}
|
|
2441
|
-
return
|
|
2467
|
+
return response;
|
|
2442
2468
|
}
|
|
2443
2469
|
async fetchPrivateDepositWithdrawFees(codes = undefined, params = {}) {
|
|
2444
2470
|
// complete response
|
|
@@ -472,7 +472,7 @@ class oceanex extends oceanex$1 {
|
|
|
472
472
|
'market': market['id'],
|
|
473
473
|
};
|
|
474
474
|
if (limit !== undefined) {
|
|
475
|
-
request['limit'] = limit;
|
|
475
|
+
request['limit'] = Math.min(limit, 1000);
|
|
476
476
|
}
|
|
477
477
|
const response = await this.publicGetTrades(this.extend(request, params));
|
|
478
478
|
//
|
package/dist/cjs/js/src/okx.js
CHANGED
|
@@ -38,7 +38,6 @@ class okx extends okx$1 {
|
|
|
38
38
|
'createDepositAddress': false,
|
|
39
39
|
'createMarketBuyOrderWithCost': true,
|
|
40
40
|
'createMarketSellOrderWithCost': true,
|
|
41
|
-
'createTrailingPercentOrder': true,
|
|
42
41
|
'createOrder': true,
|
|
43
42
|
'createOrders': true,
|
|
44
43
|
'createPostOnlyOrder': true,
|
|
@@ -46,6 +45,7 @@ class okx extends okx$1 {
|
|
|
46
45
|
'createStopLimitOrder': true,
|
|
47
46
|
'createStopMarketOrder': true,
|
|
48
47
|
'createStopOrder': true,
|
|
48
|
+
'createTrailingPercentOrder': true,
|
|
49
49
|
'editOrder': true,
|
|
50
50
|
'fetchAccounts': true,
|
|
51
51
|
'fetchBalance': true,
|
|
@@ -259,6 +259,7 @@ class okx extends okx$1 {
|
|
|
259
259
|
'sprd/order': 1 / 3,
|
|
260
260
|
'sprd/orders-pending': 1 / 3,
|
|
261
261
|
'sprd/orders-history': 1 / 2,
|
|
262
|
+
'sprd/orders-history-archive': 1 / 2,
|
|
262
263
|
'sprd/trades': 1 / 3,
|
|
263
264
|
// trade
|
|
264
265
|
'trade/order': 1 / 3,
|
|
@@ -452,7 +452,7 @@ class phemex extends phemex$1 {
|
|
|
452
452
|
},
|
|
453
453
|
},
|
|
454
454
|
'options': {
|
|
455
|
-
'brokerId': '
|
|
455
|
+
'brokerId': 'CCXT123456',
|
|
456
456
|
'x-phemex-request-expiry': 60,
|
|
457
457
|
'createOrderByQuoteRequiresPrice': true,
|
|
458
458
|
'networks': {
|
|
@@ -2477,7 +2477,7 @@ class phemex extends phemex$1 {
|
|
|
2477
2477
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
2478
2478
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
2479
2479
|
if (clientOrderId === undefined) {
|
|
2480
|
-
const brokerId = this.safeString(this.options, 'brokerId');
|
|
2480
|
+
const brokerId = this.safeString(this.options, 'brokerId', 'CCXT123456');
|
|
2481
2481
|
if (brokerId !== undefined) {
|
|
2482
2482
|
request['clOrdID'] = brokerId + this.uuid16();
|
|
2483
2483
|
}
|
|
@@ -4273,6 +4273,13 @@ class phemex extends phemex$1 {
|
|
|
4273
4273
|
};
|
|
4274
4274
|
let payload = '';
|
|
4275
4275
|
if (method === 'POST') {
|
|
4276
|
+
const isOrderPlacement = (path === 'g-orders') || (path === 'spot/orders') || (path === 'orders');
|
|
4277
|
+
if (isOrderPlacement) {
|
|
4278
|
+
if (this.safeString(params, 'clOrdID') === undefined) {
|
|
4279
|
+
const id = this.safeString(this.options, 'brokerId', 'CCXT123456');
|
|
4280
|
+
params['clOrdID'] = id + this.uuid16();
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4276
4283
|
payload = this.json(params);
|
|
4277
4284
|
body = payload;
|
|
4278
4285
|
headers['Content-Type'] = 'application/json';
|
|
@@ -542,7 +542,7 @@ class kraken extends kraken$1 {
|
|
|
542
542
|
],
|
|
543
543
|
'subscription': {
|
|
544
544
|
'name': name,
|
|
545
|
-
'interval': this.
|
|
545
|
+
'interval': this.safeValue(this.timeframes, timeframe, timeframe),
|
|
546
546
|
},
|
|
547
547
|
};
|
|
548
548
|
const request = this.deepExtend(subscribe, params);
|
|
@@ -20,6 +20,7 @@ class okx extends okx$1 {
|
|
|
20
20
|
'watchOrderBookForSymbols': true,
|
|
21
21
|
'watchBalance': true,
|
|
22
22
|
'watchOHLCV': true,
|
|
23
|
+
'watchOHLCVForSymbols': true,
|
|
23
24
|
'watchOrders': true,
|
|
24
25
|
'watchMyTrades': true,
|
|
25
26
|
'watchPositions': true,
|
|
@@ -356,6 +357,50 @@ class okx extends okx$1 {
|
|
|
356
357
|
}
|
|
357
358
|
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
358
359
|
}
|
|
360
|
+
async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
|
|
361
|
+
/**
|
|
362
|
+
* @method
|
|
363
|
+
* @name okx#watchOHLCVForSymbols
|
|
364
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
365
|
+
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
366
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
367
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
368
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
369
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
370
|
+
*/
|
|
371
|
+
const symbolsLength = symbolsAndTimeframes.length;
|
|
372
|
+
if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
|
|
373
|
+
throw new errors.ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
|
|
374
|
+
}
|
|
375
|
+
await this.loadMarkets();
|
|
376
|
+
const topics = [];
|
|
377
|
+
const messageHashes = [];
|
|
378
|
+
for (let i = 0; i < symbolsAndTimeframes.length; i++) {
|
|
379
|
+
const symbolAndTimeframe = symbolsAndTimeframes[i];
|
|
380
|
+
const sym = symbolAndTimeframe[0];
|
|
381
|
+
const tf = symbolAndTimeframe[1];
|
|
382
|
+
const marketId = this.marketId(sym);
|
|
383
|
+
const interval = this.safeString(this.timeframes, tf, tf);
|
|
384
|
+
const channel = 'candle' + interval;
|
|
385
|
+
const topic = {
|
|
386
|
+
'channel': channel,
|
|
387
|
+
'instId': marketId,
|
|
388
|
+
};
|
|
389
|
+
topics.push(topic);
|
|
390
|
+
messageHashes.push('multi:' + channel + ':' + sym);
|
|
391
|
+
}
|
|
392
|
+
const request = {
|
|
393
|
+
'op': 'subscribe',
|
|
394
|
+
'args': topics,
|
|
395
|
+
};
|
|
396
|
+
const url = this.getUrl('candle', 'public');
|
|
397
|
+
const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
398
|
+
if (this.newUpdates) {
|
|
399
|
+
limit = candles.getLimit(symbol, limit);
|
|
400
|
+
}
|
|
401
|
+
const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
|
|
402
|
+
return this.createOHLCVObject(symbol, timeframe, filtered);
|
|
403
|
+
}
|
|
359
404
|
handleOHLCV(client, message) {
|
|
360
405
|
//
|
|
361
406
|
// {
|
|
@@ -378,7 +423,7 @@ class okx extends okx$1 {
|
|
|
378
423
|
const data = this.safeValue(message, 'data', []);
|
|
379
424
|
const marketId = this.safeString(arg, 'instId');
|
|
380
425
|
const market = this.safeMarket(marketId);
|
|
381
|
-
const symbol = market['
|
|
426
|
+
const symbol = market['symbol'];
|
|
382
427
|
const interval = channel.replace('candle', '');
|
|
383
428
|
// use a reverse lookup in a static map instead
|
|
384
429
|
const timeframe = this.findTimeframe(interval);
|
|
@@ -392,8 +437,13 @@ class okx extends okx$1 {
|
|
|
392
437
|
this.ohlcvs[symbol][timeframe] = stored;
|
|
393
438
|
}
|
|
394
439
|
stored.append(parsed);
|
|
395
|
-
const messageHash = channel + ':' +
|
|
440
|
+
const messageHash = channel + ':' + market['id'];
|
|
396
441
|
client.resolve(stored, messageHash);
|
|
442
|
+
// for multiOHLCV we need special object, as opposed to other "multi"
|
|
443
|
+
// methods, because OHLCV response item does not contain symbol
|
|
444
|
+
// or timeframe, thus otherwise it would be unrecognizable
|
|
445
|
+
const messageHashForMulti = 'multi:' + channel + ':' + symbol;
|
|
446
|
+
client.resolve([symbol, timeframe, stored], messageHashForMulti);
|
|
397
447
|
}
|
|
398
448
|
}
|
|
399
449
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
@@ -776,7 +776,6 @@ class probit extends probit$1 {
|
|
|
776
776
|
const market = this.market(symbol);
|
|
777
777
|
const request = {
|
|
778
778
|
'market_id': market['id'],
|
|
779
|
-
'limit': 100,
|
|
780
779
|
'start_time': '1970-01-01T00:00:00.000Z',
|
|
781
780
|
'end_time': this.iso8601(this.milliseconds()),
|
|
782
781
|
};
|
|
@@ -784,7 +783,10 @@ class probit extends probit$1 {
|
|
|
784
783
|
request['start_time'] = this.iso8601(since);
|
|
785
784
|
}
|
|
786
785
|
if (limit !== undefined) {
|
|
787
|
-
request['limit'] = Math.min(limit,
|
|
786
|
+
request['limit'] = Math.min(limit, 1000);
|
|
787
|
+
}
|
|
788
|
+
else {
|
|
789
|
+
request['limit'] = 1000; // required to set any value
|
|
788
790
|
}
|
|
789
791
|
const response = await this.publicGetTrade(this.extend(request, params));
|
|
790
792
|
//
|
|
@@ -2092,7 +2092,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
2092
2092
|
'priceAsset': market['quoteId'],
|
|
2093
2093
|
};
|
|
2094
2094
|
if (limit !== undefined) {
|
|
2095
|
-
request['limit'] = limit;
|
|
2095
|
+
request['limit'] = Math.min(limit, 100);
|
|
2096
2096
|
}
|
|
2097
2097
|
if (since !== undefined) {
|
|
2098
2098
|
request['timeStart'] = since;
|
package/dist/cjs/js/src/woo.js
CHANGED
|
@@ -41,13 +41,13 @@ class woo extends woo$1 {
|
|
|
41
41
|
'createMarketOrder': false,
|
|
42
42
|
'createMarketOrderWithCost': false,
|
|
43
43
|
'createMarketSellOrderWithCost': false,
|
|
44
|
-
'createTrailingAmountOrder': true,
|
|
45
|
-
'createTrailingPercentOrder': true,
|
|
46
44
|
'createOrder': true,
|
|
47
45
|
'createReduceOnlyOrder': true,
|
|
48
46
|
'createStopLimitOrder': false,
|
|
49
47
|
'createStopMarketOrder': false,
|
|
50
48
|
'createStopOrder': false,
|
|
49
|
+
'createTrailingAmountOrder': true,
|
|
50
|
+
'createTrailingPercentOrder': true,
|
|
51
51
|
'fetchAccounts': true,
|
|
52
52
|
'fetchBalance': true,
|
|
53
53
|
'fetchCanceledOrders': false,
|
|
@@ -763,6 +763,56 @@ class woo extends woo$1 {
|
|
|
763
763
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
764
764
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
765
765
|
}
|
|
766
|
+
async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
767
|
+
/**
|
|
768
|
+
* @method
|
|
769
|
+
* @name createTrailingAmountOrder
|
|
770
|
+
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
|
|
771
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
772
|
+
* @param {string} type 'market' or 'limit'
|
|
773
|
+
* @param {string} side 'buy' or 'sell'
|
|
774
|
+
* @param {float} amount how much you want to trade in units of the base currency, or number of contracts
|
|
775
|
+
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
|
776
|
+
* @param {float} trailingAmount the quote amount to trail away from the current market price
|
|
777
|
+
* @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
|
|
778
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
779
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
780
|
+
*/
|
|
781
|
+
if (trailingAmount === undefined) {
|
|
782
|
+
throw new errors.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
|
|
783
|
+
}
|
|
784
|
+
if (trailingTriggerPrice === undefined) {
|
|
785
|
+
throw new errors.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingTriggerPrice argument');
|
|
786
|
+
}
|
|
787
|
+
params['trailingAmount'] = trailingAmount;
|
|
788
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice;
|
|
789
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
790
|
+
}
|
|
791
|
+
async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
792
|
+
/**
|
|
793
|
+
* @method
|
|
794
|
+
* @name createTrailingPercentOrder
|
|
795
|
+
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
|
796
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
797
|
+
* @param {string} type 'market' or 'limit'
|
|
798
|
+
* @param {string} side 'buy' or 'sell'
|
|
799
|
+
* @param {float} amount how much you want to trade in units of the base currency, or number of contracts
|
|
800
|
+
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
|
801
|
+
* @param {float} trailingPercent the percent to trail away from the current market price
|
|
802
|
+
* @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
|
|
803
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
804
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
805
|
+
*/
|
|
806
|
+
if (trailingPercent === undefined) {
|
|
807
|
+
throw new errors.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
|
|
808
|
+
}
|
|
809
|
+
if (trailingTriggerPrice === undefined) {
|
|
810
|
+
throw new errors.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
|
|
811
|
+
}
|
|
812
|
+
params['trailingPercent'] = trailingPercent;
|
|
813
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice;
|
|
814
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
815
|
+
}
|
|
766
816
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
767
817
|
/**
|
|
768
818
|
* @method
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.12";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.13';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -9,6 +9,7 @@ interface Exchange {
|
|
|
9
9
|
spotV1PrivateGetTradeQuery(params?: {}): Promise<implicitReturnType>;
|
|
10
10
|
spotV1PrivateGetTradeOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
11
11
|
spotV1PrivateGetTradeHistoryOrders(params?: {}): Promise<implicitReturnType>;
|
|
12
|
+
spotV1PrivateGetTradeMyTrades(params?: {}): Promise<implicitReturnType>;
|
|
12
13
|
spotV1PrivateGetUserCommissionRate(params?: {}): Promise<implicitReturnType>;
|
|
13
14
|
spotV1PrivateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
|
|
14
15
|
spotV1PrivatePostTradeOrder(params?: {}): Promise<implicitReturnType>;
|
|
@@ -38,6 +39,7 @@ interface Exchange {
|
|
|
38
39
|
swapV2PrivateGetUserPositions(params?: {}): Promise<implicitReturnType>;
|
|
39
40
|
swapV2PrivateGetUserIncome(params?: {}): Promise<implicitReturnType>;
|
|
40
41
|
swapV2PrivateGetTradeOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
42
|
+
swapV2PrivateGetTradeOpenOrder(params?: {}): Promise<implicitReturnType>;
|
|
41
43
|
swapV2PrivateGetTradeOrder(params?: {}): Promise<implicitReturnType>;
|
|
42
44
|
swapV2PrivateGetTradeMarginType(params?: {}): Promise<implicitReturnType>;
|
|
43
45
|
swapV2PrivateGetTradeLeverage(params?: {}): Promise<implicitReturnType>;
|
package/js/src/abstract/okx.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ interface Exchange {
|
|
|
81
81
|
privateGetSprdOrder(params?: {}): Promise<implicitReturnType>;
|
|
82
82
|
privateGetSprdOrdersPending(params?: {}): Promise<implicitReturnType>;
|
|
83
83
|
privateGetSprdOrdersHistory(params?: {}): Promise<implicitReturnType>;
|
|
84
|
+
privateGetSprdOrdersHistoryArchive(params?: {}): Promise<implicitReturnType>;
|
|
84
85
|
privateGetSprdTrades(params?: {}): Promise<implicitReturnType>;
|
|
85
86
|
privateGetTradeOrder(params?: {}): Promise<implicitReturnType>;
|
|
86
87
|
privateGetTradeOrdersPending(params?: {}): Promise<implicitReturnType>;
|
package/js/src/bigone.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export default class bigone extends Exchange {
|
|
|
13
13
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
14
14
|
fetchTime(params?: {}): Promise<number>;
|
|
15
15
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
16
|
+
parseContractBidsAsks(bidsAsks: any): any[];
|
|
17
|
+
parseContractOrderBook(orderbook: object, symbol: string, limit?: Int): OrderBook;
|
|
16
18
|
parseTrade(trade: any, market?: Market): Trade;
|
|
17
19
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
18
20
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
package/js/src/bigone.js
CHANGED
|
@@ -934,29 +934,90 @@ export default class bigone extends Exchange {
|
|
|
934
934
|
*/
|
|
935
935
|
await this.loadMarkets();
|
|
936
936
|
const market = this.market(symbol);
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
937
|
+
let response = undefined;
|
|
938
|
+
if (market['contract']) {
|
|
939
|
+
const request = {
|
|
940
|
+
'symbol': market['id'],
|
|
941
|
+
};
|
|
942
|
+
response = await this.contractPublicGetDepthSymbolSnapshot(this.extend(request, params));
|
|
943
|
+
//
|
|
944
|
+
// {
|
|
945
|
+
// bids: {
|
|
946
|
+
// '20000': '20',
|
|
947
|
+
// ...
|
|
948
|
+
// '34552': '64851',
|
|
949
|
+
// '34526.5': '59594',
|
|
950
|
+
// ...
|
|
951
|
+
// '34551.5': '29711'
|
|
952
|
+
// },
|
|
953
|
+
// asks: {
|
|
954
|
+
// '34557': '34395',
|
|
955
|
+
// ...
|
|
956
|
+
// '40000': '20',
|
|
957
|
+
// '34611.5': '56024',
|
|
958
|
+
// ...
|
|
959
|
+
// '34578.5': '66367'
|
|
960
|
+
// },
|
|
961
|
+
// to: '59737174',
|
|
962
|
+
// lastPrice: '34554.5',
|
|
963
|
+
// bestPrices: {
|
|
964
|
+
// ask: '34557.0',
|
|
965
|
+
// bid: '34552.0'
|
|
966
|
+
// },
|
|
967
|
+
// from: '0'
|
|
968
|
+
// }
|
|
969
|
+
//
|
|
970
|
+
return this.parseContractOrderBook(response, market['symbol'], limit);
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
const request = {
|
|
974
|
+
'asset_pair_name': market['id'],
|
|
975
|
+
};
|
|
976
|
+
if (limit !== undefined) {
|
|
977
|
+
request['limit'] = limit; // default 50, max 200
|
|
978
|
+
}
|
|
979
|
+
response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
|
|
980
|
+
//
|
|
981
|
+
// {
|
|
982
|
+
// "code":0,
|
|
983
|
+
// "data": {
|
|
984
|
+
// "asset_pair_name": "EOS-BTC",
|
|
985
|
+
// "bids": [
|
|
986
|
+
// { "price": "42", "order_count": 4, "quantity": "23.33363711" }
|
|
987
|
+
// ],
|
|
988
|
+
// "asks": [
|
|
989
|
+
// { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
|
|
990
|
+
// ]
|
|
991
|
+
// }
|
|
992
|
+
// }
|
|
993
|
+
//
|
|
994
|
+
const orderbook = this.safeValue(response, 'data', {});
|
|
995
|
+
return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
|
|
942
996
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
return
|
|
997
|
+
}
|
|
998
|
+
parseContractBidsAsks(bidsAsks) {
|
|
999
|
+
const bidsAsksKeys = Object.keys(bidsAsks);
|
|
1000
|
+
const result = [];
|
|
1001
|
+
for (let i = 0; i < bidsAsksKeys.length; i++) {
|
|
1002
|
+
const price = bidsAsksKeys[i];
|
|
1003
|
+
const amount = bidsAsks[price];
|
|
1004
|
+
result.push([this.parseNumber(price), this.parseNumber(amount)]);
|
|
1005
|
+
}
|
|
1006
|
+
return result;
|
|
1007
|
+
}
|
|
1008
|
+
parseContractOrderBook(orderbook, symbol, limit = undefined) {
|
|
1009
|
+
const responseBids = this.safeValue(orderbook, 'bids');
|
|
1010
|
+
const responseAsks = this.safeValue(orderbook, 'asks');
|
|
1011
|
+
const bids = this.parseContractBidsAsks(responseBids);
|
|
1012
|
+
const asks = this.parseContractBidsAsks(responseAsks);
|
|
1013
|
+
return {
|
|
1014
|
+
'symbol': symbol,
|
|
1015
|
+
'bids': this.filterByLimit(this.sortBy(bids, 0, true), limit),
|
|
1016
|
+
'asks': this.filterByLimit(this.sortBy(asks, 0), limit),
|
|
1017
|
+
'timestamp': undefined,
|
|
1018
|
+
'datetime': undefined,
|
|
1019
|
+
'nonce': undefined,
|
|
1020
|
+
};
|
|
960
1021
|
}
|
|
961
1022
|
parseTrade(trade, market = undefined) {
|
|
962
1023
|
//
|
|
@@ -1116,6 +1177,9 @@ export default class bigone extends Exchange {
|
|
|
1116
1177
|
*/
|
|
1117
1178
|
await this.loadMarkets();
|
|
1118
1179
|
const market = this.market(symbol);
|
|
1180
|
+
if (market['contract']) {
|
|
1181
|
+
throw new BadRequest(this.id + ' fetchTrades () can only fetch trades for spot markets');
|
|
1182
|
+
}
|
|
1119
1183
|
const request = {
|
|
1120
1184
|
'asset_pair_name': market['id'],
|
|
1121
1185
|
};
|
|
@@ -1178,6 +1242,9 @@ export default class bigone extends Exchange {
|
|
|
1178
1242
|
*/
|
|
1179
1243
|
await this.loadMarkets();
|
|
1180
1244
|
const market = this.market(symbol);
|
|
1245
|
+
if (market['contract']) {
|
|
1246
|
+
throw new BadRequest(this.id + ' fetchOHLCV () can only fetch ohlcvs for spot markets');
|
|
1247
|
+
}
|
|
1181
1248
|
if (limit === undefined) {
|
|
1182
1249
|
limit = 100; // default 100, max 500
|
|
1183
1250
|
}
|