mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-01 14:37:42 +00:00
2.1 KiB
2.1 KiB
Positions
class Positions
Get and handle Open positions.
Attributes:
| Name | Type | Description | Default |
|---|---|---|---|
| symbol | str | Financial instrument name. | "" |
| group | str | The filter for arranging a group of necessary symbols. Optional named parameter. If the group is specified, the function returns only positions meeting a specified criteria for a symbol name. | "" |
| ticket | int | Position ticket. | 0 |
| mt5 | MetaTrader | MetaTrader instance. | None |
symbolstr - Financial instrument name.groupstr - The filter for arranging a group of necessary symbols. Optional named parameter. If the group is specified, the function returns only positions meeting a specified criteria for a symbol name.ticketint - Position ticket.mt5MetaTrader - MetaTrader instance.
def __init__(*, symbol: str = "", group: str = "", ticket: int = 0)
Get Open Positions.
| Name | Type | Description | Default |
|---|---|---|---|
| symbol | str | Financial instrument name. | "" |
| group | str | The filter for arranging a group of necessary symbols. Optional named parameter. If the group is specified, the function returns only positions meeting a specified criteria for a symbol name. | "" |
| ticket | int | Position ticket. | 0 |
positions_total
async def positions_total() -> int
Get the number of open positions.
Returns:
| Type | Description |
|---|---|
| int | Return total number of open positions |
positions_get
async def positions_get()
Get open positions with the ability to filter by symbol or ticket.
Returns:
| Type | Description |
|---|---|
| list[TradePosition] | A list of open trade positions |
close_all
async def close_all() -> int
Close all open positions for the trading account.
Returns:
int- Return number of positions closed.