ccxt 4.3.29__py2.py3-none-any.whl → 4.3.30__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/aiohttp_client.py +1 -0
- ccxt/async_support/base/ws/future.py +27 -29
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/coinex.py +254 -307
- ccxt/async_support/whitebit.py +43 -3
- ccxt/base/exchange.py +5 -1
- ccxt/bingx.py +1 -1
- ccxt/coinex.py +254 -307
- ccxt/pro/__init__.py +1 -1
- ccxt/whitebit.py +43 -3
- {ccxt-4.3.29.dist-info → ccxt-4.3.30.dist-info}/METADATA +4 -4
- {ccxt-4.3.29.dist-info → ccxt-4.3.30.dist-info}/RECORD +17 -17
- {ccxt-4.3.29.dist-info → ccxt-4.3.30.dist-info}/WHEEL +0 -0
- {ccxt-4.3.29.dist-info → ccxt-4.3.30.dist-info}/top_level.txt +0 -0
ccxt/async_support/whitebit.py
CHANGED
@@ -45,6 +45,9 @@ class whitebit(Exchange, ImplicitAPI):
|
|
45
45
|
'cancelAllOrdersAfter': True,
|
46
46
|
'cancelOrder': True,
|
47
47
|
'cancelOrders': False,
|
48
|
+
'createMarketBuyOrderWithCost': True,
|
49
|
+
'createMarketOrderWithCost': False,
|
50
|
+
'createMarketSellOrderWithCost': False,
|
48
51
|
'createOrder': True,
|
49
52
|
'createStopLimitOrder': True,
|
50
53
|
'createStopMarketOrder': True,
|
@@ -1162,6 +1165,29 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1162
1165
|
#
|
1163
1166
|
return self.safe_integer(response, 'time')
|
1164
1167
|
|
1168
|
+
async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
1169
|
+
"""
|
1170
|
+
create a market order by providing the symbol, side and cost
|
1171
|
+
:param str symbol: unified symbol of the market to create an order in
|
1172
|
+
:param str side: 'buy' or 'sell'
|
1173
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1174
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1175
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1176
|
+
"""
|
1177
|
+
params['cost'] = cost
|
1178
|
+
# only buy side is supported
|
1179
|
+
return await self.create_order(symbol, 'market', side, 0, None, params)
|
1180
|
+
|
1181
|
+
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}) -> Order:
|
1182
|
+
"""
|
1183
|
+
create a market buy order by providing the symbol and cost
|
1184
|
+
:param str symbol: unified symbol of the market to create an order in
|
1185
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1186
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1187
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1188
|
+
"""
|
1189
|
+
return await self.create_market_order_with_cost(symbol, 'buy', cost, params)
|
1190
|
+
|
1165
1191
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1166
1192
|
"""
|
1167
1193
|
create a trade order
|
@@ -1176,6 +1202,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1176
1202
|
:param float amount: how much of currency you want to trade in units of base currency
|
1177
1203
|
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
1178
1204
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1205
|
+
:param float [params.cost]: *market orders only* the cost of the order in units of the base currency
|
1179
1206
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1180
1207
|
"""
|
1181
1208
|
await self.load_markets()
|
@@ -1183,8 +1210,15 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1183
1210
|
request = {
|
1184
1211
|
'market': market['id'],
|
1185
1212
|
'side': side,
|
1186
|
-
'amount': self.amount_to_precision(symbol, amount),
|
1187
1213
|
}
|
1214
|
+
cost = None
|
1215
|
+
cost, params = self.handle_param_string(params, 'cost')
|
1216
|
+
if cost is not None:
|
1217
|
+
if (side != 'buy') or (type != 'market'):
|
1218
|
+
raise InvalidOrder(self.id + ' createOrder() cost is only supported for market buy orders')
|
1219
|
+
request['amount'] = self.cost_to_precision(symbol, cost)
|
1220
|
+
else:
|
1221
|
+
request['amount'] = self.amount_to_precision(symbol, amount)
|
1188
1222
|
clientOrderId = self.safe_string_2(params, 'clOrdId', 'clientOrderId')
|
1189
1223
|
if clientOrderId is None:
|
1190
1224
|
brokerId = self.safe_string(self.options, 'brokerId')
|
@@ -1232,7 +1266,10 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1232
1266
|
if useCollateralEndpoint:
|
1233
1267
|
response = await self.v4PrivatePostOrderCollateralMarket(self.extend(request, params))
|
1234
1268
|
else:
|
1235
|
-
|
1269
|
+
if cost is not None:
|
1270
|
+
response = await self.v4PrivatePostOrderMarket(self.extend(request, params))
|
1271
|
+
else:
|
1272
|
+
response = await self.v4PrivatePostOrderStockMarket(self.extend(request, params))
|
1236
1273
|
return self.parse_order(response)
|
1237
1274
|
|
1238
1275
|
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
@@ -1601,6 +1638,9 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1601
1638
|
stopPrice = self.safe_number(order, 'activation_price')
|
1602
1639
|
orderId = self.safe_string_2(order, 'orderId', 'id')
|
1603
1640
|
type = self.safe_string(order, 'type')
|
1641
|
+
orderType = self.parse_order_type(type)
|
1642
|
+
if orderType == 'market':
|
1643
|
+
remaining = None
|
1604
1644
|
amount = self.safe_string(order, 'amount')
|
1605
1645
|
cost = self.safe_string(order, 'dealMoney')
|
1606
1646
|
if (side == 'buy') and ((type == 'market') or (type == 'stop market')):
|
@@ -1627,7 +1667,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1627
1667
|
'status': None,
|
1628
1668
|
'side': side,
|
1629
1669
|
'price': price,
|
1630
|
-
'type':
|
1670
|
+
'type': orderType,
|
1631
1671
|
'stopPrice': stopPrice,
|
1632
1672
|
'triggerPrice': stopPrice,
|
1633
1673
|
'amount': amount,
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.30'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -5712,6 +5712,8 @@ class Exchange(object):
|
|
5712
5712
|
|
5713
5713
|
def parse_margin_modes(self, response: List[object], symbols: List[str] = None, symbolKey: Str = None, marketType: MarketType = None):
|
5714
5714
|
marginModeStructures = {}
|
5715
|
+
if marketType is None:
|
5716
|
+
marketType = 'swap' # default to swap
|
5715
5717
|
for i in range(0, len(response)):
|
5716
5718
|
info = response[i]
|
5717
5719
|
marketId = self.safe_string(info, symbolKey)
|
@@ -5725,6 +5727,8 @@ class Exchange(object):
|
|
5725
5727
|
|
5726
5728
|
def parse_leverages(self, response: List[object], symbols: List[str] = None, symbolKey: Str = None, marketType: MarketType = None):
|
5727
5729
|
leverageStructures = {}
|
5730
|
+
if marketType is None:
|
5731
|
+
marketType = 'swap' # default to swap
|
5728
5732
|
for i in range(0, len(response)):
|
5729
5733
|
info = response[i]
|
5730
5734
|
marketId = self.safe_string(info, symbolKey)
|
ccxt/bingx.py
CHANGED
@@ -2389,7 +2389,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2389
2389
|
'stopLossPrice': stopLossPrice,
|
2390
2390
|
'takeProfitPrice': takeProfitPrice,
|
2391
2391
|
'average': self.safe_string_2(order, 'avgPrice', 'ap'),
|
2392
|
-
'cost':
|
2392
|
+
'cost': self.safe_string(order, 'cummulativeQuoteQty'),
|
2393
2393
|
'amount': self.safe_string_n(order, ['origQty', 'q', 'quantity']),
|
2394
2394
|
'filled': self.safe_string_2(order, 'executedQty', 'z'),
|
2395
2395
|
'remaining': None,
|