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/js/src/lbank.js
CHANGED
|
@@ -932,13 +932,17 @@ export default class lbank extends Exchange {
|
|
|
932
932
|
else {
|
|
933
933
|
request['size'] = 600; // max
|
|
934
934
|
}
|
|
935
|
-
|
|
935
|
+
const options = this.safeValue(this.options, 'fetchTrades', {});
|
|
936
|
+
const defaultMethod = this.safeString(options, 'method', 'spotPublicGetTrades');
|
|
937
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
936
938
|
params = this.omit(params, 'method');
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
939
|
+
let response = undefined;
|
|
940
|
+
if (method === 'spotPublicGetSupplementTrades') {
|
|
941
|
+
response = await this.spotPublicGetSupplementTrades(this.extend(request, params));
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
response = await this.spotPublicGetTrades(this.extend(request, params));
|
|
940
945
|
}
|
|
941
|
-
const response = await this[method](this.extend(request, params));
|
|
942
946
|
//
|
|
943
947
|
// {
|
|
944
948
|
// "result":"true",
|
|
@@ -1175,12 +1179,19 @@ export default class lbank extends Exchange {
|
|
|
1175
1179
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1176
1180
|
*/
|
|
1177
1181
|
await this.loadMarkets();
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
+
const options = this.safeValue(this.options, 'fetchBalance', {});
|
|
1183
|
+
const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
|
|
1184
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
1185
|
+
let response = undefined;
|
|
1186
|
+
if (method === 'spotPrivatePostSupplementUserInfoAccount') {
|
|
1187
|
+
response = await this.spotPrivatePostSupplementUserInfoAccount();
|
|
1188
|
+
}
|
|
1189
|
+
else if (method === 'spotPrivatePostUserInfo') {
|
|
1190
|
+
response = await this.spotPrivatePostUserInfo();
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
response = await this.spotPrivatePostSupplementUserInfo();
|
|
1182
1194
|
}
|
|
1183
|
-
const response = await this[method]();
|
|
1184
1195
|
//
|
|
1185
1196
|
// {
|
|
1186
1197
|
// "result": "true",
|
|
@@ -1365,14 +1376,17 @@ export default class lbank extends Exchange {
|
|
|
1365
1376
|
if (clientOrderId !== undefined) {
|
|
1366
1377
|
request['custom_id'] = clientOrderId;
|
|
1367
1378
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1379
|
+
const options = this.safeValue(this.options, 'createOrder', {});
|
|
1380
|
+
const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
|
|
1381
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
1370
1382
|
params = this.omit(params, 'method');
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1383
|
+
let response = undefined;
|
|
1384
|
+
if (method === 'spotPrivatePostCreateOrder') {
|
|
1385
|
+
response = await this.spotPrivatePostCreateOrder(this.extend(request, params));
|
|
1386
|
+
}
|
|
1387
|
+
else {
|
|
1388
|
+
response = await this.spotPrivatePostSupplementCreateOrder(this.extend(request, params));
|
|
1374
1389
|
}
|
|
1375
|
-
const response = await this[method](this.extend(request, params));
|
|
1376
1390
|
//
|
|
1377
1391
|
// {
|
|
1378
1392
|
// "result":true,
|
|
@@ -1907,13 +1921,18 @@ export default class lbank extends Exchange {
|
|
|
1907
1921
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1908
1922
|
*/
|
|
1909
1923
|
await this.loadMarkets();
|
|
1910
|
-
|
|
1924
|
+
const options = this.safeValue(this.options, 'fetchDepositAddress', {});
|
|
1925
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchDepositAddressDefault');
|
|
1926
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
1911
1927
|
params = this.omit(params, 'method');
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1928
|
+
let response = undefined;
|
|
1929
|
+
if (method === 'fetchDepositAddressSupplement') {
|
|
1930
|
+
response = await this.fetchDepositAddressSupplement(code, params);
|
|
1915
1931
|
}
|
|
1916
|
-
|
|
1932
|
+
else {
|
|
1933
|
+
response = await this.fetchDepositAddressDefault(code, params);
|
|
1934
|
+
}
|
|
1935
|
+
return response;
|
|
1917
1936
|
}
|
|
1918
1937
|
async fetchDepositAddressDefault(code, params = {}) {
|
|
1919
1938
|
await this.loadMarkets();
|
|
@@ -2285,13 +2304,16 @@ export default class lbank extends Exchange {
|
|
|
2285
2304
|
const isAuthorized = this.checkRequiredCredentials(false);
|
|
2286
2305
|
let result = undefined;
|
|
2287
2306
|
if (isAuthorized === true) {
|
|
2288
|
-
|
|
2307
|
+
const options = this.safeValue(this.options, 'fetchTransactionFees', {});
|
|
2308
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
|
|
2309
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
2289
2310
|
params = this.omit(params, 'method');
|
|
2290
|
-
if (method ===
|
|
2291
|
-
|
|
2292
|
-
|
|
2311
|
+
if (method === 'fetchPublicTransactionFees') {
|
|
2312
|
+
result = await this.fetchPublicTransactionFees(params);
|
|
2313
|
+
}
|
|
2314
|
+
else {
|
|
2315
|
+
result = await this.fetchPrivateTransactionFees(params);
|
|
2293
2316
|
}
|
|
2294
|
-
result = await this[method](params);
|
|
2295
2317
|
}
|
|
2296
2318
|
else {
|
|
2297
2319
|
result = await this.fetchPublicTransactionFees(params);
|
|
@@ -2429,19 +2451,23 @@ export default class lbank extends Exchange {
|
|
|
2429
2451
|
*/
|
|
2430
2452
|
await this.loadMarkets();
|
|
2431
2453
|
const isAuthorized = this.checkRequiredCredentials(false);
|
|
2432
|
-
|
|
2454
|
+
const response = undefined;
|
|
2433
2455
|
if (isAuthorized === true) {
|
|
2434
|
-
|
|
2456
|
+
const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
|
|
2457
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
|
|
2458
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
2435
2459
|
params = this.omit(params, 'method');
|
|
2436
|
-
if (method ===
|
|
2437
|
-
|
|
2438
|
-
|
|
2460
|
+
if (method === 'fetchPublicDepositWithdrawFees') {
|
|
2461
|
+
await this.fetchPublicDepositWithdrawFees(codes, params);
|
|
2462
|
+
}
|
|
2463
|
+
else {
|
|
2464
|
+
await this.fetchPrivateDepositWithdrawFees(codes, params);
|
|
2439
2465
|
}
|
|
2440
2466
|
}
|
|
2441
2467
|
else {
|
|
2442
|
-
|
|
2468
|
+
await this.fetchPublicDepositWithdrawFees(codes, params);
|
|
2443
2469
|
}
|
|
2444
|
-
return
|
|
2470
|
+
return response;
|
|
2445
2471
|
}
|
|
2446
2472
|
async fetchPrivateDepositWithdrawFees(codes = undefined, params = {}) {
|
|
2447
2473
|
// complete response
|
package/js/src/oceanex.js
CHANGED
|
@@ -475,7 +475,7 @@ export default class oceanex extends Exchange {
|
|
|
475
475
|
'market': market['id'],
|
|
476
476
|
};
|
|
477
477
|
if (limit !== undefined) {
|
|
478
|
-
request['limit'] = limit;
|
|
478
|
+
request['limit'] = Math.min(limit, 1000);
|
|
479
479
|
}
|
|
480
480
|
const response = await this.publicGetTrades(this.extend(request, params));
|
|
481
481
|
//
|
package/js/src/okx.js
CHANGED
|
@@ -41,7 +41,6 @@ export default class okx extends Exchange {
|
|
|
41
41
|
'createDepositAddress': false,
|
|
42
42
|
'createMarketBuyOrderWithCost': true,
|
|
43
43
|
'createMarketSellOrderWithCost': true,
|
|
44
|
-
'createTrailingPercentOrder': true,
|
|
45
44
|
'createOrder': true,
|
|
46
45
|
'createOrders': true,
|
|
47
46
|
'createPostOnlyOrder': true,
|
|
@@ -49,6 +48,7 @@ export default class okx extends Exchange {
|
|
|
49
48
|
'createStopLimitOrder': true,
|
|
50
49
|
'createStopMarketOrder': true,
|
|
51
50
|
'createStopOrder': true,
|
|
51
|
+
'createTrailingPercentOrder': true,
|
|
52
52
|
'editOrder': true,
|
|
53
53
|
'fetchAccounts': true,
|
|
54
54
|
'fetchBalance': true,
|
|
@@ -262,6 +262,7 @@ export default class okx extends Exchange {
|
|
|
262
262
|
'sprd/order': 1 / 3,
|
|
263
263
|
'sprd/orders-pending': 1 / 3,
|
|
264
264
|
'sprd/orders-history': 1 / 2,
|
|
265
|
+
'sprd/orders-history-archive': 1 / 2,
|
|
265
266
|
'sprd/trades': 1 / 3,
|
|
266
267
|
// trade
|
|
267
268
|
'trade/order': 1 / 3,
|
package/js/src/phemex.js
CHANGED
|
@@ -455,7 +455,7 @@ export default class phemex extends Exchange {
|
|
|
455
455
|
},
|
|
456
456
|
},
|
|
457
457
|
'options': {
|
|
458
|
-
'brokerId': '
|
|
458
|
+
'brokerId': 'CCXT123456',
|
|
459
459
|
'x-phemex-request-expiry': 60,
|
|
460
460
|
'createOrderByQuoteRequiresPrice': true,
|
|
461
461
|
'networks': {
|
|
@@ -2480,7 +2480,7 @@ export default class phemex extends Exchange {
|
|
|
2480
2480
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
2481
2481
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
2482
2482
|
if (clientOrderId === undefined) {
|
|
2483
|
-
const brokerId = this.safeString(this.options, 'brokerId');
|
|
2483
|
+
const brokerId = this.safeString(this.options, 'brokerId', 'CCXT123456');
|
|
2484
2484
|
if (brokerId !== undefined) {
|
|
2485
2485
|
request['clOrdID'] = brokerId + this.uuid16();
|
|
2486
2486
|
}
|
|
@@ -4276,6 +4276,13 @@ export default class phemex extends Exchange {
|
|
|
4276
4276
|
};
|
|
4277
4277
|
let payload = '';
|
|
4278
4278
|
if (method === 'POST') {
|
|
4279
|
+
const isOrderPlacement = (path === 'g-orders') || (path === 'spot/orders') || (path === 'orders');
|
|
4280
|
+
if (isOrderPlacement) {
|
|
4281
|
+
if (this.safeString(params, 'clOrdID') === undefined) {
|
|
4282
|
+
const id = this.safeString(this.options, 'brokerId', 'CCXT123456');
|
|
4283
|
+
params['clOrdID'] = id + this.uuid16();
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4279
4286
|
payload = this.json(params);
|
|
4280
4287
|
body = payload;
|
|
4281
4288
|
headers['Content-Type'] = 'application/json';
|
package/js/src/pro/kraken.js
CHANGED
|
@@ -545,7 +545,7 @@ export default class kraken extends krakenRest {
|
|
|
545
545
|
],
|
|
546
546
|
'subscription': {
|
|
547
547
|
'name': name,
|
|
548
|
-
'interval': this.
|
|
548
|
+
'interval': this.safeValue(this.timeframes, timeframe, timeframe),
|
|
549
549
|
},
|
|
550
550
|
};
|
|
551
551
|
const request = this.deepExtend(subscribe, params);
|
package/js/src/pro/okx.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export default class okx extends okxRest {
|
|
|
13
13
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
14
14
|
handleTicker(client: Client, message: any): any;
|
|
15
15
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
16
|
+
watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<OHLCV[]>>>;
|
|
16
17
|
handleOHLCV(client: Client, message: any): void;
|
|
17
18
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
18
19
|
watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
|
package/js/src/pro/okx.js
CHANGED
|
@@ -23,6 +23,7 @@ export default class okx extends okxRest {
|
|
|
23
23
|
'watchOrderBookForSymbols': true,
|
|
24
24
|
'watchBalance': true,
|
|
25
25
|
'watchOHLCV': true,
|
|
26
|
+
'watchOHLCVForSymbols': true,
|
|
26
27
|
'watchOrders': true,
|
|
27
28
|
'watchMyTrades': true,
|
|
28
29
|
'watchPositions': true,
|
|
@@ -359,6 +360,50 @@ export default class okx extends okxRest {
|
|
|
359
360
|
}
|
|
360
361
|
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
361
362
|
}
|
|
363
|
+
async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
|
|
364
|
+
/**
|
|
365
|
+
* @method
|
|
366
|
+
* @name okx#watchOHLCVForSymbols
|
|
367
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
368
|
+
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
369
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
370
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
371
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
372
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
373
|
+
*/
|
|
374
|
+
const symbolsLength = symbolsAndTimeframes.length;
|
|
375
|
+
if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
|
|
376
|
+
throw new ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
|
|
377
|
+
}
|
|
378
|
+
await this.loadMarkets();
|
|
379
|
+
const topics = [];
|
|
380
|
+
const messageHashes = [];
|
|
381
|
+
for (let i = 0; i < symbolsAndTimeframes.length; i++) {
|
|
382
|
+
const symbolAndTimeframe = symbolsAndTimeframes[i];
|
|
383
|
+
const sym = symbolAndTimeframe[0];
|
|
384
|
+
const tf = symbolAndTimeframe[1];
|
|
385
|
+
const marketId = this.marketId(sym);
|
|
386
|
+
const interval = this.safeString(this.timeframes, tf, tf);
|
|
387
|
+
const channel = 'candle' + interval;
|
|
388
|
+
const topic = {
|
|
389
|
+
'channel': channel,
|
|
390
|
+
'instId': marketId,
|
|
391
|
+
};
|
|
392
|
+
topics.push(topic);
|
|
393
|
+
messageHashes.push('multi:' + channel + ':' + sym);
|
|
394
|
+
}
|
|
395
|
+
const request = {
|
|
396
|
+
'op': 'subscribe',
|
|
397
|
+
'args': topics,
|
|
398
|
+
};
|
|
399
|
+
const url = this.getUrl('candle', 'public');
|
|
400
|
+
const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
401
|
+
if (this.newUpdates) {
|
|
402
|
+
limit = candles.getLimit(symbol, limit);
|
|
403
|
+
}
|
|
404
|
+
const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
|
|
405
|
+
return this.createOHLCVObject(symbol, timeframe, filtered);
|
|
406
|
+
}
|
|
362
407
|
handleOHLCV(client, message) {
|
|
363
408
|
//
|
|
364
409
|
// {
|
|
@@ -381,7 +426,7 @@ export default class okx extends okxRest {
|
|
|
381
426
|
const data = this.safeValue(message, 'data', []);
|
|
382
427
|
const marketId = this.safeString(arg, 'instId');
|
|
383
428
|
const market = this.safeMarket(marketId);
|
|
384
|
-
const symbol = market['
|
|
429
|
+
const symbol = market['symbol'];
|
|
385
430
|
const interval = channel.replace('candle', '');
|
|
386
431
|
// use a reverse lookup in a static map instead
|
|
387
432
|
const timeframe = this.findTimeframe(interval);
|
|
@@ -395,8 +440,13 @@ export default class okx extends okxRest {
|
|
|
395
440
|
this.ohlcvs[symbol][timeframe] = stored;
|
|
396
441
|
}
|
|
397
442
|
stored.append(parsed);
|
|
398
|
-
const messageHash = channel + ':' +
|
|
443
|
+
const messageHash = channel + ':' + market['id'];
|
|
399
444
|
client.resolve(stored, messageHash);
|
|
445
|
+
// for multiOHLCV we need special object, as opposed to other "multi"
|
|
446
|
+
// methods, because OHLCV response item does not contain symbol
|
|
447
|
+
// or timeframe, thus otherwise it would be unrecognizable
|
|
448
|
+
const messageHashForMulti = 'multi:' + channel + ':' + symbol;
|
|
449
|
+
client.resolve([symbol, timeframe, stored], messageHashForMulti);
|
|
400
450
|
}
|
|
401
451
|
}
|
|
402
452
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
package/js/src/probit.js
CHANGED
|
@@ -779,7 +779,6 @@ export default class probit extends Exchange {
|
|
|
779
779
|
const market = this.market(symbol);
|
|
780
780
|
const request = {
|
|
781
781
|
'market_id': market['id'],
|
|
782
|
-
'limit': 100,
|
|
783
782
|
'start_time': '1970-01-01T00:00:00.000Z',
|
|
784
783
|
'end_time': this.iso8601(this.milliseconds()),
|
|
785
784
|
};
|
|
@@ -787,7 +786,10 @@ export default class probit extends Exchange {
|
|
|
787
786
|
request['start_time'] = this.iso8601(since);
|
|
788
787
|
}
|
|
789
788
|
if (limit !== undefined) {
|
|
790
|
-
request['limit'] = Math.min(limit,
|
|
789
|
+
request['limit'] = Math.min(limit, 1000);
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
request['limit'] = 1000; // required to set any value
|
|
791
793
|
}
|
|
792
794
|
const response = await this.publicGetTrade(this.extend(request, params));
|
|
793
795
|
//
|
package/js/src/wavesexchange.js
CHANGED
|
@@ -2095,7 +2095,7 @@ export default class wavesexchange extends Exchange {
|
|
|
2095
2095
|
'priceAsset': market['quoteId'],
|
|
2096
2096
|
};
|
|
2097
2097
|
if (limit !== undefined) {
|
|
2098
|
-
request['limit'] = limit;
|
|
2098
|
+
request['limit'] = Math.min(limit, 100);
|
|
2099
2099
|
}
|
|
2100
2100
|
if (since !== undefined) {
|
|
2101
2101
|
request['timeStart'] = since;
|
package/js/src/woo.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export default class woo extends Exchange {
|
|
|
14
14
|
fetchTradingFees(params?: {}): Promise<{}>;
|
|
15
15
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
16
16
|
createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
17
|
+
createTrailingAmountOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, trailingAmount?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
|
|
18
|
+
createTrailingPercentOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, trailingPercent?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
|
|
17
19
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
18
20
|
editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
|
|
19
21
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/woo.js
CHANGED
|
@@ -44,13 +44,13 @@ export default class woo extends Exchange {
|
|
|
44
44
|
'createMarketOrder': false,
|
|
45
45
|
'createMarketOrderWithCost': false,
|
|
46
46
|
'createMarketSellOrderWithCost': false,
|
|
47
|
-
'createTrailingAmountOrder': true,
|
|
48
|
-
'createTrailingPercentOrder': true,
|
|
49
47
|
'createOrder': true,
|
|
50
48
|
'createReduceOnlyOrder': true,
|
|
51
49
|
'createStopLimitOrder': false,
|
|
52
50
|
'createStopMarketOrder': false,
|
|
53
51
|
'createStopOrder': false,
|
|
52
|
+
'createTrailingAmountOrder': true,
|
|
53
|
+
'createTrailingPercentOrder': true,
|
|
54
54
|
'fetchAccounts': true,
|
|
55
55
|
'fetchBalance': true,
|
|
56
56
|
'fetchCanceledOrders': false,
|
|
@@ -766,6 +766,56 @@ export default class woo extends Exchange {
|
|
|
766
766
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
767
767
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
768
768
|
}
|
|
769
|
+
async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
770
|
+
/**
|
|
771
|
+
* @method
|
|
772
|
+
* @name createTrailingAmountOrder
|
|
773
|
+
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
|
|
774
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
775
|
+
* @param {string} type 'market' or 'limit'
|
|
776
|
+
* @param {string} side 'buy' or 'sell'
|
|
777
|
+
* @param {float} amount how much you want to trade in units of the base currency, or number of contracts
|
|
778
|
+
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
|
779
|
+
* @param {float} trailingAmount the quote amount to trail away from the current market price
|
|
780
|
+
* @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
|
|
781
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
782
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
783
|
+
*/
|
|
784
|
+
if (trailingAmount === undefined) {
|
|
785
|
+
throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
|
|
786
|
+
}
|
|
787
|
+
if (trailingTriggerPrice === undefined) {
|
|
788
|
+
throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingTriggerPrice argument');
|
|
789
|
+
}
|
|
790
|
+
params['trailingAmount'] = trailingAmount;
|
|
791
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice;
|
|
792
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
793
|
+
}
|
|
794
|
+
async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
795
|
+
/**
|
|
796
|
+
* @method
|
|
797
|
+
* @name createTrailingPercentOrder
|
|
798
|
+
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
|
799
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
800
|
+
* @param {string} type 'market' or 'limit'
|
|
801
|
+
* @param {string} side 'buy' or 'sell'
|
|
802
|
+
* @param {float} amount how much you want to trade in units of the base currency, or number of contracts
|
|
803
|
+
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
|
804
|
+
* @param {float} trailingPercent the percent to trail away from the current market price
|
|
805
|
+
* @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
|
|
806
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
807
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
808
|
+
*/
|
|
809
|
+
if (trailingPercent === undefined) {
|
|
810
|
+
throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
|
|
811
|
+
}
|
|
812
|
+
if (trailingTriggerPrice === undefined) {
|
|
813
|
+
throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
|
|
814
|
+
}
|
|
815
|
+
params['trailingPercent'] = trailingPercent;
|
|
816
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice;
|
|
817
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
818
|
+
}
|
|
769
819
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
770
820
|
/**
|
|
771
821
|
* @method
|
package/package.json
CHANGED