Utils
utils
Functions:
| Name | Description |
|---|---|
save_output |
Save output DataFrame to a CSV file. |
get_current_date |
Get the current date as a string. |
decorate_all_methods |
Class decorator that applies a given decorator to all callable methods. |
get_next_weekday |
Return the input date if it is a weekday, otherwise the next Monday. |
save_output
Save output DataFrame to a CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
DataFrame
|
The data to save. |
required |
|
str
|
A tag or description of the data for logging purposes. |
required |
|
SavePathType | None
|
The file path to save data. Defaults to None. |
None
|
Source code in src/tradingagents/dataflows/utils.py
get_current_date
Get the current date as a string.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Current date in YYYY-MM-DD format. |
decorate_all_methods
decorate_all_methods(
decorator: Callable[[Callable[..., object]], Callable[..., object]],
) -> Callable[[type], type]
Class decorator that applies a given decorator to all callable methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Callable[[Callable[..., object]], Callable[..., object]]
|
The decorator to apply. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[type], type]
|
Callable[[type], type]: A class decorator. |
Source code in src/tradingagents/dataflows/utils.py
get_next_weekday
Return the input date if it is a weekday, otherwise the next Monday.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | datetime
|
The starting date, either as a datetime object or a string in YYYY-MM-DD format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
datetime |
datetime
|
The input date when it is Monday through Friday, or the next Monday when the input falls on a weekend. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |