-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing feature: Bracket Orders #63
Comments
Hi, is it still possible to use the OTOCO order to implement a Bracket order? The example on the Tasty website shows this, right? It would be great if you could post an example, as I'm having trouble understanding the process from the documentation. https://developer.tastytrade.com/order-management/#submit-complex-order
|
Hi, this is still not implemented. If you'd like to create a PR to add it, feel welcome! It looks like it's a grouping of three orders: opening order, stop loss, and profit taking, all wrapped into one. The |
Solved in PR #107 |
When will it be merged to main? |
As soon as the tests are passing! |
This can now be done pretty easily: symbol = Equity.get_equity(session, 'AAPL')
opening = symbol.build_leg(Decimal(1), OrderAction.BUY_TO_OPEN)
closing = symbol.build_leg(Decimal(1), OrderAction.SELL_TO_CLOSE)
otoco = NewComplexOrder(
trigger_order=NewOrder(
time_in_force=OrderTimeInForce.DAY,
order_type=OrderType.LIMIT,
legs=[opening],
price=Decimal('180'),
price_effect=PriceEffect.DEBIT
),
orders=[
NewOrder(
time_in_force=OrderTimeInForce.GTC,
order_type=OrderType.LIMIT,
legs=[closing],
price=Decimal('200'), # take profits
price_effect=PriceEffect.CREDIT
),
NewOrder(
time_in_force=OrderTimeInForce.GTC,
order_type=OrderType.STOP,
legs=[closing],
stop_trigger=Decimal('160'), # stop loss
price_effect=PriceEffect.CREDIT
)
]
)
resp = account.place_complex_order(session, otoco, dry_run=False) For an OCO order, it's exactly the same, but without the |
Thats great. Thanks for developing this. |
Currently the SDK doesn't support bracket orders as documented here: https://developer.tastytrade.com/order-management/
This is a feature I'd like to support at some point.
The text was updated successfully, but these errors were encountered: