mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-17 13:58:15 +00:00
v3.19
This commit is contained in:
+61
-68
@@ -1,103 +1,96 @@
|
||||
<a id="aiomql.records"></a>
|
||||
|
||||
# aiomql.records
|
||||
|
||||
This module contains the Records class, which is used to read and update trade records from csv files.
|
||||
|
||||
<a id="aiomql.records.Records"></a>
|
||||
|
||||
## Records Objects
|
||||
# Records
|
||||
|
||||
## Table of contents
|
||||
- [Records](#records)
|
||||
- [\_\_init\_\_](#__init__)
|
||||
- [get\_records](#get_records)
|
||||
- [read\_update](#read_update)
|
||||
- [update\_rows](#update_rows)
|
||||
- [update\_records](#update_records)
|
||||
- [update\_record](#update_record)
|
||||
|
||||
<a id="records"></a>
|
||||
### Records
|
||||
```python
|
||||
class Records()
|
||||
```
|
||||
This utility class read trade records from csv files, and update them based on their closing positions. To use this default
|
||||
implementation the csv files should at least have the following columns `['order', 'symbol', 'actual_profit', 'win', 'closed']`
|
||||
Once a trade have been closed, the actual profit and win status will be updated in the csv file.
|
||||
#### Headers
|
||||
| column | type | description |
|
||||
|---------------|-------|-------------------------------------------------------|
|
||||
| order | int | Order id of the trade |
|
||||
| symbol | str | the name of the Symbol |
|
||||
| actual_profit | float | The actual profit of the trade, this zero by default |
|
||||
| win | bool | The win status of the trade, this is False by default |
|
||||
| closed | bool | The status of the trade, this is False by default |
|
||||
#### Attributes
|
||||
| name | type | description |
|
||||
|-------------|--------|--------------------------------------------------------------|
|
||||
| records_dir | Path | Absolut path to directory containing record of placed trades |
|
||||
| config | Config | Config object |
|
||||
|
||||
This utility class read trade records from csv files, and update them based on their closing positions.
|
||||
|
||||
**Attributes**:
|
||||
|
||||
- `config` - Config object
|
||||
- `records_dir(Path)` - Path to directory containing record of placed trades, If not given takes the default
|
||||
from the config
|
||||
|
||||
<a id="aiomql.records.Records.__init__"></a>
|
||||
|
||||
#### \_\_init\_\_
|
||||
|
||||
<a id="__init__"></a>
|
||||
### \_\_init\_\_
|
||||
```python
|
||||
def __init__(records_dir: Path = '')
|
||||
def __init__(records_dir: Path | str = '')
|
||||
```
|
||||
|
||||
Initialize the Records class.
|
||||
#### Arguments
|
||||
| name | type | description |
|
||||
|--------------|------|----------------------------------------------------------------|
|
||||
| records_dir | Path | Absolute path to directory containing record of placed trades. |
|
||||
|
||||
**Arguments**:
|
||||
|
||||
- `records_dir` _Path_ - Path to directory containing record of placed trades.
|
||||
|
||||
<a id="aiomql.records.Records.get_records"></a>
|
||||
|
||||
#### get\_records
|
||||
|
||||
<a id="get_records"></a>
|
||||
### get\_records
|
||||
```python
|
||||
async def get_records()
|
||||
```
|
||||
|
||||
Get trade records from records_dir folder
|
||||
#### Yields
|
||||
| type | description |
|
||||
|------|--------------------|
|
||||
| Path | Trade record files |
|
||||
|
||||
**Yields**:
|
||||
|
||||
- `files` - Trade record files
|
||||
|
||||
<a id="aiomql.records.Records.read_update"></a>
|
||||
|
||||
#### read\_update
|
||||
|
||||
<a id="read_update"></a>
|
||||
### read\_update
|
||||
```python
|
||||
async def read_update(file: Path)
|
||||
```
|
||||
|
||||
Read and update trade records
|
||||
#### Arguments
|
||||
| name | type | description |
|
||||
|------|------|-------------------|
|
||||
| file | Path | Trade record file |
|
||||
|
||||
**Arguments**:
|
||||
|
||||
- `file` - Trade record file
|
||||
|
||||
<a id="aiomql.records.Records.update_rows"></a>
|
||||
|
||||
#### update\_rows
|
||||
|
||||
<a id="update_rows"></a>
|
||||
### update\_rows
|
||||
```python
|
||||
async def update_rows(rows: list[dict]) -> list[dict]
|
||||
```
|
||||
|
||||
Update the rows of entered trades in the csv file with the actual profit.
|
||||
#### Arguments
|
||||
| name | type | description |
|
||||
|------|------------|---------------------------------------------------------------------------|
|
||||
| rows | list[dict] | A list of dictionaries from the dictionary writer object of the csv file. |
|
||||
|
||||
**Arguments**:
|
||||
#### Returns
|
||||
| type | description |
|
||||
|------------|---------------------------------------------------------------|
|
||||
| list[dict] | A list of dictionaries with the actual profit and win status. |
|
||||
|
||||
- `rows` - A list of dictionaries from the dictionary writer object of the csv file.
|
||||
|
||||
|
||||
**Returns**:
|
||||
|
||||
- `list[dict]` - A list of dictionaries with the actual profit and win status.
|
||||
|
||||
<a id="aiomql.records.Records.update_records"></a>
|
||||
|
||||
#### update\_records
|
||||
|
||||
<a id="update_records"></a>
|
||||
### update\_records
|
||||
```python
|
||||
async def update_records()
|
||||
```
|
||||
|
||||
Update trade records in the records_dir folder.
|
||||
|
||||
<a id="aiomql.records.Records.update_record"></a>
|
||||
|
||||
#### update\_record
|
||||
|
||||
<a id="update_record"></a>
|
||||
### update\_record
|
||||
```python
|
||||
async def update_record(file: Path | str)
|
||||
```
|
||||
|
||||
Update a single trade record file.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user