ccxt 4.4.37 → 4.4.38
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 +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +5 -1
- 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/kucoin.js +76 -2
- package/dist/cjs/src/kucoinfutures.js +93 -5
- package/dist/cjs/src/ndax.js +7 -2
- package/dist/cjs/src/okx.js +0 -1
- package/dist/cjs/src/probit.js +3 -1
- 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/base/Exchange.js +5 -1
- 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/kucoin.js +76 -2
- package/js/src/kucoinfutures.js +93 -5
- package/js/src/ndax.d.ts +2 -0
- package/js/src/ndax.js +7 -2
- package/js/src/okx.js +0 -1
- package/js/src/probit.js +3 -1
- package/package.json +1 -1
|
@@ -357,6 +357,91 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
357
357
|
// 'code': 'BTC',
|
|
358
358
|
// },
|
|
359
359
|
},
|
|
360
|
+
'features': {
|
|
361
|
+
'spot': undefined,
|
|
362
|
+
'forDerivs': {
|
|
363
|
+
'sandbox': false,
|
|
364
|
+
'createOrder': {
|
|
365
|
+
'marginMode': true,
|
|
366
|
+
'triggerPrice': true,
|
|
367
|
+
'triggerPriceType': {
|
|
368
|
+
'last': true,
|
|
369
|
+
'mark': true,
|
|
370
|
+
'index': true,
|
|
371
|
+
},
|
|
372
|
+
'triggerDirection': true,
|
|
373
|
+
'stopLossPrice': true,
|
|
374
|
+
'takeProfitPrice': true,
|
|
375
|
+
'attachedStopLossTakeProfit': {
|
|
376
|
+
'triggerPrice': undefined,
|
|
377
|
+
'triggerPriceType': undefined,
|
|
378
|
+
'limitPrice': true,
|
|
379
|
+
},
|
|
380
|
+
'timeInForce': {
|
|
381
|
+
'IOC': true,
|
|
382
|
+
'FOK': false,
|
|
383
|
+
'PO': true,
|
|
384
|
+
'GTD': false,
|
|
385
|
+
},
|
|
386
|
+
'hedged': false,
|
|
387
|
+
'trailing': false,
|
|
388
|
+
// exchange-supported features
|
|
389
|
+
// 'iceberg': true,
|
|
390
|
+
// 'selfTradePrevention': true,
|
|
391
|
+
// 'twap': false,
|
|
392
|
+
// 'oco': false,
|
|
393
|
+
},
|
|
394
|
+
'createOrders': {
|
|
395
|
+
'max': 20,
|
|
396
|
+
},
|
|
397
|
+
'fetchMyTrades': {
|
|
398
|
+
'marginMode': true,
|
|
399
|
+
'limit': 1000,
|
|
400
|
+
'daysBack': undefined,
|
|
401
|
+
'untilDays': 7,
|
|
402
|
+
},
|
|
403
|
+
'fetchOrder': {
|
|
404
|
+
'marginMode': false,
|
|
405
|
+
'trigger': false,
|
|
406
|
+
'trailing': false,
|
|
407
|
+
},
|
|
408
|
+
'fetchOpenOrders': {
|
|
409
|
+
'marginMode': false,
|
|
410
|
+
'limit': 1000,
|
|
411
|
+
'trigger': true,
|
|
412
|
+
'trailing': false,
|
|
413
|
+
},
|
|
414
|
+
'fetchOrders': undefined,
|
|
415
|
+
'fetchClosedOrders': {
|
|
416
|
+
'marginMode': false,
|
|
417
|
+
'limit': 1000,
|
|
418
|
+
'daysBackClosed': undefined,
|
|
419
|
+
'daysBackCanceled': undefined,
|
|
420
|
+
'untilDays': undefined,
|
|
421
|
+
'trigger': true,
|
|
422
|
+
'trailing': false,
|
|
423
|
+
},
|
|
424
|
+
'fetchOHLCV': {
|
|
425
|
+
'limit': 500,
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
'swap': {
|
|
429
|
+
'linear': {
|
|
430
|
+
'extends': 'forDerivs',
|
|
431
|
+
},
|
|
432
|
+
'inverse': {
|
|
433
|
+
'extends': 'forDerivs',
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
'future': {
|
|
437
|
+
'linear': {
|
|
438
|
+
'extends': 'forDerivs',
|
|
439
|
+
},
|
|
440
|
+
'inverse': {
|
|
441
|
+
'extends': 'forDerivs',
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
},
|
|
360
445
|
});
|
|
361
446
|
}
|
|
362
447
|
/**
|
|
@@ -1751,10 +1836,10 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1751
1836
|
if (symbol !== undefined) {
|
|
1752
1837
|
request['symbol'] = this.marketId(symbol);
|
|
1753
1838
|
}
|
|
1754
|
-
const
|
|
1839
|
+
const trigger = this.safeValue2(params, 'stop', 'trigger');
|
|
1755
1840
|
params = this.omit(params, ['stop', 'trigger']);
|
|
1756
1841
|
let response = undefined;
|
|
1757
|
-
if (
|
|
1842
|
+
if (trigger) {
|
|
1758
1843
|
response = await this.futuresPrivateDeleteStopOrders(this.extend(request, params));
|
|
1759
1844
|
}
|
|
1760
1845
|
else {
|
|
@@ -1938,7 +2023,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1938
2023
|
if (paginate) {
|
|
1939
2024
|
return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
|
|
1940
2025
|
}
|
|
1941
|
-
const
|
|
2026
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
1942
2027
|
const until = this.safeInteger(params, 'until');
|
|
1943
2028
|
params = this.omit(params, ['stop', 'until', 'trigger']);
|
|
1944
2029
|
if (status === 'closed') {
|
|
@@ -1948,7 +2033,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1948
2033
|
status = 'active';
|
|
1949
2034
|
}
|
|
1950
2035
|
const request = {};
|
|
1951
|
-
if (!
|
|
2036
|
+
if (!trigger) {
|
|
1952
2037
|
request['status'] = status;
|
|
1953
2038
|
}
|
|
1954
2039
|
else if (status !== 'active') {
|
|
@@ -1966,7 +2051,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1966
2051
|
request['endAt'] = until;
|
|
1967
2052
|
}
|
|
1968
2053
|
let response = undefined;
|
|
1969
|
-
if (
|
|
2054
|
+
if (trigger) {
|
|
1970
2055
|
response = await this.futuresPrivateGetStopOrders(this.extend(request, params));
|
|
1971
2056
|
}
|
|
1972
2057
|
else {
|
|
@@ -2591,6 +2676,9 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2591
2676
|
if (since !== undefined) {
|
|
2592
2677
|
request['startAt'] = since;
|
|
2593
2678
|
}
|
|
2679
|
+
if (limit !== undefined) {
|
|
2680
|
+
request['pageSize'] = Math.min(1000, limit);
|
|
2681
|
+
}
|
|
2594
2682
|
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
2595
2683
|
const response = await this.futuresPrivateGetFills(this.extend(request, params));
|
|
2596
2684
|
//
|
package/dist/cjs/src/ndax.js
CHANGED
|
@@ -1089,8 +1089,11 @@ class ndax extends ndax$1 {
|
|
|
1089
1089
|
const omsId = this.safeInteger(this.options, 'omsId', 1);
|
|
1090
1090
|
await this.loadMarkets();
|
|
1091
1091
|
await this.loadAccounts();
|
|
1092
|
-
const defaultAccountId = this.safeInteger2(this.options, 'accountId', 'AccountId'
|
|
1093
|
-
|
|
1092
|
+
const defaultAccountId = this.safeInteger2(this.options, 'accountId', 'AccountId');
|
|
1093
|
+
let accountId = this.safeInteger2(params, 'accountId', 'AccountId', defaultAccountId);
|
|
1094
|
+
if (accountId === undefined) {
|
|
1095
|
+
accountId = parseInt(this.accounts[0]['id']);
|
|
1096
|
+
}
|
|
1094
1097
|
params = this.omit(params, ['accountId', 'AccountId']);
|
|
1095
1098
|
const request = {
|
|
1096
1099
|
'omsId': omsId,
|
|
@@ -1373,6 +1376,7 @@ class ndax extends ndax$1 {
|
|
|
1373
1376
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1374
1377
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1375
1378
|
* @param {float} [params.triggerPrice] the price at which a trigger order would be triggered
|
|
1379
|
+
* @param {string} [params.clientOrderId] a unique id for the order
|
|
1376
1380
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1377
1381
|
*/
|
|
1378
1382
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -1615,6 +1619,7 @@ class ndax extends ndax$1 {
|
|
|
1615
1619
|
* @param {string} id order id
|
|
1616
1620
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1617
1621
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1622
|
+
* @param {string} [params.clientOrderId] a unique id for the order
|
|
1618
1623
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1619
1624
|
*/
|
|
1620
1625
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
package/dist/cjs/src/okx.js
CHANGED
package/dist/cjs/src/probit.js
CHANGED
|
@@ -271,6 +271,8 @@ class probit extends probit$1 {
|
|
|
271
271
|
const base = this.safeCurrencyCode(baseId);
|
|
272
272
|
const quote = this.safeCurrencyCode(quoteId);
|
|
273
273
|
const closed = this.safeBool(market, 'closed', false);
|
|
274
|
+
const showInUI = this.safeBool(market, 'show_in_ui', true);
|
|
275
|
+
const active = !closed && showInUI;
|
|
274
276
|
const takerFeeRate = this.safeString(market, 'taker_fee_rate');
|
|
275
277
|
const taker = Precise["default"].stringDiv(takerFeeRate, '100');
|
|
276
278
|
const makerFeeRate = this.safeString(market, 'maker_fee_rate');
|
|
@@ -290,7 +292,7 @@ class probit extends probit$1 {
|
|
|
290
292
|
'swap': false,
|
|
291
293
|
'future': false,
|
|
292
294
|
'option': false,
|
|
293
|
-
'active':
|
|
295
|
+
'active': active,
|
|
294
296
|
'contract': false,
|
|
295
297
|
'linear': undefined,
|
|
296
298
|
'inverse': undefined,
|
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.37";
|
|
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.38';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -34,7 +34,6 @@ interface Exchange {
|
|
|
34
34
|
swapV1PublicGetMarketMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
35
35
|
swapV1PublicGetTradeMultiAssetsRules(params?: {}): Promise<implicitReturnType>;
|
|
36
36
|
swapV1PrivateGetPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
37
|
-
swapV1PrivateGetMarketMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
38
37
|
swapV1PrivateGetTradeBatchCancelReplace(params?: {}): Promise<implicitReturnType>;
|
|
39
38
|
swapV1PrivateGetTradeFullOrder(params?: {}): Promise<implicitReturnType>;
|
|
40
39
|
swapV1PrivateGetMaintMarginRatio(params?: {}): Promise<implicitReturnType>;
|
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;
|
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');
|