Skip to content

ApiTradeHistoryDTO

stonepy.models.ApiTradeHistoryDTO.ApiTradeHistoryDTO

Bases: ResponseModel

Details of a previous trade for use in the Trade History.

order_id class-attribute instance-attribute

order_id: int | None = Field(default=None, alias='OrderId')

The order ID.

opening_order_ids class-attribute instance-attribute

opening_order_ids: list[int] | None = Field(
    default=None, alias="OpeningOrderIds"
)

The orders that are being closed / part closed by this order.

market_id class-attribute instance-attribute

market_id: int | None = Field(
    default=None, alias="MarketId"
)

The market ID.

market_name class-attribute instance-attribute

market_name: str | None = Field(
    default=None, alias="MarketName"
)

The name of the market.

direction class-attribute instance-attribute

direction: str | None = Field(
    default=None, alias="Direction"
)

The direction of the trade, Buy or Sell .

original_quantity class-attribute instance-attribute

original_quantity: Decimal | None = Field(
    default=None, alias="OriginalQuantity"
)

The original quantity of the trade, before part closures.

quantity class-attribute instance-attribute

quantity: Decimal | None = Field(
    default=None, alias="Quantity"
)

The current quantity of the trade.

price class-attribute instance-attribute

price: Decimal | None = Field(default=None, alias='Price')

The open price of the trade.

trading_account_id class-attribute instance-attribute

trading_account_id: int | None = Field(
    default=None, alias="TradingAccountId"
)

The Trading Account ID that the order is on.

currency class-attribute instance-attribute

currency: str | None = Field(default=None, alias="Currency")

The trade currency.

realised_pnl class-attribute instance-attribute

realised_pnl: Decimal | None = Field(
    default=None, alias="RealisedPnl"
)

The realised profit and loss (P&L).

realised_pnl_currency class-attribute instance-attribute

realised_pnl_currency: str | None = Field(
    default=None, alias="RealisedPnlCurrency"
)

The realised P&L currency.

last_changed_date_time_utc class-attribute instance-attribute

last_changed_date_time_utc: StoneXDateTime | None = Field(
    default=None, alias="LastChangedDateTimeUtc"
)

Represents the date and time when the trade/order was last edited. Note: does not include things such as the current market price.

executed_date_time_utc class-attribute instance-attribute

executed_date_time_utc: StoneXDateTime | None = Field(
    default=None, alias="ExecutedDateTimeUtc"
)

The time that the order was executed.

trade_reference class-attribute instance-attribute

trade_reference: str | None = Field(
    default=None, alias="TradeReference"
)

An alternative trade reference.

managed_trades class-attribute instance-attribute

managed_trades: list[ApiManagedTradeHistoryDTO] | None = (
    Field(default=None, alias="ManagedTrades")
)

The list of constituent trades for Trading Advisor managed positions (if applicable) .

order_reference class-attribute instance-attribute

order_reference: str | None = Field(
    default=None, alias="OrderReference"
)

The order reference for this trade.

source class-attribute instance-attribute

source: str | None = Field(default=None, alias='Source')

The source for this trade i.e. FIX/MT4/G2.

is_close_by class-attribute instance-attribute

is_close_by: bool | None = Field(
    default=None, alias="IsCloseBy"
)

Flag to indicate if this order was closed or used to close another order.

liquidation class-attribute instance-attribute

liquidation: bool | None = Field(
    default=None, alias="Liquidation"
)

Flag to indicate if this order was placed to liquidate a position.

fixed_initial_margin class-attribute instance-attribute

fixed_initial_margin: Decimal | None = Field(
    default=None, alias="FixedInitialMargin"
)

The fixed amount of trading resources used to place the trade.