Files
aiomql/docs/account.md
T

85 lines
2.2 KiB
Markdown
Raw Normal View History

2023-10-11 09:49:06 +01:00
2024-01-18 02:26:27 +01:00
- [Account](#Account)
- [__aenter__](#Account.__aenter__)
- [sign_in](#Account.sign_in)
- [refresh](#Account.refresh)
- [has_symbol](#Account.has_symbol)
- [symbols_get](#Account.symbols_get)
- [AccountInfo](#AccountInfo)
- [Account](#Account)
- [sign_in](#Account.sign_in)
- [has_symbol](#Account.has_symbol)
- [symbols_get](#Account.symbols_get)
-
<a id="Account"></a>
### Account
2023-10-11 09:49:06 +01:00
```python
class Account(AccountInfo)
```
2024-01-18 02:26:27 +01:00
Singleton class for managing a trading account. A subclass of [AccountInfo](#AccountInfo).
2024-01-01 05:25:41 +01:00
All AccountInfo attributes are available in this class.
2023-10-16 15:36:31 +01:00
### Attributes:
2023-10-11 09:49:06 +01:00
|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()|
2024-01-18 02:26:27 +01:00
<a id="Account.__aenter__"></a>
#### __aenter__
2023-10-11 09:49:06 +01:00
```python
async def __aenter__() -> 'Account'
```
2024-01-01 05:25:41 +01:00
Async context manager for the Account class. Connects to a trading account and returns the account instance.
2023-10-16 15:36:31 +01:00
#### Returns:
2023-10-11 09:49:06 +01:00
|Type|Description|
|---|---|
|**Account**|An instance of the Account class|
2023-10-16 15:36:31 +01:00
#### Raises:
2023-10-11 09:49:06 +01:00
|Exception|Description|
|---|---|
|**LoginError**|If login fails|
2024-01-18 02:26:27 +01:00
<a id="Account.sign_in"></a>
#### sign_in
2023-10-11 09:49:06 +01:00
```python
async def sign_in() -> bool
```
Connect to a trading account.
2023-10-16 15:36:31 +01:00
#### Returns:
2023-10-11 09:49:06 +01:00
|Type|Description|
|---|---|
|**bool**|True if login was successful else False|
2024-01-18 02:26:27 +01:00
<a id="Account.refresh"></a>
#### refresh
```python
async def refresh()
```
Refreshes the account instance with the latest data from the MetaTrader 5 terminal
<a id="Account.has_symbol"></a>
#### has_symbol
2023-10-11 09:49:06 +01:00
```python
def has_symbol(symbol: str | Type[SymbolInfo])
```
2024-01-01 05:25:41 +01:00
Checks to see if a symbol is available for a trading account
#### Parameters:
2023-10-11 09:49:06 +01:00
|Name|Type|Description|
|---|---|---|
|**symbol**|**str** or **SymbolInfo**|A symbol name or SymbolInfo instance|
2023-10-16 15:36:31 +01:00
#### Returns:
2023-10-11 09:49:06 +01:00
|Type|Description|
|---|---|
|**bool**|True if symbol is available else False|
2024-01-18 02:26:27 +01:00
<a id="Account.symbols_get"></a>
#### symbols_get
2023-10-11 09:49:06 +01:00
```python
async def symbols_get() -> set[SymbolInfo]
```
Get all financial instruments from the MetaTrader 5 terminal available for the current account.
2023-10-16 15:36:31 +01:00
#### Returns:
2023-10-11 09:49:06 +01:00
|Type|Description|
|---|---|
2024-01-01 05:25:41 +01:00
|**set[SymbolInfo]**|A set of SymbolInfo instances|