/*
 * Thalex RPC API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// PortfolioMarginBreakdownPortfolioUnderlyingsInnerScenariosInnerPositionsInner : Results of scenario simulations on affected portfolio positions and open orders.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PortfolioMarginBreakdownPortfolioUnderlyingsInnerScenariosInnerPositionsInner {
    /// Instrument feedcode.
    #[serde(rename = "instrument_name", skip_serializing_if = "Option::is_none")]
    pub instrument_name: Option<String>,
    /// Position/order size in contracts.
    #[serde(rename = "position", skip_serializing_if = "Option::is_none")]
    pub position: Option<rust_decimal::Decimal>,
    /// P&L for a single contract of this instrument.
    #[serde(rename = "instrument_pnl", skip_serializing_if = "Option::is_none")]
    pub instrument_pnl: Option<rust_decimal::Decimal>,
    /// Total P&L for the position/order in this instrument.
    #[serde(rename = "pnl", skip_serializing_if = "Option::is_none")]
    pub pnl: Option<rust_decimal::Decimal>,
    /// The price at the moment of scenario calculation.  For positions this is set to the current mark price.  For open orders this is the order limit price.
    #[serde(rename = "current_price", skip_serializing_if = "Option::is_none")]
    pub current_price: Option<rust_decimal::Decimal>,
    /// The price simulated for the scenario.
    #[serde(rename = "scenario_price", skip_serializing_if = "Option::is_none")]
    pub scenario_price: Option<rust_decimal::Decimal>,
    /// Indicates whether this position is implied from an open order.
    #[serde(rename = "open_order", skip_serializing_if = "Option::is_none")]
    pub open_order: Option<bool>,
    /// Indicates whether this order was assumed to be filled in this scenario.  Orders are assumed to be filled if they, for the particular scenario, generate an immediate loss if filled at the limit price.  Only orders that are assumed to be filled are taken into account for the loss, roll contingency and option contingency margin requirements.  This field is only present if `open_order` is `true`.
    #[serde(rename = "assumed_filled", skip_serializing_if = "Option::is_none")]
    pub assumed_filled: Option<bool>,
}

impl PortfolioMarginBreakdownPortfolioUnderlyingsInnerScenariosInnerPositionsInner {
    /// Results of scenario simulations on affected portfolio positions and open orders.
    pub fn new() -> PortfolioMarginBreakdownPortfolioUnderlyingsInnerScenariosInnerPositionsInner {
        PortfolioMarginBreakdownPortfolioUnderlyingsInnerScenariosInnerPositionsInner {
            instrument_name: None,
            position: None,
            instrument_pnl: None,
            pnl: None,
            current_price: None,
            scenario_price: None,
            open_order: None,
            assumed_filled: None,
        }
    }
}
