Account state¶
Read models returned by Trader queries and trading calls.
Position
dataclass
¶
Position(ticket: int, symbol: str, side: Side, volume: float, price_open: float, sl: float | None, tp: float | None, price_current: float, profit: float, time: int, magic: int, comment: str, swap: float, identifier: int, reason: int, time_msc: int, time_update: int, time_update_msc: int, external_id: str)
An open position. sl and tp are None when not set.
PendingOrder
dataclass
¶
PendingOrder(ticket: int, symbol: str, side: Side, kind: PendingKind, volume: float, price: float, magic: int, comment: str)
A pending order waiting on the server.
TradeReceipt
dataclass
¶
TradeReceipt(retcode: int, deal: int, order: int, volume: float, price: float, bid: float, ask: float, comment: str, request_id: int, retcode_external: int)
Broker answer to a trade request.
Field names mirror MetaTrader5's OrderSendResult on purpose, so 2.x code
reading result.retcode / result.comment keeps working unchanged.