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

Oanda - Recreate get_open_orders()

  • I have a strategy that occasionally calls broker.get_orders_open()

    From what I see on the docs, OandaBroker does not have a method for get_orders_open().

    So I assume I will have to re-create the functionality if I want to keep checking for open orders in a live environment.

    With that in mind please help me check if my understanding of what is needed is correct. I would need to:

    • Create a list / order book for storing orders.
    • Add the order object to the list once an order is submitted (add the returned order object from the buy/sell call to the list)
    • Remove the order object from the list once I receive a order.Completed notification.

    Do I still need to be aware of the warning not to manipulate the orders as mentioned in the link below? Or is that only applicable to orders managed through backtraders own broker class?

    For clarity, I just want to track open orders for potentially cancelling them in the future (both for adjusting stops and entry orders).


Log in to reply