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

Bracket Order - "valid" parameter

  • Hello, I'm trying to simulate a buy stop and sell stop trade, I am currently opening a buy bracket order where the main orders exectype is a Stop Order at a price above the current market price, everything is working as expected until I set the "valid" parameter to expire the bracket order after 30 minutes if the price isn't reached, the problem I'm seeing is that the main order gets expired after 30 minutes even after the main orders stop price is hit, is this the intended functionality? My goal is to issue a buy stop order that has an expiry time but if the price is reached I don't want to expire the tp/sl orders that were set during the creation of the bracket order.. any ideas?

  • Issue the orders manually, gives more control over the orders sent. Try using the parent-child orders. It would be better if you could post a snippet of the code, for further analysis. Try reading the bracket order documention for manually issuing them.

  • administrators

    The buy_bracket/sell_bracket methods contain the parameters limitargs and stopargs, which are dictionaries intended to supply specific value for the corresponding orders. You can specify valid for each, both or none of them. And you can use kwargs to affect all of them.

    See: Docs - Strategy

Log in to reply