mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-18 14:28:08 +00:00
v3.19
This commit is contained in:
+60
-47
@@ -1,59 +1,72 @@
|
||||
# Table of Contents
|
||||
# Config
|
||||
|
||||
* [aiomql.core.config](#aiomql.core.config)
|
||||
* [Config](#aiomql.core.config.Config)
|
||||
* [account\_info](#aiomql.core.config.Config.account_info)
|
||||
|
||||
<a id="aiomql.core.config"></a>
|
||||
|
||||
# aiomql.core.config
|
||||
|
||||
<a id="aiomql.core.config.Config"></a>
|
||||
|
||||
## Config Objects
|
||||
## Table of Contents
|
||||
- [Config](#config.Config)
|
||||
- [account\_info](#config.account_info)
|
||||
- [load\_config](#config.load_config)
|
||||
- [create\_records\_dir](#config.create_records_dir)
|
||||
|
||||
|
||||
<a id="config.Config"></a>
|
||||
```python
|
||||
class Config()
|
||||
class Config
|
||||
```
|
||||
A class for handling configuration settings for the aiomql package. A single instance of this class is created and used
|
||||
per bot instance.
|
||||
### Class Attributes
|
||||
| Name | Type | Description | Default |
|
||||
|------------------|--------------|-----------------------------------------------------|-----------------------------------------------------|
|
||||
| `record\_trades` | `bool` | Whether to keep record of trades or not. | True |
|
||||
| `filename` | `str` | Name of the config file | aiomql.json |
|
||||
| `records\_dir` | `str\| Path` | Path to the directory where trade records are saved | Should be relative to the project root |
|
||||
| `login` | `str` | Trading account number | |
|
||||
| `password` | `str` | Trading account password | |
|
||||
| `server` | `str` | Broker server | |
|
||||
| `path` | `str\|Path` | Path to terminal file | Absolute |
|
||||
| `timeout` | `int` | Timeout for terminal connection | |
|
||||
| `config_dir` | `str` | Directory where the config file is located | Optional. Should be relative to the root directory |
|
||||
| `state` | `dict` | A global state object | |
|
||||
| `task_queue` | `Queue` | A global queue for handling tasks | |
|
||||
| `bot` | `Bot` | The bot instance | Added to the config object after bot initialization |
|
||||
| `root_dir` | `str` | Root directory of the project | |
|
||||
|
||||
A class for handling configuration settings for the aiomql package.
|
||||
|
||||
**Arguments**:
|
||||
|
||||
- `**kwargs` - Configuration settings as keyword arguments.
|
||||
Variables set this way supersede those set in the config file.
|
||||
|
||||
|
||||
**Attributes**:
|
||||
|
||||
- `record_trades` _bool_ - Whether to keep record of trades or not.
|
||||
- `filename` _str_ - Name of the config file
|
||||
- `records_dir` _str_ - Path to the directory where trade records are saved
|
||||
- `win_percentage` _float_ - Percentage of achieved target profit in a trade to be considered a win
|
||||
- `login` _int_ - Trading account number
|
||||
- `password` _str_ - Trading account password
|
||||
- `server` _str_ - Broker server
|
||||
- `path` _str_ - Path to terminal file
|
||||
- `timeout` _int_ - Timeout for terminal connection
|
||||
|
||||
|
||||
**Notes**:
|
||||
|
||||
By default, the config class looks for a file named aiomql.json.
|
||||
You can change this by passing the filename keyword argument to the constructor.
|
||||
By passing reload=True to the load_config method, you can reload and search again for the config file.
|
||||
|
||||
<a id="aiomql.core.config.Config.account_info"></a>
|
||||
|
||||
#### account\_info
|
||||
#### Notes
|
||||
By default, the config class looks for a file named aiomql.json.
|
||||
You can change this by passing the filename keyword argument to the constructor.
|
||||
By passing reload=True to the load_config method, you can reload and search again for the config file.
|
||||
|
||||
<a id="config.account_info"></a>
|
||||
### account\_info
|
||||
```python
|
||||
def account_info() -> dict['login', 'password', 'server']
|
||||
```
|
||||
|
||||
Returns Account login details as found in the config object if available
|
||||
#### Returns
|
||||
| Type | Description |
|
||||
|--------|-------------------------------------------------------|
|
||||
| `dict` | A dictionary with login, password, and server details |
|
||||
|
||||
**Returns**:
|
||||
|
||||
- `dict` - A dictionary of login details
|
||||
<a id="config.load_config"></a>
|
||||
### load\_config
|
||||
```python
|
||||
def load_config(self, *, file: str = None, reload: bool = True, filename: str = None, config_dir: str = '')
|
||||
```
|
||||
Load configuration settings from a file.
|
||||
#### Parameters
|
||||
| Name | Type | Description |
|
||||
|--------------|--------|-------------------------------------------------------------------------------------------------------------|
|
||||
| `file` | `str` | The file to load the configuration settings from. If not provided, the default file is used. |
|
||||
| `reload` | `bool` | Whether to reload the configuration settings or not. |
|
||||
| `filename` | `str` | The name of the file to load the configuration settings from. If not provided, the default filename is used |
|
||||
| `config_dir` | `str` | The directory where the configuration file is located. Default is the root directory |
|
||||
|
||||
<a id="config.create_records_dir"></a>
|
||||
### create_records_dir
|
||||
```python
|
||||
def create_records_dir(self, *, records_dir: str | Path = 'records'):
|
||||
```
|
||||
Create a directory for saving trade records.
|
||||
#### Parameters
|
||||
| Name | Type | Description |
|
||||
|----------------|-------------|-------------------------------------------------------------------|
|
||||
| `records\_dir` | `str\|Path` | The directory where trade records are saved. Default is 'records' |
|
||||
|
||||
Reference in New Issue
Block a user