# Base Class ## 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 ```python 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__ ```python def __init__(**kwargs) ``` #### Parameters: | Name | Type | Description | |----------|-------|---------------------------------------------------| | `kwargs` | `Any` | Object attributes and values as keyword arguments | ### 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 | 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 ```python @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 ```python 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 ```python @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 ```python @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 |