2026-02-21 07:43:33 +01:00
|
|
|
# symbol
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
`aiomql.lib.symbol` — Trading instrument interface.
|
2024-02-12 21:09:28 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
## Overview
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
The `Symbol` class represents a financial instrument (forex pair, stock, etc.) and provides
|
|
|
|
|
methods for querying market data, selecting symbols, and retrieving rates and ticks.
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
Inherits from [`_Base`](../core/base.md).
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
## Classes
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
### `Symbol`
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
> Interface for a MetaTrader 5 trading instrument.
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
| Attribute | Type | Description |
|
|
|
|
|
|-----------|------|-------------|
|
|
|
|
|
| `name` | `str` | Symbol name (e.g. `"EURUSD"`) |
|
|
|
|
|
| `select` | `bool` | Whether the symbol is selected in Market Watch |
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
All `SymbolInfo` fields are available as instance attributes after initialisation.
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
#### Initialisation
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
| Method | Description |
|
|
|
|
|
|--------|-------------|
|
|
|
|
|
| `init()` | Fetches symbol info from the terminal and sets all attributes |
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
#### Market Data
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
| Method | Returns | Description |
|
|
|
|
|
|--------|---------|-------------|
|
|
|
|
|
| `info_tick()` | `Tick` | Current tick for the symbol |
|
|
|
|
|
| `copy_rates_from(timeframe, date_from, count)` | `Candles` | Historical bars from a date |
|
|
|
|
|
| `copy_rates_from_pos(timeframe, start_pos, count)` | `Candles` | Historical bars from a position |
|
|
|
|
|
| `copy_rates_range(timeframe, date_from, date_to)` | `Candles` | Historical bars in a range |
|
|
|
|
|
| `copy_ticks_from(date_from, count, flags)` | `Ticks` | Historical ticks from a date |
|
|
|
|
|
| `copy_ticks_range(date_from, date_to, flags)` | `Ticks` | Historical ticks in a range |
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
#### Helpers
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
| Property | Returns | Description |
|
|
|
|
|
|----------|---------|-------------|
|
|
|
|
|
| `pip` | `float` | The pip size for the symbol |
|
|
|
|
|
| `spread` | `float` | Current bid-ask spread |
|
2024-11-10 12:25:50 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
## Synchronous API
|
2023-10-11 09:49:06 +01:00
|
|
|
|
2026-02-21 07:43:33 +01:00
|
|
|
Available in `aiomql.lib.sync.symbol`.
|