ccxt
ccxt copied to clipboard
Average price not included in BingX order
Operating System
Ubuntu 20.04.5 LTS
Programming Languages
Python
CCXT Version
4.2.51
Description
Average price not included in BingX order ('average': None). This is important, especially for a market order.
{'info': {'symbol': 'NEXA-USDT', 'orderId': '1762393630149869568', 'transactTime': '1709022359774', 'price': '0.00000752', 'stopPrice': '0', 'origQty': '3094794', 'executedQty': '3057843', 'cummulativeQuoteQty': '23.349689148', 'status': 'FILLED', 'type': 'MARKET', 'side': 'SELL', 'clientOrderID': ''}, 'id': '1762393630149869568', 'clientOrderId': None, 'symbol': 'NEXA/USDT', 'timestamp': 1709022359774, 'datetime': '2024-02-27T08:25:59.774Z', 'lastTradeTimestamp': None, 'lastUpdateTimestamp': None, 'type': 'market', 'timeInForce': 'IOC', 'postOnly': None, 'side': 'sell', 'price': 7.52e-06, 'stopPrice': 0.0, 'triggerPrice': 0.0, 'stopLossPrice': None, 'takeProfitPrice': None, 'average': None, 'cost': 22.99497936, 'amount': 3094794.0, 'filled': 3057843.0, 'remaining': 36951.0, 'status': 'closed', 'fee': {'currency': 'USDT', 'cost': None}, 'trades': [], 'reduceOnly': None, 'fees': [{'currency': 'USDT', 'cost': None}]}
Code
order = await bingx.create_market_order(symbol, side, amount, end_price)
Hi @grozz97
It seems we need to calculate manually. Is average price 23.349689148/3057843 = 0.000007636 in that order?
@sc0Vu
In this example there was one transaction. I think it should be like this: average = price. But if there were several transactions, then apparently you will have to calculate the average price.
The exchange does not provide the average price for an order?
@grozz97
Can you retrieve average price with fetchClosedOrders or watchOrders? Usually, exchange won't return executed price when create order. Is supposed to be async on exchange side? Would they send order to match engine and write result in db?
@sc0Vu
We are talking about a market order. It is immediately executed and closed upon creation. For example, this method (create_market_order()) for other exchanges (gateio, mexc, coinex) always returns the correct "average" field.
@grozz97 I think you're right, and exchange don't provide average (the info object is the response.
the average field should be present, also cost field has been added.
this issue is going to be closed now, if any further issues, feel free to re-open