2026-02-21 07:43:33 +01:00
|
|
|
# result
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
`aiomql.lib.result` — Trade result recording (CSV / JSON / SQL).
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
## Overview
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
The `Result` class records trade outcomes and strategy parameters to files in CSV, JSON,
|
|
|
|
|
or SQL format. It integrates with the `Config` to determine the recording directory and
|
|
|
|
|
format.
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
Inherits from [`_Base`](../core/base.md).
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
## Classes
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
### `Result`
|
2024-02-12 21:09:28 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
> Saves trade results to persistent storage.
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
| Attribute | Type | Description |
|
|
|
|
|
|-----------|------|-------------|
|
|
|
|
|
| `config` | `Config` | Global configuration |
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
#### Methods
|
2024-02-12 21:09:28 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
| Method | Description |
|
|
|
|
|
|--------|-------------|
|
|
|
|
|
| `save(result, parameters, name)` | Dispatches to the configured format (CSV/JSON/SQL) |
|
|
|
|
|
| `save_csv(result, parameters, name)` | Appends a result row to a CSV file |
|
|
|
|
|
| `save_json(result, parameters, name)` | Appends a result object to a JSON file |
|
|
|
|
|
| `save_sql(result, parameters, name)` | Saves the result to the SQLite database |
|
|
|
|
|
| `get_data(result, parameters)` | Prepares a unified dict from result and parameters |
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
## Synchronous API
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
Available in `aiomql.lib.sync.result`.
|