ccxt 3.1.21__py2.py3-none-any.whl → 3.1.24__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 CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '3.1.21'
25
+ __version__ = '3.1.24'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/bitstamp.py CHANGED
@@ -4,16 +4,22 @@ from ccxt.base.types import Entry
4
4
  class ImplicitAPI:
5
5
  public_get_ohlc_pair = publicGetOhlcPair = Entry('ohlc/{pair}/', 'public', 'GET', {'cost': 1})
6
6
  public_get_order_book_pair = publicGetOrderBookPair = Entry('order_book/{pair}/', 'public', 'GET', {'cost': 1})
7
+ public_get_ticker = publicGetTicker = Entry('ticker/', 'public', 'GET', {'cost': 1})
7
8
  public_get_ticker_hour_pair = publicGetTickerHourPair = Entry('ticker_hour/{pair}/', 'public', 'GET', {'cost': 1})
8
9
  public_get_ticker_pair = publicGetTickerPair = Entry('ticker/{pair}/', 'public', 'GET', {'cost': 1})
9
10
  public_get_transactions_pair = publicGetTransactionsPair = Entry('transactions/{pair}/', 'public', 'GET', {'cost': 1})
10
11
  public_get_trading_pairs_info = publicGetTradingPairsInfo = Entry('trading-pairs-info/', 'public', 'GET', {'cost': 1})
12
+ public_get_currencies = publicGetCurrencies = Entry('currencies/', 'public', 'GET', {'cost': 1})
13
+ public_get_eur_usd = publicGetEurUsd = Entry('eur_usd/', 'public', 'GET', {'cost': 1})
14
+ private_post_account_balances = privatePostAccountBalances = Entry('account_balances/', 'private', 'POST', {'cost': 1})
15
+ private_post_account_balances_currency = privatePostAccountBalancesCurrency = Entry('account_balances/{currency}/', 'private', 'POST', {'cost': 1})
11
16
  private_post_balance = privatePostBalance = Entry('balance/', 'private', 'POST', {'cost': 1})
12
17
  private_post_balance_pair = privatePostBalancePair = Entry('balance/{pair}/', 'private', 'POST', {'cost': 1})
13
18
  private_post_bch_withdrawal = privatePostBchWithdrawal = Entry('bch_withdrawal/', 'private', 'POST', {'cost': 1})
14
19
  private_post_bch_address = privatePostBchAddress = Entry('bch_address/', 'private', 'POST', {'cost': 1})
15
20
  private_post_user_transactions = privatePostUserTransactions = Entry('user_transactions/', 'private', 'POST', {'cost': 1})
16
21
  private_post_user_transactions_pair = privatePostUserTransactionsPair = Entry('user_transactions/{pair}/', 'private', 'POST', {'cost': 1})
22
+ private_post_crypto_transactions = privatePostCryptoTransactions = Entry('crypto-transactions/', 'private', 'POST', {'cost': 1})
17
23
  private_post_open_orders_all = privatePostOpenOrdersAll = Entry('open_orders/all/', 'private', 'POST', {'cost': 1})
18
24
  private_post_open_orders_pair = privatePostOpenOrdersPair = Entry('open_orders/{pair}/', 'private', 'POST', {'cost': 1})
19
25
  private_post_order_status = privatePostOrderStatus = Entry('order_status/', 'private', 'POST', {'cost': 1})
@@ -28,6 +34,10 @@ class ImplicitAPI:
28
34
  private_post_sell_instant_pair = privatePostSellInstantPair = Entry('sell/instant/{pair}/', 'private', 'POST', {'cost': 1})
29
35
  private_post_transfer_to_main = privatePostTransferToMain = Entry('transfer-to-main/', 'private', 'POST', {'cost': 1})
30
36
  private_post_transfer_from_main = privatePostTransferFromMain = Entry('transfer-from-main/', 'private', 'POST', {'cost': 1})
37
+ private_post_my_trading_pairs = privatePostMyTradingPairs = Entry('my_trading_pairs/', 'private', 'POST', {'cost': 1})
38
+ private_post_fees_trading = privatePostFeesTrading = Entry('fees/trading/', 'private', 'POST', {'cost': 1})
39
+ private_post_fees_withdrawal = privatePostFeesWithdrawal = Entry('fees/withdrawal/', 'private', 'POST', {'cost': 1})
40
+ private_post_fees_withdrawal_currency = privatePostFeesWithdrawalCurrency = Entry('fees/withdrawal/{currency}/', 'private', 'POST', {'cost': 1})
31
41
  private_post_withdrawal_requests = privatePostWithdrawalRequests = Entry('withdrawal-requests/', 'private', 'POST', {'cost': 1})
32
42
  private_post_withdrawal_open = privatePostWithdrawalOpen = Entry('withdrawal/open/', 'private', 'POST', {'cost': 1})
33
43
  private_post_withdrawal_status = privatePostWithdrawalStatus = Entry('withdrawal/status/', 'private', 'POST', {'cost': 1})
ccxt/abstract/bybit.py CHANGED
@@ -244,6 +244,7 @@ class ImplicitAPI:
244
244
  private_get_v5_asset_transfer_query_account_coins_balance = privateGetV5AssetTransferQueryAccountCoinsBalance = Entry('v5/asset/transfer/query-account-coins-balance', 'private', 'GET', {'cost': 2.5})
245
245
  private_get_v5_user_query_sub_members = privateGetV5UserQuerySubMembers = Entry('v5/user/query-sub-members', 'private', 'GET', {'cost': 10})
246
246
  private_get_v5_user_query_api = privateGetV5UserQueryApi = Entry('v5/user/query-api', 'private', 'GET', {'cost': 10})
247
+ private_get_v5_customer_info = privateGetV5CustomerInfo = Entry('v5/customer/info', 'private', 'GET', {'cost': 10})
247
248
  private_get_v5_spot_cross_margin_trade_loan_info = privateGetV5SpotCrossMarginTradeLoanInfo = Entry('v5/spot-cross-margin-trade/loan-info', 'private', 'GET', {'cost': 1})
248
249
  private_get_v5_spot_cross_margin_trade_account = privateGetV5SpotCrossMarginTradeAccount = Entry('v5/spot-cross-margin-trade/account', 'private', 'GET', {'cost': 1})
249
250
  private_get_v5_spot_cross_margin_trade_orders = privateGetV5SpotCrossMarginTradeOrders = Entry('v5/spot-cross-margin-trade/orders', 'private', 'GET', {'cost': 1})
@@ -55,6 +55,7 @@ class ImplicitAPI:
55
55
  private_get_v2_tradingpositionshistory = privateGetV2TradingPositionsHistory = Entry('v2/tradingPositionsHistory', 'private', 'GET', {'cost': 1})
56
56
  private_get_v2_transactions = privateGetV2Transactions = Entry('v2/transactions', 'private', 'GET', {'cost': 1})
57
57
  private_get_v2_withdrawals = privateGetV2Withdrawals = Entry('v2/withdrawals', 'private', 'GET', {'cost': 1})
58
+ private_get_v2_fetchorder = privateGetV2FetchOrder = Entry('v2/fetchOrder', 'private', 'GET', {'cost': 1})
58
59
  private_post_v1_order = privatePostV1Order = Entry('v1/order', 'private', 'POST', {'cost': 1})
59
60
  private_post_v1_updatetradingposition = privatePostV1UpdateTradingPosition = Entry('v1/updateTradingPosition', 'private', 'POST', {'cost': 1})
60
61
  private_post_v1_updatetradingorder = privatePostV1UpdateTradingOrder = Entry('v1/updateTradingOrder', 'private', 'POST', {'cost': 1})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '3.1.21'
7
+ __version__ = '3.1.24'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '3.1.21'
5
+ __version__ = '3.1.24'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1250,21 +1250,10 @@ class Exchange(BaseExchange):
1250
1250
  })
1251
1251
 
1252
1252
  async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Optional[int] = None, limit: Optional[int] = None, params={}):
1253
- if not self.has['fetchTrades']:
1254
- raise NotSupported(self.id + ' fetchOHLCV() is not supported yet')
1255
- trades = await self.fetchTrades(symbol, since, limit, params)
1256
- ohlcvc = self.build_ohlcvc(trades, timeframe, since, limit)
1257
- result = []
1258
- for i in range(0, len(ohlcvc)):
1259
- result.append([
1260
- self.safe_integer(ohlcvc[i], 0),
1261
- self.safe_number(ohlcvc[i], 1),
1262
- self.safe_number(ohlcvc[i], 2),
1263
- self.safe_number(ohlcvc[i], 3),
1264
- self.safe_number(ohlcvc[i], 4),
1265
- self.safe_number(ohlcvc[i], 5),
1266
- ])
1267
- return result
1253
+ message = ''
1254
+ if self.has['fetchTrades']:
1255
+ message = '. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" file'
1256
+ raise NotSupported(self.id + ' fetchOHLCV() is not supported yet' + message)
1268
1257
 
1269
1258
  async def watch_ohlcv(self, symbol: str, timeframe='1m', since: Optional[int] = None, limit: Optional[int] = None, params={}):
1270
1259
  raise NotSupported(self.id + ' watchOHLCV() is not supported yet')
@@ -1731,13 +1720,6 @@ class Exchange(BaseExchange):
1731
1720
  ohlcvs[candle][i_count] = self.sum(ohlcvs[candle][i_count], 1)
1732
1721
  return ohlcvs
1733
1722
 
1734
- async def fetch_ohlcvc(self, symbol, timeframe='1m', since: Optional[Any] = None, limit: Optional[int] = None, params={}):
1735
- if not self.has['fetchTrades']:
1736
- raise NotSupported(self.id + ' fetchOHLCV() is not supported yet')
1737
- await self.load_markets()
1738
- trades = await self.fetchTrades(symbol, since, limit, params)
1739
- return self.build_ohlcvc(trades, timeframe, since, limit)
1740
-
1741
1723
  def parse_trading_view_ohlcv(self, ohlcvs, market=None, timeframe='1m', since: Optional[int] = None, limit: Optional[int] = None):
1742
1724
  result = self.convert_trading_view_to_ohlcv(ohlcvs)
1743
1725
  return self.parse_ohlcvs(result, market, timeframe, since, limit)
@@ -2361,19 +2361,22 @@ class bitget(Exchange, ImplicitAPI):
2361
2361
  #
2362
2362
  # spot
2363
2363
  # {
2364
- # accountId: '6394957606',
2365
- # symbol: 'BTCUSDT_SPBL',
2366
- # orderId: '881623995442958336',
2367
- # clientOrderId: '135335e9-b054-4e43-b00a-499f11d3a5cc',
2368
- # price: '39000.000000000000',
2369
- # quantity: '0.000700000000',
2370
- # orderType: 'limit',
2371
- # side: 'buy',
2372
- # status: 'new',
2373
- # fillPrice: '0.000000000000',
2374
- # fillQuantity: '0.000000000000',
2375
- # fillTotalAmount: '0.000000000000',
2376
- # cTime: '1645921460972'
2364
+ # "accountId": "222222222",
2365
+ # "symbol": "TRXUSDT_SPBL",
2366
+ # "orderId": "1041901704004947968",
2367
+ # "clientOrderId": "c5e8a5e1-a07f-4202-8061-b88bd598b264",
2368
+ # "price": "0",
2369
+ # "quantity": "10.0000000000000000",
2370
+ # "orderType": "market",
2371
+ # "side": "buy",
2372
+ # "status": "full_fill",
2373
+ # "fillPrice": "0.0699782527055350",
2374
+ # "fillQuantity": "142.9015000000000000",
2375
+ # "fillTotalAmount": "9.9999972790000000",
2376
+ # "enterPointSource": "API",
2377
+ # "feeDetail": "{\"BGB\":{\"deduction\":true,\"feeCoinCode\":\"BGB\",\"totalDeductionFee\":-0.017118519726,\"totalFee\":-0.017118519726}}",
2378
+ # "orderSource": "market",
2379
+ # "cTime": "1684134644509"
2377
2380
  # }
2378
2381
  #
2379
2382
  # swap
@@ -2435,6 +2438,22 @@ class bitget(Exchange, ImplicitAPI):
2435
2438
  side = 'sell'
2436
2439
  clientOrderId = self.safe_string_2(order, 'clientOrderId', 'clientOid')
2437
2440
  fee = None
2441
+ feeCostString = self.safe_string(order, 'fee')
2442
+ if feeCostString is not None:
2443
+ # swap
2444
+ fee = {
2445
+ 'cost': feeCostString,
2446
+ 'currency': market['settle'],
2447
+ }
2448
+ feeDetail = self.safe_value(order, 'feeDetail')
2449
+ if feeDetail is not None:
2450
+ parsedFeeDetail = json.loads(feeDetail)
2451
+ feeValues = list(parsedFeeDetail.values())
2452
+ first = self.safe_value(feeValues, 0)
2453
+ fee = {
2454
+ 'cost': self.safe_string(first, 'totalFee'),
2455
+ 'currency': self.safe_currency_code(self.safe_string(first, 'feeCoinCode')),
2456
+ }
2438
2457
  rawStatus = self.safe_string_2(order, 'status', 'state')
2439
2458
  status = self.parse_order_status(rawStatus)
2440
2459
  lastTradeTimestamp = self.safe_integer(order, 'uTime')
@@ -3308,7 +3327,10 @@ class bitget(Exchange, ImplicitAPI):
3308
3327
  # }
3309
3328
  #
3310
3329
  data = self.safe_value(response, 'data')
3311
- return self.safe_value(data, 'orderList', [])
3330
+ if data is not None:
3331
+ return self.safe_value_2(data, 'orderList', 'data', [])
3332
+ parsedData = json.loads(response)
3333
+ return self.safe_value(parsedData, 'data', [])
3312
3334
 
3313
3335
  async def fetch_ledger(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
3314
3336
  """
@@ -127,20 +127,26 @@ class bitstamp(Exchange, ImplicitAPI):
127
127
  'get': {
128
128
  'ohlc/{pair}/': 1,
129
129
  'order_book/{pair}/': 1,
130
+ 'ticker/': 1,
130
131
  'ticker_hour/{pair}/': 1,
131
132
  'ticker/{pair}/': 1,
132
133
  'transactions/{pair}/': 1,
133
134
  'trading-pairs-info/': 1,
135
+ 'currencies/': 1,
136
+ 'eur_usd/': 1,
134
137
  },
135
138
  },
136
139
  'private': {
137
140
  'post': {
141
+ 'account_balances/': 1,
142
+ 'account_balances/{currency}/': 1,
138
143
  'balance/': 1,
139
144
  'balance/{pair}/': 1,
140
145
  'bch_withdrawal/': 1,
141
146
  'bch_address/': 1,
142
147
  'user_transactions/': 1,
143
148
  'user_transactions/{pair}/': 1,
149
+ 'crypto-transactions/': 1,
144
150
  'open_orders/all/': 1,
145
151
  'open_orders/{pair}/': 1,
146
152
  'order_status/': 1,
@@ -155,6 +161,10 @@ class bitstamp(Exchange, ImplicitAPI):
155
161
  'sell/instant/{pair}/': 1,
156
162
  'transfer-to-main/': 1,
157
163
  'transfer-from-main/': 1,
164
+ 'my_trading_pairs/': 1,
165
+ 'fees/trading/': 1,
166
+ 'fees/withdrawal/': 1,
167
+ 'fees/withdrawal/{currency}/': 1,
158
168
  'withdrawal-requests/': 1,
159
169
  'withdrawal/open/': 1,
160
170
  'withdrawal/status/': 1,
@@ -411,6 +411,7 @@ class bybit(Exchange, ImplicitAPI):
411
411
  # user
412
412
  'v5/user/query-sub-members': 10,
413
413
  'v5/user/query-api': 10,
414
+ 'v5/customer/info': 10,
414
415
  'v5/spot-cross-margin-trade/loan-info': 1, # 50/s => cost = 50 / 50 = 1
415
416
  'v5/spot-cross-margin-trade/account': 1, # 50/s => cost = 50 / 50 = 1
416
417
  'v5/spot-cross-margin-trade/orders': 1, # 50/s => cost = 50 / 50 = 1
@@ -88,7 +88,7 @@ class currencycom(Exchange, ImplicitAPI):
88
88
  'fetchOHLCV': True,
89
89
  'fetchOpenOrder': None,
90
90
  'fetchOpenOrders': True,
91
- 'fetchOrder': None,
91
+ 'fetchOrder': True,
92
92
  'fetchOrderBook': True,
93
93
  'fetchOrderBooks': None,
94
94
  'fetchOrders': None,
@@ -214,6 +214,7 @@ class currencycom(Exchange, ImplicitAPI):
214
214
  'v2/tradingPositionsHistory': 1,
215
215
  'v2/transactions': 1,
216
216
  'v2/withdrawals': 1,
217
+ 'v2/fetchOrder': 1,
217
218
  },
218
219
  'post': {
219
220
  'v1/order': 1,
@@ -269,6 +270,8 @@ class currencycom(Exchange, ImplicitAPI):
269
270
  'Only leverage symbol allowed here:': BadSymbol, # when you fetchLeverage for non-leverage symbols, like 'BTC/USDT' instead of 'BTC/USDT_LEVERAGE': {"code":"-1128","msg":"Only leverage symbol allowed here: BTC/USDT"}
270
271
  'market data service is not available': ExchangeNotAvailable, # {"code":"-1021","msg":"market data service is not available"}
271
272
  'your time is ahead of server': InvalidNonce, # {"code":"-1021","msg":"your time is ahead of server"}
273
+ 'Can not find account': BadRequest, # -1128
274
+ 'You mentioned an invalid value for the price parameter': BadRequest, # -1030
272
275
  },
273
276
  'exact': {
274
277
  '-1000': ExchangeNotAvailable, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
@@ -279,7 +282,7 @@ class currencycom(Exchange, ImplicitAPI):
279
282
  '-1100': InvalidOrder, # createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'
280
283
  '-1104': ExchangeError, # Not all sent parameters were read, read 8 parameters but was sent 9
281
284
  '-1025': AuthenticationError, # {"code":-1025,"msg":"Invalid API-key, IP, or permissions for action"}
282
- '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."} | {"code":"-1128","msg":"Combination of parameters invalid"} | {"code":"-1128","msg":"Invalid limit price"}
285
+ '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."} | {"code":"-1128","msg":"Combination of parameters invalid"} | {"code":"-1128","msg":"Invalid limit price"} | {"code":"-1128","msg":"Can not find account: null"}
283
286
  '-2010': ExchangeError, # generic error code for createOrder -> 'Account has insufficient balance for requested action.', {"code":-2010,"msg":"Rest API trading is not enabled."}, etc...
284
287
  '-2011': OrderNotFound, # cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'
285
288
  '-2013': OrderNotFound, # fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'
@@ -607,7 +610,7 @@ class currencycom(Exchange, ImplicitAPI):
607
610
  result = []
608
611
  for i in range(0, len(accounts)):
609
612
  account = accounts[i]
610
- accountId = self.safe_integer(account, 'accountId')
613
+ accountId = self.safe_string(account, 'accountId') # must be string, because the numeric value is far too big for integer, and causes bugs
611
614
  currencyId = self.safe_string(account, 'asset')
612
615
  currencyCode = self.safe_currency_code(currencyId)
613
616
  result.append({
@@ -1077,28 +1080,14 @@ class currencycom(Exchange, ImplicitAPI):
1077
1080
  # "orderId": "00000000-0000-0000-0000-000006eacaa0",
1078
1081
  # "transactTime": "1645281669295",
1079
1082
  # "price": "30000.00000000",
1080
- # "origQty": "0.0002",
1081
- # "executedQty": "0.0", # positive for BUY, negative for SELL
1082
- # "status": "NEW",
1083
+ # "origQty": "0.0002", # might not be present for "market" order
1084
+ # "executedQty": "0.0", # positive for BUY, negative for SELL. This property might not be present in Leverage markets
1085
+ # "margin": 0.1, # present in leverage markets
1086
+ # "status": "NEW", # NEW, FILLED, ...
1083
1087
  # "timeInForce": "GTC",
1084
- # "type": "LIMIT",
1088
+ # "type": "LIMIT", # LIMIT, MARKET
1085
1089
  # "side": "BUY",
1086
- # }
1087
- #
1088
- # market
1089
- #
1090
- # {
1091
- # "symbol": "DOGE/USD",
1092
- # "orderId": "00000000-0000-0000-0000-000006eab2ad",
1093
- # "transactTime": "1645283022252",
1094
- # "price": "0.14066000",
1095
- # "origQty": "40",
1096
- # "executedQty": "40.0", # positive for BUY, negative for SELL
1097
- # "status": "FILLED",
1098
- # "timeInForce": "FOK",
1099
- # "type": "MARKET",
1100
- # "side": "SELL",
1101
- # "fills": [
1090
+ # "fills": [ # self field might not be present if there were no fills
1102
1091
  # {
1103
1092
  # "price": "0.14094",
1104
1093
  # "qty": "40.0",
@@ -1108,6 +1097,32 @@ class currencycom(Exchange, ImplicitAPI):
1108
1097
  # ],
1109
1098
  # }
1110
1099
  #
1100
+ # fetchOrder(fetchOpenOrders is an array same structure, with some extra fields)
1101
+ #
1102
+ # {
1103
+ # "symbol": "BTC/USD_LEVERAGE",
1104
+ # "accountId": "123456789012345678",
1105
+ # "orderId": "00a01234-0123-54c4-0000-123451234567",
1106
+ # "price": "25779.35",
1107
+ # "status": "MODIFIED",
1108
+ # "type": "LIMIT",
1109
+ # "timeInForceType": "GTC",
1110
+ # "side": "BUY",
1111
+ # "guaranteedStopLoss": False,
1112
+ # "trailingStopLoss": False,
1113
+ # "margin": "0.05",
1114
+ # "takeProfit": "27020.00",
1115
+ # "stopLoss": "24500.35",
1116
+ # "fills": [], # might not be present
1117
+ # "timestamp": "1685958369623", # "time" in "fetchOpenOrders"
1118
+ # "expireTime": "1686167960000", # "expireTimestamp" in "fetchOpenOrders"
1119
+ # "quantity": "0.00040", # "origQty" in "fetchOpenOrders"
1120
+ # "executedQty": "0.0", # present in "fetchOpenOrders"
1121
+ # "updateTime": "1685958369542", # present in "fetchOpenOrders"
1122
+ # "leverage": True, # present in "fetchOpenOrders"
1123
+ # "working": True # present in "fetchOpenOrders"
1124
+ # }
1125
+ #
1111
1126
  # cancelOrder
1112
1127
  #
1113
1128
  # {
@@ -1122,36 +1137,18 @@ class currencycom(Exchange, ImplicitAPI):
1122
1137
  # "side": "BUY",
1123
1138
  # }
1124
1139
  #
1125
- # fetchOpenOrders
1126
- #
1127
- # {
1128
- # "symbol": "DOGE/USD",
1129
- # "orderId": "00000000-0000-0003-0000-000004bcc27a",
1130
- # "price": "0.13",
1131
- # "origQty": "39.0",
1132
- # "executedQty": "0.0",
1133
- # "status": "NEW",
1134
- # "timeInForce": "GTC",
1135
- # "type": "LIMIT",
1136
- # "side": "BUY",
1137
- # "time": "1645284216240",
1138
- # "updateTime": "1645284216240",
1139
- # "leverage": False, # whether it's swap or not
1140
- # "working": True,
1141
- # }
1142
- #
1143
1140
  marketId = self.safe_string(order, 'symbol')
1144
1141
  symbol = self.safe_symbol(marketId, market, '/')
1145
1142
  id = self.safe_string(order, 'orderId')
1146
1143
  price = self.safe_string(order, 'price')
1147
- amount = self.safe_string(order, 'origQty')
1144
+ amount = self.safe_string_2(order, 'origQty', 'quantity')
1148
1145
  filledRaw = self.safe_string(order, 'executedQty')
1149
1146
  filled = Precise.string_abs(filledRaw)
1150
1147
  status = self.parse_order_status(self.safe_string(order, 'status'))
1151
- timeInForce = self.parse_order_time_in_force(self.safe_string(order, 'timeInForce'))
1148
+ timeInForce = self.parse_order_time_in_force(self.safe_string_2(order, 'timeInForce', 'timeInForceType'))
1152
1149
  type = self.parse_order_type(self.safe_string(order, 'type'))
1153
1150
  side = self.parse_order_side(self.safe_string(order, 'side'))
1154
- timestamp = self.safe_integer_2(order, 'time', 'transactTime')
1151
+ timestamp = self.safe_integer_n(order, ['time', 'transactTime', 'timestamp'])
1155
1152
  fills = self.safe_value(order, 'fills')
1156
1153
  return self.safe_order({
1157
1154
  'info': order,
@@ -1179,6 +1176,8 @@ class currencycom(Exchange, ImplicitAPI):
1179
1176
  def parse_order_status(self, status):
1180
1177
  statuses = {
1181
1178
  'NEW': 'open',
1179
+ 'CREATED': 'open',
1180
+ 'MODIFIED': 'open',
1182
1181
  'PARTIALLY_FILLED': 'open',
1183
1182
  'FILLED': 'closed',
1184
1183
  'CANCELED': 'canceled',
@@ -1304,6 +1303,46 @@ class currencycom(Exchange, ImplicitAPI):
1304
1303
  #
1305
1304
  return self.parse_order(response, market)
1306
1305
 
1306
+ async def fetch_order(self, id: str, symbol: Optional[str] = None, params={}):
1307
+ """
1308
+ fetches information on an order made by the user
1309
+ see https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getOrderUsingGET
1310
+ :param str symbol: unified symbol of the market the order was made in
1311
+ :param dict params: extra parameters specific to the currencycom api endpoint
1312
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1313
+ """
1314
+ self.check_required_symbol('fetchOrder', symbol)
1315
+ await self.load_markets()
1316
+ market = self.market(symbol)
1317
+ request = {
1318
+ 'orderId': id,
1319
+ 'symbol': market['id'],
1320
+ }
1321
+ response = await self.privateGetV2FetchOrder(self.extend(request, params))
1322
+ #
1323
+ # {
1324
+ # "accountId": "109698017413125316",
1325
+ # "orderId": "2810f1c5-0079-54c4-0000-000080421601",
1326
+ # "quantity": "20.0",
1327
+ # "price": "0.06",
1328
+ # "timestamp": "1661157503788",
1329
+ # "status": "CREATED",
1330
+ # "type": "LIMIT",
1331
+ # "timeInForceType": "GTC",
1332
+ # "side": "BUY",
1333
+ # "margin": "0.1",
1334
+ # "fills": [ # might not be present
1335
+ # {
1336
+ # "price": "0.14094",
1337
+ # "qty": "40.0",
1338
+ # "commission": "0",
1339
+ # "commissionAsset": "dUSD"
1340
+ # }
1341
+ # ]
1342
+ # }
1343
+ #
1344
+ return self.parse_order(response)
1345
+
1307
1346
  async def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
1308
1347
  """
1309
1348
  fetch all unfilled currently open orders
@@ -198,6 +198,7 @@ class poloniex(Exchange, ImplicitAPI):
198
198
  'BDG': 'Badgercoin',
199
199
  'BTM': 'Bitmark',
200
200
  'CON': 'Coino',
201
+ 'ETHTRON': 'ETH',
201
202
  'GOLD': 'GoldEagles',
202
203
  'GPUC': 'GPU',
203
204
  'HOT': 'Hotcoin',
@@ -210,6 +211,7 @@ class poloniex(Exchange, ImplicitAPI):
210
211
  'STR': 'XLM',
211
212
  'SOC': 'SOCC',
212
213
  'TRADE': 'Unitrade',
214
+ 'TRXETH': 'TRX',
213
215
  'XAP': 'API Coin',
214
216
  # self is not documented in the API docs for Poloniex
215
217
  # https://github.com/ccxt/ccxt/issues/7084
@@ -220,6 +222,7 @@ class poloniex(Exchange, ImplicitAPI):
220
222
  # with a USDTTRON or a USDTETH currency id, respectfully
221
223
  # therefore we have map them back to the original code USDT
222
224
  # otherwise the returned withdrawals are filtered out
225
+ 'USDTBSC': 'USDT',
223
226
  'USDTTRON': 'USDT',
224
227
  'USDTETH': 'USDT',
225
228
  'UST': 'USTC',
@@ -234,6 +237,7 @@ class poloniex(Exchange, ImplicitAPI):
234
237
  'BSC': 'BEP20',
235
238
  'ETH': 'ERC20',
236
239
  'TRON': 'TRC20',
240
+ 'TRX': 'TRC20',
237
241
  },
238
242
  'limits': {
239
243
  'cost': {
@@ -643,7 +647,7 @@ class poloniex(Exchange, ImplicitAPI):
643
647
  :param dict params: extra parameters specific to the poloniex api endpoint
644
648
  :returns dict: an associative dictionary of currencies
645
649
  """
646
- response = await self.publicGetCurrencies(params)
650
+ response = await self.publicGetCurrencies(self.extend(params, {'includeMultiChainCurrencies': True}))
647
651
  #
648
652
  # [
649
653
  # {
@@ -659,6 +663,8 @@ class poloniex(Exchange, ImplicitAPI):
659
663
  # "delisted": False,
660
664
  # "tradingState": "NORMAL",
661
665
  # "walletState": "DISABLED",
666
+ # "walletDepositState": 'DISABLED',
667
+ # "walletWithdrawalState": 'DISABLED',
662
668
  # "parentChain": null,
663
669
  # "isMultiChain": False,
664
670
  # "isChildChain": False,
@@ -674,36 +680,91 @@ class poloniex(Exchange, ImplicitAPI):
674
680
  id = self.safe_value(ids, 0)
675
681
  currency = self.safe_value(item, id)
676
682
  code = self.safe_currency_code(id)
683
+ name = self.safe_string(currency, 'name')
684
+ networkId = self.safe_string(currency, 'blockchain')
685
+ networkCode = self.network_id_to_code(networkId, code)
677
686
  delisted = self.safe_value(currency, 'delisted')
678
- walletState = self.safe_string(currency, 'walletState')
679
- enabled = walletState == 'ENABLED'
680
- listed = not delisted
681
- active = listed and enabled
687
+ walletEnabled = self.safe_string(currency, 'walletState') == 'ENABLED'
688
+ depositEnabled = self.safe_string(currency, 'walletDepositState') == 'ENABLED'
689
+ withdrawEnabled = self.safe_string(currency, 'walletWithdrawalState') == 'ENABLED'
690
+ active = not delisted and walletEnabled and depositEnabled and withdrawEnabled
682
691
  numericId = self.safe_integer(currency, 'id')
683
- fee = self.safe_number(currency, 'withdrawalFee')
684
- result[code] = {
685
- 'id': id,
686
- 'numericId': numericId,
687
- 'code': code,
692
+ feeString = self.safe_string(currency, 'withdrawalFee')
693
+ parentChain = self.safe_value(currency, 'parentChain')
694
+ noParentChain = parentChain is None
695
+ if self.safe_value(result, code) is None:
696
+ result[code] = {
697
+ 'id': id,
698
+ 'code': code,
699
+ 'info': None,
700
+ 'name': name,
701
+ 'active': active,
702
+ 'deposit': depositEnabled,
703
+ 'withdraw': withdrawEnabled,
704
+ 'fee': self.parse_number(feeString),
705
+ 'precision': None,
706
+ 'limits': {
707
+ 'amount': {
708
+ 'min': None,
709
+ 'max': None,
710
+ },
711
+ 'deposit': {
712
+ 'min': None,
713
+ 'max': None,
714
+ },
715
+ 'withdraw': {
716
+ 'min': None,
717
+ 'max': None,
718
+ },
719
+ },
720
+ }
721
+ minFeeString = self.safe_string(result[code], 'fee')
722
+ if feeString is not None:
723
+ minFeeString = feeString if (minFeeString is None) else Precise.string_min(feeString, minFeeString)
724
+ depositAvailable = self.safe_value(result[code], 'deposit')
725
+ depositAvailable = depositEnabled if (depositEnabled) else depositAvailable
726
+ withdrawAvailable = self.safe_value(result[code], 'withdraw')
727
+ withdrawAvailable = withdrawEnabled if (withdrawEnabled) else withdrawAvailable
728
+ networks = self.safe_value(result[code], 'networks', {})
729
+ networks[networkCode] = {
688
730
  'info': currency,
689
- 'name': currency['name'],
731
+ 'id': networkId,
732
+ 'network': networkCode,
733
+ 'currencyId': id,
734
+ 'numericId': numericId,
735
+ 'deposit': depositEnabled,
736
+ 'withdraw': withdrawEnabled,
690
737
  'active': active,
691
- 'deposit': None,
692
- 'withdraw': None,
693
- 'fee': fee,
738
+ 'fee': self.parse_number(feeString),
694
739
  'precision': None,
695
- 'networks': {},
696
740
  'limits': {
697
741
  'amount': {
698
742
  'min': None,
699
743
  'max': None,
700
744
  },
701
745
  'withdraw': {
702
- 'min': fee,
746
+ 'min': None,
747
+ 'max': None,
748
+ },
749
+ 'deposit': {
750
+ 'min': None,
703
751
  'max': None,
704
752
  },
705
753
  },
706
754
  }
755
+ result[code]['networks'] = networks
756
+ info = self.safe_value(result[code], 'info', [])
757
+ rawInfo = {}
758
+ rawInfo[id] = currency
759
+ info.append(rawInfo)
760
+ result[code]['info'] = info
761
+ if noParentChain:
762
+ result[code]['id'] = id
763
+ result[code]['name'] = name
764
+ result[code]['active'] = depositAvailable and withdrawAvailable
765
+ result[code]['deposit'] = depositAvailable
766
+ result[code]['withdraw'] = withdrawAvailable
767
+ result[code]['fee'] = self.parse_number(minFeeString)
707
768
  return result
708
769
 
709
770
  async def fetch_ticker(self, symbol: str, params={}):
ccxt/async_support/xt.py CHANGED
@@ -4342,7 +4342,11 @@ class xt(Exchange, ImplicitAPI):
4342
4342
  timestamp = self.number_to_string(self.nonce())
4343
4343
  body = query
4344
4344
  if (payload == '/v4/order') or (payload == '/future/trade/v1/order/create') or (payload == '/future/trade/v1/entrust/create-plan') or (payload == '/future/trade/v1/entrust/create-profit') or (payload == '/future/trade/v1/order/create-batch'):
4345
- body['clientMedia'] = 'CCXT'
4345
+ id = 'CCXT'
4346
+ if payload.find('future') > -1:
4347
+ body['clientMedia'] = id
4348
+ else:
4349
+ body['media'] = id
4346
4350
  isUndefinedBody = ((method == 'GET') or (path == 'order/{orderId}'))
4347
4351
  body = None if isUndefinedBody else self.json(body)
4348
4352
  payloadString = None