ccxt 4.4.82__py2.py3-none-any.whl → 4.4.86__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.
Files changed (121) hide show
  1. ccxt/__init__.py +3 -9
  2. ccxt/abstract/blofin.py +8 -0
  3. ccxt/abstract/btcbox.py +1 -0
  4. ccxt/abstract/myokx.py +2 -0
  5. ccxt/abstract/okx.py +2 -0
  6. ccxt/apex.py +2 -1
  7. ccxt/ascendex.py +187 -151
  8. ccxt/async_support/__init__.py +3 -9
  9. ccxt/async_support/apex.py +2 -1
  10. ccxt/async_support/ascendex.py +187 -151
  11. ccxt/async_support/base/exchange.py +51 -24
  12. ccxt/async_support/base/ws/cache.py +6 -1
  13. ccxt/async_support/bequant.py +1 -1
  14. ccxt/async_support/bitget.py +5 -6
  15. ccxt/async_support/bitmart.py +1 -1
  16. ccxt/async_support/bitrue.py +14 -32
  17. ccxt/async_support/bitso.py +33 -0
  18. ccxt/async_support/bitstamp.py +33 -0
  19. ccxt/async_support/{huobijp.py → bittrade.py} +11 -11
  20. ccxt/async_support/blofin.py +145 -14
  21. ccxt/async_support/btcbox.py +25 -5
  22. ccxt/async_support/bybit.py +16 -37
  23. ccxt/async_support/cex.py +2 -4
  24. ccxt/async_support/coinbase.py +58 -47
  25. ccxt/async_support/coinbaseexchange.py +141 -32
  26. ccxt/async_support/coincatch.py +14 -67
  27. ccxt/async_support/coinex.py +28 -29
  28. ccxt/async_support/coinlist.py +17 -16
  29. ccxt/async_support/coinmetro.py +20 -11
  30. ccxt/async_support/coinone.py +8 -10
  31. ccxt/async_support/coinsph.py +124 -2
  32. ccxt/async_support/cryptocom.py +109 -2
  33. ccxt/async_support/cryptomus.py +42 -80
  34. ccxt/async_support/delta.py +75 -36
  35. ccxt/async_support/deribit.py +4 -5
  36. ccxt/async_support/derive.py +46 -10
  37. ccxt/async_support/ellipx.py +175 -77
  38. ccxt/async_support/gate.py +1 -1
  39. ccxt/async_support/gemini.py +3 -4
  40. ccxt/async_support/hitbtc.py +56 -65
  41. ccxt/async_support/hollaex.py +106 -49
  42. ccxt/async_support/htx.py +20 -43
  43. ccxt/async_support/hyperliquid.py +6 -6
  44. ccxt/async_support/kraken.py +27 -23
  45. ccxt/async_support/kucoinfutures.py +5 -0
  46. ccxt/async_support/lbank.py +1 -1
  47. ccxt/async_support/mexc.py +2 -2
  48. ccxt/async_support/ndax.py +25 -24
  49. ccxt/async_support/okcoin.py +12 -29
  50. ccxt/async_support/okx.py +9 -0
  51. ccxt/async_support/onetrading.py +10 -7
  52. ccxt/async_support/oxfun.py +40 -110
  53. ccxt/async_support/paradex.py +123 -4
  54. ccxt/base/exchange.py +21 -2
  55. ccxt/base/types.py +3 -0
  56. ccxt/bequant.py +1 -1
  57. ccxt/bitget.py +5 -6
  58. ccxt/bitmart.py +1 -1
  59. ccxt/bitrue.py +14 -32
  60. ccxt/bitso.py +33 -0
  61. ccxt/bitstamp.py +33 -0
  62. ccxt/{huobijp.py → bittrade.py} +11 -11
  63. ccxt/blofin.py +145 -14
  64. ccxt/btcbox.py +24 -5
  65. ccxt/bybit.py +16 -37
  66. ccxt/cex.py +2 -4
  67. ccxt/coinbase.py +58 -47
  68. ccxt/coinbaseexchange.py +141 -32
  69. ccxt/coincatch.py +14 -67
  70. ccxt/coinex.py +28 -29
  71. ccxt/coinlist.py +17 -16
  72. ccxt/coinmetro.py +20 -11
  73. ccxt/coinone.py +8 -10
  74. ccxt/coinsph.py +124 -2
  75. ccxt/cryptocom.py +109 -2
  76. ccxt/cryptomus.py +42 -80
  77. ccxt/delta.py +75 -36
  78. ccxt/deribit.py +4 -5
  79. ccxt/derive.py +46 -10
  80. ccxt/ellipx.py +175 -77
  81. ccxt/gate.py +1 -1
  82. ccxt/gemini.py +3 -4
  83. ccxt/hitbtc.py +56 -65
  84. ccxt/hollaex.py +106 -49
  85. ccxt/htx.py +20 -43
  86. ccxt/hyperliquid.py +6 -6
  87. ccxt/kraken.py +27 -23
  88. ccxt/kucoinfutures.py +5 -0
  89. ccxt/lbank.py +1 -1
  90. ccxt/mexc.py +2 -2
  91. ccxt/ndax.py +25 -24
  92. ccxt/okcoin.py +12 -29
  93. ccxt/okx.py +9 -0
  94. ccxt/onetrading.py +10 -7
  95. ccxt/oxfun.py +40 -110
  96. ccxt/paradex.py +123 -4
  97. ccxt/pro/__init__.py +109 -5
  98. ccxt/pro/binance.py +32 -33
  99. ccxt/pro/bithumb.py +5 -3
  100. ccxt/pro/{huobijp.py → bittrade.py} +3 -3
  101. ccxt/pro/kraken.py +249 -79
  102. ccxt/pro/luno.py +6 -5
  103. ccxt/pro/mexc.py +254 -7
  104. ccxt/pro/poloniex.py +6 -2
  105. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/METADATA +8 -11
  106. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/RECORD +110 -121
  107. ccxt/abstract/bl3p.py +0 -19
  108. ccxt/abstract/idex.py +0 -26
  109. ccxt/abstract/kuna.py +0 -182
  110. ccxt/async_support/base/ws/fast_client.py +0 -97
  111. ccxt/async_support/bl3p.py +0 -543
  112. ccxt/async_support/idex.py +0 -1889
  113. ccxt/async_support/kuna.py +0 -1935
  114. ccxt/bl3p.py +0 -543
  115. ccxt/idex.py +0 -1889
  116. ccxt/kuna.py +0 -1935
  117. ccxt/pro/idex.py +0 -687
  118. /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
  119. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/LICENSE.txt +0 -0
  120. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/WHEEL +0 -0
  121. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/top_level.txt +0 -0
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.4.82'
25
+ __version__ = '4.4.86'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -107,8 +107,8 @@ from ccxt.bitrue import bitrue # noqa: F4
107
107
  from ccxt.bitso import bitso # noqa: F401
108
108
  from ccxt.bitstamp import bitstamp # noqa: F401
109
109
  from ccxt.bitteam import bitteam # noqa: F401
110
+ from ccxt.bittrade import bittrade # noqa: F401
110
111
  from ccxt.bitvavo import bitvavo # noqa: F401
111
- from ccxt.bl3p import bl3p # noqa: F401
112
112
  from ccxt.blockchaincom import blockchaincom # noqa: F401
113
113
  from ccxt.blofin import blofin # noqa: F401
114
114
  from ccxt.btcalpha import btcalpha # noqa: F401
@@ -148,16 +148,13 @@ from ccxt.hitbtc import hitbtc # noqa: F4
148
148
  from ccxt.hollaex import hollaex # noqa: F401
149
149
  from ccxt.htx import htx # noqa: F401
150
150
  from ccxt.huobi import huobi # noqa: F401
151
- from ccxt.huobijp import huobijp # noqa: F401
152
151
  from ccxt.hyperliquid import hyperliquid # noqa: F401
153
- from ccxt.idex import idex # noqa: F401
154
152
  from ccxt.independentreserve import independentreserve # noqa: F401
155
153
  from ccxt.indodax import indodax # noqa: F401
156
154
  from ccxt.kraken import kraken # noqa: F401
157
155
  from ccxt.krakenfutures import krakenfutures # noqa: F401
158
156
  from ccxt.kucoin import kucoin # noqa: F401
159
157
  from ccxt.kucoinfutures import kucoinfutures # noqa: F401
160
- from ccxt.kuna import kuna # noqa: F401
161
158
  from ccxt.latoken import latoken # noqa: F401
162
159
  from ccxt.lbank import lbank # noqa: F401
163
160
  from ccxt.luno import luno # noqa: F401
@@ -216,8 +213,8 @@ exchanges = [
216
213
  'bitso',
217
214
  'bitstamp',
218
215
  'bitteam',
216
+ 'bittrade',
219
217
  'bitvavo',
220
- 'bl3p',
221
218
  'blockchaincom',
222
219
  'blofin',
223
220
  'btcalpha',
@@ -257,16 +254,13 @@ exchanges = [
257
254
  'hollaex',
258
255
  'htx',
259
256
  'huobi',
260
- 'huobijp',
261
257
  'hyperliquid',
262
- 'idex',
263
258
  'independentreserve',
264
259
  'indodax',
265
260
  'kraken',
266
261
  'krakenfutures',
267
262
  'kucoin',
268
263
  'kucoinfutures',
269
- 'kuna',
270
264
  'latoken',
271
265
  'lbank',
272
266
  'luno',
ccxt/abstract/blofin.py CHANGED
@@ -20,10 +20,14 @@ class ImplicitAPI:
20
20
  private_get_account_positions = privateGetAccountPositions = Entry('account/positions', 'private', 'GET', {'cost': 1})
21
21
  private_get_account_leverage_info = privateGetAccountLeverageInfo = Entry('account/leverage-info', 'private', 'GET', {'cost': 1})
22
22
  private_get_account_margin_mode = privateGetAccountMarginMode = Entry('account/margin-mode', 'private', 'GET', {'cost': 1})
23
+ private_get_account_position_mode = privateGetAccountPositionMode = Entry('account/position-mode', 'private', 'GET', {'cost': 1})
23
24
  private_get_account_batch_leverage_info = privateGetAccountBatchLeverageInfo = Entry('account/batch-leverage-info', 'private', 'GET', {'cost': 1})
24
25
  private_get_trade_orders_tpsl_pending = privateGetTradeOrdersTpslPending = Entry('trade/orders-tpsl-pending', 'private', 'GET', {'cost': 1})
26
+ private_get_trade_orders_algo_pending = privateGetTradeOrdersAlgoPending = Entry('trade/orders-algo-pending', 'private', 'GET', {'cost': 1})
25
27
  private_get_trade_orders_history = privateGetTradeOrdersHistory = Entry('trade/orders-history', 'private', 'GET', {'cost': 1})
26
28
  private_get_trade_orders_tpsl_history = privateGetTradeOrdersTpslHistory = Entry('trade/orders-tpsl-history', 'private', 'GET', {'cost': 1})
29
+ private_get_trade_orders_algo_history = privateGetTradeOrdersAlgoHistory = Entry('trade/orders-algo-history', 'private', 'GET', {'cost': 1})
30
+ private_get_trade_order_price_range = privateGetTradeOrderPriceRange = Entry('trade/order/price-range', 'private', 'GET', {'cost': 1})
27
31
  private_get_user_query_apikey = privateGetUserQueryApikey = Entry('user/query-apikey', 'private', 'GET', {'cost': 1})
28
32
  private_get_affiliate_basic = privateGetAffiliateBasic = Entry('affiliate/basic', 'private', 'GET', {'cost': 1})
29
33
  private_get_copytrading_instruments = privateGetCopytradingInstruments = Entry('copytrading/instruments', 'private', 'GET', {'cost': 1})
@@ -38,8 +42,12 @@ class ImplicitAPI:
38
42
  private_get_copytrading_trade_position_history_by_order = privateGetCopytradingTradePositionHistoryByOrder = Entry('copytrading/trade/position-history-by-order', 'private', 'GET', {'cost': 1})
39
43
  private_get_copytrading_trade_orders_history = privateGetCopytradingTradeOrdersHistory = Entry('copytrading/trade/orders-history', 'private', 'GET', {'cost': 1})
40
44
  private_get_copytrading_trade_pending_tpsl_by_order = privateGetCopytradingTradePendingTpslByOrder = Entry('copytrading/trade/pending-tpsl-by-order', 'private', 'GET', {'cost': 1})
45
+ private_post_account_set_margin_mode = privatePostAccountSetMarginMode = Entry('account/set-margin-mode', 'private', 'POST', {'cost': 1})
46
+ private_post_account_set_position_mode = privatePostAccountSetPositionMode = Entry('account/set-position-mode', 'private', 'POST', {'cost': 1})
41
47
  private_post_trade_order = privatePostTradeOrder = Entry('trade/order', 'private', 'POST', {'cost': 1})
48
+ private_post_trade_order_algo = privatePostTradeOrderAlgo = Entry('trade/order-algo', 'private', 'POST', {'cost': 1})
42
49
  private_post_trade_cancel_order = privatePostTradeCancelOrder = Entry('trade/cancel-order', 'private', 'POST', {'cost': 1})
50
+ private_post_trade_cancel_algo = privatePostTradeCancelAlgo = Entry('trade/cancel-algo', 'private', 'POST', {'cost': 1})
43
51
  private_post_account_set_leverage = privatePostAccountSetLeverage = Entry('account/set-leverage', 'private', 'POST', {'cost': 1})
44
52
  private_post_trade_batch_orders = privatePostTradeBatchOrders = Entry('trade/batch-orders', 'private', 'POST', {'cost': 1})
45
53
  private_post_trade_order_tpsl = privatePostTradeOrderTpsl = Entry('trade/order-tpsl', 'private', 'POST', {'cost': 1})
ccxt/abstract/btcbox.py CHANGED
@@ -12,3 +12,4 @@ class ImplicitAPI:
12
12
  private_post_trade_list = privatePostTradeList = Entry('trade_list', 'private', 'POST', {})
13
13
  private_post_trade_view = privatePostTradeView = Entry('trade_view', 'private', 'POST', {})
14
14
  private_post_wallet = privatePostWallet = Entry('wallet', 'private', 'POST', {})
15
+ webapi_get_ajax_coin_coininfo = webApiGetAjaxCoinCoinInfo = Entry('ajax/coin/coinInfo', 'webApi', 'GET', {})
ccxt/abstract/myokx.py CHANGED
@@ -161,6 +161,7 @@ class ImplicitAPI:
161
161
  private_get_account_spot_manual_borrow_repay = privateGetAccountSpotManualBorrowRepay = Entry('account/spot-manual-borrow-repay', 'private', 'GET', {'cost': 10})
162
162
  private_get_account_set_auto_repay = privateGetAccountSetAutoRepay = Entry('account/set-auto-repay', 'private', 'GET', {'cost': 4})
163
163
  private_get_account_spot_borrow_repay_history = privateGetAccountSpotBorrowRepayHistory = Entry('account/spot-borrow-repay-history', 'private', 'GET', {'cost': 4})
164
+ private_get_account_move_positions_history = privateGetAccountMovePositionsHistory = Entry('account/move-positions-history', 'private', 'GET', {'cost': 10})
164
165
  private_get_users_subaccount_list = privateGetUsersSubaccountList = Entry('users/subaccount/list', 'private', 'GET', {'cost': 10})
165
166
  private_get_account_subaccount_balances = privateGetAccountSubaccountBalances = Entry('account/subaccount/balances', 'private', 'GET', {'cost': 3.3333333333333335})
166
167
  private_get_asset_subaccount_balances = privateGetAssetSubaccountBalances = Entry('asset/subaccount/balances', 'private', 'GET', {'cost': 3.3333333333333335})
@@ -284,6 +285,7 @@ class ImplicitAPI:
284
285
  private_post_account_fixed_loan_manual_reborrow = privatePostAccountFixedLoanManualReborrow = Entry('account/fixed-loan/manual-reborrow', 'private', 'POST', {'cost': 5})
285
286
  private_post_account_fixed_loan_repay_borrowing_order = privatePostAccountFixedLoanRepayBorrowingOrder = Entry('account/fixed-loan/repay-borrowing-order', 'private', 'POST', {'cost': 5})
286
287
  private_post_account_bills_history_archive = privatePostAccountBillsHistoryArchive = Entry('account/bills-history-archive', 'private', 'POST', {'cost': 72000})
288
+ private_post_account_move_positions = privatePostAccountMovePositions = Entry('account/move-positions', 'private', 'POST', {'cost': 10})
287
289
  private_post_users_subaccount_modify_apikey = privatePostUsersSubaccountModifyApikey = Entry('users/subaccount/modify-apikey', 'private', 'POST', {'cost': 10})
288
290
  private_post_asset_subaccount_transfer = privatePostAssetSubaccountTransfer = Entry('asset/subaccount/transfer', 'private', 'POST', {'cost': 10})
289
291
  private_post_users_subaccount_set_transfer_out = privatePostUsersSubaccountSetTransferOut = Entry('users/subaccount/set-transfer-out', 'private', 'POST', {'cost': 10})
ccxt/abstract/okx.py CHANGED
@@ -161,6 +161,7 @@ class ImplicitAPI:
161
161
  private_get_account_spot_manual_borrow_repay = privateGetAccountSpotManualBorrowRepay = Entry('account/spot-manual-borrow-repay', 'private', 'GET', {'cost': 10})
162
162
  private_get_account_set_auto_repay = privateGetAccountSetAutoRepay = Entry('account/set-auto-repay', 'private', 'GET', {'cost': 4})
163
163
  private_get_account_spot_borrow_repay_history = privateGetAccountSpotBorrowRepayHistory = Entry('account/spot-borrow-repay-history', 'private', 'GET', {'cost': 4})
164
+ private_get_account_move_positions_history = privateGetAccountMovePositionsHistory = Entry('account/move-positions-history', 'private', 'GET', {'cost': 10})
164
165
  private_get_users_subaccount_list = privateGetUsersSubaccountList = Entry('users/subaccount/list', 'private', 'GET', {'cost': 10})
165
166
  private_get_account_subaccount_balances = privateGetAccountSubaccountBalances = Entry('account/subaccount/balances', 'private', 'GET', {'cost': 3.3333333333333335})
166
167
  private_get_asset_subaccount_balances = privateGetAssetSubaccountBalances = Entry('asset/subaccount/balances', 'private', 'GET', {'cost': 3.3333333333333335})
@@ -284,6 +285,7 @@ class ImplicitAPI:
284
285
  private_post_account_fixed_loan_manual_reborrow = privatePostAccountFixedLoanManualReborrow = Entry('account/fixed-loan/manual-reborrow', 'private', 'POST', {'cost': 5})
285
286
  private_post_account_fixed_loan_repay_borrowing_order = privatePostAccountFixedLoanRepayBorrowingOrder = Entry('account/fixed-loan/repay-borrowing-order', 'private', 'POST', {'cost': 5})
286
287
  private_post_account_bills_history_archive = privatePostAccountBillsHistoryArchive = Entry('account/bills-history-archive', 'private', 'POST', {'cost': 72000})
288
+ private_post_account_move_positions = privatePostAccountMovePositions = Entry('account/move-positions', 'private', 'POST', {'cost': 10})
287
289
  private_post_users_subaccount_modify_apikey = privatePostUsersSubaccountModifyApikey = Entry('users/subaccount/modify-apikey', 'private', 'POST', {'cost': 10})
288
290
  private_post_asset_subaccount_transfer = privatePostAssetSubaccountTransfer = Entry('asset/subaccount/transfer', 'private', 'POST', {'cost': 10})
289
291
  private_post_users_subaccount_set_transfer_out = privatePostUsersSubaccountSetTransferOut = Entry('users/subaccount/set-transfer-out', 'private', 'POST', {'cost': 10})
ccxt/apex.py CHANGED
@@ -1077,9 +1077,10 @@ class apex(Exchange, ImplicitAPI):
1077
1077
  for i in range(0, len(resultList)):
1078
1078
  entry = resultList[i]
1079
1079
  timestamp = self.safe_integer(entry, 'fundingTimestamp')
1080
+ marketId = self.safe_string(entry, 'symbol')
1080
1081
  rates.append({
1081
1082
  'info': entry,
1082
- 'symbol': self.safe_string(entry, 'symbol'),
1083
+ 'symbol': self.safe_symbol(marketId, market),
1083
1084
  'fundingRate': self.safe_number(entry, 'rate'),
1084
1085
  'timestamp': timestamp,
1085
1086
  'datetime': self.iso8601(timestamp),
ccxt/ascendex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.ascendex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -477,6 +477,7 @@ class ascendex(Exchange, ImplicitAPI):
477
477
  'broad': {},
478
478
  },
479
479
  'commonCurrencies': {
480
+ 'XBT': 'XBT', # self is not BTC ! just another token
480
481
  'BOND': 'BONDED',
481
482
  'BTCBEAR': 'BEAR',
482
483
  'BTCBULL': 'BULL',
@@ -497,112 +498,82 @@ class ascendex(Exchange, ImplicitAPI):
497
498
  :param dict [params]: extra parameters specific to the exchange API endpoint
498
499
  :returns dict: an associative dictionary of currencies
499
500
  """
500
- assetsPromise = self.v1PublicGetAssets(params)
501
- #
502
- # {
503
- # "code":0,
504
- # "data":[
505
- # {
506
- # "assetCode" : "LTCBULL",
507
- # "assetName" : "3X Long LTC Token",
508
- # "precisionScale" : 9,
509
- # "nativeScale" : 4,
510
- # "withdrawalFee" : "0.2",
511
- # "minWithdrawalAmt" : "1.0",
512
- # "status" : "Normal"
513
- # },
514
- # ]
515
- # }
516
- #
517
- marginPromise = self.v1PublicGetMarginAssets(params)
518
- #
519
- # {
520
- # "code":0,
521
- # "data":[
522
- # {
523
- # "assetCode":"BTT",
524
- # "displayName": "BTT",
525
- # "borrowAssetCode":"BTT-B",
526
- # "interestAssetCode":"BTT-I",
527
- # "nativeScale":0,
528
- # "numConfirmations":1,
529
- # "withdrawFee":"100.0",
530
- # "minWithdrawalAmt":"1000.0",
531
- # "statusCode":"Normal",
532
- # "statusMessage":"",
533
- # "interestRate":"0.001"
534
- # }
535
- # ]
536
- # }
537
- #
538
- cashPromise = self.v1PublicGetCashAssets(params)
501
+ response = self.v2PublicGetAssets(params)
539
502
  #
540
- # {
541
- # "code":0,
542
- # "data":[
543
- # {
544
- # "assetCode":"LTCBULL",
545
- # "displayName": "LTCBULL",
546
- # "nativeScale":4,
547
- # "numConfirmations":20,
548
- # "withdrawFee":"0.2",
549
- # "minWithdrawalAmt":"1.0",
550
- # "statusCode":"Normal",
551
- # "statusMessage":"" # hideFromWalletTx
552
- # }
503
+ # {
504
+ # "code": "0",
505
+ # "data": [
506
+ # {
507
+ # "assetCode": "USDT",
508
+ # "assetName": "Tether",
509
+ # "precisionScale": 9,
510
+ # "nativeScale": 4,
511
+ # "blockChain": [
512
+ # {
513
+ # "chainName": "Solana",
514
+ # "withdrawFee": "2.0",
515
+ # "allowDeposit": True,
516
+ # "allowWithdraw": True,
517
+ # "minDepositAmt": "0.01",
518
+ # "minWithdrawal": "4.0",
519
+ # "numConfirmations": 1
520
+ # },
521
+ # ...
522
+ # ]
523
+ # },
553
524
  # ]
554
- # }
525
+ # }
555
526
  #
556
- assets, margin, cash = [assetsPromise, marginPromise, cashPromise]
557
- assetsData = self.safe_list(assets, 'data', [])
558
- marginData = self.safe_list(margin, 'data', [])
559
- cashData = self.safe_list(cash, 'data', [])
560
- assetsById = self.index_by(assetsData, 'assetCode')
561
- marginById = self.index_by(marginData, 'assetCode')
562
- cashById = self.index_by(cashData, 'assetCode')
563
- dataById = self.deep_extend(assetsById, marginById, cashById)
564
- ids = list(dataById.keys())
527
+ data = self.safe_list(response, 'data', [])
565
528
  result: dict = {}
566
- for i in range(0, len(ids)):
567
- id = self.safe_string(ids, i)
568
- currency = dataById[id]
529
+ for i in range(0, len(data)):
530
+ currency = data[i]
531
+ id = self.safe_string(currency, 'assetCode')
569
532
  code = self.safe_currency_code(id)
570
- scale = self.safe_string_2(currency, 'precisionScale', 'nativeScale')
571
- precision = self.parse_number(self.parse_precision(scale))
572
- fee = self.safe_number_2(currency, 'withdrawFee', 'withdrawalFee')
573
- status = self.safe_string(currency, 'status')
574
- statusCode = self.safe_string(currency, 'statusCode')
575
- active = (status == 'Normal')
576
- depositEnabled: Bool = None
577
- withdrawEnabled: Bool = None
578
- if status == 'Delisted' or statusCode == 'hideFromWalletTx':
579
- depositEnabled = False
580
- withdrawEnabled = False
581
- elif status == 'Normal':
582
- depositEnabled = True
583
- withdrawEnabled = True
584
- elif status == 'NoTransaction' or statusCode == 'NoTransaction':
585
- depositEnabled = True
586
- withdrawEnabled = False
587
- elif status == 'NoDeposit':
588
- depositEnabled = False
589
- withdrawEnabled = True
590
- marginInside = ('borrowAssetCode' in currency)
591
- result[code] = {
533
+ chains = self.safe_list(currency, 'blockChain', [])
534
+ precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'nativeScale')))
535
+ networks = {}
536
+ for j in range(0, len(chains)):
537
+ networkEtnry = chains[j]
538
+ networkId = self.safe_string(networkEtnry, 'chainName')
539
+ networkCode = self.network_code_to_id(networkId)
540
+ networks[networkCode] = {
541
+ 'fee': self.safe_number(networkEtnry, 'withdrawFee'),
542
+ 'active': None,
543
+ 'withdraw': self.safe_bool(networkEtnry, 'allowWithdraw'),
544
+ 'deposit': self.safe_bool(networkEtnry, 'allowDeposit'),
545
+ 'precision': precision,
546
+ 'limits': {
547
+ 'amount': {
548
+ 'min': None,
549
+ 'max': None,
550
+ },
551
+ 'withdraw': {
552
+ 'min': self.safe_number(networkEtnry, 'minWithdrawal'),
553
+ 'max': None,
554
+ },
555
+ 'deposit': {
556
+ 'min': self.safe_number(networkEtnry, 'minDepositAmt'),
557
+ 'max': None,
558
+ },
559
+ },
560
+ }
561
+ # todo type: if chainsLength == 0 and (assetName.endswith(' Staking') or assetName.find(' Reward ') >= 0 or assetName.find('Slot Auction') >= 0 or assetName.find(' Freeze Asset') >= 0):
562
+ result[code] = self.safe_currency_structure({
592
563
  'id': id,
593
564
  'code': code,
594
565
  'info': currency,
595
566
  'type': None,
596
- 'margin': marginInside,
567
+ 'margin': None,
597
568
  'name': self.safe_string(currency, 'assetName'),
598
- 'active': active,
599
- 'deposit': depositEnabled,
600
- 'withdraw': withdrawEnabled,
601
- 'fee': fee,
569
+ 'active': None,
570
+ 'deposit': None,
571
+ 'withdraw': None,
572
+ 'fee': None,
602
573
  'precision': precision,
603
574
  'limits': {
604
575
  'amount': {
605
- 'min': precision,
576
+ 'min': None,
606
577
  'max': None,
607
578
  },
608
579
  'withdraw': {
@@ -610,8 +581,8 @@ class ascendex(Exchange, ImplicitAPI):
610
581
  'max': None,
611
582
  },
612
583
  },
613
- 'networks': {}, # todo
614
- }
584
+ 'networks': networks,
585
+ })
615
586
  return result
616
587
 
617
588
  def fetch_markets(self, params={}) -> List[Market]:
@@ -620,6 +591,12 @@ class ascendex(Exchange, ImplicitAPI):
620
591
  :param dict [params]: extra parameters specific to the exchange API endpoint
621
592
  :returns dict[]: an array of objects representing market data
622
593
  """
594
+ spotPromise = self.fetch_spot_markets(params)
595
+ contractPromise = self.fetch_contract_markets(params)
596
+ spotMarkets, contractMarkets = [spotPromise, contractPromise]
597
+ return self.array_concat(spotMarkets, contractMarkets)
598
+
599
+ def fetch_spot_markets(self, params={}) -> List[Market]:
623
600
  productsPromise = self.v1PublicGetProducts(params)
624
601
  #
625
602
  # {
@@ -671,7 +648,91 @@ class ascendex(Exchange, ImplicitAPI):
671
648
  # ]
672
649
  # }
673
650
  #
674
- perpetualsPromise = self.v2PublicGetFuturesContract(params)
651
+ products, cash = [productsPromise, cashPromise]
652
+ productsData = self.safe_list(products, 'data', [])
653
+ productsById = self.index_by(productsData, 'symbol')
654
+ cashData = self.safe_list(cash, 'data', [])
655
+ cashAndPerpetualsById = self.index_by(cashData, 'symbol')
656
+ dataById = self.deep_extend(productsById, cashAndPerpetualsById)
657
+ ids = list(dataById.keys())
658
+ result = []
659
+ for i in range(0, len(ids)):
660
+ id = ids[i]
661
+ if id.find('-PERP') >= 0:
662
+ continue # skip perpetuals, endpoint returns them
663
+ market = dataById[id]
664
+ status = self.safe_string(market, 'status')
665
+ domain = self.safe_string(market, 'domain')
666
+ active = False
667
+ if ((status == 'Normal') or (status == 'InternalTrading')) and (domain != 'LeveragedETF'):
668
+ active = True
669
+ minQty = self.safe_number(market, 'minQty')
670
+ maxQty = self.safe_number(market, 'maxQty')
671
+ minPrice = self.safe_number(market, 'tickSize')
672
+ maxPrice: Num = None
673
+ underlying = self.safe_string_2(market, 'underlying', 'symbol')
674
+ parts = underlying.split('/')
675
+ baseId = self.safe_string(parts, 0)
676
+ quoteId = self.safe_string(parts, 1)
677
+ base = self.safe_currency_code(baseId)
678
+ quote = self.safe_currency_code(quoteId)
679
+ fee = self.safe_number(market, 'commissionReserveRate')
680
+ marginTradable = self.safe_bool(market, 'marginTradable', False)
681
+ result.append({
682
+ 'id': id,
683
+ 'symbol': base + '/' + quote,
684
+ 'base': base,
685
+ 'baseId': baseId,
686
+ 'quote': quote,
687
+ 'quoteId': quoteId,
688
+ 'settle': None,
689
+ 'settleId': None,
690
+ 'type': 'spot',
691
+ 'spot': True,
692
+ 'margin': marginTradable,
693
+ 'swap': False,
694
+ 'future': False,
695
+ 'option': False,
696
+ 'active': active,
697
+ 'contract': False,
698
+ 'linear': None,
699
+ 'inverse': None,
700
+ 'taker': fee,
701
+ 'maker': fee,
702
+ 'contractSize': None,
703
+ 'expiry': None,
704
+ 'expiryDatetime': None,
705
+ 'strike': None,
706
+ 'optionType': None,
707
+ 'precision': {
708
+ 'amount': self.safe_number(market, 'lotSize'),
709
+ 'price': self.safe_number(market, 'tickSize'),
710
+ },
711
+ 'limits': {
712
+ 'leverage': {
713
+ 'min': None,
714
+ 'max': None,
715
+ },
716
+ 'amount': {
717
+ 'min': minQty,
718
+ 'max': maxQty,
719
+ },
720
+ 'price': {
721
+ 'min': minPrice,
722
+ 'max': maxPrice,
723
+ },
724
+ 'cost': {
725
+ 'min': self.safe_number(market, 'minNotional'),
726
+ 'max': self.safe_number(market, 'maxNotional'),
727
+ },
728
+ },
729
+ 'created': self.safe_integer(market, 'tradingStartTime'),
730
+ 'info': market,
731
+ })
732
+ return result
733
+
734
+ def fetch_contract_markets(self, params={}) -> List[Market]:
735
+ contracts = self.v2PublicGetFuturesContract(params)
675
736
  #
676
737
  # {
677
738
  # "code": 0,
@@ -684,9 +745,9 @@ class ascendex(Exchange, ImplicitAPI):
684
745
  # "underlying": "BTC/USDT",
685
746
  # "tradingStartTime": 1579701600000,
686
747
  # "priceFilter": {
687
- # "minPrice": "1",
748
+ # "minPrice": "0.1",
688
749
  # "maxPrice": "1000000",
689
- # "tickSize": "1"
750
+ # "tickSize": "0.1"
690
751
  # },
691
752
  # "lotSizeFilter": {
692
753
  # "minQty": "0.0001",
@@ -709,50 +770,25 @@ class ascendex(Exchange, ImplicitAPI):
709
770
  # ]
710
771
  # }
711
772
  #
712
- products, cash, perpetuals = [productsPromise, cashPromise, perpetualsPromise]
713
- productsData = self.safe_list(products, 'data', [])
714
- productsById = self.index_by(productsData, 'symbol')
715
- cashData = self.safe_list(cash, 'data', [])
716
- perpetualsData = self.safe_list(perpetuals, 'data', [])
717
- cashAndPerpetualsData = self.array_concat(cashData, perpetualsData)
718
- cashAndPerpetualsById = self.index_by(cashAndPerpetualsData, 'symbol')
719
- dataById = self.deep_extend(productsById, cashAndPerpetualsById)
720
- ids = list(dataById.keys())
773
+ data = self.safe_list(contracts, 'data', [])
721
774
  result = []
722
- for i in range(0, len(ids)):
723
- id = ids[i]
724
- market = dataById[id]
725
- settleId = self.safe_string(market, 'settlementAsset')
726
- settle = self.safe_currency_code(settleId)
727
- status = self.safe_string(market, 'status')
728
- domain = self.safe_string(market, 'domain')
729
- active = False
730
- if ((status == 'Normal') or (status == 'InternalTrading')) and (domain != 'LeveragedETF'):
731
- active = True
732
- spot = settle is None
733
- swap = not spot
734
- linear = True if swap else None
735
- minQty = self.safe_number(market, 'minQty')
736
- maxQty = self.safe_number(market, 'maxQty')
737
- minPrice = self.safe_number(market, 'tickSize')
738
- maxPrice: Num = None
739
- underlying = self.safe_string_2(market, 'underlying', 'symbol')
775
+ for i in range(0, len(data)):
776
+ market = data[i]
777
+ id = self.safe_string(market, 'symbol')
778
+ underlying = self.safe_string(market, 'underlying')
740
779
  parts = underlying.split('/')
741
780
  baseId = self.safe_string(parts, 0)
742
- quoteId = self.safe_string(parts, 1)
743
781
  base = self.safe_currency_code(baseId)
782
+ quoteId = self.safe_string(parts, 1)
744
783
  quote = self.safe_currency_code(quoteId)
745
- symbol = base + '/' + quote
746
- if swap:
747
- lotSizeFilter = self.safe_dict(market, 'lotSizeFilter')
748
- minQty = self.safe_number(lotSizeFilter, 'minQty')
749
- maxQty = self.safe_number(lotSizeFilter, 'maxQty')
750
- priceFilter = self.safe_dict(market, 'priceFilter')
751
- minPrice = self.safe_number(priceFilter, 'minPrice')
752
- maxPrice = self.safe_number(priceFilter, 'maxPrice')
753
- symbol = base + '/' + quote + ':' + settle
784
+ settleId = self.safe_string(market, 'settlementAsset')
785
+ settle = self.safe_currency_code(settleId)
786
+ linear = settle == quote
787
+ inverse = settle == base
788
+ symbol = base + '/' + quote + ':' + settle
789
+ priceFilter = self.safe_dict(market, 'priceFilter')
790
+ lotSizeFilter = self.safe_dict(market, 'lotSizeFilter')
754
791
  fee = self.safe_number(market, 'commissionReserveRate')
755
- marginTradable = self.safe_bool(market, 'marginTradable', False)
756
792
  result.append({
757
793
  'id': id,
758
794
  'symbol': symbol,
@@ -762,26 +798,26 @@ class ascendex(Exchange, ImplicitAPI):
762
798
  'baseId': baseId,
763
799
  'quoteId': quoteId,
764
800
  'settleId': settleId,
765
- 'type': 'swap' if swap else 'spot',
766
- 'spot': spot,
767
- 'margin': marginTradable if spot else None,
768
- 'swap': swap,
801
+ 'type': 'swap',
802
+ 'spot': False,
803
+ 'margin': None,
804
+ 'swap': True,
769
805
  'future': False,
770
806
  'option': False,
771
- 'active': active,
772
- 'contract': swap,
807
+ 'active': self.safe_string(market, 'status') == 'Normal',
808
+ 'contract': True,
773
809
  'linear': linear,
774
- 'inverse': not linear if swap else None,
810
+ 'inverse': inverse,
775
811
  'taker': fee,
776
812
  'maker': fee,
777
- 'contractSize': self.parse_number('1') if swap else None,
813
+ 'contractSize': self.parse_number('1'),
778
814
  'expiry': None,
779
815
  'expiryDatetime': None,
780
816
  'strike': None,
781
817
  'optionType': None,
782
818
  'precision': {
783
- 'amount': self.safe_number(market, 'lotSize'),
784
- 'price': self.safe_number(market, 'tickSize'),
819
+ 'amount': self.safe_number(lotSizeFilter, 'lotSize'),
820
+ 'price': self.safe_number(priceFilter, 'tickSize'),
785
821
  },
786
822
  'limits': {
787
823
  'leverage': {
@@ -789,12 +825,12 @@ class ascendex(Exchange, ImplicitAPI):
789
825
  'max': None,
790
826
  },
791
827
  'amount': {
792
- 'min': minQty,
793
- 'max': maxQty,
828
+ 'min': self.safe_number(lotSizeFilter, 'minQty'),
829
+ 'max': self.safe_number(lotSizeFilter, 'maxQty'),
794
830
  },
795
831
  'price': {
796
- 'min': minPrice,
797
- 'max': maxPrice,
832
+ 'min': self.safe_number(priceFilter, 'minPrice'),
833
+ 'max': self.safe_number(priceFilter, 'maxPrice'),
798
834
  },
799
835
  'cost': {
800
836
  'min': self.safe_number(market, 'minNotional'),