trading_agent.tools.get_candles_tool
¶
The get_candles tool: price candles of one instrument over a range.
Typical usage example:
tool = GetCandlesTool(reader, formatter)
GetCandlesArguments
¶
Bases: InstrumentArguments
The arguments of get_candles: the instrument's fields plus the range.
Attributes:
| Name | Type | Description |
|---|---|---|
interval |
str
|
The candle length, such as day, 60minute, 15minute, 5minute or minute. |
days |
int | None
|
How many days to count back from today; used when from_date is not given. |
from_date |
str | None
|
The first day, as YYYY-MM-DD. |
to_date |
str | None
|
The last day, as YYYY-MM-DD; needed with from_date. |
rows |
int
|
How many of the most recent candles to return. |
GetCandlesTool
¶
Bases: BrokerTool
Reads one instrument's candles.
Source code in src/trading_agent/tools/broker_tool.py
run
async
¶
Reads the candles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arguments
|
GetCandlesArguments
|
The instrument and range. |
required |
Returns:
| Type | Description |
|---|---|
ToolResult
|
The candles as CSV, or an error. |