trading_agent.tools.place_bracket_order_tool
¶
The place_bracket_order tool: an entry order that sets up its own stop-loss and target when it fills.
UBI's order engine works the exits, so they act in real time even while the desk's model is busy or asleep: on the entry's first fill it places a stop-limit and a target sized to what filled, and when either exit fills it cancels the other. The risk engine checks the entry, because only the entry adds risk.
Typical usage example:
tool = PlaceBracketOrderTool(services, 'main', 'dry_run')
BracketOrderArguments
¶
Bases: OrderArguments
An entry order with its stop-loss and target.
Attributes:
| Name | Type | Description |
|---|---|---|
order_type |
Literal['market', 'limit']
|
The entry's type, "market" or "limit". |
stop_price |
float | None
|
The stop-loss trigger in rupees, or None for no stop. |
stop_limit_price |
float | None
|
The stop-loss's limit in rupees, needed with stop_price, because every stop is a stop-limit; for a long position it is at or below stop_price. |
target_price |
float | None
|
The target's limit in rupees, or None for no target. |
PlaceBracketOrderTool
¶
Bases: OrderTool
Places one bracket order.