My algo trading script is running fine with a dummy logic (for testing the platform automatic order placement) It places orders, cancels orders, modifies order as per my logic.
Script suffers two problems: 1 . timeout exception (yet to find a robust solution) 2. once it a while script places two orders (whereas it should place only one order). It happens like once in 50 times.
1 . timeout exception (yet to find a robust solution)
You can handle Time-out exception at your end and re-check the scenerio and then perform the logic again.
2. once it a while script places two orders (whereas it should place only one order). It happens like once in 50 times.
It should mostly happen in case of Timeout exception or others. So, in case of any exception, you need to handle it and check if the order is placed while getting an exception at the end, if yes pass it or else place the same order again.
Is there any sample code for exception handling? just for a rough guide
You can add try except block something like this.You can also go through this python documentation.