mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-13 03:48:05 +00:00
v4
This commit is contained in:
+53
-27
@@ -1,14 +1,17 @@
|
||||
# Base Class
|
||||
# Base
|
||||
|
||||
## Table of Contents
|
||||
- [Base](#base)
|
||||
- [set\_attributes](#base.set_attributes)
|
||||
- [annotations](#base.annotations)
|
||||
- [get\_dict](#base.get_dict)
|
||||
- [class\_vars](#base.class_vars)
|
||||
- [dict](#base.dict)
|
||||
- [Base](#base.base)
|
||||
- [set_attributes](#base.set_attributes)
|
||||
- [annotations](#base.annotations)
|
||||
- [get_dict](#base.get_dict)
|
||||
- [class_vars](#base.class_vars)
|
||||
- [dict](#base.dict)
|
||||
|
||||
<a id="base"></a>
|
||||
- [_Base](#_base._base)
|
||||
|
||||
|
||||
<a id="base.base"></a>
|
||||
### Base
|
||||
```python
|
||||
class Base
|
||||
@@ -16,11 +19,12 @@ class Base
|
||||
A base class for all data model classes in the aiomql package. This class provides a set of common methods
|
||||
and attributes for all data model classes.
|
||||
|
||||
#### Class Attributes
|
||||
| Name | Type | Description | Default |
|
||||
|----------|--------------|-------------------------------------|---------|
|
||||
| `mt5` | `MetaTrader` | An instance of the MetaTrader class | |
|
||||
| `config` | `Config` | An instance of the Config class | |
|
||||
#### Attributes:
|
||||
| Name | Type | Description |
|
||||
|-----------|-------|------------------------------------------------------------------------------------------------------|
|
||||
| `exclude` | `set` | A set of attributes to be excluded when retrieving attributes using the *get_dict* and *dict* method |
|
||||
| `include` | `set` | A set of attributes to be included when retrieving attributes using the *get_dict* and *dict* method |
|
||||
|
||||
|
||||
<a id="base.__init__"></a>
|
||||
### __init__
|
||||
@@ -32,25 +36,28 @@ def __init__(**kwargs)
|
||||
|----------|-------|---------------------------------------------------|
|
||||
| `kwargs` | `Any` | Object attributes and values as keyword arguments |
|
||||
|
||||
|
||||
<a id="base.set_attributes"></a>
|
||||
### set_attributes
|
||||
```python
|
||||
def set_attributes(**kwargs)
|
||||
```
|
||||
Set keyword arguments as object attributes. Only sets attributes that have been annotated on the class body.
|
||||
#### Parameters
|
||||
|
||||
#### Parameters:
|
||||
| Name | Type | Description |
|
||||
|----------|-------|---------------------------------------------------|
|
||||
| `kwargs` | `Any` | Object attributes and values as keyword arguments |
|
||||
|
||||
#### Raises
|
||||
#### Raises:
|
||||
| Exception | Description |
|
||||
|------------------|-----------------------------------------------------------------------------------|
|
||||
| `AttributeError` | When assigning an attribute that does not belong to the class or any parent class |
|
||||
|
||||
#### Notes
|
||||
#### Notes:
|
||||
Only sets attributes that have been annotated on the class body.
|
||||
|
||||
|
||||
<a id="base.annotations"></a>
|
||||
### annotations
|
||||
```python
|
||||
@@ -59,43 +66,49 @@ Only sets attributes that have been annotated on the class body.
|
||||
def annotations() -> dict
|
||||
```
|
||||
Class annotations from all ancestor classes and the current class.
|
||||
#### Returns
|
||||
| Type | Description |
|
||||
|--------|-----------------------------------|
|
||||
| `dict` | A dictionary of class annotations |
|
||||
#### Returns:
|
||||
| Type | Description |
|
||||
|------------------|-----------------------------------|
|
||||
| `dict[str, Any]` | A dictionary of class annotations |
|
||||
|
||||
|
||||
<a id="base.get_dict"></a>
|
||||
#### get\_dict
|
||||
#### get_dict
|
||||
```python
|
||||
def get_dict(exclude: set = None, include: set = None) -> dict
|
||||
```
|
||||
Returns class attributes as a dict, with the ability to filter
|
||||
#### Parameters
|
||||
|
||||
#### Parameters:
|
||||
| Name | Type | Description |
|
||||
|-----------|-------|------------------------------------|
|
||||
| `exclude` | `set` | A set of attributes to be excluded |
|
||||
| `include` | `set` | Specific attributes to be returned |
|
||||
#### Returns
|
||||
|
||||
#### Returns:
|
||||
| Type | Description |
|
||||
|--------|--------------------------------------------|
|
||||
| `dict` | A dictionary of specified class attributes |
|
||||
|
||||
#### Notes
|
||||
#### Notes:
|
||||
You can only set either of include or exclude. If you set both, include will take precedence
|
||||
|
||||
|
||||
<a id="base.class_vars"></a>
|
||||
### class\_vars
|
||||
### class_vars
|
||||
```python
|
||||
@property
|
||||
@cache
|
||||
def class_vars()
|
||||
```
|
||||
Annotated class attributes
|
||||
#### Returns
|
||||
|
||||
#### Returns:
|
||||
| Type | Description |
|
||||
|--------|-------------------------------------------------------------------------------------------|
|
||||
| `dict` | A dictionary of available class attributes in all ancestor classes and the current class. |
|
||||
|
||||
|
||||
<a id="base.dict"></a>
|
||||
### dict
|
||||
```python
|
||||
@@ -103,7 +116,20 @@ Annotated class attributes
|
||||
def dict() -> dict
|
||||
```
|
||||
All instance and class attributes as a dictionary, except those excluded in the Meta class.
|
||||
#### Returns
|
||||
|
||||
#### Returns:
|
||||
| Type | Description |
|
||||
|--------|-----------------------------------------------|
|
||||
| `dict` | A dictionary of instance and class attributes |
|
||||
|
||||
|
||||
<a id="_base._base></a>
|
||||
### _Base(Base)
|
||||
Base class that provides access to the MetaTrader and Config classes as well as the MetaBackTester class for
|
||||
backtesting mode.
|
||||
|
||||
#### Attributes:
|
||||
| Name | Type | Description | Default |
|
||||
|----------|--------------|-------------------------------------|---------|
|
||||
| `mt5` | `MetaTrader` | An instance of the MetaTrader class | |
|
||||
| `config` | `Config` | An instance of the Config class | |
|
||||
|
||||
Reference in New Issue
Block a user