ccxt 4.4.37 → 4.4.39
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.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +73 -2
- package/dist/cjs/src/base/Exchange.js +31 -10
- package/dist/cjs/src/binance.js +0 -2
- package/dist/cjs/src/bingx.js +93 -8
- package/dist/cjs/src/bitget.js +0 -2
- package/dist/cjs/src/bithumb.js +1 -1
- package/dist/cjs/src/bitmart.js +163 -15
- package/dist/cjs/src/bybit.js +3 -2
- package/dist/cjs/src/digifinex.js +58 -18
- package/dist/cjs/src/htx.js +154 -32
- package/dist/cjs/src/kucoin.js +77 -2
- package/dist/cjs/src/kucoinfutures.js +93 -5
- package/dist/cjs/src/mexc.js +36 -25
- package/dist/cjs/src/ndax.js +7 -2
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/probit.js +3 -1
- package/dist/cjs/src/woo.js +4 -4
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +0 -1
- package/js/src/abstract/digifinex.d.ts +1 -0
- package/js/src/abstract/mexc.d.ts +1 -0
- package/js/src/alpaca.d.ts +11 -1
- package/js/src/alpaca.js +73 -2
- package/js/src/base/Exchange.js +31 -10
- package/js/src/binance.js +0 -2
- package/js/src/bingx.d.ts +14 -1
- package/js/src/bingx.js +93 -8
- package/js/src/bitget.js +0 -2
- package/js/src/bithumb.js +1 -1
- package/js/src/bitmart.js +163 -15
- package/js/src/bybit.js +3 -2
- package/js/src/digifinex.d.ts +4 -2
- package/js/src/digifinex.js +58 -18
- package/js/src/htx.d.ts +5 -5
- package/js/src/htx.js +154 -32
- package/js/src/kucoin.js +77 -2
- package/js/src/kucoinfutures.js +93 -5
- package/js/src/mexc.d.ts +7 -7
- package/js/src/mexc.js +36 -25
- package/js/src/ndax.d.ts +2 -0
- package/js/src/ndax.js +7 -2
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/probit.js +3 -1
- package/js/src/woo.js +4 -4
- package/package.json +1 -1
package/js/src/base/Exchange.js
CHANGED
|
@@ -2373,6 +2373,10 @@ export default class Exchange {
|
|
|
2373
2373
|
}
|
|
2374
2374
|
featuresMapper(initialFeatures, marketType, subType = undefined) {
|
|
2375
2375
|
let featuresObj = (subType !== undefined) ? initialFeatures[marketType][subType] : initialFeatures[marketType];
|
|
2376
|
+
// if exchange does not have that market-type (eg. future>inverse)
|
|
2377
|
+
if (featuresObj === undefined) {
|
|
2378
|
+
return undefined;
|
|
2379
|
+
}
|
|
2376
2380
|
const extendsStr = this.safeString(featuresObj, 'extends');
|
|
2377
2381
|
if (extendsStr !== undefined) {
|
|
2378
2382
|
featuresObj = this.omit(featuresObj, 'extends');
|
|
@@ -2395,7 +2399,7 @@ export default class Exchange {
|
|
|
2395
2399
|
// default 'GTC' to true
|
|
2396
2400
|
const gtcValue = this.safeBool(featuresObj['createOrder']['timeInForce'], 'gtc');
|
|
2397
2401
|
if (gtcValue === undefined) {
|
|
2398
|
-
featuresObj['createOrder']['timeInForce']['
|
|
2402
|
+
featuresObj['createOrder']['timeInForce']['GTC'] = true;
|
|
2399
2403
|
}
|
|
2400
2404
|
}
|
|
2401
2405
|
return featuresObj;
|
|
@@ -6792,8 +6796,10 @@ export default class Exchange {
|
|
|
6792
6796
|
const symbolAndTimeFrame = symbolsAndTimeFrames[i];
|
|
6793
6797
|
const symbol = this.safeString(symbolAndTimeFrame, 0);
|
|
6794
6798
|
const timeframe = this.safeString(symbolAndTimeFrame, 1);
|
|
6795
|
-
if (
|
|
6796
|
-
|
|
6799
|
+
if (symbol in this.ohlcvs) {
|
|
6800
|
+
if (timeframe in this.ohlcvs[symbol]) {
|
|
6801
|
+
delete this.ohlcvs[symbol][timeframe];
|
|
6802
|
+
}
|
|
6797
6803
|
}
|
|
6798
6804
|
}
|
|
6799
6805
|
}
|
|
@@ -6801,35 +6807,50 @@ export default class Exchange {
|
|
|
6801
6807
|
for (let i = 0; i < symbols.length; i++) {
|
|
6802
6808
|
const symbol = symbols[i];
|
|
6803
6809
|
if (topic === 'trades') {
|
|
6804
|
-
|
|
6810
|
+
if (symbol in this.trades) {
|
|
6811
|
+
delete this.trades[symbol];
|
|
6812
|
+
}
|
|
6805
6813
|
}
|
|
6806
6814
|
else if (topic === 'orderbook') {
|
|
6807
|
-
|
|
6815
|
+
if (symbol in this.orderbooks) {
|
|
6816
|
+
delete this.orderbooks[symbol];
|
|
6817
|
+
}
|
|
6808
6818
|
}
|
|
6809
6819
|
else if (topic === 'ticker') {
|
|
6810
|
-
|
|
6820
|
+
if (symbol in this.tickers) {
|
|
6821
|
+
delete this.tickers[symbol];
|
|
6822
|
+
}
|
|
6811
6823
|
}
|
|
6812
6824
|
}
|
|
6813
6825
|
}
|
|
6814
6826
|
else {
|
|
6815
6827
|
if (topic === 'myTrades') {
|
|
6816
6828
|
// don't reset this.myTrades directly here
|
|
6817
|
-
// because in c# we need to use a different object
|
|
6829
|
+
// because in c# we need to use a different object (thread-safe dict)
|
|
6818
6830
|
const keys = Object.keys(this.myTrades);
|
|
6819
6831
|
for (let i = 0; i < keys.length; i++) {
|
|
6820
|
-
|
|
6832
|
+
const key = keys[i];
|
|
6833
|
+
if (key in this.myTrades) {
|
|
6834
|
+
delete this.myTrades[key];
|
|
6835
|
+
}
|
|
6821
6836
|
}
|
|
6822
6837
|
}
|
|
6823
6838
|
else if (topic === 'orders') {
|
|
6824
6839
|
const orderSymbols = Object.keys(this.orders);
|
|
6825
6840
|
for (let i = 0; i < orderSymbols.length; i++) {
|
|
6826
|
-
|
|
6841
|
+
const orderSymbol = orderSymbols[i];
|
|
6842
|
+
if (orderSymbol in this.orders) {
|
|
6843
|
+
delete this.orders[orderSymbol];
|
|
6844
|
+
}
|
|
6827
6845
|
}
|
|
6828
6846
|
}
|
|
6829
6847
|
else if (topic === 'ticker') {
|
|
6830
6848
|
const tickerSymbols = Object.keys(this.tickers);
|
|
6831
6849
|
for (let i = 0; i < tickerSymbols.length; i++) {
|
|
6832
|
-
|
|
6850
|
+
const tickerSymbol = tickerSymbols[i];
|
|
6851
|
+
if (tickerSymbol in this.tickers) {
|
|
6852
|
+
delete this.tickers[tickerSymbol];
|
|
6853
|
+
}
|
|
6833
6854
|
}
|
|
6834
6855
|
}
|
|
6835
6856
|
}
|
package/js/src/binance.js
CHANGED
|
@@ -1571,7 +1571,6 @@ export default class binance extends Exchange {
|
|
|
1571
1571
|
'takeProfitPrice': true,
|
|
1572
1572
|
'attachedStopLossTakeProfit': undefined,
|
|
1573
1573
|
'timeInForce': {
|
|
1574
|
-
'GTC': true,
|
|
1575
1574
|
'IOC': true,
|
|
1576
1575
|
'FOK': true,
|
|
1577
1576
|
'PO': true,
|
|
@@ -1638,7 +1637,6 @@ export default class binance extends Exchange {
|
|
|
1638
1637
|
'takeProfitPrice': true,
|
|
1639
1638
|
'attachedStopLossTakeProfit': undefined,
|
|
1640
1639
|
'timeInForce': {
|
|
1641
|
-
'GTC': true,
|
|
1642
1640
|
'IOC': true,
|
|
1643
1641
|
'FOK': true,
|
|
1644
1642
|
'PO': true,
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export default class bingx extends Exchange {
|
|
|
46
46
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
|
|
47
47
|
* @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
|
48
48
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
|
49
|
-
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#
|
|
49
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data
|
|
50
50
|
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
|
|
51
51
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
52
52
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -193,6 +193,19 @@ export default class bingx extends Exchange {
|
|
|
193
193
|
*/
|
|
194
194
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
195
195
|
parseBalance(response: any): Balances;
|
|
196
|
+
/**
|
|
197
|
+
* @method
|
|
198
|
+
* @name bingx#fetchPositionHistory
|
|
199
|
+
* @description fetches historical positions
|
|
200
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History
|
|
201
|
+
* @param {string} symbol unified contract symbol
|
|
202
|
+
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
203
|
+
* @param {int} [limit] the maximum amount of records to fetch
|
|
204
|
+
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
205
|
+
* @param {int} [params.until] the latest time in ms to fetch positions for
|
|
206
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
207
|
+
*/
|
|
208
|
+
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
196
209
|
/**
|
|
197
210
|
* @method
|
|
198
211
|
* @name bingx#fetchPositions
|
package/js/src/bingx.js
CHANGED
|
@@ -83,7 +83,7 @@ export default class bingx extends Exchange {
|
|
|
83
83
|
'fetchPositionHistory': false,
|
|
84
84
|
'fetchPositionMode': true,
|
|
85
85
|
'fetchPositions': true,
|
|
86
|
-
'fetchPositionsHistory':
|
|
86
|
+
'fetchPositionsHistory': true,
|
|
87
87
|
'fetchTicker': true,
|
|
88
88
|
'fetchTickers': true,
|
|
89
89
|
'fetchTime': true,
|
|
@@ -207,7 +207,6 @@ export default class bingx extends Exchange {
|
|
|
207
207
|
'private': {
|
|
208
208
|
'get': {
|
|
209
209
|
'positionSide/dual': 5,
|
|
210
|
-
'market/markPriceKlines': 1,
|
|
211
210
|
'trade/batchCancelReplace': 5,
|
|
212
211
|
'trade/fullOrder': 2,
|
|
213
212
|
'maintMarginRatio': 2,
|
|
@@ -541,7 +540,6 @@ export default class bingx extends Exchange {
|
|
|
541
540
|
'limitPrice': true,
|
|
542
541
|
},
|
|
543
542
|
'timeInForce': {
|
|
544
|
-
'GTC': true,
|
|
545
543
|
'IOC': true,
|
|
546
544
|
'FOK': true,
|
|
547
545
|
'PO': true,
|
|
@@ -1018,7 +1016,7 @@ export default class bingx extends Exchange {
|
|
|
1018
1016
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
|
|
1019
1017
|
* @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
|
1020
1018
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
|
1021
|
-
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#
|
|
1019
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data
|
|
1022
1020
|
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
|
|
1023
1021
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1024
1022
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -1064,7 +1062,7 @@ export default class bingx extends Exchange {
|
|
|
1064
1062
|
const price = this.safeString(params, 'price');
|
|
1065
1063
|
params = this.omit(params, 'price');
|
|
1066
1064
|
if (price === 'mark') {
|
|
1067
|
-
response = await this.
|
|
1065
|
+
response = await this.swapV1PublicGetMarketMarkPriceKlines(this.extend(request, params));
|
|
1068
1066
|
}
|
|
1069
1067
|
else {
|
|
1070
1068
|
response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
|
|
@@ -2337,6 +2335,71 @@ export default class bingx extends Exchange {
|
|
|
2337
2335
|
}
|
|
2338
2336
|
return this.safeBalance(result);
|
|
2339
2337
|
}
|
|
2338
|
+
/**
|
|
2339
|
+
* @method
|
|
2340
|
+
* @name bingx#fetchPositionHistory
|
|
2341
|
+
* @description fetches historical positions
|
|
2342
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History
|
|
2343
|
+
* @param {string} symbol unified contract symbol
|
|
2344
|
+
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
2345
|
+
* @param {int} [limit] the maximum amount of records to fetch
|
|
2346
|
+
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
2347
|
+
* @param {int} [params.until] the latest time in ms to fetch positions for
|
|
2348
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
2349
|
+
*/
|
|
2350
|
+
async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
|
|
2351
|
+
await this.loadMarkets();
|
|
2352
|
+
const market = this.market(symbol);
|
|
2353
|
+
let request = {
|
|
2354
|
+
'symbol': market['id'],
|
|
2355
|
+
};
|
|
2356
|
+
if (limit !== undefined) {
|
|
2357
|
+
request['pageSize'] = limit;
|
|
2358
|
+
}
|
|
2359
|
+
if (since !== undefined) {
|
|
2360
|
+
request['startTs'] = since;
|
|
2361
|
+
}
|
|
2362
|
+
[request, params] = this.handleUntilOption('endTs', request, params);
|
|
2363
|
+
let response = undefined;
|
|
2364
|
+
if (market['linear']) {
|
|
2365
|
+
response = await this.swapV1PrivateGetTradePositionHistory(this.extend(request, params));
|
|
2366
|
+
}
|
|
2367
|
+
else {
|
|
2368
|
+
throw new NotSupported(this.id + ' fetchPositionHistory() is not supported for inverse swap positions');
|
|
2369
|
+
}
|
|
2370
|
+
//
|
|
2371
|
+
// {
|
|
2372
|
+
// "code": 0,
|
|
2373
|
+
// "msg": "",
|
|
2374
|
+
// "data": {
|
|
2375
|
+
// "positionHistory": [
|
|
2376
|
+
// {
|
|
2377
|
+
// "positionId": "1861675561156571136",
|
|
2378
|
+
// "symbol": "LTC-USDT",
|
|
2379
|
+
// "isolated": false,
|
|
2380
|
+
// "positionSide": "LONG",
|
|
2381
|
+
// "openTime": 1732693017000,
|
|
2382
|
+
// "updateTime": 1733310292000,
|
|
2383
|
+
// "avgPrice": "95.18",
|
|
2384
|
+
// "avgClosePrice": "129.48",
|
|
2385
|
+
// "realisedProfit": "102.89",
|
|
2386
|
+
// "netProfit": "99.63",
|
|
2387
|
+
// "positionAmt": "30.0",
|
|
2388
|
+
// "closePositionAmt": "30.0",
|
|
2389
|
+
// "leverage": 6,
|
|
2390
|
+
// "closeAllPositions": true,
|
|
2391
|
+
// "positionCommission": "-0.33699650000000003",
|
|
2392
|
+
// "totalFunding": "-2.921461693902908"
|
|
2393
|
+
// },
|
|
2394
|
+
// ]
|
|
2395
|
+
// }
|
|
2396
|
+
// }
|
|
2397
|
+
//
|
|
2398
|
+
const data = this.safeDict(response, 'data', {});
|
|
2399
|
+
const records = this.safeList(data, 'positionHistory', []);
|
|
2400
|
+
const positions = this.parsePositions(records);
|
|
2401
|
+
return this.filterBySymbolSinceLimit(positions, symbol, since, limit);
|
|
2402
|
+
}
|
|
2340
2403
|
/**
|
|
2341
2404
|
* @method
|
|
2342
2405
|
* @name bingx#fetchPositions
|
|
@@ -2585,6 +2648,27 @@ export default class bingx extends Exchange {
|
|
|
2585
2648
|
// "positionAmt": "1.20365912",
|
|
2586
2649
|
// }
|
|
2587
2650
|
//
|
|
2651
|
+
// linear swap fetchPositionHistory
|
|
2652
|
+
//
|
|
2653
|
+
// {
|
|
2654
|
+
// "positionId": "1861675561156571136",
|
|
2655
|
+
// "symbol": "LTC-USDT",
|
|
2656
|
+
// "isolated": false,
|
|
2657
|
+
// "positionSide": "LONG",
|
|
2658
|
+
// "openTime": 1732693017000,
|
|
2659
|
+
// "updateTime": 1733310292000,
|
|
2660
|
+
// "avgPrice": "95.18",
|
|
2661
|
+
// "avgClosePrice": "129.48",
|
|
2662
|
+
// "realisedProfit": "102.89",
|
|
2663
|
+
// "netProfit": "99.63",
|
|
2664
|
+
// "positionAmt": "30.0",
|
|
2665
|
+
// "closePositionAmt": "30.0",
|
|
2666
|
+
// "leverage": 6,
|
|
2667
|
+
// "closeAllPositions": true,
|
|
2668
|
+
// "positionCommission": "-0.33699650000000003",
|
|
2669
|
+
// "totalFunding": "-2.921461693902908"
|
|
2670
|
+
// }
|
|
2671
|
+
//
|
|
2588
2672
|
let marketId = this.safeString(position, 'symbol', '');
|
|
2589
2673
|
marketId = marketId.replace('/', '-'); // standard return different format
|
|
2590
2674
|
const isolated = this.safeBool(position, 'isolated');
|
|
@@ -2592,6 +2676,7 @@ export default class bingx extends Exchange {
|
|
|
2592
2676
|
if (isolated !== undefined) {
|
|
2593
2677
|
marginMode = isolated ? 'isolated' : 'cross';
|
|
2594
2678
|
}
|
|
2679
|
+
const timestamp = this.safeInteger(position, 'openTime');
|
|
2595
2680
|
return this.safePosition({
|
|
2596
2681
|
'info': position,
|
|
2597
2682
|
'id': this.safeString(position, 'positionId'),
|
|
@@ -2609,8 +2694,8 @@ export default class bingx extends Exchange {
|
|
|
2609
2694
|
'lastPrice': undefined,
|
|
2610
2695
|
'side': this.safeStringLower(position, 'positionSide'),
|
|
2611
2696
|
'hedged': undefined,
|
|
2612
|
-
'timestamp':
|
|
2613
|
-
'datetime':
|
|
2697
|
+
'timestamp': timestamp,
|
|
2698
|
+
'datetime': this.iso8601(timestamp),
|
|
2614
2699
|
'lastUpdateTimestamp': this.safeInteger(position, 'updateTime'),
|
|
2615
2700
|
'maintenanceMargin': undefined,
|
|
2616
2701
|
'maintenanceMarginPercentage': undefined,
|
|
@@ -6384,7 +6469,7 @@ export default class bingx extends Exchange {
|
|
|
6384
6469
|
}
|
|
6385
6470
|
else {
|
|
6386
6471
|
const query = this.urlencode(parsedParams);
|
|
6387
|
-
url += '?' + query + '&signature=' + signature;
|
|
6472
|
+
url += '?' + query + '&' + 'signature=' + signature;
|
|
6388
6473
|
}
|
|
6389
6474
|
}
|
|
6390
6475
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
package/js/src/bitget.js
CHANGED
|
@@ -1465,7 +1465,6 @@ export default class bitget extends Exchange {
|
|
|
1465
1465
|
'limitPrice': true,
|
|
1466
1466
|
},
|
|
1467
1467
|
'timeInForce': {
|
|
1468
|
-
'GTC': true,
|
|
1469
1468
|
'IOC': true,
|
|
1470
1469
|
'FOK': true,
|
|
1471
1470
|
'PO': true,
|
|
@@ -1536,7 +1535,6 @@ export default class bitget extends Exchange {
|
|
|
1536
1535
|
'limitPrice': false,
|
|
1537
1536
|
},
|
|
1538
1537
|
'timeInForce': {
|
|
1539
|
-
'GTC': true,
|
|
1540
1538
|
'IOC': true,
|
|
1541
1539
|
'FOK': true,
|
|
1542
1540
|
'PO': true,
|
package/js/src/bithumb.js
CHANGED
|
@@ -1052,7 +1052,7 @@ export default class bithumb extends Exchange {
|
|
|
1052
1052
|
'address': address,
|
|
1053
1053
|
'currency': currency['id'],
|
|
1054
1054
|
};
|
|
1055
|
-
if (code === 'XRP' || code === 'XMR' || code === 'EOS' || code === 'STEEM') {
|
|
1055
|
+
if (code === 'XRP' || code === 'XMR' || code === 'EOS' || code === 'STEEM' || code === 'TON') {
|
|
1056
1056
|
const destination = this.safeString(params, 'destination');
|
|
1057
1057
|
if ((tag === undefined) && (destination === undefined)) {
|
|
1058
1058
|
throw new ArgumentsRequired(this.id + ' ' + code + ' withdraw() requires a tag argument or an extra destination param');
|
package/js/src/bitmart.js
CHANGED
|
@@ -688,6 +688,151 @@ export default class bitmart extends Exchange {
|
|
|
688
688
|
'createMarketBuyOrderRequiresPrice': true,
|
|
689
689
|
'brokerId': 'CCXTxBitmart000',
|
|
690
690
|
},
|
|
691
|
+
'features': {
|
|
692
|
+
'default': {
|
|
693
|
+
'sandbox': false,
|
|
694
|
+
'createOrder': {
|
|
695
|
+
'marginMode': true,
|
|
696
|
+
'triggerPrice': false,
|
|
697
|
+
'triggerPriceType': undefined,
|
|
698
|
+
'triggerDirection': false,
|
|
699
|
+
'stopLossPrice': false,
|
|
700
|
+
'takeProfitPrice': false,
|
|
701
|
+
'attachedStopLossTakeProfit': undefined,
|
|
702
|
+
'timeInForce': {
|
|
703
|
+
'IOC': true,
|
|
704
|
+
'FOK': false,
|
|
705
|
+
'PO': true,
|
|
706
|
+
'GTD': false,
|
|
707
|
+
},
|
|
708
|
+
'hedged': false,
|
|
709
|
+
'trailing': false,
|
|
710
|
+
'marketBuyRequiresPrice': true,
|
|
711
|
+
'marketBuyByCost': true,
|
|
712
|
+
// exchange-supported features
|
|
713
|
+
// 'leverage': true,
|
|
714
|
+
// 'selfTradePrevention': false,
|
|
715
|
+
// 'twap': false,
|
|
716
|
+
// 'iceberg': false,
|
|
717
|
+
// 'oco': false,
|
|
718
|
+
},
|
|
719
|
+
'createOrders': {
|
|
720
|
+
'max': 10,
|
|
721
|
+
},
|
|
722
|
+
'fetchMyTrades': {
|
|
723
|
+
'marginMode': true,
|
|
724
|
+
'limit': 200,
|
|
725
|
+
'daysBack': undefined,
|
|
726
|
+
'untilDays': 99999,
|
|
727
|
+
},
|
|
728
|
+
'fetchOrder': {
|
|
729
|
+
'marginMode': false,
|
|
730
|
+
'trigger': false,
|
|
731
|
+
'trailing': false,
|
|
732
|
+
},
|
|
733
|
+
'fetchOpenOrders': {
|
|
734
|
+
'marginMode': true,
|
|
735
|
+
'limit': 200,
|
|
736
|
+
'trigger': false,
|
|
737
|
+
'trailing': false,
|
|
738
|
+
},
|
|
739
|
+
'fetchOrders': undefined,
|
|
740
|
+
'fetchClosedOrders': {
|
|
741
|
+
'marginMode': true,
|
|
742
|
+
'limit': 200,
|
|
743
|
+
'daysBackClosed': undefined,
|
|
744
|
+
'daysBackCanceled': undefined,
|
|
745
|
+
'untilDays': undefined,
|
|
746
|
+
'trigger': false,
|
|
747
|
+
'trailing': false,
|
|
748
|
+
},
|
|
749
|
+
'fetchOHLCV': {
|
|
750
|
+
'limit': 1000, // variable timespans for recent endpoint, 200 for historical
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
'forDerivatives': {
|
|
754
|
+
'extends': 'default',
|
|
755
|
+
'createOrder': {
|
|
756
|
+
'marginMode': true,
|
|
757
|
+
'triggerPrice': true,
|
|
758
|
+
'triggerPriceType': {
|
|
759
|
+
'last': true,
|
|
760
|
+
'mark': true,
|
|
761
|
+
'index': false,
|
|
762
|
+
},
|
|
763
|
+
'triggerDirection': true,
|
|
764
|
+
'stopLossPrice': true,
|
|
765
|
+
'takeProfitPrice': true,
|
|
766
|
+
'attachedStopLossTakeProfit': {
|
|
767
|
+
'triggerPriceType': {
|
|
768
|
+
'last': true,
|
|
769
|
+
'mark': true,
|
|
770
|
+
'index': false,
|
|
771
|
+
},
|
|
772
|
+
'limitPrice': false,
|
|
773
|
+
},
|
|
774
|
+
'timeInForce': {
|
|
775
|
+
'IOC': true,
|
|
776
|
+
'FOK': true,
|
|
777
|
+
'PO': true,
|
|
778
|
+
'GTD': false,
|
|
779
|
+
},
|
|
780
|
+
'hedged': false,
|
|
781
|
+
'trailing': true,
|
|
782
|
+
'marketBuyRequiresPrice': true,
|
|
783
|
+
'marketBuyByCost': true,
|
|
784
|
+
// exchange-supported features
|
|
785
|
+
// 'selfTradePrevention': true,
|
|
786
|
+
// 'twap': false,
|
|
787
|
+
// 'iceberg': false,
|
|
788
|
+
// 'oco': false,
|
|
789
|
+
},
|
|
790
|
+
'fetchMyTrades': {
|
|
791
|
+
'marginMode': true,
|
|
792
|
+
'limit': undefined,
|
|
793
|
+
'daysBack': undefined,
|
|
794
|
+
'untilDays': 99999,
|
|
795
|
+
},
|
|
796
|
+
'fetchOrder': {
|
|
797
|
+
'marginMode': false,
|
|
798
|
+
'trigger': false,
|
|
799
|
+
'trailing': true,
|
|
800
|
+
},
|
|
801
|
+
'fetchOpenOrders': {
|
|
802
|
+
'marginMode': false,
|
|
803
|
+
'limit': 100,
|
|
804
|
+
'trigger': true,
|
|
805
|
+
'trailing': false,
|
|
806
|
+
},
|
|
807
|
+
'fetchClosedOrders': {
|
|
808
|
+
'marginMode': true,
|
|
809
|
+
'limit': 200,
|
|
810
|
+
'daysBackClosed': undefined,
|
|
811
|
+
'daysBackCanceled': undefined,
|
|
812
|
+
'untilDays': undefined,
|
|
813
|
+
'trigger': false,
|
|
814
|
+
'trailing': false,
|
|
815
|
+
},
|
|
816
|
+
'fetchOHLCV': {
|
|
817
|
+
'limit': 500,
|
|
818
|
+
},
|
|
819
|
+
},
|
|
820
|
+
'spot': {
|
|
821
|
+
'extends': 'default',
|
|
822
|
+
},
|
|
823
|
+
'swap': {
|
|
824
|
+
'linear': {
|
|
825
|
+
'extends': 'forDerivatives',
|
|
826
|
+
},
|
|
827
|
+
'inverse': {
|
|
828
|
+
'extends': 'forDerivatives',
|
|
829
|
+
},
|
|
830
|
+
},
|
|
831
|
+
'future': {
|
|
832
|
+
'linear': undefined,
|
|
833
|
+
'inverse': undefined,
|
|
834
|
+
},
|
|
835
|
+
},
|
|
691
836
|
});
|
|
692
837
|
}
|
|
693
838
|
/**
|
|
@@ -1954,11 +2099,12 @@ export default class bitmart extends Exchange {
|
|
|
1954
2099
|
request['orderMode'] = 'iso_margin';
|
|
1955
2100
|
}
|
|
1956
2101
|
const options = this.safeDict(this.options, 'fetchMyTrades', {});
|
|
1957
|
-
const
|
|
2102
|
+
const maxLimit = 200;
|
|
2103
|
+
const defaultLimit = this.safeInteger(options, 'limit', maxLimit);
|
|
1958
2104
|
if (limit === undefined) {
|
|
1959
2105
|
limit = defaultLimit;
|
|
1960
2106
|
}
|
|
1961
|
-
request['limit'] = limit;
|
|
2107
|
+
request['limit'] = Math.min(limit, maxLimit);
|
|
1962
2108
|
if (since !== undefined) {
|
|
1963
2109
|
request['startTime'] = since;
|
|
1964
2110
|
}
|
|
@@ -2642,8 +2788,7 @@ export default class bitmart extends Exchange {
|
|
|
2642
2788
|
* @name bitmart#createSwapOrderRequest
|
|
2643
2789
|
* @ignore
|
|
2644
2790
|
* @description create a trade order
|
|
2645
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
2646
|
-
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2791
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed
|
|
2647
2792
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2648
2793
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
|
|
2649
2794
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -3162,13 +3307,13 @@ export default class bitmart extends Exchange {
|
|
|
3162
3307
|
market = this.market(symbol);
|
|
3163
3308
|
request['symbol'] = market['id'];
|
|
3164
3309
|
}
|
|
3165
|
-
if (limit !== undefined) {
|
|
3166
|
-
request['limit'] = limit;
|
|
3167
|
-
}
|
|
3168
3310
|
let type = undefined;
|
|
3169
3311
|
let response = undefined;
|
|
3170
3312
|
[type, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
3171
3313
|
if (type === 'spot') {
|
|
3314
|
+
if (limit !== undefined) {
|
|
3315
|
+
request['limit'] = Math.min(limit, 200);
|
|
3316
|
+
}
|
|
3172
3317
|
let marginMode = undefined;
|
|
3173
3318
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
3174
3319
|
if (marginMode === 'isolated') {
|
|
@@ -3185,9 +3330,12 @@ export default class bitmart extends Exchange {
|
|
|
3185
3330
|
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
3186
3331
|
}
|
|
3187
3332
|
else if (type === 'swap') {
|
|
3188
|
-
|
|
3333
|
+
if (limit !== undefined) {
|
|
3334
|
+
request['limit'] = Math.min(limit, 100);
|
|
3335
|
+
}
|
|
3336
|
+
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3189
3337
|
params = this.omit(params, ['stop', 'trigger']);
|
|
3190
|
-
if (
|
|
3338
|
+
if (isTrigger) {
|
|
3191
3339
|
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
3192
3340
|
}
|
|
3193
3341
|
else {
|
|
@@ -3293,13 +3441,8 @@ export default class bitmart extends Exchange {
|
|
|
3293
3441
|
throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
3294
3442
|
}
|
|
3295
3443
|
}
|
|
3296
|
-
let marginMode = undefined;
|
|
3297
|
-
[marginMode, params] = this.handleMarginModeAndParams('fetchClosedOrders', params);
|
|
3298
|
-
if (marginMode === 'isolated') {
|
|
3299
|
-
request['orderMode'] = 'iso_margin';
|
|
3300
|
-
}
|
|
3301
|
-
const startTimeKey = (type === 'spot') ? 'startTime' : 'start_time';
|
|
3302
3444
|
if (since !== undefined) {
|
|
3445
|
+
const startTimeKey = (type === 'spot') ? 'startTime' : 'start_time';
|
|
3303
3446
|
request[startTimeKey] = since;
|
|
3304
3447
|
}
|
|
3305
3448
|
const endTimeKey = (type === 'spot') ? 'endTime' : 'end_time';
|
|
@@ -3310,6 +3453,11 @@ export default class bitmart extends Exchange {
|
|
|
3310
3453
|
}
|
|
3311
3454
|
let response = undefined;
|
|
3312
3455
|
if (type === 'spot') {
|
|
3456
|
+
let marginMode = undefined;
|
|
3457
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchClosedOrders', params);
|
|
3458
|
+
if (marginMode === 'isolated') {
|
|
3459
|
+
request['orderMode'] = 'iso_margin';
|
|
3460
|
+
}
|
|
3313
3461
|
response = await this.privatePostSpotV4QueryHistoryOrders(this.extend(request, params));
|
|
3314
3462
|
}
|
|
3315
3463
|
else {
|
package/js/src/bybit.js
CHANGED
|
@@ -662,6 +662,9 @@ export default class bybit extends Exchange {
|
|
|
662
662
|
'110071': ExchangeError,
|
|
663
663
|
'110072': InvalidOrder,
|
|
664
664
|
'110073': ExchangeError,
|
|
665
|
+
'110092': InvalidOrder,
|
|
666
|
+
'110093': InvalidOrder,
|
|
667
|
+
'110094': InvalidOrder,
|
|
665
668
|
'130006': InvalidOrder,
|
|
666
669
|
'130021': InsufficientFunds,
|
|
667
670
|
'130074': InvalidOrder,
|
|
@@ -1101,7 +1104,6 @@ export default class bybit extends Exchange {
|
|
|
1101
1104
|
'limitPrice': true,
|
|
1102
1105
|
},
|
|
1103
1106
|
'timeInForce': {
|
|
1104
|
-
'GTC': true,
|
|
1105
1107
|
'IOC': true,
|
|
1106
1108
|
'FOK': true,
|
|
1107
1109
|
'PO': true,
|
|
@@ -1163,7 +1165,6 @@ export default class bybit extends Exchange {
|
|
|
1163
1165
|
'limitPrice': true,
|
|
1164
1166
|
},
|
|
1165
1167
|
'timeInForce': {
|
|
1166
|
-
'GTC': true,
|
|
1167
1168
|
'IOC': true,
|
|
1168
1169
|
'FOK': true,
|
|
1169
1170
|
'PO': true,
|
package/js/src/digifinex.d.ts
CHANGED
|
@@ -297,10 +297,12 @@ export default class digifinex extends Exchange {
|
|
|
297
297
|
* @method
|
|
298
298
|
* @name digifinex#transfer
|
|
299
299
|
* @description transfer currency internally between wallets on the same account
|
|
300
|
+
* @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#transfer-assets-among-accounts
|
|
301
|
+
* @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#accounttransfer
|
|
300
302
|
* @param {string} code unified currency code
|
|
301
303
|
* @param {float} amount amount to transfer
|
|
302
|
-
* @param {string} fromAccount account to transfer from
|
|
303
|
-
* @param {string} toAccount account to transfer to
|
|
304
|
+
* @param {string} fromAccount 'spot', 'swap', 'margin', 'OTC' - account to transfer from
|
|
305
|
+
* @param {string} toAccount 'spot', 'swap', 'margin', 'OTC' - account to transfer to
|
|
304
306
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
305
307
|
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
306
308
|
*/
|