For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

notify_order() Race Condition

  • Hello,

    I am wondering, is it wrong to send orders inside the notify_order() method? During live trading, I wait for an entry order to be signalled as 'Complete' in the notify_order() method and immediately send 2 stop loss orders (one fixed and one trailing) but I noticed that notify_order() is never called again for those stop loss orders, more specifically I do not receive order 'Accepted' even though the orders show up on the live broker. The live broker I am using btw is Interactive Brokers. Should I not send these stop loss orders inside this method to allow it to be freed up?


  • administrators

    @agserran said in notify_order() Race Condition:

    notify_order() Race Condition

    The notifications are received in the main thread via a synchronized queue (standard python machinery). Your code never leaves the main thread.

    When you send orders they are managed in the main thread (ibpy puts them in a socket and there they go)

    It cannot as such be a race condition, because only 1 thread is involved.

    Some examples with what you do would be needed.

Log in to reply