Files
aiomql/docs/lib/result.md
T

81 lines
2.2 KiB
Markdown
Raw Normal View History

2024-02-12 21:09:28 +01:00
# Result
2023-10-11 09:49:06 +01:00
2024-02-12 21:09:28 +01:00
## Table of Contents
2024-11-10 12:25:50 +01:00
- [Result](#result.result)
- [__init__](#result.__init__)
- [save](#result.save)
- [get_data](#result.get_data)
- [to_csv](#result.to_csv)
- [to_json](#result.to_json)
2023-10-11 09:49:06 +01:00
2024-11-10 12:25:50 +01:00
<a id="result.result"></a>
2023-10-11 09:49:06 +01:00
```python
2024-11-10 12:25:50 +01:00
class Result
2023-10-11 09:49:06 +01:00
```
2024-02-12 21:09:28 +01:00
A base class for handling trade results and strategy parameters for record keeping and analysis.
2024-11-10 12:25:50 +01:00
#### Attributes:
2024-02-12 21:09:28 +01:00
| Name | Type | Description |
|--------------|-------------------|-----------------------------------|
| `result` | `OrderSendResult` | The result of the trade |
| `parameters` | `dict` | The parameters used for the trade |
| `name` | `str` | The name of the result object |
2023-10-11 09:49:06 +01:00
2024-11-10 12:25:50 +01:00
<a id="result.__init__"></a>
### \__init\__
2023-10-11 09:49:06 +01:00
```python
2024-11-10 12:25:50 +01:00
def __init__(*, result: OrderSendResult, parameters: dict = None, name: str = '')
2023-10-11 09:49:06 +01:00
```
2024-02-12 21:09:28 +01:00
Prepare result data for record keeping and analysis.
2024-11-10 12:25:50 +01:00
#### Parameters:
2024-02-12 21:09:28 +01:00
| Name | Type | Description |
|--------------|-------------------|-----------------------------------|
| `result` | `OrderSendResult` | The result of the trade |
| `parameters` | `dict` | The parameters used for the trade |
| `name` | `str` | The name of the result object |
2024-11-10 12:25:50 +01:00
<a id="result.get_data"></a>
### get_data
2023-10-11 09:49:06 +01:00
```python
2024-11-10 12:25:50 +01:00
def get_data(self) -> dict
2023-10-11 09:49:06 +01:00
```
2024-02-12 21:09:28 +01:00
Get the result data as a dictionary
2024-11-10 12:25:50 +01:00
#### Returns:
2024-02-12 21:09:28 +01:00
| Type | Description |
|--------|-----------------|
| `dict` | The result data |
2024-11-10 12:25:50 +01:00
<a id="result.to_save"></a>
### to_save
```python
async def to_save(*, trade_record_mode: Literal["csv", "json"] = None)
```
Save to json or csv depending on the trade record mode.
#### Returns:
| Name | Type | Description | Default |
|---------------------|--------------------------|-----------------------|---------|
| `trade_record_mode` | `Literal["csv", "json"]` | The trade record mode | None |
<a id="result.to_csv"></a>
### to_csv
2023-10-11 09:49:06 +01:00
```python
2024-02-12 21:09:28 +01:00
async def to_csv()
2023-10-11 09:49:06 +01:00
```
2024-02-12 21:09:28 +01:00
Record trade results and associated parameters as a csv file
2024-05-05 00:08:57 +01:00
2024-11-10 12:25:50 +01:00
<a id="result.to_json"></a>
### to_json
2024-05-05 00:08:57 +01:00
```python
async def to_json()
```
Record trade results and associated parameters as a json file
```