I am currently programming a script to use on the Bitmex API. In algo trading a lot can happen to cause an error in the script, so my question to you all was if I missed a safety and what kind of safeties y'all are using?
This is the list of safeties and optimizations that I am using:
- Use mark price for stoploss when calculating profit.
- Complex calculations out of the main loop.
- Use bucketed orders.
- Order handling is priority over getting data (stoplosses first, then take profit order, then entry order, then price data).
- Bitmex offline server safety, make sure there are no open trades when the server is offline.
- Use Websocket API.
If request failed, retry request 1/2x (if there is no overload error) otherwise shut down.
If request failed for entry order with overload error, if the running price is x% close to the entry price dont execute the order
If request failed for stoploss / exit order with overload error, keep trying till it goes through (check if its possible to execute stoploss if running price already passed the appointed stoploss price)
- If base order filled and straight below stoploss price, stoploss placement will get an error, if below cancel stoploss placement and exit at market.
- 2th check from BitMEX side, check if base order has stoploss and takeprofit order. I already check on my side if after I submitted an order if BitMEX recieved it.
- Max 10 stop orders (BitMEX limit).
- Use 1 order quantity for the whole trade (same amount for entering an exiting a trade).
I was wondering if I missed some? I am also curious what kind of safeties and optimizations y'all are using and willing to share? Thanks in advance!