ccxt 4.4.30__py2.py3-none-any.whl → 4.4.32__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 (268) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ace.py +36 -12
  3. ccxt/alpaca.py +62 -22
  4. ccxt/ascendex.py +65 -30
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ace.py +36 -12
  7. ccxt/async_support/alpaca.py +62 -22
  8. ccxt/async_support/ascendex.py +65 -30
  9. ccxt/async_support/base/exchange.py +3 -3
  10. ccxt/async_support/base/ws/aiohttp_client.py +25 -3
  11. ccxt/async_support/bigone.py +71 -27
  12. ccxt/async_support/binance.py +555 -323
  13. ccxt/async_support/bingx.py +208 -108
  14. ccxt/async_support/bit2c.py +34 -12
  15. ccxt/async_support/bitbank.py +42 -14
  16. ccxt/async_support/bitbns.py +17 -9
  17. ccxt/async_support/bitfinex.py +68 -24
  18. ccxt/async_support/bitfinex2.py +116 -44
  19. ccxt/async_support/bitflyer.py +54 -18
  20. ccxt/async_support/bitget.py +277 -145
  21. ccxt/async_support/bithumb.py +39 -14
  22. ccxt/async_support/bitmart.py +145 -79
  23. ccxt/async_support/bitmex.py +90 -30
  24. ccxt/async_support/bitopro.py +66 -22
  25. ccxt/async_support/bitrue.py +109 -57
  26. ccxt/async_support/bitso.py +55 -19
  27. ccxt/async_support/bitstamp.py +84 -36
  28. ccxt/async_support/bitteam.py +51 -17
  29. ccxt/async_support/bitvavo.py +57 -22
  30. ccxt/async_support/bl3p.py +26 -10
  31. ccxt/async_support/blockchaincom.py +63 -21
  32. ccxt/async_support/blofin.py +95 -38
  33. ccxt/async_support/btcalpha.py +48 -16
  34. ccxt/async_support/btcbox.py +27 -9
  35. ccxt/async_support/btcmarkets.py +57 -19
  36. ccxt/async_support/btcturk.py +36 -12
  37. ccxt/async_support/bybit.py +251 -95
  38. ccxt/async_support/cex.py +65 -22
  39. ccxt/async_support/coinbase.py +138 -56
  40. ccxt/async_support/coinbaseexchange.py +76 -28
  41. ccxt/async_support/coinbaseinternational.py +75 -27
  42. ccxt/async_support/coincatch.py +191 -97
  43. ccxt/async_support/coincheck.py +33 -11
  44. ccxt/async_support/coinex.py +212 -101
  45. ccxt/async_support/coinlist.py +87 -30
  46. ccxt/async_support/coinmate.py +55 -24
  47. ccxt/async_support/coinmetro.py +52 -18
  48. ccxt/async_support/coinone.py +27 -10
  49. ccxt/async_support/coinsph.py +73 -27
  50. ccxt/async_support/coinspot.py +25 -9
  51. ccxt/async_support/cryptocom.py +103 -38
  52. ccxt/async_support/currencycom.py +70 -23
  53. ccxt/async_support/delta.py +90 -30
  54. ccxt/async_support/deribit.py +131 -50
  55. ccxt/async_support/digifinex.py +114 -51
  56. ccxt/async_support/exmo.py +104 -45
  57. ccxt/async_support/gate.py +313 -157
  58. ccxt/async_support/gemini.py +57 -20
  59. ccxt/async_support/hashkey.py +151 -66
  60. ccxt/async_support/hitbtc.py +157 -74
  61. ccxt/async_support/hollaex.py +76 -25
  62. ccxt/async_support/htx.py +297 -240
  63. ccxt/async_support/huobijp.py +1 -0
  64. ccxt/async_support/hyperliquid.py +94 -38
  65. ccxt/async_support/idex.py +73 -24
  66. ccxt/async_support/independentreserve.py +12 -5
  67. ccxt/async_support/indodax.py +54 -17
  68. ccxt/async_support/kraken.py +108 -36
  69. ccxt/async_support/krakenfutures.py +88 -34
  70. ccxt/async_support/kucoin.py +214 -110
  71. ccxt/async_support/kucoinfutures.py +209 -64
  72. ccxt/async_support/kuna.py +80 -39
  73. ccxt/async_support/latoken.py +70 -33
  74. ccxt/async_support/lbank.py +89 -38
  75. ccxt/async_support/luno.py +54 -19
  76. ccxt/async_support/lykke.py +54 -19
  77. ccxt/async_support/mercado.py +1 -0
  78. ccxt/async_support/mexc.py +226 -108
  79. ccxt/async_support/ndax.py +58 -19
  80. ccxt/async_support/novadax.py +67 -22
  81. ccxt/async_support/oceanex.py +58 -19
  82. ccxt/async_support/okcoin.py +81 -38
  83. ccxt/async_support/okx.py +270 -109
  84. ccxt/async_support/onetrading.py +3 -1
  85. ccxt/async_support/oxfun.py +95 -36
  86. ccxt/async_support/p2b.py +49 -23
  87. ccxt/async_support/paradex.py +75 -27
  88. ccxt/async_support/paymium.py +31 -11
  89. ccxt/async_support/phemex.py +108 -56
  90. ccxt/async_support/poloniex.py +80 -30
  91. ccxt/async_support/poloniexfutures.py +72 -30
  92. ccxt/async_support/probit.py +64 -22
  93. ccxt/async_support/timex.py +58 -19
  94. ccxt/async_support/tokocrypto.py +63 -22
  95. ccxt/async_support/tradeogre.py +7 -2
  96. ccxt/async_support/upbit.py +72 -25
  97. ccxt/async_support/vertex.py +74 -28
  98. ccxt/async_support/wavesexchange.py +32 -8
  99. ccxt/async_support/wazirx.py +51 -17
  100. ccxt/async_support/whitebit.py +105 -41
  101. ccxt/async_support/woo.py +162 -65
  102. ccxt/async_support/woofipro.py +119 -50
  103. ccxt/async_support/xt.py +150 -73
  104. ccxt/async_support/yobit.py +49 -16
  105. ccxt/async_support/zaif.py +30 -10
  106. ccxt/async_support/zonda.py +46 -16
  107. ccxt/base/exchange.py +47 -35
  108. ccxt/base/types.py +1 -0
  109. ccxt/bigone.py +71 -27
  110. ccxt/binance.py +555 -323
  111. ccxt/bingx.py +208 -108
  112. ccxt/bit2c.py +34 -12
  113. ccxt/bitbank.py +42 -14
  114. ccxt/bitbns.py +17 -9
  115. ccxt/bitfinex.py +68 -24
  116. ccxt/bitfinex2.py +116 -44
  117. ccxt/bitflyer.py +54 -18
  118. ccxt/bitget.py +277 -145
  119. ccxt/bithumb.py +39 -14
  120. ccxt/bitmart.py +145 -79
  121. ccxt/bitmex.py +90 -30
  122. ccxt/bitopro.py +66 -22
  123. ccxt/bitrue.py +109 -57
  124. ccxt/bitso.py +55 -19
  125. ccxt/bitstamp.py +84 -36
  126. ccxt/bitteam.py +51 -17
  127. ccxt/bitvavo.py +57 -22
  128. ccxt/bl3p.py +26 -10
  129. ccxt/blockchaincom.py +63 -21
  130. ccxt/blofin.py +95 -38
  131. ccxt/btcalpha.py +48 -16
  132. ccxt/btcbox.py +27 -9
  133. ccxt/btcmarkets.py +57 -19
  134. ccxt/btcturk.py +36 -12
  135. ccxt/bybit.py +251 -95
  136. ccxt/cex.py +65 -22
  137. ccxt/coinbase.py +138 -56
  138. ccxt/coinbaseexchange.py +76 -28
  139. ccxt/coinbaseinternational.py +75 -27
  140. ccxt/coincatch.py +191 -97
  141. ccxt/coincheck.py +33 -11
  142. ccxt/coinex.py +212 -101
  143. ccxt/coinlist.py +87 -30
  144. ccxt/coinmate.py +55 -24
  145. ccxt/coinmetro.py +52 -18
  146. ccxt/coinone.py +27 -10
  147. ccxt/coinsph.py +73 -27
  148. ccxt/coinspot.py +25 -9
  149. ccxt/cryptocom.py +103 -38
  150. ccxt/currencycom.py +70 -23
  151. ccxt/delta.py +90 -30
  152. ccxt/deribit.py +131 -50
  153. ccxt/digifinex.py +114 -51
  154. ccxt/exmo.py +104 -45
  155. ccxt/gate.py +313 -157
  156. ccxt/gemini.py +57 -20
  157. ccxt/hashkey.py +151 -66
  158. ccxt/hitbtc.py +157 -74
  159. ccxt/hollaex.py +76 -25
  160. ccxt/htx.py +297 -240
  161. ccxt/huobijp.py +1 -0
  162. ccxt/hyperliquid.py +94 -38
  163. ccxt/idex.py +73 -24
  164. ccxt/independentreserve.py +12 -5
  165. ccxt/indodax.py +54 -17
  166. ccxt/kraken.py +108 -36
  167. ccxt/krakenfutures.py +88 -34
  168. ccxt/kucoin.py +214 -110
  169. ccxt/kucoinfutures.py +209 -64
  170. ccxt/kuna.py +80 -39
  171. ccxt/latoken.py +70 -33
  172. ccxt/lbank.py +89 -38
  173. ccxt/luno.py +54 -19
  174. ccxt/lykke.py +54 -19
  175. ccxt/mercado.py +1 -0
  176. ccxt/mexc.py +226 -108
  177. ccxt/ndax.py +58 -19
  178. ccxt/novadax.py +67 -22
  179. ccxt/oceanex.py +58 -19
  180. ccxt/okcoin.py +81 -38
  181. ccxt/okx.py +270 -109
  182. ccxt/onetrading.py +3 -1
  183. ccxt/oxfun.py +95 -36
  184. ccxt/p2b.py +49 -23
  185. ccxt/paradex.py +75 -27
  186. ccxt/paymium.py +31 -11
  187. ccxt/phemex.py +108 -56
  188. ccxt/poloniex.py +80 -30
  189. ccxt/poloniexfutures.py +72 -30
  190. ccxt/pro/__init__.py +1 -1
  191. ccxt/pro/alpaca.py +15 -5
  192. ccxt/pro/ascendex.py +18 -6
  193. ccxt/pro/binance.py +204 -123
  194. ccxt/pro/bingx.py +44 -24
  195. ccxt/pro/bitfinex.py +13 -5
  196. ccxt/pro/bitget.py +76 -37
  197. ccxt/pro/bithumb.py +12 -4
  198. ccxt/pro/bitmart.py +44 -20
  199. ccxt/pro/bitmex.py +42 -14
  200. ccxt/pro/bitopro.py +15 -5
  201. ccxt/pro/bitrue.py +7 -3
  202. ccxt/pro/bitvavo.py +97 -62
  203. ccxt/pro/blockchaincom.py +18 -6
  204. ccxt/pro/blofin.py +36 -12
  205. ccxt/pro/bybit.py +100 -42
  206. ccxt/pro/cex.py +48 -16
  207. ccxt/pro/coinbase.py +32 -12
  208. ccxt/pro/coinbaseexchange.py +1 -1
  209. ccxt/pro/coinbaseinternational.py +34 -14
  210. ccxt/pro/coincatch.py +54 -19
  211. ccxt/pro/coincheck.py +6 -2
  212. ccxt/pro/coinex.py +40 -20
  213. ccxt/pro/coinone.py +9 -3
  214. ccxt/pro/cryptocom.py +71 -27
  215. ccxt/pro/deribit.py +36 -12
  216. ccxt/pro/exmo.py +10 -4
  217. ccxt/pro/gate.py +65 -31
  218. ccxt/pro/gemini.py +21 -7
  219. ccxt/pro/hashkey.py +27 -9
  220. ccxt/pro/hitbtc.py +61 -37
  221. ccxt/pro/hollaex.py +15 -5
  222. ccxt/pro/htx.py +39 -21
  223. ccxt/pro/hyperliquid.py +41 -14
  224. ccxt/pro/kraken.py +49 -17
  225. ccxt/pro/krakenfutures.py +47 -24
  226. ccxt/pro/kucoin.py +60 -31
  227. ccxt/pro/kucoinfutures.py +41 -19
  228. ccxt/pro/lbank.py +27 -9
  229. ccxt/pro/luno.py +3 -1
  230. ccxt/pro/mexc.py +36 -19
  231. ccxt/pro/ndax.py +12 -4
  232. ccxt/pro/okcoin.py +18 -6
  233. ccxt/pro/okx.py +76 -28
  234. ccxt/pro/onetrading.py +21 -7
  235. ccxt/pro/oxfun.py +54 -20
  236. ccxt/pro/p2b.py +23 -11
  237. ccxt/pro/paradex.py +12 -4
  238. ccxt/pro/phemex.py +31 -19
  239. ccxt/pro/poloniex.py +50 -22
  240. ccxt/pro/poloniexfutures.py +17 -7
  241. ccxt/pro/probit.py +18 -6
  242. ccxt/pro/upbit.py +25 -9
  243. ccxt/pro/vertex.py +20 -6
  244. ccxt/pro/wazirx.py +21 -7
  245. ccxt/pro/whitebit.py +25 -9
  246. ccxt/pro/woo.py +32 -12
  247. ccxt/pro/woofipro.py +35 -13
  248. ccxt/pro/xt.py +46 -26
  249. ccxt/probit.py +64 -22
  250. ccxt/timex.py +58 -19
  251. ccxt/tokocrypto.py +63 -22
  252. ccxt/tradeogre.py +7 -2
  253. ccxt/upbit.py +72 -25
  254. ccxt/vertex.py +74 -28
  255. ccxt/wavesexchange.py +32 -8
  256. ccxt/wazirx.py +51 -17
  257. ccxt/whitebit.py +105 -41
  258. ccxt/woo.py +162 -65
  259. ccxt/woofipro.py +119 -50
  260. ccxt/xt.py +150 -73
  261. ccxt/yobit.py +49 -16
  262. ccxt/zaif.py +30 -10
  263. ccxt/zonda.py +46 -16
  264. {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/METADATA +11 -5
  265. {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/RECORD +268 -268
  266. {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/LICENSE.txt +0 -0
  267. {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/WHEEL +0 -0
  268. {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/top_level.txt +0 -0
@@ -504,6 +504,13 @@ class phemex(Exchange, ImplicitAPI):
504
504
  'transfer': {
505
505
  'fillResponseFromRequest': True,
506
506
  },
507
+ 'triggerPriceTypesMap': {
508
+ 'last': 'ByLastPrice',
509
+ 'mark': 'ByMarkPrice',
510
+ 'index': 'ByIndexPrice',
511
+ 'ask': 'ByAskPrice',
512
+ 'bid': 'ByBidPrice',
513
+ },
507
514
  },
508
515
  })
509
516
 
@@ -754,7 +761,9 @@ class phemex(Exchange, ImplicitAPI):
754
761
  async def fetch_markets(self, params={}) -> List[Market]:
755
762
  """
756
763
  retrieves data on all markets for phemex
757
- :see: https://phemex-docs.github.io/#query-product-information-3
764
+
765
+ https://phemex-docs.github.io/#query-product-information-3
766
+
758
767
  :param dict [params]: extra parameters specific to the exchange API endpoint
759
768
  :returns dict[]: an array of objects representing market data
760
769
  """
@@ -1076,7 +1085,9 @@ class phemex(Exchange, ImplicitAPI):
1076
1085
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
1077
1086
  """
1078
1087
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
1079
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorderbook
1088
+
1089
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorderbook
1090
+
1080
1091
  :param str symbol: unified symbol of the market to fetch the order book for
1081
1092
  :param int [limit]: the maximum amount of order book entries to return
1082
1093
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1200,8 +1211,10 @@ class phemex(Exchange, ImplicitAPI):
1200
1211
  async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1201
1212
  """
1202
1213
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1203
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querykline
1204
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-kline
1214
+
1215
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querykline
1216
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-kline
1217
+
1205
1218
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1206
1219
  :param str timeframe: the length of time each candle represents
1207
1220
  :param int [since]: *only used for USDT settled contracts, otherwise is emulated and not supported by the exchange* timestamp in ms of the earliest candle to fetch
@@ -1364,7 +1377,9 @@ class phemex(Exchange, ImplicitAPI):
1364
1377
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
1365
1378
  """
1366
1379
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1367
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query24hrsticker
1380
+
1381
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query24hrsticker
1382
+
1368
1383
  :param str symbol: unified symbol of the market to fetch the ticker for
1369
1384
  :param dict [params]: extra parameters specific to the exchange API endpoint
1370
1385
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -1433,9 +1448,11 @@ class phemex(Exchange, ImplicitAPI):
1433
1448
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1434
1449
  """
1435
1450
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1436
- :see: https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols-2 # spot
1437
- :see: https://phemex-docs.github.io/#query-24-ticker-for-all-symbols # linear
1438
- :see: https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols # inverse
1451
+
1452
+ https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols-2 # spot
1453
+ https://phemex-docs.github.io/#query-24-ticker-for-all-symbols # linear
1454
+ https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols # inverse
1455
+
1439
1456
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1440
1457
  :param dict [params]: extra parameters specific to the exchange API endpoint
1441
1458
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -1463,7 +1480,9 @@ class phemex(Exchange, ImplicitAPI):
1463
1480
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1464
1481
  """
1465
1482
  get the list of most recent trades for a particular symbol
1466
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querytrades
1483
+
1484
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querytrades
1485
+
1467
1486
  :param str symbol: unified symbol of the market to fetch trades for
1468
1487
  :param int [since]: timestamp in ms of the earliest trade to fetch
1469
1488
  :param int [limit]: the maximum amount of trades to fetch
@@ -1886,9 +1905,11 @@ class phemex(Exchange, ImplicitAPI):
1886
1905
  async def fetch_balance(self, params={}) -> Balances:
1887
1906
  """
1888
1907
  query for balance and get the amount of funds available for trading or funds locked in orders
1889
- :see: https://phemex-docs.github.io/#query-wallets
1890
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
1891
- :see: https://phemex-docs.github.io/#query-trading-account-and-positions
1908
+
1909
+ https://phemex-docs.github.io/#query-wallets
1910
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
1911
+ https://phemex-docs.github.io/#query-trading-account-and-positions
1912
+
1892
1913
  :param dict [params]: extra parameters specific to the exchange API endpoint
1893
1914
  :param str [params.type]: spot or swap
1894
1915
  :param str [params.code]: *swap only* currency code of the balance to query(USD, USDT, etc), default is USDT
@@ -2056,6 +2077,7 @@ class phemex(Exchange, ImplicitAPI):
2056
2077
  'PartiallyFilled': 'open',
2057
2078
  'Filled': 'closed',
2058
2079
  'Canceled': 'canceled',
2080
+ 'Suspended': 'canceled',
2059
2081
  '1': 'open',
2060
2082
  '2': 'canceled',
2061
2083
  '3': 'closed',
@@ -2394,8 +2416,10 @@ class phemex(Exchange, ImplicitAPI):
2394
2416
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2395
2417
  """
2396
2418
  create a trade order
2397
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
2398
- :see: https://phemex-docs.github.io/#place-order-http-put-prefered-3
2419
+
2420
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
2421
+ https://phemex-docs.github.io/#place-order-http-put-prefered-3
2422
+
2399
2423
  :param str symbol: unified symbol of the market to create an order in
2400
2424
  :param str type: 'market' or 'limit'
2401
2425
  :param str side: 'buy' or 'sell'
@@ -2523,13 +2547,10 @@ class phemex(Exchange, ImplicitAPI):
2523
2547
  request['stopLossEp'] = self.to_ep(stopLossTriggerPrice, market)
2524
2548
  stopLossTriggerPriceType = self.safe_string_2(stopLoss, 'triggerPriceType', 'slTrigger')
2525
2549
  if stopLossTriggerPriceType is not None:
2526
- if market['settle'] == 'USDT':
2527
- if (stopLossTriggerPriceType != 'ByMarkPrice') and (stopLossTriggerPriceType != 'ByLastPrice') and (stopLossTriggerPriceType != 'ByIndexPrice') and (stopLossTriggerPriceType != 'ByAskPrice') and (stopLossTriggerPriceType != 'ByBidPrice') and (stopLossTriggerPriceType != 'ByMarkPriceLimit') and (stopLossTriggerPriceType != 'ByLastPriceLimit'):
2528
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", "ByIndexPrice", "ByAskPrice", "ByBidPrice", "ByMarkPriceLimit", "ByLastPriceLimit" or "ByLastPrice"')
2529
- else:
2530
- if (stopLossTriggerPriceType != 'ByMarkPrice') and (stopLossTriggerPriceType != 'ByLastPrice'):
2531
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"')
2532
- request['slTrigger'] = stopLossTriggerPriceType
2550
+ request['slTrigger'] = self.safe_string(self.options['triggerPriceTypesMap'], stopLossTriggerPriceType, stopLossTriggerPriceType)
2551
+ slLimitPrice = self.safe_string(stopLoss, 'price')
2552
+ if slLimitPrice is not None:
2553
+ request['slPxRp'] = self.price_to_precision(symbol, slLimitPrice)
2533
2554
  if takeProfitDefined:
2534
2555
  takeProfitTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice')
2535
2556
  if takeProfitTriggerPrice is None:
@@ -2538,15 +2559,12 @@ class phemex(Exchange, ImplicitAPI):
2538
2559
  request['takeProfitRp'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
2539
2560
  else:
2540
2561
  request['takeProfitEp'] = self.to_ep(takeProfitTriggerPrice, market)
2541
- takeProfitTriggerPriceType = self.safe_string_2(stopLoss, 'triggerPriceType', 'tpTrigger')
2562
+ takeProfitTriggerPriceType = self.safe_string_2(takeProfit, 'triggerPriceType', 'tpTrigger')
2542
2563
  if takeProfitTriggerPriceType is not None:
2543
- if market['settle'] == 'USDT':
2544
- if (takeProfitTriggerPriceType != 'ByMarkPrice') and (takeProfitTriggerPriceType != 'ByLastPrice') and (takeProfitTriggerPriceType != 'ByIndexPrice') and (takeProfitTriggerPriceType != 'ByAskPrice') and (takeProfitTriggerPriceType != 'ByBidPrice') and (takeProfitTriggerPriceType != 'ByMarkPriceLimit') and (takeProfitTriggerPriceType != 'ByLastPriceLimit'):
2545
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", "ByIndexPrice", "ByAskPrice", "ByBidPrice", "ByMarkPriceLimit", "ByLastPriceLimit" or "ByLastPrice"')
2546
- else:
2547
- if (takeProfitTriggerPriceType != 'ByMarkPrice') and (takeProfitTriggerPriceType != 'ByLastPrice'):
2548
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"')
2549
- request['tpTrigger'] = takeProfitTriggerPriceType
2564
+ request['tpTrigger'] = self.safe_string(self.options['triggerPriceTypesMap'], takeProfitTriggerPriceType, takeProfitTriggerPriceType)
2565
+ tpLimitPrice = self.safe_string(takeProfit, 'price')
2566
+ if tpLimitPrice is not None:
2567
+ request['tpPxRp'] = self.price_to_precision(symbol, tpLimitPrice)
2550
2568
  if (type == 'Limit') or (type == 'StopLimit') or (type == 'LimitIfTouched'):
2551
2569
  if market['settle'] == 'USDT':
2552
2570
  request['priceRp'] = self.price_to_precision(symbol, price)
@@ -2657,7 +2675,9 @@ class phemex(Exchange, ImplicitAPI):
2657
2675
  async def edit_order(self, id: str, symbol: str, type: OrderType = None, side: OrderSide = None, amount: Num = None, price: Num = None, params={}):
2658
2676
  """
2659
2677
  edit a trade order
2660
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#amend-order-by-orderid
2678
+
2679
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#amend-order-by-orderid
2680
+
2661
2681
  :param str id: cancel order id
2662
2682
  :param str symbol: unified symbol of the market to create an order in
2663
2683
  :param str type: 'market' or 'limit'
@@ -2718,7 +2738,9 @@ class phemex(Exchange, ImplicitAPI):
2718
2738
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
2719
2739
  """
2720
2740
  cancels an open order
2721
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancel-single-order-by-orderid
2741
+
2742
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancel-single-order-by-orderid
2743
+
2722
2744
  :param str id: order id
2723
2745
  :param str symbol: unified symbol of the market the order was made in
2724
2746
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2754,7 +2776,9 @@ class phemex(Exchange, ImplicitAPI):
2754
2776
  async def cancel_all_orders(self, symbol: Str = None, params={}):
2755
2777
  """
2756
2778
  cancel all open orders in a market
2757
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancelall
2779
+
2780
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancelall
2781
+
2758
2782
  :param str symbol: unified market symbol of the market to cancel orders in
2759
2783
  :param dict [params]: extra parameters specific to the exchange API endpoint
2760
2784
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -2810,7 +2834,9 @@ class phemex(Exchange, ImplicitAPI):
2810
2834
 
2811
2835
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
2812
2836
  """
2813
- :see: https://phemex-docs.github.io/#query-orders-by-ids
2837
+
2838
+ https://phemex-docs.github.io/#query-orders-by-ids
2839
+
2814
2840
  fetches information on an order made by the user
2815
2841
  :param str id: the order id
2816
2842
  :param str symbol: unified symbol of the market the order was made in
@@ -2855,7 +2881,9 @@ class phemex(Exchange, ImplicitAPI):
2855
2881
  async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2856
2882
  """
2857
2883
  fetches information on multiple orders made by the user
2858
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
2884
+
2885
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
2886
+
2859
2887
  :param str symbol: unified market symbol of the market orders were made in
2860
2888
  :param int [since]: the earliest time in ms to fetch orders for
2861
2889
  :param int [limit]: the maximum number of order structures to retrieve
@@ -2888,9 +2916,11 @@ class phemex(Exchange, ImplicitAPI):
2888
2916
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2889
2917
  """
2890
2918
  fetch all unfilled currently open orders
2891
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
2892
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
2893
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
2919
+
2920
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
2921
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
2922
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
2923
+
2894
2924
  :param str symbol: unified market symbol
2895
2925
  :param int [since]: the earliest time in ms to fetch open orders for
2896
2926
  :param int [limit]: the maximum number of open order structures to retrieve
@@ -2927,10 +2957,12 @@ class phemex(Exchange, ImplicitAPI):
2927
2957
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2928
2958
  """
2929
2959
  fetches information on multiple closed orders made by the user
2930
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
2931
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
2932
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
2933
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
2960
+
2961
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
2962
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
2963
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
2964
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
2965
+
2934
2966
  :param str symbol: unified market symbol of the market orders were made in
2935
2967
  :param int [since]: the earliest time in ms to fetch orders for
2936
2968
  :param int [limit]: the maximum number of order structures to retrieve
@@ -3004,9 +3036,11 @@ class phemex(Exchange, ImplicitAPI):
3004
3036
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
3005
3037
  """
3006
3038
  fetch all trades made by the user
3007
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
3008
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
3009
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
3039
+
3040
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
3041
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
3042
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
3043
+
3010
3044
  :param str symbol: unified market symbol
3011
3045
  :param int [since]: the earliest time in ms to fetch trades for
3012
3046
  :param int [limit]: the maximum number of trades structures to retrieve
@@ -3406,12 +3440,14 @@ class phemex(Exchange, ImplicitAPI):
3406
3440
  async def fetch_positions(self, symbols: Strings = None, params={}):
3407
3441
  """
3408
3442
  fetch all open positions
3409
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
3410
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
3411
- :see: https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
3443
+
3444
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
3445
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
3446
+ https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
3447
+
3412
3448
  :param str[] [symbols]: list of unified market symbols
3413
3449
  :param dict [params]: extra parameters specific to the exchange API endpoint
3414
- :param str [param.method]: *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3450
+ :param str [params.method]: *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3415
3451
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
3416
3452
  """
3417
3453
  await self.load_markets()
@@ -3674,7 +3710,9 @@ class phemex(Exchange, ImplicitAPI):
3674
3710
  async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
3675
3711
  """
3676
3712
  fetch the history of funding payments paid and received on self account
3677
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#futureDataFundingFeesHist
3713
+
3714
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#futureDataFundingFeesHist
3715
+
3678
3716
  :param str symbol: unified market symbol
3679
3717
  :param int [since]: the earliest time in ms to fetch funding history for
3680
3718
  :param int [limit]: the maximum number of funding history structures to retrieve
@@ -3863,7 +3901,9 @@ class phemex(Exchange, ImplicitAPI):
3863
3901
  async def set_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3864
3902
  """
3865
3903
  Either adds or reduces margin in an isolated position in order to set the margin to a specific value
3866
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode
3904
+
3905
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode
3906
+
3867
3907
  :param str symbol: unified market symbol of the market to set margin in
3868
3908
  :param float amount: the amount to set the margin to
3869
3909
  :param dict [params]: parameters specific to the exchange API endpoint
@@ -3948,7 +3988,9 @@ class phemex(Exchange, ImplicitAPI):
3948
3988
  async def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
3949
3989
  """
3950
3990
  set hedged to True or False for a market
3951
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#switch-position-mode-synchronously
3991
+
3992
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#switch-position-mode-synchronously
3993
+
3952
3994
  :param bool hedged: set to True to use dualSidePosition
3953
3995
  :param str symbol: not used by binance setPositionMode()
3954
3996
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4080,7 +4122,8 @@ class phemex(Exchange, ImplicitAPI):
4080
4122
  # ]
4081
4123
  # },
4082
4124
  #
4083
- market = self.safe_market(None, market)
4125
+ marketId = self.safe_string(info, 'symbol')
4126
+ market = self.safe_market(marketId, market)
4084
4127
  riskLimits = (market['info']['riskLimits'])
4085
4128
  tiers = []
4086
4129
  minNotional = 0
@@ -4089,6 +4132,7 @@ class phemex(Exchange, ImplicitAPI):
4089
4132
  maxNotional = self.safe_integer(tier, 'limit')
4090
4133
  tiers.append({
4091
4134
  'tier': self.sum(i, 1),
4135
+ 'symbol': self.safe_symbol(marketId, market),
4092
4136
  'currency': market['settle'],
4093
4137
  'minNotional': minNotional,
4094
4138
  'maxNotional': maxNotional,
@@ -4136,7 +4180,9 @@ class phemex(Exchange, ImplicitAPI):
4136
4180
  async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
4137
4181
  """
4138
4182
  set the level of leverage for a market
4139
- :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage
4183
+
4184
+ https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage
4185
+
4140
4186
  :param float leverage: the rate of leverage, 100 > leverage > -100 excluding numbers between -1 to 1
4141
4187
  :param str symbol: unified market symbol
4142
4188
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4361,7 +4407,9 @@ class phemex(Exchange, ImplicitAPI):
4361
4407
  async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4362
4408
  """
4363
4409
  fetches historical funding rate prices
4364
- :see: https://phemex-docs.github.io/#query-funding-rate-history-2
4410
+
4411
+ https://phemex-docs.github.io/#query-funding-rate-history-2
4412
+
4365
4413
  :param str symbol: unified symbol of the market to fetch the funding rate history for
4366
4414
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
4367
4415
  :param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
@@ -4434,7 +4482,9 @@ class phemex(Exchange, ImplicitAPI):
4434
4482
  async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4435
4483
  """
4436
4484
  make a withdrawal
4437
- :see: https://phemex-docs.github.io/#create-withdraw-request
4485
+
4486
+ https://phemex-docs.github.io/#create-withdraw-request
4487
+
4438
4488
  :param str code: unified currency code
4439
4489
  :param float amount: the amount to withdraw
4440
4490
  :param str address: the address to withdraw to
@@ -4500,7 +4550,9 @@ class phemex(Exchange, ImplicitAPI):
4500
4550
  async def fetch_open_interest(self, symbol: str, params={}):
4501
4551
  """
4502
4552
  retrieves the open interest of a trading pair
4503
- :see: https://phemex-docs.github.io/#query-24-hours-ticker
4553
+
4554
+ https://phemex-docs.github.io/#query-24-hours-ticker
4555
+
4504
4556
  :param str symbol: unified CCXT market symbol
4505
4557
  :param dict [params]: exchange specific parameters
4506
4558
  :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure: