cex.io missing price & amount for market orders
See original GitHub issue- OS: Linux
- Programming Language version: python 3.6
- CCXT version: 1.18.361
- Exchange: cex.io
- Method: fetchClosedOrders
I’m fetching my trade history on cex.io. I noticed that many orderes with status “closed” have price: null and amount: 0. I thought ok if price is null (market order: makes sense) then I could derive it using the amount * cost… but the amount is also to 0 in such cases, and this is a bug.
See e.g. here the response of one these not parsed properly orders:
{
"id": "7609054087",
"datetime": "2018-11-19T19:26:06.461Z",
"timestamp": 1542655566461,
"lastTradeTimestamp": null,
"status": "closed",
"symbol": "BTC/USD",
"type": null,
"side": "buy",
"price": null,
"cost": 249.36,
"amount": 0.0,
"filled": 0.0,
"remaining": 0.0,
"trades": null,
"fee": {
"currency": "USD",
"rate": 0.0025,
"cost": 0.63
},
"info": {
"id": "7609054087",
"type": "buy",
"time": "2018-11-19T19:26:06.461Z",
"lastTxTime": "2018-11-19T19:26:06.461Z",
"lastTx": "7609054097",
"pos": null,
"status": "d",
"symbol1": "BTC",
"symbol2": "USD",
"amount": "0.00000000",
"amount2": "250.00",
"remains": "0.00000000",
"tfa:USD": "0.63",
"tta:USD": "249.36",
"a:BTC:cds": "0.04982417",
"a:USD:cds": "250.00",
"f:USD:cds": "0.63",
"tradingFeeTaker": "0.25",
"tradingFeeUserVolumeAmount": "19111256",
"orderId": "7609054087"
}
}
In the cex.io ui the order looks like this:
Unluckily via API they don’t provide the price, but the “filled” amount should be used to set the amount. See in the info
property with the original response:
"a:BTC:cds": "0.04982417",
So, once you got the amount, also the price should be set with this calculation: amount_filled / cost… which in my case -> 250 / 0.04982417 = 5017.645050585
But cex.io shows Avg. Execution price
: 5004.8
So I wonder what’s going on here. Either I calculated wrongly or cex.io doesn’t show data correctly. 5004 vs 5017 is quite a big difference…
Also, the parsing is not done properly for filled & amount, as these values should be always positive, but I noticed in many cases (for sell orders, seems this happens for market orders where the price is missing) that they are negative. See e.g. here:
{
"id": "7669027383",
"datetime": "2018-11-26T12:19:30.777Z",
"timestamp": 1543234770777,
"lastTradeTimestamp": null,
"status": "closed",
"symbol": "XLM/USD",
"type": null,
"side": "sell",
"price": null,
"cost": 34.41,
"amount": -200.0,
"filled": -200.0,
"remaining": 0.0,
"trades": null,
"fee": {
"currency": "USD",
"rate": 0.0025,
"cost": 0.09
},
"info": {
"id": "7669027383",
"type": "sell",
"time": "2018-11-26T12:19:30.777Z",
"lastTxTime": "2018-11-26T12:19:30.777Z",
"lastTx": "7669027411",
"pos": null,
"status": "d",
"symbol1": "XLM",
"symbol2": "USD",
"amount": "-200.00000000",
"remains": "0.0000000",
"tfa:USD": "0.09",
"tta:USD": "34.41",
"a:USD:cds": "34.41",
"a:XLM:cds": "200.0000000",
"f:USD:cds": "0.09",
"tradingFeeTaker": "0.25",
"tradingFeeUserVolumeAmount": "44365067",
"orderId": "7669027383"
}
}
I’m also a bit tired to investigate further, @kroitor I leave this to you 😉 sorry (for not fixing it myself) & thx for looking at it.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
I’ve done a bunch of work on cex. I’ll submit work work so far…
@firepol i’ll try to fix it in a day or two. Need to rework the order parser for
cex
, hope to resolve it shortly.