Enhance fetchOrder/cancelOrder handling
See original GitHub issueUsually for fetchOrder/cancelOrder there is only the orderID needed, but sometimes there is also the symbol and/or the side needed to cancel/fetch the order.
It is easy to provide the symbol, since there is an extra parameter in the function call and the symbol is ignored if not needed.
The side parameter is more annoying, because passing params={'side': 'sell'}
can break other exchanges, because they will include this and the exchange does not want this. so there is a check needed, which exchanges need the side and which dont.
An easy solution for this would be to have an api like this:
order = exchange.createOrder(...)
order = exchange.fetchOrder(order)
exchange.cancelOrder(order)
Create Order would always add properties needed for a fetch/cancel and the specific exchange methods could then pick the properties needed. I know, that this would break every code out there and people using databases to safe orderIDs and use them later would need to change a lot of code.
So probably a solution like an additional function: fetchOrderFromOrder / cancelOrderFromOrder
.
They would just call fetchOrder/cancelOrder
with the needed parameters.
These could be implemented in the base classes and only overwritten in the specific exchange classes if needed.
Any ideas on that?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
@kroitor Great, I will create a pull request later today.
@brandsimon yep, that makes sense, I would agree with the above.