2024-11-15 21:13:19 +01:00
|
|
|
# BackTestAccount
|
2024-11-13 04:29:37 +01:00
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
## Table of Contents
|
|
|
|
|
- [BackTestAccount](#back_test_account.back_test_account)
|
|
|
|
|
- [get_dict](#back_test_account.back_test_account.get_dict)
|
|
|
|
|
- [asdict](#back_test_account.asdict)
|
|
|
|
|
- [set_attrs](#back_test_account.set_attrs)
|
2024-11-13 04:29:37 +01:00
|
|
|
|
|
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
### BackTestAccount
|
|
|
|
|
<a id="back_test_account.back_test_account"></a>
|
2024-11-13 04:29:37 +01:00
|
|
|
```python
|
|
|
|
|
@dataclass
|
2024-11-15 21:13:19 +01:00
|
|
|
class BackTestAccount:
|
2024-11-13 04:29:37 +01:00
|
|
|
```
|
2024-11-15 21:13:19 +01:00
|
|
|
The `BackTestAccount` class provides data structure for managing account data specifically for backtesting purposes.
|
2024-11-13 04:29:37 +01:00
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
#### Attributes:
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
|
|-------------|---------------|-----------------------------------------------------------|
|
|
|
|
|
| `balance` | `float` | The account balance for the backtest |
|
|
|
|
|
| `equity` | `float` | The equity value of the account during the backtest |
|
|
|
|
|
| `currency` | `str` | The currency type used in the backtesting account |
|
|
|
|
|
| `leverage` | `float` | Leverage ratio applied to the backtest account |
|
|
|
|
|
| `spread` | `int` | Spread value applied to simulated trades |
|
2024-11-13 04:29:37 +01:00
|
|
|
|
|
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
<a id="back_test_account.get_dict"></a>
|
|
|
|
|
### get_dict
|
2024-11-13 04:29:37 +01:00
|
|
|
```python
|
2024-11-15 21:13:19 +01:00
|
|
|
def get_dict(exclude: set = None, include: set = None) -> dict
|
2024-11-13 04:29:37 +01:00
|
|
|
```
|
2024-11-15 21:13:19 +01:00
|
|
|
Returns a dictionary representation of the account data. The `exclude` and `include` parameters allow filtering of data keys.
|
2024-11-13 04:29:37 +01:00
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
#### Arguments:
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
|
|-----------|-------|----------------------------------------------------------|
|
|
|
|
|
| `exclude` | `set` | A set of attribute names to exclude from the dictionary. |
|
|
|
|
|
| `include` | `set` | A set of attribute names to include in the dictionary. |
|
2024-11-13 04:29:37 +01:00
|
|
|
|
|
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
<a id="back_test_account.asdict"></a>
|
|
|
|
|
### asdict
|
2024-11-13 04:29:37 +01:00
|
|
|
```python
|
2024-11-15 21:13:19 +01:00
|
|
|
def asdict() -> dict
|
2024-11-13 04:29:37 +01:00
|
|
|
```
|
2024-11-15 21:13:19 +01:00
|
|
|
Returns a dictionary of all attributes in the account data without filtering.
|
2024-11-13 04:29:37 +01:00
|
|
|
|
|
|
|
|
|
2024-11-15 21:13:19 +01:00
|
|
|
### set_attrs
|
|
|
|
|
<a id="back_test_account.set_attrs"></a>
|
2024-11-13 04:29:37 +01:00
|
|
|
```python
|
|
|
|
|
def set_attrs(**kwargs)
|
|
|
|
|
```
|
2024-11-15 21:13:19 +01:00
|
|
|
Sets multiple attributes at once by passing key-value pairs as keyword arguments.
|