This commit is contained in:
Ichinga Samuel
2023-10-16 15:36:31 +01:00
parent 027f9fd8de
commit e285610fe5
22 changed files with 849 additions and 817 deletions
+14 -30
View File
@@ -5,14 +5,13 @@ class Account(AccountInfo)
```
Singleton class for managing a trading account. A subclass of [AccountInfo](#accountinfo). All AccountInfo attributes are available in this class.
**Attributes**
### Attributes:
|Name|Type|Description|Default|
|---|---|---|---|
|**connected**|**bool**|Status of connection to MetaTrader 5 Terminal|False|
|symbols|set[SymbolInfo]|A set of available symbols for the financial market.|set()|
**Notes**\
### Notes
Other Account properties are defined in the AccountInfo class.
### refresh
@@ -28,73 +27,58 @@ def account_info() -> dict
```
Get account login, server and password details. If the login attribute of the account instance returns
a falsy value, the config instance is used to get the account details.
**Returns**
#### Returns:
|Type|Description|
|---|---|
|**dict**|A dict of login, server and password details|
**Notes**\
#### Note:
This method will only look for config details in the config instance if the login attribute of the account Instance returns a falsy value
#### __aenter__
### __aenter__
```python
async def __aenter__() -> 'Account'
```
Connect to a trading account and return the account instance.
Async context manager for the Account class.
**Returns**
#### Returns:
|Type|Description|
|---|---|
|**Account**|An instance of the Account class|
**Raises**
#### Raises:
|Exception|Description|
|---|---|
|**LoginError**|If login fails|
#### sign_in
### sign_in
```python
async def sign_in() -> bool
```
Connect to a trading account.
**Returns**
#### Returns:
|Type|Description|
|---|---|
|**bool**|True if login was successful else False|
#### has_symbol
### has_symbol
```python
def has_symbol(symbol: str | Type[SymbolInfo])
```
Checks to see if a symbol is available for a trading account\
**Parameters**
#### Arguments:
|Name|Type|Description|
|---|---|---|
|**symbol**|**str** or **SymbolInfo**|A symbol name or SymbolInfo instance|
**Returns**
#### Returns:
|Type|Description|
|---|---|
|**bool**|True if symbol is available else False|
#### symbols_get
### symbols_get
```python
async def symbols_get() -> set[SymbolInfo]
```
Get all financial instruments from the MetaTrader 5 terminal available for the current account.
**Returns**
#### Returns:
|Type|Description|
|---|---|
|**set[SymbolInfo]**|A set of SymbolInfo instances|