Files
Ichinga Samuel 4f0150a552 v3.23
2024-10-29 13:04:45 +01:00

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
  • 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.
  • mt5 MetaTrader - MetaTrader instance.

#### __init__

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.