ccxt 4.4.11__py2.py3-none-any.whl → 4.4.13__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/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +4 -1
- ccxt/async_support/bigone.py +2 -0
- ccxt/async_support/binance.py +54 -3
- ccxt/async_support/bingx.py +84 -5
- ccxt/async_support/bitget.py +2 -0
- ccxt/async_support/bitmex.py +1 -0
- ccxt/async_support/bybit.py +4 -1
- ccxt/async_support/coinbaseinternational.py +2 -0
- ccxt/async_support/coinex.py +2 -0
- ccxt/async_support/delta.py +2 -0
- ccxt/async_support/deribit.py +2 -0
- ccxt/async_support/digifinex.py +2 -0
- ccxt/async_support/gate.py +2 -0
- ccxt/async_support/htx.py +8 -2
- ccxt/async_support/kraken.py +4 -4
- ccxt/async_support/krakenfutures.py +2 -0
- ccxt/async_support/kucoinfutures.py +2 -0
- ccxt/async_support/mexc.py +16 -4
- ccxt/async_support/okx.py +51 -20
- ccxt/async_support/oxfun.py +1 -0
- ccxt/async_support/paradex.py +1 -0
- ccxt/async_support/phemex.py +10 -3
- ccxt/async_support/poloniex.py +1 -0
- ccxt/base/exchange.py +7 -1
- ccxt/base/types.py +2 -0
- ccxt/bigone.py +2 -0
- ccxt/binance.py +54 -3
- ccxt/bingx.py +84 -5
- ccxt/bitget.py +2 -0
- ccxt/bitmex.py +1 -0
- ccxt/bybit.py +4 -1
- ccxt/coinbaseinternational.py +2 -0
- ccxt/coinex.py +2 -0
- ccxt/delta.py +2 -0
- ccxt/deribit.py +2 -0
- ccxt/digifinex.py +2 -0
- ccxt/gate.py +2 -0
- ccxt/htx.py +8 -2
- ccxt/kraken.py +4 -4
- ccxt/krakenfutures.py +2 -0
- ccxt/kucoinfutures.py +2 -0
- ccxt/mexc.py +16 -4
- ccxt/okx.py +51 -20
- ccxt/oxfun.py +1 -0
- ccxt/paradex.py +1 -0
- ccxt/phemex.py +10 -3
- ccxt/poloniex.py +1 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +72 -5
- ccxt/pro/bitfinex.py +8 -8
- ccxt/pro/krakenfutures.py +2 -0
- ccxt/pro/phemex.py +2 -0
- ccxt/pro/woo.py +69 -0
- ccxt/test/tests_async.py +31 -3
- ccxt/test/tests_helpers.py +13 -36
- ccxt/test/tests_init.py +6 -2
- ccxt/test/tests_sync.py +31 -3
- {ccxt-4.4.11.dist-info → ccxt-4.4.13.dist-info}/METADATA +4 -5
- {ccxt-4.4.11.dist-info → ccxt-4.4.13.dist-info}/RECORD +64 -64
- {ccxt-4.4.11.dist-info → ccxt-4.4.13.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.11.dist-info → ccxt-4.4.13.dist-info}/WHEEL +0 -0
- {ccxt-4.4.11.dist-info → ccxt-4.4.13.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.4.
|
5
|
+
__version__ = '4.4.13'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -1036,6 +1036,9 @@ class Exchange(BaseExchange):
|
|
1036
1036
|
async def fetch_tickers(self, symbols: Strings = None, params={}):
|
1037
1037
|
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
1038
1038
|
|
1039
|
+
async def fetch_mark_prices(self, symbols: Strings = None, params={}):
|
1040
|
+
raise NotSupported(self.id + ' fetchMarkPrices() is not supported yet')
|
1041
|
+
|
1039
1042
|
async def fetch_tickers_ws(self, symbols: Strings = None, params={}):
|
1040
1043
|
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
1041
1044
|
|
ccxt/async_support/bigone.py
CHANGED
@@ -724,6 +724,8 @@ class bigone(Exchange, ImplicitAPI):
|
|
724
724
|
'average': None,
|
725
725
|
'baseVolume': self.safe_string_2(ticker, 'volume', 'volume24h'),
|
726
726
|
'quoteVolume': self.safe_string(ticker, 'volume24hInUsd'),
|
727
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
728
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
727
729
|
'info': ticker,
|
728
730
|
}, market)
|
729
731
|
|
ccxt/async_support/binance.py
CHANGED
@@ -133,6 +133,7 @@ class binance(Exchange, ImplicitAPI):
|
|
133
133
|
'fetchMarketLeverageTiers': 'emulated',
|
134
134
|
'fetchMarkets': True,
|
135
135
|
'fetchMarkOHLCV': True,
|
136
|
+
'fetchMarkPrices': True,
|
136
137
|
'fetchMyLiquidations': True,
|
137
138
|
'fetchMySettlementHistory': True,
|
138
139
|
'fetchMyTrades': True,
|
@@ -1217,6 +1218,9 @@ class binance(Exchange, ImplicitAPI):
|
|
1217
1218
|
},
|
1218
1219
|
'option': {},
|
1219
1220
|
},
|
1221
|
+
'currencies': {
|
1222
|
+
'BNFCR': self.safe_currency_structure({'id': 'BNFCR', 'code': 'BNFCR', 'precision': self.parse_number('0.001')}),
|
1223
|
+
},
|
1220
1224
|
'commonCurrencies': {
|
1221
1225
|
'BCC': 'BCC', # kept for backward-compatibility https://github.com/ccxt/ccxt/issues/4848
|
1222
1226
|
'YOYO': 'YOYOW',
|
@@ -3715,6 +3719,18 @@ class binance(Exchange, ImplicitAPI):
|
|
3715
3719
|
return orderbook
|
3716
3720
|
|
3717
3721
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
3722
|
+
# markPrices
|
3723
|
+
#
|
3724
|
+
# {
|
3725
|
+
# "symbol": "BTCUSDT",
|
3726
|
+
# "markPrice": "11793.63104562", # mark price
|
3727
|
+
# "indexPrice": "11781.80495970", # index price
|
3728
|
+
# "estimatedSettlePrice": "11781.16138815", # Estimated Settle Price, only useful in the last hour before the settlement starts.
|
3729
|
+
# "lastFundingRate": "0.00038246", # This is the lastest estimated funding rate
|
3730
|
+
# "nextFundingTime": 1597392000000,
|
3731
|
+
# "interestRate": "0.00010000",
|
3732
|
+
# "time": 1597370495002
|
3733
|
+
# }
|
3718
3734
|
#
|
3719
3735
|
# {
|
3720
3736
|
# "symbol": "ETHBTC",
|
@@ -3818,7 +3834,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3818
3834
|
# "time":"1673899278514"
|
3819
3835
|
# }
|
3820
3836
|
#
|
3821
|
-
timestamp = self.
|
3837
|
+
timestamp = self.safe_integer_2(ticker, 'closeTime', 'time')
|
3822
3838
|
marketType = None
|
3823
3839
|
if ('time' in ticker):
|
3824
3840
|
marketType = 'contract'
|
@@ -3858,6 +3874,8 @@ class binance(Exchange, ImplicitAPI):
|
|
3858
3874
|
'average': None,
|
3859
3875
|
'baseVolume': baseVolume,
|
3860
3876
|
'quoteVolume': quoteVolume,
|
3877
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
3878
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
3861
3879
|
'info': ticker,
|
3862
3880
|
}, market)
|
3863
3881
|
|
@@ -4088,6 +4106,31 @@ class binance(Exchange, ImplicitAPI):
|
|
4088
4106
|
raise NotSupported(self.id + ' fetchTickers() does not support ' + type + ' markets yet')
|
4089
4107
|
return self.parse_tickers(response, symbols)
|
4090
4108
|
|
4109
|
+
async def fetch_mark_prices(self, symbols: Strings = None, params={}) -> Tickers:
|
4110
|
+
"""
|
4111
|
+
fetches mark prices for multiple markets
|
4112
|
+
:see: https://binance-docs.github.io/apidocs/futures/en/#mark-price
|
4113
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
4114
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4115
|
+
:param str [params.subType]: "linear" or "inverse"
|
4116
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
4117
|
+
"""
|
4118
|
+
await self.load_markets()
|
4119
|
+
symbols = self.market_symbols(symbols, None, True, True, True)
|
4120
|
+
market = self.get_market_from_symbols(symbols)
|
4121
|
+
type = None
|
4122
|
+
type, params = self.handle_market_type_and_params('fetchTickers', market, params, 'swap')
|
4123
|
+
subType = None
|
4124
|
+
subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
|
4125
|
+
response = None
|
4126
|
+
if self.is_linear(type, subType):
|
4127
|
+
response = await self.fapiPublicGetPremiumIndex(params)
|
4128
|
+
elif self.is_inverse(type, subType):
|
4129
|
+
response = await self.dapiPublicGetPremiumIndex(params)
|
4130
|
+
else:
|
4131
|
+
raise NotSupported(self.id + ' fetchMarkPrices() does not support ' + type + ' markets yet')
|
4132
|
+
return self.parse_tickers(response, symbols)
|
4133
|
+
|
4091
4134
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
4092
4135
|
# when api method = publicGetKlines or fapiPublicGetKlines or dapiPublicGetKlines
|
4093
4136
|
# [
|
@@ -5596,6 +5639,8 @@ class binance(Exchange, ImplicitAPI):
|
|
5596
5639
|
:param float [params.takeProfitPrice]: the price that a take profit order is triggered at
|
5597
5640
|
:param boolean [params.portfolioMargin]: set to True if you would like to create an order in a portfolio margin account
|
5598
5641
|
:param str [params.stopLossOrTakeProfit]: 'stopLoss' or 'takeProfit', required for spot trailing orders
|
5642
|
+
:param str [params.positionSide]: *swap and portfolio margin only* "BOTH" for one-way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
|
5643
|
+
:param bool [params.hedged]: *swap and portfolio margin only* True for hedged mode, False for one way mode, default is False
|
5599
5644
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
5600
5645
|
"""
|
5601
5646
|
await self.load_markets()
|
@@ -5681,9 +5726,9 @@ class binance(Exchange, ImplicitAPI):
|
|
5681
5726
|
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'createOrder', 'papi', 'portfolioMargin', False)
|
5682
5727
|
marginMode = None
|
5683
5728
|
marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
|
5729
|
+
reduceOnly = self.safe_bool(params, 'reduceOnly', False)
|
5684
5730
|
if (marketType == 'margin') or (marginMode is not None) or market['option']:
|
5685
5731
|
# for swap and future reduceOnly is a string that cant be sent with close position set to True or in hedge mode
|
5686
|
-
reduceOnly = self.safe_bool(params, 'reduceOnly', False)
|
5687
5732
|
params = self.omit(params, 'reduceOnly')
|
5688
5733
|
if market['option']:
|
5689
5734
|
request['reduceOnly'] = reduceOnly
|
@@ -5884,7 +5929,13 @@ class binance(Exchange, ImplicitAPI):
|
|
5884
5929
|
# remove timeInForce from params because PO is only used by self.is_post_only and it's not a valid value for Binance
|
5885
5930
|
if self.safe_string(params, 'timeInForce') == 'PO':
|
5886
5931
|
params = self.omit(params, 'timeInForce')
|
5887
|
-
|
5932
|
+
hedged = self.safe_bool(params, 'hedged', False)
|
5933
|
+
if not market['spot'] and not market['option'] and hedged:
|
5934
|
+
if reduceOnly:
|
5935
|
+
params = self.omit(params, 'reduceOnly')
|
5936
|
+
side = 'sell' if (side == 'buy') else 'buy'
|
5937
|
+
request['positionSide'] = 'LONG' if (side == 'buy') else 'SHORT'
|
5938
|
+
requestParams = self.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test', 'hedged'])
|
5888
5939
|
return self.extend(request, requestParams)
|
5889
5940
|
|
5890
5941
|
async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
ccxt/async_support/bingx.py
CHANGED
@@ -81,6 +81,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
81
81
|
'fetchMarginMode': True,
|
82
82
|
'fetchMarkets': True,
|
83
83
|
'fetchMarkOHLCV': True,
|
84
|
+
'fetchMarkPrices': True,
|
84
85
|
'fetchMyLiquidations': True,
|
85
86
|
'fetchOHLCV': True,
|
86
87
|
'fetchOpenInterest': True,
|
@@ -591,8 +592,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
591
592
|
networkList = self.safe_list(entry, 'networkList')
|
592
593
|
networks: dict = {}
|
593
594
|
fee = None
|
594
|
-
depositEnabled =
|
595
|
-
withdrawEnabled =
|
595
|
+
depositEnabled = False
|
596
|
+
withdrawEnabled = False
|
596
597
|
defaultLimits: dict = {}
|
597
598
|
for j in range(0, len(networkList)):
|
598
599
|
rawNetwork = networkList[j]
|
@@ -603,7 +604,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
603
604
|
if networkDepositEnabled:
|
604
605
|
depositEnabled = True
|
605
606
|
networkWithdrawEnabled = self.safe_bool(rawNetwork, 'withdrawEnable')
|
606
|
-
if
|
607
|
+
if networkWithdrawEnabled:
|
607
608
|
withdrawEnabled = True
|
608
609
|
limits: dict = {
|
609
610
|
'withdraw': {
|
@@ -1655,7 +1656,70 @@ class bingx(Exchange, ImplicitAPI):
|
|
1655
1656
|
tickers = self.safe_list(response, 'data')
|
1656
1657
|
return self.parse_tickers(tickers, symbols)
|
1657
1658
|
|
1659
|
+
async def fetch_mark_prices(self, symbols: Strings = None, params={}) -> Tickers:
|
1660
|
+
"""
|
1661
|
+
fetches mark prices for multiple markets
|
1662
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
|
1663
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1664
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1665
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
1666
|
+
"""
|
1667
|
+
await self.load_markets()
|
1668
|
+
market = None
|
1669
|
+
if symbols is not None:
|
1670
|
+
symbols = self.market_symbols(symbols)
|
1671
|
+
firstSymbol = self.safe_string(symbols, 0)
|
1672
|
+
if firstSymbol is not None:
|
1673
|
+
market = self.market(firstSymbol)
|
1674
|
+
subType = None
|
1675
|
+
subType, params = self.handle_sub_type_and_params('fetchMarkPrices', market, params, 'linear')
|
1676
|
+
response = None
|
1677
|
+
if subType == 'inverse':
|
1678
|
+
response = await self.cswapV1PublicGetMarketPremiumIndex(params)
|
1679
|
+
else:
|
1680
|
+
response = await self.swapV2PublicGetQuotePremiumIndex(params)
|
1681
|
+
#
|
1682
|
+
# spot and swap
|
1683
|
+
#
|
1684
|
+
# {
|
1685
|
+
# "code": 0,
|
1686
|
+
# "msg": "",
|
1687
|
+
# "timestamp": 1720647285296,
|
1688
|
+
# "data": [
|
1689
|
+
# {
|
1690
|
+
# "symbol": "SOL-USD",
|
1691
|
+
# "priceChange": "-2.418",
|
1692
|
+
# "priceChangePercent": "-1.6900%",
|
1693
|
+
# "lastPrice": "140.574",
|
1694
|
+
# "lastQty": "1",
|
1695
|
+
# "highPrice": "146.190",
|
1696
|
+
# "lowPrice": "138.586",
|
1697
|
+
# "volume": "1464648.00",
|
1698
|
+
# "quoteVolume": "102928.12",
|
1699
|
+
# "openPrice": "142.994",
|
1700
|
+
# "closeTime": "1720647284976",
|
1701
|
+
# "bidPrice": "140.573",
|
1702
|
+
# "bidQty": "372",
|
1703
|
+
# "askPrice": "140.577",
|
1704
|
+
# "askQty": "58"
|
1705
|
+
# },
|
1706
|
+
# ...
|
1707
|
+
# ]
|
1708
|
+
# }
|
1709
|
+
#
|
1710
|
+
tickers = self.safe_list(response, 'data')
|
1711
|
+
return self.parse_tickers(tickers, symbols)
|
1712
|
+
|
1658
1713
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
1714
|
+
#
|
1715
|
+
# mark price
|
1716
|
+
# {
|
1717
|
+
# "symbol": "string",
|
1718
|
+
# "lastFundingRate": "string",
|
1719
|
+
# "markPrice": "string",
|
1720
|
+
# "indexPrice": "string",
|
1721
|
+
# "nextFundingTime": "int64"
|
1722
|
+
# }
|
1659
1723
|
#
|
1660
1724
|
# spot
|
1661
1725
|
# {
|
@@ -1741,6 +1805,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1741
1805
|
'average': None,
|
1742
1806
|
'baseVolume': baseVolume,
|
1743
1807
|
'quoteVolume': quoteVolume,
|
1808
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
1809
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
1744
1810
|
'info': ticker,
|
1745
1811
|
}, market)
|
1746
1812
|
|
@@ -2458,6 +2524,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2458
2524
|
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
2459
2525
|
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
2460
2526
|
:param boolean [params.test]: *swap only* whether to use the test endpoint or not, default is False
|
2527
|
+
:param str [params.positionSide]: *contracts only* "BOTH" for one way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
|
2461
2528
|
:param boolean [params.hedged]: *swap only* whether the order is in hedged mode or one way mode
|
2462
2529
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2463
2530
|
"""
|
@@ -4184,13 +4251,25 @@ class bingx(Exchange, ImplicitAPI):
|
|
4184
4251
|
currencyId = self.safe_string(depositAddress, 'coin')
|
4185
4252
|
currency = self.safe_currency(currencyId, currency)
|
4186
4253
|
code = currency['code']
|
4187
|
-
|
4254
|
+
# the exchange API returns deposit addresses without the leading '0x' prefix
|
4255
|
+
# however, the exchange API does require the 0x prefix to withdraw
|
4256
|
+
# so we append the prefix before returning the address to the user
|
4257
|
+
# that is only if the underlying contract address has the 0x prefix
|
4258
|
+
networkCode = self.safe_string(depositAddress, 'network')
|
4259
|
+
if networkCode is not None:
|
4260
|
+
if networkCode in currency['networks']:
|
4261
|
+
network = currency['networks'][networkCode]
|
4262
|
+
contractAddress = self.safe_string(network['info'], 'contractAddress')
|
4263
|
+
if contractAddress is not None:
|
4264
|
+
if contractAddress[0] == '0' and contractAddress[1] == 'x':
|
4265
|
+
if address[0] != '0' or address[1] != 'x':
|
4266
|
+
address = '0x' + address
|
4188
4267
|
self.check_address(address)
|
4189
4268
|
return {
|
4190
4269
|
'currency': code,
|
4191
4270
|
'address': address,
|
4192
4271
|
'tag': tag,
|
4193
|
-
'network':
|
4272
|
+
'network': networkCode,
|
4194
4273
|
'info': depositAddress,
|
4195
4274
|
}
|
4196
4275
|
|
ccxt/async_support/bitget.py
CHANGED
@@ -2570,6 +2570,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2570
2570
|
'average': None,
|
2571
2571
|
'baseVolume': self.safe_string(ticker, 'baseVolume'),
|
2572
2572
|
'quoteVolume': self.safe_string(ticker, 'quoteVolume'),
|
2573
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
2573
2574
|
'info': ticker,
|
2574
2575
|
}, market)
|
2575
2576
|
|
@@ -3948,6 +3949,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3948
3949
|
:param str [params.trailingTriggerPrice]: *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
3949
3950
|
:param str [params.triggerType]: *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
3950
3951
|
:param boolean [params.oneWayMode]: *swap and future only* required to set self to True in one_way_mode and you can leave self in hedge_mode, can adjust the mode using the setPositionMode() method
|
3952
|
+
:param bool [params.hedged]: *swap and future only* True for hedged mode, False for one way mode, default is False
|
3951
3953
|
:param bool [params.reduceOnly]: True or False whether the order is reduce-only
|
3952
3954
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3953
3955
|
"""
|
ccxt/async_support/bitmex.py
CHANGED
@@ -1370,6 +1370,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1370
1370
|
'average': None,
|
1371
1371
|
'baseVolume': self.safe_string(ticker, 'homeNotional24h'),
|
1372
1372
|
'quoteVolume': self.safe_string(ticker, 'foreignNotional24h'),
|
1373
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
1373
1374
|
'info': ticker,
|
1374
1375
|
}, market)
|
1375
1376
|
|
ccxt/async_support/bybit.py
CHANGED
@@ -2054,6 +2054,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
2054
2054
|
'average': None,
|
2055
2055
|
'baseVolume': baseVolume,
|
2056
2056
|
'quoteVolume': quoteVolume,
|
2057
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
2058
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
2057
2059
|
'info': ticker,
|
2058
2060
|
}, market)
|
2059
2061
|
|
@@ -3431,7 +3433,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
3431
3433
|
:param str [params.timeInForce]: "GTC", "IOC", "FOK"
|
3432
3434
|
:param bool [params.postOnly]: True or False whether the order is post-only
|
3433
3435
|
:param bool [params.reduceOnly]: True or False whether the order is reduce-only
|
3434
|
-
:param str [params.positionIdx]: *contracts only*
|
3436
|
+
:param str [params.positionIdx]: *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
|
3437
|
+
:param bool [params.hedged]: *contracts only* True for hedged mode, False for one way mode, default is False
|
3435
3438
|
:param boolean [params.isLeverage]: *unified spot only* False then spot trading True then margin trading
|
3436
3439
|
:param str [params.tpslMode]: *contract only* 'full' or 'partial'
|
3437
3440
|
:param str [params.mmp]: *option only* market maker protection
|
@@ -1426,6 +1426,8 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
1426
1426
|
'baseVolume': None,
|
1427
1427
|
'quoteVolume': None,
|
1428
1428
|
'previousClose': None,
|
1429
|
+
'markPrice': self.safe_number(ticker, 'mark_price'),
|
1430
|
+
'indexPrice': self.safe_number(ticker, 'index_price'),
|
1429
1431
|
})
|
1430
1432
|
|
1431
1433
|
async def fetch_balance(self, params={}) -> Balances:
|
ccxt/async_support/coinex.py
CHANGED
@@ -922,6 +922,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
922
922
|
'average': None,
|
923
923
|
'baseVolume': self.safe_string(ticker, 'volume'),
|
924
924
|
'quoteVolume': None,
|
925
|
+
'markPrice': self.safe_string(ticker, 'mark_price'),
|
926
|
+
'indexPrice': self.safe_string(ticker, 'index_price'),
|
925
927
|
'info': ticker,
|
926
928
|
}, market)
|
927
929
|
|
ccxt/async_support/delta.py
CHANGED
@@ -946,6 +946,8 @@ class delta(Exchange, ImplicitAPI):
|
|
946
946
|
'average': None,
|
947
947
|
'baseVolume': self.safe_number(ticker, 'volume'),
|
948
948
|
'quoteVolume': self.safe_number(ticker, 'turnover'),
|
949
|
+
'markPrice': self.safe_number(ticker, 'mark_price'),
|
950
|
+
'indexPrice': self.safe_number(ticker, 'spot_price'),
|
949
951
|
'info': ticker,
|
950
952
|
}, market)
|
951
953
|
|
ccxt/async_support/deribit.py
CHANGED
@@ -1133,6 +1133,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
1133
1133
|
'average': None,
|
1134
1134
|
'baseVolume': None,
|
1135
1135
|
'quoteVolume': self.safe_string(stats, 'volume'),
|
1136
|
+
'markPrice': self.safe_string(ticker, 'mark_price'),
|
1137
|
+
'indexPrice': self.safe_string(ticker, 'index_price'),
|
1136
1138
|
'info': ticker,
|
1137
1139
|
}, market)
|
1138
1140
|
|
ccxt/async_support/digifinex.py
CHANGED
@@ -1164,6 +1164,8 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1164
1164
|
'average': None,
|
1165
1165
|
'baseVolume': self.safe_string_2(ticker, 'vol', 'volume_24h'),
|
1166
1166
|
'quoteVolume': self.safe_string(ticker, 'base_vol'),
|
1167
|
+
'markPrice': self.safe_string(ticker, 'mark_price'),
|
1168
|
+
'indexPrice': indexPrice,
|
1167
1169
|
'info': ticker,
|
1168
1170
|
}, market)
|
1169
1171
|
|
ccxt/async_support/gate.py
CHANGED
@@ -2515,6 +2515,8 @@ class gate(Exchange, ImplicitAPI):
|
|
2515
2515
|
'average': None,
|
2516
2516
|
'baseVolume': baseVolume,
|
2517
2517
|
'quoteVolume': quoteVolume,
|
2518
|
+
'markPrice': self.safe_string(ticker, 'mark_price'),
|
2519
|
+
'indexPrice': self.safe_string(ticker, 'index_price'),
|
2518
2520
|
'info': ticker,
|
2519
2521
|
}, market)
|
2520
2522
|
|
ccxt/async_support/htx.py
CHANGED
@@ -3482,6 +3482,12 @@ class htx(Exchange, ImplicitAPI):
|
|
3482
3482
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3483
3483
|
"""
|
3484
3484
|
fetches information on an order made by the user
|
3485
|
+
:see: https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id
|
3486
|
+
:see: https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order
|
3487
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-information-of-an-order
|
3488
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-information-of-order
|
3489
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#get-information-of-an-order
|
3490
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-information-of-an-order
|
3485
3491
|
:param str symbol: unified symbol of the market the order was made in
|
3486
3492
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3487
3493
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -4082,7 +4088,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4082
4088
|
await self.load_accounts()
|
4083
4089
|
for i in range(0, len(self.accounts)):
|
4084
4090
|
account = self.accounts[i]
|
4085
|
-
if account
|
4091
|
+
if self.safe_string(account, 'type') == 'spot':
|
4086
4092
|
accountId = self.safe_string(account, 'id')
|
4087
4093
|
if accountId is not None:
|
4088
4094
|
break
|
@@ -4737,7 +4743,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4737
4743
|
cost = self.safe_string(order, 'amount')
|
4738
4744
|
else:
|
4739
4745
|
amount = self.safe_string_2(order, 'volume', 'amount')
|
4740
|
-
cost = self.safe_string_n(order, ['filled-cash-amount', 'field-cash-amount', 'trade_turnover']) # same typo
|
4746
|
+
cost = self.safe_string_n(order, ['filled-cash-amount', 'field-cash-amount', 'trade_turnover']) # same typo here
|
4741
4747
|
filled = self.safe_string_n(order, ['filled-amount', 'field-amount', 'trade_volume']) # typo in their API, filled amount
|
4742
4748
|
price = self.safe_string_2(order, 'price', 'order_price')
|
4743
4749
|
feeCost = self.safe_string_2(order, 'filled-fees', 'field-fees') # typo in their API, filled feeSide
|
ccxt/async_support/kraken.py
CHANGED
@@ -1740,7 +1740,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
1740
1740
|
request['volume'] = self.cost_to_precision(symbol, cost)
|
1741
1741
|
extendedOflags = flags + ',viqc' if (flags is not None) else 'viqc'
|
1742
1742
|
request['oflags'] = extendedOflags
|
1743
|
-
elif isLimitOrder and not isTrailingAmountOrder:
|
1743
|
+
elif isLimitOrder and not isTrailingAmountOrder and not isTrailingPercentOrder:
|
1744
1744
|
request['price'] = self.price_to_precision(symbol, price)
|
1745
1745
|
reduceOnly = self.safe_bool_2(params, 'reduceOnly', 'reduce_only')
|
1746
1746
|
if isStopLossOrTakeProfitTrigger:
|
@@ -1760,8 +1760,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
1760
1760
|
request['price2'] = self.price_to_precision(symbol, price)
|
1761
1761
|
elif isTrailingAmountOrder or isTrailingPercentOrder:
|
1762
1762
|
trailingPercentString = None
|
1763
|
-
if
|
1764
|
-
trailingPercentString = trailingPercent if (trailingPercent.endswith('%')) else '+' +
|
1763
|
+
if trailingPercent is not None:
|
1764
|
+
trailingPercentString = ('+' + trailingPercent) if (trailingPercent.endswith('%')) else ('+' + trailingPercent + '%')
|
1765
1765
|
trailingAmountString = '+' + trailingAmount if (trailingAmount is not None) else None # must use + for self
|
1766
1766
|
offset = self.safe_string(params, 'offset', '-') # can use + or - for self
|
1767
1767
|
trailingLimitAmountString = offset + self.number_to_string(trailingLimitAmount) if (trailingLimitAmount is not None) else None
|
@@ -1770,7 +1770,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
1770
1770
|
if isLimitOrder or (trailingLimitAmount is not None) or (trailingLimitPercent is not None):
|
1771
1771
|
request['ordertype'] = 'trailing-stop-limit'
|
1772
1772
|
if trailingLimitPercent is not None:
|
1773
|
-
trailingLimitPercentString = trailingLimitPercent if (trailingLimitPercent.endswith('%')) else (
|
1773
|
+
trailingLimitPercentString = (offset + trailingLimitPercent) if (trailingLimitPercent.endswith('%')) else (offset + trailingLimitPercent + '%')
|
1774
1774
|
request['price'] = trailingPercentString
|
1775
1775
|
request['price2'] = trailingLimitPercentString
|
1776
1776
|
elif trailingLimitAmount is not None:
|
@@ -611,6 +611,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
611
611
|
'average': average,
|
612
612
|
'baseVolume': baseVolume,
|
613
613
|
'quoteVolume': quoteVolume,
|
614
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
615
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
614
616
|
'info': ticker,
|
615
617
|
})
|
616
618
|
|
@@ -944,6 +944,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
944
944
|
'average': None,
|
945
945
|
'baseVolume': self.safe_string(ticker, 'volumeOf24h'),
|
946
946
|
'quoteVolume': self.safe_string(ticker, 'turnoverOf24h'),
|
947
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
948
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
947
949
|
'info': ticker,
|
948
950
|
}, market)
|
949
951
|
|
ccxt/async_support/mexc.py
CHANGED
@@ -2055,6 +2055,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
2055
2055
|
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2056
2056
|
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2057
2057
|
:param bool [params.reduceOnly]: *contract only* indicates if self order is to reduce the size of a position
|
2058
|
+
:param bool [params.hedged]: *swap only* True for hedged mode, False for one way mode, default is False
|
2058
2059
|
*
|
2059
2060
|
* EXCHANGE SPECIFIC PARAMETERS
|
2060
2061
|
:param int [params.leverage]: *contract only* leverage is necessary on isolated margin
|
@@ -2180,6 +2181,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
2180
2181
|
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2181
2182
|
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2182
2183
|
:param bool [params.reduceOnly]: indicates if self order is to reduce the size of a position
|
2184
|
+
:param bool [params.hedged]: *swap only* True for hedged mode, False for one way mode, default is False
|
2183
2185
|
*
|
2184
2186
|
* EXCHANGE SPECIFIC PARAMETERS
|
2185
2187
|
:param int [params.leverage]: leverage is necessary on isolated margin
|
@@ -2247,15 +2249,25 @@ class mexc(Exchange, ImplicitAPI):
|
|
2247
2249
|
if leverage is None:
|
2248
2250
|
raise ArgumentsRequired(self.id + ' createSwapOrder() requires a leverage parameter for isolated margin orders')
|
2249
2251
|
reduceOnly = self.safe_bool(params, 'reduceOnly', False)
|
2250
|
-
|
2251
|
-
|
2252
|
+
hedged = self.safe_bool(params, 'hedged', False)
|
2253
|
+
sideInteger = None
|
2254
|
+
if hedged:
|
2255
|
+
if reduceOnly:
|
2256
|
+
params = self.omit(params, 'reduceOnly') # hedged mode does not accept self parameter
|
2257
|
+
side = 'sell' if (side == 'buy') else 'buy'
|
2258
|
+
sideInteger = 1 if (side == 'buy') else 3
|
2259
|
+
request['positionMode'] = 1
|
2252
2260
|
else:
|
2253
|
-
|
2261
|
+
if reduceOnly:
|
2262
|
+
sideInteger = 2 if (side == 'buy') else 4
|
2263
|
+
else:
|
2264
|
+
sideInteger = 1 if (side == 'buy') else 3
|
2265
|
+
request['side'] = sideInteger
|
2254
2266
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'externalOid')
|
2255
2267
|
if clientOrderId is not None:
|
2256
2268
|
request['externalOid'] = clientOrderId
|
2257
2269
|
stopPrice = self.safe_number_2(params, 'triggerPrice', 'stopPrice')
|
2258
|
-
params = self.omit(params, ['clientOrderId', 'externalOid', 'postOnly', 'stopPrice', 'triggerPrice'])
|
2270
|
+
params = self.omit(params, ['clientOrderId', 'externalOid', 'postOnly', 'stopPrice', 'triggerPrice', 'hedged'])
|
2259
2271
|
response = None
|
2260
2272
|
if stopPrice:
|
2261
2273
|
request['triggerPrice'] = self.price_to_precision(symbol, stopPrice)
|