placing order twice

saurabh3679
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.

I am clueless why script is placing 2 orders ?

any help?
  • rakeshr
    @saurabh3679
    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.
  • saurabh3679
    Hi Rakesh,
    Is there any sample code for exception handling? just for a rough guide
  • rakeshr
    @saurabh3679
    You can add try except block something like this.You can also go through this python documentation.
    try:
    Your_logic_here
    except ReadTimeout:
    pass
Sign In or Register to comment.