mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-23 16:58:07 +00:00
v4.0.17 no-backtest
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# result_db
|
||||
|
||||
`aiomql.lib.result_db` — SQLite-backed trade result storage.
|
||||
|
||||
## Overview
|
||||
|
||||
The `ResultDB` dataclass stores trade results in a SQLite database via the [`DB`](../core/db.md)
|
||||
ORM base class. Each instance represents a single trade record with fields for order details,
|
||||
strategy parameters, and profit/loss.
|
||||
|
||||
## Classes
|
||||
|
||||
### `ResultDB`
|
||||
|
||||
> Dataclass for persisting trade results to SQLite.
|
||||
|
||||
Inherits from `DB`. Decorated with `@dataclass`.
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | `int` | Primary key (auto-incremented) |
|
||||
| `symbol` | `str` | Trading instrument |
|
||||
| `order_type` | `str` | Order type string |
|
||||
| `strategy` | `str` | Strategy name |
|
||||
| `volume` | `float` | Trade volume |
|
||||
| `points` | `float` | Profit in points |
|
||||
| `profit` | `float` | Profit in account currency |
|
||||
| `actual_profit` | `float` | Actual profit after close |
|
||||
| `*` | … | Additional strategy-specific fields |
|
||||
|
||||
#### Methods
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `save(commit, update, data, conn)` | Inserts or updates the record |
|
||||
| `get(**kwargs)` | Retrieves a single matching record |
|
||||
| `filter(**kwargs)` | Retrieves all matching records |
|
||||
Reference in New Issue
Block a user