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.
- ccxt/__init__.py +1 -1
- ccxt/ace.py +36 -12
- ccxt/alpaca.py +62 -22
- ccxt/ascendex.py +65 -30
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +36 -12
- ccxt/async_support/alpaca.py +62 -22
- ccxt/async_support/ascendex.py +65 -30
- ccxt/async_support/base/exchange.py +3 -3
- ccxt/async_support/base/ws/aiohttp_client.py +25 -3
- ccxt/async_support/bigone.py +71 -27
- ccxt/async_support/binance.py +555 -323
- ccxt/async_support/bingx.py +208 -108
- ccxt/async_support/bit2c.py +34 -12
- ccxt/async_support/bitbank.py +42 -14
- ccxt/async_support/bitbns.py +17 -9
- ccxt/async_support/bitfinex.py +68 -24
- ccxt/async_support/bitfinex2.py +116 -44
- ccxt/async_support/bitflyer.py +54 -18
- ccxt/async_support/bitget.py +277 -145
- ccxt/async_support/bithumb.py +39 -14
- ccxt/async_support/bitmart.py +145 -79
- ccxt/async_support/bitmex.py +90 -30
- ccxt/async_support/bitopro.py +66 -22
- ccxt/async_support/bitrue.py +109 -57
- ccxt/async_support/bitso.py +55 -19
- ccxt/async_support/bitstamp.py +84 -36
- ccxt/async_support/bitteam.py +51 -17
- ccxt/async_support/bitvavo.py +57 -22
- ccxt/async_support/bl3p.py +26 -10
- ccxt/async_support/blockchaincom.py +63 -21
- ccxt/async_support/blofin.py +95 -38
- ccxt/async_support/btcalpha.py +48 -16
- ccxt/async_support/btcbox.py +27 -9
- ccxt/async_support/btcmarkets.py +57 -19
- ccxt/async_support/btcturk.py +36 -12
- ccxt/async_support/bybit.py +251 -95
- ccxt/async_support/cex.py +65 -22
- ccxt/async_support/coinbase.py +138 -56
- ccxt/async_support/coinbaseexchange.py +76 -28
- ccxt/async_support/coinbaseinternational.py +75 -27
- ccxt/async_support/coincatch.py +191 -97
- ccxt/async_support/coincheck.py +33 -11
- ccxt/async_support/coinex.py +212 -101
- ccxt/async_support/coinlist.py +87 -30
- ccxt/async_support/coinmate.py +55 -24
- ccxt/async_support/coinmetro.py +52 -18
- ccxt/async_support/coinone.py +27 -10
- ccxt/async_support/coinsph.py +73 -27
- ccxt/async_support/coinspot.py +25 -9
- ccxt/async_support/cryptocom.py +103 -38
- ccxt/async_support/currencycom.py +70 -23
- ccxt/async_support/delta.py +90 -30
- ccxt/async_support/deribit.py +131 -50
- ccxt/async_support/digifinex.py +114 -51
- ccxt/async_support/exmo.py +104 -45
- ccxt/async_support/gate.py +313 -157
- ccxt/async_support/gemini.py +57 -20
- ccxt/async_support/hashkey.py +151 -66
- ccxt/async_support/hitbtc.py +157 -74
- ccxt/async_support/hollaex.py +76 -25
- ccxt/async_support/htx.py +297 -240
- ccxt/async_support/huobijp.py +1 -0
- ccxt/async_support/hyperliquid.py +94 -38
- ccxt/async_support/idex.py +73 -24
- ccxt/async_support/independentreserve.py +12 -5
- ccxt/async_support/indodax.py +54 -17
- ccxt/async_support/kraken.py +108 -36
- ccxt/async_support/krakenfutures.py +88 -34
- ccxt/async_support/kucoin.py +214 -110
- ccxt/async_support/kucoinfutures.py +209 -64
- ccxt/async_support/kuna.py +80 -39
- ccxt/async_support/latoken.py +70 -33
- ccxt/async_support/lbank.py +89 -38
- ccxt/async_support/luno.py +54 -19
- ccxt/async_support/lykke.py +54 -19
- ccxt/async_support/mercado.py +1 -0
- ccxt/async_support/mexc.py +226 -108
- ccxt/async_support/ndax.py +58 -19
- ccxt/async_support/novadax.py +67 -22
- ccxt/async_support/oceanex.py +58 -19
- ccxt/async_support/okcoin.py +81 -38
- ccxt/async_support/okx.py +270 -109
- ccxt/async_support/onetrading.py +3 -1
- ccxt/async_support/oxfun.py +95 -36
- ccxt/async_support/p2b.py +49 -23
- ccxt/async_support/paradex.py +75 -27
- ccxt/async_support/paymium.py +31 -11
- ccxt/async_support/phemex.py +108 -56
- ccxt/async_support/poloniex.py +80 -30
- ccxt/async_support/poloniexfutures.py +72 -30
- ccxt/async_support/probit.py +64 -22
- ccxt/async_support/timex.py +58 -19
- ccxt/async_support/tokocrypto.py +63 -22
- ccxt/async_support/tradeogre.py +7 -2
- ccxt/async_support/upbit.py +72 -25
- ccxt/async_support/vertex.py +74 -28
- ccxt/async_support/wavesexchange.py +32 -8
- ccxt/async_support/wazirx.py +51 -17
- ccxt/async_support/whitebit.py +105 -41
- ccxt/async_support/woo.py +162 -65
- ccxt/async_support/woofipro.py +119 -50
- ccxt/async_support/xt.py +150 -73
- ccxt/async_support/yobit.py +49 -16
- ccxt/async_support/zaif.py +30 -10
- ccxt/async_support/zonda.py +46 -16
- ccxt/base/exchange.py +47 -35
- ccxt/base/types.py +1 -0
- ccxt/bigone.py +71 -27
- ccxt/binance.py +555 -323
- ccxt/bingx.py +208 -108
- ccxt/bit2c.py +34 -12
- ccxt/bitbank.py +42 -14
- ccxt/bitbns.py +17 -9
- ccxt/bitfinex.py +68 -24
- ccxt/bitfinex2.py +116 -44
- ccxt/bitflyer.py +54 -18
- ccxt/bitget.py +277 -145
- ccxt/bithumb.py +39 -14
- ccxt/bitmart.py +145 -79
- ccxt/bitmex.py +90 -30
- ccxt/bitopro.py +66 -22
- ccxt/bitrue.py +109 -57
- ccxt/bitso.py +55 -19
- ccxt/bitstamp.py +84 -36
- ccxt/bitteam.py +51 -17
- ccxt/bitvavo.py +57 -22
- ccxt/bl3p.py +26 -10
- ccxt/blockchaincom.py +63 -21
- ccxt/blofin.py +95 -38
- ccxt/btcalpha.py +48 -16
- ccxt/btcbox.py +27 -9
- ccxt/btcmarkets.py +57 -19
- ccxt/btcturk.py +36 -12
- ccxt/bybit.py +251 -95
- ccxt/cex.py +65 -22
- ccxt/coinbase.py +138 -56
- ccxt/coinbaseexchange.py +76 -28
- ccxt/coinbaseinternational.py +75 -27
- ccxt/coincatch.py +191 -97
- ccxt/coincheck.py +33 -11
- ccxt/coinex.py +212 -101
- ccxt/coinlist.py +87 -30
- ccxt/coinmate.py +55 -24
- ccxt/coinmetro.py +52 -18
- ccxt/coinone.py +27 -10
- ccxt/coinsph.py +73 -27
- ccxt/coinspot.py +25 -9
- ccxt/cryptocom.py +103 -38
- ccxt/currencycom.py +70 -23
- ccxt/delta.py +90 -30
- ccxt/deribit.py +131 -50
- ccxt/digifinex.py +114 -51
- ccxt/exmo.py +104 -45
- ccxt/gate.py +313 -157
- ccxt/gemini.py +57 -20
- ccxt/hashkey.py +151 -66
- ccxt/hitbtc.py +157 -74
- ccxt/hollaex.py +76 -25
- ccxt/htx.py +297 -240
- ccxt/huobijp.py +1 -0
- ccxt/hyperliquid.py +94 -38
- ccxt/idex.py +73 -24
- ccxt/independentreserve.py +12 -5
- ccxt/indodax.py +54 -17
- ccxt/kraken.py +108 -36
- ccxt/krakenfutures.py +88 -34
- ccxt/kucoin.py +214 -110
- ccxt/kucoinfutures.py +209 -64
- ccxt/kuna.py +80 -39
- ccxt/latoken.py +70 -33
- ccxt/lbank.py +89 -38
- ccxt/luno.py +54 -19
- ccxt/lykke.py +54 -19
- ccxt/mercado.py +1 -0
- ccxt/mexc.py +226 -108
- ccxt/ndax.py +58 -19
- ccxt/novadax.py +67 -22
- ccxt/oceanex.py +58 -19
- ccxt/okcoin.py +81 -38
- ccxt/okx.py +270 -109
- ccxt/onetrading.py +3 -1
- ccxt/oxfun.py +95 -36
- ccxt/p2b.py +49 -23
- ccxt/paradex.py +75 -27
- ccxt/paymium.py +31 -11
- ccxt/phemex.py +108 -56
- ccxt/poloniex.py +80 -30
- ccxt/poloniexfutures.py +72 -30
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +15 -5
- ccxt/pro/ascendex.py +18 -6
- ccxt/pro/binance.py +204 -123
- ccxt/pro/bingx.py +44 -24
- ccxt/pro/bitfinex.py +13 -5
- ccxt/pro/bitget.py +76 -37
- ccxt/pro/bithumb.py +12 -4
- ccxt/pro/bitmart.py +44 -20
- ccxt/pro/bitmex.py +42 -14
- ccxt/pro/bitopro.py +15 -5
- ccxt/pro/bitrue.py +7 -3
- ccxt/pro/bitvavo.py +97 -62
- ccxt/pro/blockchaincom.py +18 -6
- ccxt/pro/blofin.py +36 -12
- ccxt/pro/bybit.py +100 -42
- ccxt/pro/cex.py +48 -16
- ccxt/pro/coinbase.py +32 -12
- ccxt/pro/coinbaseexchange.py +1 -1
- ccxt/pro/coinbaseinternational.py +34 -14
- ccxt/pro/coincatch.py +54 -19
- ccxt/pro/coincheck.py +6 -2
- ccxt/pro/coinex.py +40 -20
- ccxt/pro/coinone.py +9 -3
- ccxt/pro/cryptocom.py +71 -27
- ccxt/pro/deribit.py +36 -12
- ccxt/pro/exmo.py +10 -4
- ccxt/pro/gate.py +65 -31
- ccxt/pro/gemini.py +21 -7
- ccxt/pro/hashkey.py +27 -9
- ccxt/pro/hitbtc.py +61 -37
- ccxt/pro/hollaex.py +15 -5
- ccxt/pro/htx.py +39 -21
- ccxt/pro/hyperliquid.py +41 -14
- ccxt/pro/kraken.py +49 -17
- ccxt/pro/krakenfutures.py +47 -24
- ccxt/pro/kucoin.py +60 -31
- ccxt/pro/kucoinfutures.py +41 -19
- ccxt/pro/lbank.py +27 -9
- ccxt/pro/luno.py +3 -1
- ccxt/pro/mexc.py +36 -19
- ccxt/pro/ndax.py +12 -4
- ccxt/pro/okcoin.py +18 -6
- ccxt/pro/okx.py +76 -28
- ccxt/pro/onetrading.py +21 -7
- ccxt/pro/oxfun.py +54 -20
- ccxt/pro/p2b.py +23 -11
- ccxt/pro/paradex.py +12 -4
- ccxt/pro/phemex.py +31 -19
- ccxt/pro/poloniex.py +50 -22
- ccxt/pro/poloniexfutures.py +17 -7
- ccxt/pro/probit.py +18 -6
- ccxt/pro/upbit.py +25 -9
- ccxt/pro/vertex.py +20 -6
- ccxt/pro/wazirx.py +21 -7
- ccxt/pro/whitebit.py +25 -9
- ccxt/pro/woo.py +32 -12
- ccxt/pro/woofipro.py +35 -13
- ccxt/pro/xt.py +46 -26
- ccxt/probit.py +64 -22
- ccxt/timex.py +58 -19
- ccxt/tokocrypto.py +63 -22
- ccxt/tradeogre.py +7 -2
- ccxt/upbit.py +72 -25
- ccxt/vertex.py +74 -28
- ccxt/wavesexchange.py +32 -8
- ccxt/wazirx.py +51 -17
- ccxt/whitebit.py +105 -41
- ccxt/woo.py +162 -65
- ccxt/woofipro.py +119 -50
- ccxt/xt.py +150 -73
- ccxt/yobit.py +49 -16
- ccxt/zaif.py +30 -10
- ccxt/zonda.py +46 -16
- {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/METADATA +11 -5
- {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/RECORD +268 -268
- {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/WHEEL +0 -0
- {ccxt-4.4.30.dist-info → ccxt-4.4.32.dist-info}/top_level.txt +0 -0
ccxt/phemex.py
CHANGED
@@ -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
|
def fetch_markets(self, params={}) -> List[Market]:
|
755
762
|
"""
|
756
763
|
retrieves data on all markets for phemex
|
757
|
-
|
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
|
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
|
-
|
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
|
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
|
-
|
1204
|
-
|
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
|
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
|
-
|
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
|
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
|
-
|
1437
|
-
|
1438
|
-
|
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
|
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
|
-
|
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
|
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
|
-
|
1890
|
-
|
1891
|
-
|
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
|
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
|
-
|
2398
|
-
|
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
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
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(
|
2562
|
+
takeProfitTriggerPriceType = self.safe_string_2(takeProfit, 'triggerPriceType', 'tpTrigger')
|
2542
2563
|
if takeProfitTriggerPriceType is not None:
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
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
|
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
|
-
|
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
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2719
2739
|
"""
|
2720
2740
|
cancels an open order
|
2721
|
-
|
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
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
2755
2777
|
"""
|
2756
2778
|
cancel all open orders in a market
|
2757
|
-
|
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
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
2812
2836
|
"""
|
2813
|
-
|
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
|
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
|
-
|
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
|
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
|
-
|
2892
|
-
|
2893
|
-
|
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
|
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
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
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
|
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
|
-
|
3008
|
-
|
3009
|
-
|
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
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
3407
3441
|
"""
|
3408
3442
|
fetch all open positions
|
3409
|
-
|
3410
|
-
|
3411
|
-
|
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 [
|
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
|
self.load_markets()
|
@@ -3674,7 +3710,9 @@ class phemex(Exchange, ImplicitAPI):
|
|
3674
3710
|
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
|
-
|
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
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
4137
4181
|
"""
|
4138
4182
|
set the level of leverage for a market
|
4139
|
-
|
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
|
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
|
-
|
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
|
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
4435
4483
|
"""
|
4436
4484
|
make a withdrawal
|
4437
|
-
|
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
|
def fetch_open_interest(self, symbol: str, params={}):
|
4501
4551
|
"""
|
4502
4552
|
retrieves the open interest of a trading pair
|
4503
|
-
|
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:
|