Message: OpenPosition

File: WebAPI/trade_routing_2.proto

Description

Account and contract open position. There could be more than one position per account and contract. (id is used as a key for updates).

Note: An OpenPosition represents a single trade (order_2.Trade) if not aggregated (see OpenPosition.is_aggregated). An open position aggregated from multiple trades can only exist as confirmed positions. Whether and how a position is aggregated is determined by the clearing firm.

Used in

PositionStatus

Fields

id

Type: sint32

Description: Surrogate ID as a key for updates.

uint32_qty (deprecated)

Type: uint32

Description: Note: Use qty field instead.

qty

Type: cqg.Decimal

Description: Position size, zero means that this position is deleted.

Note: Quantity can be safely compared to zero, because this is an integral number of metadata_2.ContractMetadata.volume_scale units.

price_correct

Type: double

Description: Position average price.

Note: Since it could be an aggregated position the price is sent in correct format directly.

trade_date

Type: sint64

Description: Exchange specific trade date when the trade happened or last changed (date only value).

statement_date

Type: sint64

Description: Statement date (date value only).

trade_utc_time (deprecated)

Type: sint64

Description: Note: Use trade_utc_timestamp field instead.

trade_utc_timestamp

Type: google.protobuf.Timestamp

Description: UTC trade time (including date) if available, it might not be available e.g., for the previous day positions.

is_aggregated

Type: bool

Description: True if the price is an aggregated position price.

is_short

Type: bool

Description: True if the open position is short (result of a sell operation), long otherwise. Undefined for deleted position (qty is 0).

is_yesterday

Type: bool

Default: false

Description: Whether it is a yesterday or a today position.

Note: Where available, this attribute is from the exchange trade date perspective. It is used for position tracking and open/close instructions. It is not the same as the previous day (associated with brokerage statement) vs. intraday. It is also not static. For example, an intraday fill with open_close_effect=OPEN_CLOSE_INSTRUCTION_OPEN (see order_2.TransactionStatus.open_close_effect) will appear when it is received during the trading session in an open position or matched trade with is_yesterday=false. After the exchange trade date rolls over for that contract, and before the brokerage statement arrives reflecting it as a previous day position, the same open position or matched trade will contain is_yesterday=true.

speculation_type

Type: uint32

Description: Speculation type of the position. One of SpeculationType enum.