trading_agent.tools.cancel_order_tool
¶
The cancel_order tool: cancels one of the desk's own orders, or one part of a bracket.
Cancelling takes risk away, so the risk engine is not asked; the desk order book only confirms that the desk placed the order. An order that has a parent_id is cancelled through UBI's order engine, which stops the whole order and every leg it has resting at a broker, so a bracket's exits go with it. A position the order already opened stays open.
Typical usage example:
tool = CancelOrderTool(services, 'main', 'dry_run')
CancelOrderArguments
¶
Bases: BaseModel
Which order to cancel.
Attributes:
| Name | Type | Description |
|---|---|---|
parent_id |
str | None
|
The parent_id that place_order or place_bracket_order answered with, or None. |
order_id |
str | None
|
The broker's order_id, or None. |
part |
str | None
|
With parent_id, the path of one part of a bracket to cancel alone, such as root.each_fill.children.1 for its target; or None for the whole order. |
reason |
str
|
Why the desk is cancelling, kept in the journal. |
CancelOrderTool
¶
Bases: OrderTool
Cancels one of the desk's own orders.