3 ms·
A max loss is probably the first thing you should code! It's not so easy though. What if you have a bug in your pnl calculator? Also, do you just block all new
by cheatdeath 11y ago
A max loss is probably the first thing you should code!
It's not so easy though. What if you have a bug in your pnl calculator? Also, do you just block all new orders when you hit the max loss or do you liquidate your positions when you hit the max loss - because that's more code you could have bugs in. Maybe you cancel initiating orders and go to market on liquidating orders? Maybe you have code to limit the number of orders/size you can be working simultaneously - might have a bug in there too!
What if someone clears out the book i.e. a huge sell orders clears out all the buy limit orders and your pnl prints down massively for a millisecond? Should you also sell when this happens - probably getting a terrible exit price or do you wait and see if the book repopulates?