ccxt 4.4.37__py2.py3-none-any.whl → 4.4.39__py2.py3-none-any.whl
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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bingx.py +0 -1
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/mexc.py +1 -0
- ccxt/abstract/woo.py +2 -2
- ccxt/alpaca.py +74 -3
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +74 -3
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +0 -2
- ccxt/async_support/bingx.py +89 -8
- ccxt/async_support/bitget.py +2 -4
- ccxt/async_support/bithumb.py +1 -1
- ccxt/async_support/bitmart.py +160 -13
- ccxt/async_support/bybit.py +3 -2
- ccxt/async_support/digifinex.py +57 -18
- ccxt/async_support/htx.py +154 -32
- ccxt/async_support/kucoin.py +76 -2
- ccxt/async_support/kucoinfutures.py +92 -5
- ccxt/async_support/mexc.py +36 -25
- ccxt/async_support/ndax.py +5 -1
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/probit.py +3 -1
- ccxt/async_support/woo.py +6 -6
- ccxt/base/exchange.py +24 -11
- ccxt/binance.py +0 -2
- ccxt/bingx.py +89 -8
- ccxt/bitget.py +2 -4
- ccxt/bithumb.py +1 -1
- ccxt/bitmart.py +160 -13
- ccxt/bybit.py +3 -2
- ccxt/digifinex.py +57 -18
- ccxt/htx.py +154 -32
- ccxt/kucoin.py +76 -2
- ccxt/kucoinfutures.py +92 -5
- ccxt/mexc.py +36 -25
- ccxt/ndax.py +5 -1
- ccxt/okx.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/woo.py +1 -1
- ccxt/probit.py +3 -1
- ccxt/test/tests_async.py +5 -1
- ccxt/test/tests_sync.py +5 -1
- ccxt/woo.py +6 -6
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/METADATA +4 -4
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/RECORD +49 -49
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/WHEEL +0 -0
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/top_level.txt +0 -0
ccxt/async_support/mexc.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.mexc import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade,
|
10
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -133,8 +133,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
133
133
|
'fetchTickers': True,
|
134
134
|
'fetchTime': True,
|
135
135
|
'fetchTrades': True,
|
136
|
-
'fetchTradingFee':
|
137
|
-
'fetchTradingFees':
|
136
|
+
'fetchTradingFee': True,
|
137
|
+
'fetchTradingFees': False,
|
138
138
|
'fetchTradingLimits': None,
|
139
139
|
'fetchTransactionFee': 'emulated',
|
140
140
|
'fetchTransactionFees': True,
|
@@ -207,6 +207,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
207
207
|
'allOrders': 10,
|
208
208
|
'account': 10,
|
209
209
|
'myTrades': 10,
|
210
|
+
'tradeFee': 10,
|
210
211
|
'sub-account/list': 1,
|
211
212
|
'sub-account/apiKey': 1,
|
212
213
|
'capital/config/getall': 10,
|
@@ -3426,34 +3427,44 @@ class mexc(Exchange, ImplicitAPI):
|
|
3426
3427
|
})
|
3427
3428
|
return result
|
3428
3429
|
|
3429
|
-
async def
|
3430
|
+
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
3430
3431
|
"""
|
3431
|
-
fetch the trading fees for
|
3432
|
+
fetch the trading fees for a market
|
3432
3433
|
|
3433
|
-
https://mexcdevelop.github.io/apidocs/spot_v3_en/#
|
3434
|
-
https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
|
3434
|
+
https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-mx-deduct-status
|
3435
3435
|
|
3436
|
+
:param str symbol: unified market symbol
|
3436
3437
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3437
|
-
:returns dict: a
|
3438
|
+
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
3438
3439
|
"""
|
3439
3440
|
await self.load_markets()
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3441
|
+
market = self.market(symbol)
|
3442
|
+
if not market['spot']:
|
3443
|
+
raise BadRequest(self.id + ' fetchTradingFee() supports spot markets only')
|
3444
|
+
request: dict = {
|
3445
|
+
'symbol': market['id'],
|
3446
|
+
}
|
3447
|
+
response = await self.spotPrivateGetTradeFee(self.extend(request, params))
|
3448
|
+
#
|
3449
|
+
# {
|
3450
|
+
# "data":{
|
3451
|
+
# "makerCommission":0.003000000000000000,
|
3452
|
+
# "takerCommission":0.003000000000000000
|
3453
|
+
# },
|
3454
|
+
# "code":0,
|
3455
|
+
# "msg":"success",
|
3456
|
+
# "timestamp":1669109672717
|
3457
|
+
# }
|
3458
|
+
#
|
3459
|
+
data = self.safe_dict(response, 'data', {})
|
3460
|
+
return {
|
3461
|
+
'info': data,
|
3462
|
+
'symbol': symbol,
|
3463
|
+
'maker': self.safe_number(data, 'makerCommission'),
|
3464
|
+
'taker': self.safe_number(data, 'takerCommission'),
|
3465
|
+
'percentage': None,
|
3466
|
+
'tierBased': None,
|
3467
|
+
}
|
3457
3468
|
|
3458
3469
|
def custom_parse_balance(self, response, marketType) -> Balances:
|
3459
3470
|
#
|
ccxt/async_support/ndax.py
CHANGED
@@ -1069,8 +1069,10 @@ class ndax(Exchange, ImplicitAPI):
|
|
1069
1069
|
omsId = self.safe_integer(self.options, 'omsId', 1)
|
1070
1070
|
await self.load_markets()
|
1071
1071
|
await self.load_accounts()
|
1072
|
-
defaultAccountId = self.safe_integer_2(self.options, 'accountId', 'AccountId'
|
1072
|
+
defaultAccountId = self.safe_integer_2(self.options, 'accountId', 'AccountId')
|
1073
1073
|
accountId = self.safe_integer_2(params, 'accountId', 'AccountId', defaultAccountId)
|
1074
|
+
if accountId is None:
|
1075
|
+
accountId = int(self.accounts[0]['id'])
|
1074
1076
|
params = self.omit(params, ['accountId', 'AccountId'])
|
1075
1077
|
request: dict = {
|
1076
1078
|
'omsId': omsId,
|
@@ -1348,6 +1350,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1348
1350
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
1349
1351
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1350
1352
|
:param float [params.triggerPrice]: the price at which a trigger order would be triggered
|
1353
|
+
:param str [params.clientOrderId]: a unique id for the order
|
1351
1354
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1352
1355
|
"""
|
1353
1356
|
omsId = self.safe_integer(self.options, 'omsId', 1)
|
@@ -1578,6 +1581,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1578
1581
|
:param str id: order id
|
1579
1582
|
:param str symbol: unified symbol of the market the order was made in
|
1580
1583
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1584
|
+
:param str [params.clientOrderId]: a unique id for the order
|
1581
1585
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1582
1586
|
"""
|
1583
1587
|
omsId = self.safe_integer(self.options, 'omsId', 1)
|
ccxt/async_support/okx.py
CHANGED
@@ -1225,7 +1225,6 @@ class okx(Exchange, ImplicitAPI):
|
|
1225
1225
|
'limitPrice': True,
|
1226
1226
|
},
|
1227
1227
|
'timeInForce': {
|
1228
|
-
'GTC': True,
|
1229
1228
|
'IOC': True,
|
1230
1229
|
'FOK': True,
|
1231
1230
|
'PO': True,
|
@@ -2244,6 +2243,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2244
2243
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
2245
2244
|
:param int [limit]: the maximum amount of trades to fetch
|
2246
2245
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2246
|
+
:param str [params.method]: 'publicGetMarketTrades' or 'publicGetMarketHistoryTrades' default is 'publicGetMarketTrades'
|
2247
2247
|
:param boolean [params.paginate]: *only applies to publicGetMarketHistoryTrades* default False, when True will automatically paginate by calling self endpoint multiple times
|
2248
2248
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
2249
2249
|
"""
|
ccxt/async_support/probit.py
CHANGED
@@ -287,6 +287,8 @@ class probit(Exchange, ImplicitAPI):
|
|
287
287
|
base = self.safe_currency_code(baseId)
|
288
288
|
quote = self.safe_currency_code(quoteId)
|
289
289
|
closed = self.safe_bool(market, 'closed', False)
|
290
|
+
showInUI = self.safe_bool(market, 'show_in_ui', True)
|
291
|
+
active = not closed and showInUI
|
290
292
|
takerFeeRate = self.safe_string(market, 'taker_fee_rate')
|
291
293
|
taker = Precise.string_div(takerFeeRate, '100')
|
292
294
|
makerFeeRate = self.safe_string(market, 'maker_fee_rate')
|
@@ -306,7 +308,7 @@ class probit(Exchange, ImplicitAPI):
|
|
306
308
|
'swap': False,
|
307
309
|
'future': False,
|
308
310
|
'option': False,
|
309
|
-
'active':
|
311
|
+
'active': active,
|
310
312
|
'contract': False,
|
311
313
|
'linear': None,
|
312
314
|
'inverse': None,
|
ccxt/async_support/woo.py
CHANGED
@@ -45,7 +45,7 @@ class woo(Exchange, ImplicitAPI):
|
|
45
45
|
'cancelAllOrders': True,
|
46
46
|
'cancelAllOrdersAfter': True,
|
47
47
|
'cancelOrder': True,
|
48
|
-
'cancelWithdraw': False, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://
|
48
|
+
'cancelWithdraw': False, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://docx.woo.io/wootrade-documents/#cancel-withdraw-request
|
49
49
|
'closeAllPositions': False,
|
50
50
|
'closePosition': False,
|
51
51
|
'createConvertTrade': True,
|
@@ -124,7 +124,7 @@ class woo(Exchange, ImplicitAPI):
|
|
124
124
|
'setMargin': False,
|
125
125
|
'setPositionMode': True,
|
126
126
|
'transfer': True,
|
127
|
-
'withdraw': True, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://
|
127
|
+
'withdraw': True, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://docx.woo.io/wootrade-documents/#token-withdraw
|
128
128
|
},
|
129
129
|
'timeframes': {
|
130
130
|
'1m': '1m',
|
@@ -168,7 +168,7 @@ class woo(Exchange, ImplicitAPI):
|
|
168
168
|
'pub': {
|
169
169
|
'get': {
|
170
170
|
'hist/kline': 10,
|
171
|
-
'hist/trades':
|
171
|
+
'hist/trades': 10,
|
172
172
|
},
|
173
173
|
},
|
174
174
|
'public': {
|
@@ -218,11 +218,11 @@ class woo(Exchange, ImplicitAPI):
|
|
218
218
|
'client/futures_leverage': 60,
|
219
219
|
},
|
220
220
|
'post': {
|
221
|
-
'order':
|
221
|
+
'order': 1, # 10 requests per 1 second per symbol
|
222
222
|
'order/cancel_all_after': 1,
|
223
223
|
'asset/main_sub_transfer': 30, # 20 requests per 60 seconds
|
224
224
|
'asset/ltv': 30,
|
225
|
-
'asset/withdraw': 30, # implemented in ccxt, disabled on the exchange side https://
|
225
|
+
'asset/withdraw': 30, # implemented in ccxt, disabled on the exchange side https://docx.woo.io/wootrade-documents/#token-withdraw
|
226
226
|
'asset/internal_withdraw': 30,
|
227
227
|
'interest/repay': 60,
|
228
228
|
'client/account_mode': 120,
|
@@ -235,7 +235,7 @@ class woo(Exchange, ImplicitAPI):
|
|
235
235
|
'order': 1,
|
236
236
|
'client/order': 1,
|
237
237
|
'orders': 1,
|
238
|
-
'asset/withdraw': 120, # implemented in ccxt, disabled on the exchange side https://
|
238
|
+
'asset/withdraw': 120, # implemented in ccxt, disabled on the exchange side https://docx.woo.io/wootrade-documents/#cancel-withdraw-request
|
239
239
|
},
|
240
240
|
},
|
241
241
|
},
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.39'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -2791,6 +2791,9 @@ class Exchange(object):
|
|
2791
2791
|
|
2792
2792
|
def features_mapper(self, initialFeatures: Any, marketType: Str, subType: Str = None):
|
2793
2793
|
featuresObj = initialFeatures[marketType][subType] if (subType is not None) else initialFeatures[marketType]
|
2794
|
+
# if exchange does not have that market-type(eg. future>inverse)
|
2795
|
+
if featuresObj is None:
|
2796
|
+
return None
|
2794
2797
|
extendsStr: Str = self.safe_string(featuresObj, 'extends')
|
2795
2798
|
if extendsStr is not None:
|
2796
2799
|
featuresObj = self.omit(featuresObj, 'extends')
|
@@ -2810,7 +2813,7 @@ class Exchange(object):
|
|
2810
2813
|
# default 'GTC' to True
|
2811
2814
|
gtcValue = self.safe_bool(featuresObj['createOrder']['timeInForce'], 'gtc')
|
2812
2815
|
if gtcValue is None:
|
2813
|
-
featuresObj['createOrder']['timeInForce']['
|
2816
|
+
featuresObj['createOrder']['timeInForce']['GTC'] = True
|
2814
2817
|
return featuresObj
|
2815
2818
|
|
2816
2819
|
def orderbook_checksum_message(self, symbol: Str):
|
@@ -6534,29 +6537,39 @@ class Exchange(object):
|
|
6534
6537
|
symbolAndTimeFrame = symbolsAndTimeFrames[i]
|
6535
6538
|
symbol = self.safe_string(symbolAndTimeFrame, 0)
|
6536
6539
|
timeframe = self.safe_string(symbolAndTimeFrame, 1)
|
6537
|
-
if
|
6538
|
-
|
6540
|
+
if symbol in self.ohlcvs:
|
6541
|
+
if timeframe in self.ohlcvs[symbol]:
|
6542
|
+
del self.ohlcvs[symbol][timeframe]
|
6539
6543
|
elif symbolsLength > 0:
|
6540
6544
|
for i in range(0, len(symbols)):
|
6541
6545
|
symbol = symbols[i]
|
6542
6546
|
if topic == 'trades':
|
6543
|
-
|
6547
|
+
if symbol in self.trades:
|
6548
|
+
del self.trades[symbol]
|
6544
6549
|
elif topic == 'orderbook':
|
6545
|
-
|
6550
|
+
if symbol in self.orderbooks:
|
6551
|
+
del self.orderbooks[symbol]
|
6546
6552
|
elif topic == 'ticker':
|
6547
|
-
|
6553
|
+
if symbol in self.tickers:
|
6554
|
+
del self.tickers[symbol]
|
6548
6555
|
else:
|
6549
6556
|
if topic == 'myTrades':
|
6550
6557
|
# don't reset self.myTrades directly here
|
6551
|
-
# because in c# we need to use a different object
|
6558
|
+
# because in c# we need to use a different object(thread-safe dict)
|
6552
6559
|
keys = list(self.myTrades.keys())
|
6553
6560
|
for i in range(0, len(keys)):
|
6554
|
-
|
6561
|
+
key = keys[i]
|
6562
|
+
if key in self.myTrades:
|
6563
|
+
del self.myTrades[key]
|
6555
6564
|
elif topic == 'orders':
|
6556
6565
|
orderSymbols = list(self.orders.keys())
|
6557
6566
|
for i in range(0, len(orderSymbols)):
|
6558
|
-
|
6567
|
+
orderSymbol = orderSymbols[i]
|
6568
|
+
if orderSymbol in self.orders:
|
6569
|
+
del self.orders[orderSymbol]
|
6559
6570
|
elif topic == 'ticker':
|
6560
6571
|
tickerSymbols = list(self.tickers.keys())
|
6561
6572
|
for i in range(0, len(tickerSymbols)):
|
6562
|
-
|
6573
|
+
tickerSymbol = tickerSymbols[i]
|
6574
|
+
if tickerSymbol in self.tickers:
|
6575
|
+
del self.tickers[tickerSymbol]
|
ccxt/binance.py
CHANGED
@@ -1591,7 +1591,6 @@ class binance(Exchange, ImplicitAPI):
|
|
1591
1591
|
'takeProfitPrice': True,
|
1592
1592
|
'attachedStopLossTakeProfit': None, # not supported
|
1593
1593
|
'timeInForce': {
|
1594
|
-
'GTC': True,
|
1595
1594
|
'IOC': True,
|
1596
1595
|
'FOK': True,
|
1597
1596
|
'PO': True,
|
@@ -1658,7 +1657,6 @@ class binance(Exchange, ImplicitAPI):
|
|
1658
1657
|
'takeProfitPrice': True,
|
1659
1658
|
'attachedStopLossTakeProfit': None, # not supported
|
1660
1659
|
'timeInForce': {
|
1661
|
-
'GTC': True,
|
1662
1660
|
'IOC': True,
|
1663
1661
|
'FOK': True,
|
1664
1662
|
'PO': True,
|
ccxt/bingx.py
CHANGED
@@ -95,7 +95,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
95
95
|
'fetchPositionHistory': False,
|
96
96
|
'fetchPositionMode': True,
|
97
97
|
'fetchPositions': True,
|
98
|
-
'fetchPositionsHistory':
|
98
|
+
'fetchPositionsHistory': True,
|
99
99
|
'fetchTicker': True,
|
100
100
|
'fetchTickers': True,
|
101
101
|
'fetchTime': True,
|
@@ -219,7 +219,6 @@ class bingx(Exchange, ImplicitAPI):
|
|
219
219
|
'private': {
|
220
220
|
'get': {
|
221
221
|
'positionSide/dual': 5,
|
222
|
-
'market/markPriceKlines': 1,
|
223
222
|
'trade/batchCancelReplace': 5,
|
224
223
|
'trade/fullOrder': 2,
|
225
224
|
'maintMarginRatio': 2,
|
@@ -553,7 +552,6 @@ class bingx(Exchange, ImplicitAPI):
|
|
553
552
|
'limitPrice': True,
|
554
553
|
},
|
555
554
|
'timeInForce': {
|
556
|
-
'GTC': True,
|
557
555
|
'IOC': True,
|
558
556
|
'FOK': True,
|
559
557
|
'PO': True,
|
@@ -1015,7 +1013,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1015
1013
|
https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
|
1016
1014
|
https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
1017
1015
|
https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
1018
|
-
https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#
|
1016
|
+
https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data
|
1019
1017
|
https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
|
1020
1018
|
|
1021
1019
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
@@ -1055,7 +1053,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1055
1053
|
price = self.safe_string(params, 'price')
|
1056
1054
|
params = self.omit(params, 'price')
|
1057
1055
|
if price == 'mark':
|
1058
|
-
response = self.
|
1056
|
+
response = self.swapV1PublicGetMarketMarkPriceKlines(self.extend(request, params))
|
1059
1057
|
else:
|
1060
1058
|
response = self.swapV3PublicGetQuoteKlines(self.extend(request, params))
|
1061
1059
|
#
|
@@ -2264,6 +2262,67 @@ class bingx(Exchange, ImplicitAPI):
|
|
2264
2262
|
result[code] = account
|
2265
2263
|
return self.safe_balance(result)
|
2266
2264
|
|
2265
|
+
def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
2266
|
+
"""
|
2267
|
+
fetches historical positions
|
2268
|
+
|
2269
|
+
https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History
|
2270
|
+
|
2271
|
+
:param str symbol: unified contract symbol
|
2272
|
+
:param int [since]: the earliest time in ms to fetch positions for
|
2273
|
+
:param int [limit]: the maximum amount of records to fetch
|
2274
|
+
:param dict [params]: extra parameters specific to the exchange api endpoint
|
2275
|
+
:param int [params.until]: the latest time in ms to fetch positions for
|
2276
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
2277
|
+
"""
|
2278
|
+
self.load_markets()
|
2279
|
+
market = self.market(symbol)
|
2280
|
+
request: dict = {
|
2281
|
+
'symbol': market['id'],
|
2282
|
+
}
|
2283
|
+
if limit is not None:
|
2284
|
+
request['pageSize'] = limit
|
2285
|
+
if since is not None:
|
2286
|
+
request['startTs'] = since
|
2287
|
+
request, params = self.handle_until_option('endTs', request, params)
|
2288
|
+
response = None
|
2289
|
+
if market['linear']:
|
2290
|
+
response = self.swapV1PrivateGetTradePositionHistory(self.extend(request, params))
|
2291
|
+
else:
|
2292
|
+
raise NotSupported(self.id + ' fetchPositionHistory() is not supported for inverse swap positions')
|
2293
|
+
#
|
2294
|
+
# {
|
2295
|
+
# "code": 0,
|
2296
|
+
# "msg": "",
|
2297
|
+
# "data": {
|
2298
|
+
# "positionHistory": [
|
2299
|
+
# {
|
2300
|
+
# "positionId": "1861675561156571136",
|
2301
|
+
# "symbol": "LTC-USDT",
|
2302
|
+
# "isolated": False,
|
2303
|
+
# "positionSide": "LONG",
|
2304
|
+
# "openTime": 1732693017000,
|
2305
|
+
# "updateTime": 1733310292000,
|
2306
|
+
# "avgPrice": "95.18",
|
2307
|
+
# "avgClosePrice": "129.48",
|
2308
|
+
# "realisedProfit": "102.89",
|
2309
|
+
# "netProfit": "99.63",
|
2310
|
+
# "positionAmt": "30.0",
|
2311
|
+
# "closePositionAmt": "30.0",
|
2312
|
+
# "leverage": 6,
|
2313
|
+
# "closeAllPositions": True,
|
2314
|
+
# "positionCommission": "-0.33699650000000003",
|
2315
|
+
# "totalFunding": "-2.921461693902908"
|
2316
|
+
# },
|
2317
|
+
# ]
|
2318
|
+
# }
|
2319
|
+
# }
|
2320
|
+
#
|
2321
|
+
data = self.safe_dict(response, 'data', {})
|
2322
|
+
records = self.safe_list(data, 'positionHistory', [])
|
2323
|
+
positions = self.parse_positions(records)
|
2324
|
+
return self.filter_by_symbol_since_limit(positions, symbol, since, limit)
|
2325
|
+
|
2267
2326
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
2268
2327
|
"""
|
2269
2328
|
fetch all open positions
|
@@ -2503,12 +2562,34 @@ class bingx(Exchange, ImplicitAPI):
|
|
2503
2562
|
# "positionAmt": "1.20365912",
|
2504
2563
|
# }
|
2505
2564
|
#
|
2565
|
+
# linear swap fetchPositionHistory
|
2566
|
+
#
|
2567
|
+
# {
|
2568
|
+
# "positionId": "1861675561156571136",
|
2569
|
+
# "symbol": "LTC-USDT",
|
2570
|
+
# "isolated": False,
|
2571
|
+
# "positionSide": "LONG",
|
2572
|
+
# "openTime": 1732693017000,
|
2573
|
+
# "updateTime": 1733310292000,
|
2574
|
+
# "avgPrice": "95.18",
|
2575
|
+
# "avgClosePrice": "129.48",
|
2576
|
+
# "realisedProfit": "102.89",
|
2577
|
+
# "netProfit": "99.63",
|
2578
|
+
# "positionAmt": "30.0",
|
2579
|
+
# "closePositionAmt": "30.0",
|
2580
|
+
# "leverage": 6,
|
2581
|
+
# "closeAllPositions": True,
|
2582
|
+
# "positionCommission": "-0.33699650000000003",
|
2583
|
+
# "totalFunding": "-2.921461693902908"
|
2584
|
+
# }
|
2585
|
+
#
|
2506
2586
|
marketId = self.safe_string(position, 'symbol', '')
|
2507
2587
|
marketId = marketId.replace('/', '-') # standard return different format
|
2508
2588
|
isolated = self.safe_bool(position, 'isolated')
|
2509
2589
|
marginMode = None
|
2510
2590
|
if isolated is not None:
|
2511
2591
|
marginMode = 'isolated' if isolated else 'cross'
|
2592
|
+
timestamp = self.safe_integer(position, 'openTime')
|
2512
2593
|
return self.safe_position({
|
2513
2594
|
'info': position,
|
2514
2595
|
'id': self.safe_string(position, 'positionId'),
|
@@ -2526,8 +2607,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
2526
2607
|
'lastPrice': None,
|
2527
2608
|
'side': self.safe_string_lower(position, 'positionSide'),
|
2528
2609
|
'hedged': None,
|
2529
|
-
'timestamp':
|
2530
|
-
'datetime':
|
2610
|
+
'timestamp': timestamp,
|
2611
|
+
'datetime': self.iso8601(timestamp),
|
2531
2612
|
'lastUpdateTimestamp': self.safe_integer(position, 'updateTime'),
|
2532
2613
|
'maintenanceMargin': None,
|
2533
2614
|
'maintenanceMarginPercentage': None,
|
@@ -6088,7 +6169,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
6088
6169
|
body = self.json(parsedParams)
|
6089
6170
|
else:
|
6090
6171
|
query = self.urlencode(parsedParams)
|
6091
|
-
url += '?' + query + '&signature=' + signature
|
6172
|
+
url += '?' + query + '&' + 'signature=' + signature
|
6092
6173
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
6093
6174
|
|
6094
6175
|
def nonce(self):
|
ccxt/bitget.py
CHANGED
@@ -1473,8 +1473,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
1473
1473
|
'index': False, # not on spot
|
1474
1474
|
},
|
1475
1475
|
'triggerDirection': False,
|
1476
|
-
'stopLossPrice': True, #
|
1477
|
-
'takeProfitPrice': True, #
|
1476
|
+
'stopLossPrice': True, # todo: not yet implemented in spot
|
1477
|
+
'takeProfitPrice': True, # todo: not yet implemented in spot
|
1478
1478
|
'attachedStopLossTakeProfit': {
|
1479
1479
|
'triggerPriceType': {
|
1480
1480
|
'last': False,
|
@@ -1484,7 +1484,6 @@ class bitget(Exchange, ImplicitAPI):
|
|
1484
1484
|
'limitPrice': True,
|
1485
1485
|
},
|
1486
1486
|
'timeInForce': {
|
1487
|
-
'GTC': True,
|
1488
1487
|
'IOC': True,
|
1489
1488
|
'FOK': True,
|
1490
1489
|
'PO': True,
|
@@ -1555,7 +1554,6 @@ class bitget(Exchange, ImplicitAPI):
|
|
1555
1554
|
'limitPrice': False,
|
1556
1555
|
},
|
1557
1556
|
'timeInForce': {
|
1558
|
-
'GTC': True,
|
1559
1557
|
'IOC': True,
|
1560
1558
|
'FOK': True,
|
1561
1559
|
'PO': True,
|
ccxt/bithumb.py
CHANGED
@@ -1027,7 +1027,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
1027
1027
|
'address': address,
|
1028
1028
|
'currency': currency['id'],
|
1029
1029
|
}
|
1030
|
-
if code == 'XRP' or code == 'XMR' or code == 'EOS' or code == 'STEEM':
|
1030
|
+
if code == 'XRP' or code == 'XMR' or code == 'EOS' or code == 'STEEM' or code == 'TON':
|
1031
1031
|
destination = self.safe_string(params, 'destination')
|
1032
1032
|
if (tag is None) and (destination is None):
|
1033
1033
|
raise ArgumentsRequired(self.id + ' ' + code + ' withdraw() requires a tag argument or an extra destination param')
|