How to get the (live) broker's API response data for bracket order?



  • Is there one?


  • administrators

    Not sure what you mean with live API response. When the broker sends the confirmation of a bracket order or cancellation, an Order object is sent to your strategy via the notify_order with the current status.

    Oanda doesn't have bracket orders, but rather an order with bracketing prices and the 2 of the 3 orders which make up the bracket order set are simulated.



  • Oanda doesn't have bracket orders, but rather an order with bracketing prices and the 2 of the 3 orders which make up the bracket order set are simulated.

    1. Yes I remember this part from another forum post.

    2. I figured it out. This works:

    valid=datetime.utcnow() + timedelta( hours=num_hours_traversed)
    

    This, however, does not:

    valid=self.datas[0].datetime.datetime() + timedelta( hours=num_hours_traversed)
    

    How do I force BT to deal everything in UTC ? I see in your docs:

    Unless a tz parameter (a pytz-compatible object) is passed to the data feed, all time output is in UTC format as expressed above.
    

    But above it says "pytz is not really recommended"...?


  • administrators

    valid=self.datas[0].datetime.datetime() + timedelta( hours=num_hours_traversed)
    ```
    

    What's not actually working?

    @Taewoo-Kim said in How to get the (live) broker's API response data for bracket order?:

    How do I force BT to deal everything in UTC ?

    Everything is done in UTC unless told otherwise.

    But above it says "pytz is not really recommended"...?

    To have all us on the same page, you can point to the specific documentation page.



  • not working => the order doesn't register at all


  • administrators

    See:

    • Thread title: How to get the (live) broker's API response data for bracket order?

    • This doesn't work:

      valid=self.datas[0].datetime.datetime() + timedelta( hours=num_hours_traversed)
      
    • not working => the order doesn't register at all

    They are for sure connected in your code, tests and line of thought, but they provide no information here becase there is no context to bind them together.


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.