mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-16 05:18:07 +00:00
v3.19
This commit is contained in:
+35
-22
@@ -1,34 +1,47 @@
|
||||
## <a id="strategy"></a> Strategy
|
||||
# Strategy
|
||||
The base class for creating strategies.
|
||||
|
||||
## Table of Contents
|
||||
- [Strategy](#strategy)
|
||||
- [\_\_init\_\_](#init)
|
||||
- [sleep](#sleep)
|
||||
- [trade](#trade)
|
||||
|
||||
|
||||
<a id="strategy"></a>
|
||||
### Strategy
|
||||
```python
|
||||
class Strategy(ABC)
|
||||
```
|
||||
The base class for creating strategies.
|
||||
### Attributes:
|
||||
|Name|Type|Description|Default|
|
||||
|---|---|---|---|
|
||||
|**name**|**str**|A name for the strategy.|None|
|
||||
|**account**|**Account**|Account instance.|None|
|
||||
|**mt5**|**MetaTrader**|MetaTrader instance.|None|
|
||||
|**config**|**Config**|Config instance.|None|
|
||||
|**symbol**|**Symbol**|The Financial Instrument as a Symbol Object|None|
|
||||
|**parameters**|**Dict**|A dictionary of parameters for the strategy.|None|
|
||||
#### Attributes
|
||||
| Name | Type | Description | Default |
|
||||
|--------------|--------------|----------------------------------------------|---------|
|
||||
| `name` | `str` | A name for the strategy. | None |
|
||||
| `account` | `Account` | Account instance. | None |
|
||||
| `mt5` | `MetaTrader` | MetaTrader instance. | None |
|
||||
| `config` | `Config` | Config instance. | None |
|
||||
| `symbol` | `Symbol` | The Financial Instrument as a Symbol Object | None |
|
||||
| `parameters` | `Dict` | A dictionary of parameters for the strategy. | None |
|
||||
| `sessions` | `Sessions` | Trading sessions. | None |
|
||||
|
||||
### Notes:
|
||||
### Notes
|
||||
Define the name of a strategy as a class attribute. If not provided, the class name will be used as the name.
|
||||
|
||||
<a id="init"></a>
|
||||
### \_\_init\_\_
|
||||
```python
|
||||
def __init__(*, symbol: Symbol, params: dict = None, sessions: Sessions)
|
||||
```
|
||||
Initiate the parameters dict and add name and symbol fields. Use class name as strategy name if name is not provided.
|
||||
### Arguments:
|
||||
|Name| Type | Description | Default |
|
||||
|---|--------------------|-----------------------------|-------------------|
|
||||
|**symbol**| **Symbol** | The Financial instrument | None |
|
||||
|**params**| **Dict** | Trading strategy parameters | None |
|
||||
|**sessions**| **Sessions** | Trading sessions | None |
|
||||
#### Parameters
|
||||
| Name | Type | Description | Default |
|
||||
|------------|------------|-----------------------------|---------|
|
||||
| `symbol` | `Symbol` | The Financial instrument | None |
|
||||
| `params` | `Dict` | Trading strategy parameters | None |
|
||||
| `sessions` | `Sessions` | Trading sessions | None |
|
||||
|
||||
<a id="sleep"></a>
|
||||
### sleep
|
||||
```python
|
||||
@staticmethod
|
||||
@@ -37,12 +50,12 @@ async def sleep(secs: float)
|
||||
Sleep for the needed amount of seconds in between requests to the terminal.
|
||||
computes the accurate amount of time needed to sleep ensuring that the next request is made at the start of
|
||||
a new bar and making cooperative multitasking possible.
|
||||
#### Parameters
|
||||
| Name | Type | Description | Default |
|
||||
|--------|---------|----------------------------------------------------------------|---------|
|
||||
| `secs` | `float` | The time in seconds. Usually the timeframe you are trading on. | None |
|
||||
|
||||
### Arguments:
|
||||
|Name| Type | Description | Default |
|
||||
|---|--------------------|-----------------------------|-------------------|
|
||||
|**secs**| **float** | The time in seconds. Usually the timeframe you are trading on. | None |
|
||||
|
||||
<a id="trade"></a>
|
||||
### trade
|
||||
```python
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user