mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-07-27 20:27:43 +00:00
3.7 KiB
3.7 KiB
Base Class
Table of Contents
Base
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 |
init
def __init__(**kwargs)
Parameters:
| Name | Type | Description |
|---|---|---|
kwargs |
Any |
Object attributes and values as keyword arguments |
set_attributes
def set_attributes(**kwargs)
Set keyword arguments as object attributes. Only sets attributes that have been annotated on the class body.
Parameters
| Name | Type | Description |
|---|---|---|
kwargs |
Any |
Object attributes and values as keyword arguments |
Raises
| Exception | Description |
|---|---|
AttributeError |
When assigning an attribute that does not belong to the class or any parent class |
Notes
Only sets attributes that have been annotated on the class body.
annotations
@property
@cache
def annotations() -> dict
Class annotations from all ancestor classes and the current class.
Returns
| Type | Description |
|---|---|
dict |
A dictionary of class annotations |
get_dict
def get_dict(exclude: set = None, include: set = None) -> dict
Returns class attributes as a dict, with the ability to filter
Parameters
| Name | Type | Description |
|---|---|---|
exclude |
set |
A set of attributes to be excluded |
include |
set |
Specific attributes to be returned |
Returns
| Type | Description |
|---|---|
dict |
A dictionary of specified class attributes |
Notes
You can only set either of include or exclude. If you set both, include will take precedence
class_vars
@property
@cache
def class_vars()
Annotated class attributes
Returns
| Type | Description |
|---|---|
dict |
A dictionary of available class attributes in all ancestor classes and the current class. |
dict
@property
def dict() -> dict
All instance and class attributes as a dictionary, except those excluded in the Meta class.
Returns
| Type | Description |
|---|---|
dict |
A dictionary of instance and class attributes |