use {
crate::models::{
orders::{OrderType, ValidityType},
ws::portfolio_feed_request::PortfolioUpdateType,
Exchange, ExchangeSegment, OrderStatus, OrderVariety, ProductType, TransactionType,
},
serde::{Deserialize, Serialize},
};
#[derive(Deserialize, Serialize, Debug)]
#[serde(untagged)]
pub enum PortfolioFeedResponse {
HoldingData {
update_type: PortfolioUpdateType,
isin: String,
cnc_used_quantity: u32,
collateral_type: String,
company_name: String,
haircut: f64,
product: ProductType,
quantity: u32,
instrument_token: String,
instrument_key: String,
average_price: f64,
collateral_quantity: u32,
collateral_update_quantity: u32,
t1_quantity: u32,
exchange: Exchange,
},
OrderData {
update_type: PortfolioUpdateType,
user_id: String,
exchange: Exchange,
product: ProductType,
price: f64,
quantity: u32,
status: OrderStatus,
tag: Option<String>,
instrument_token: String,
instrument_key: String,
placed_by: String,
trading_symbol: String,
order_type: OrderType,
validity: ValidityType,
trigger_price: f64,
disclosed_quantity: u32,
transaction_type: TransactionType,
average_price: f64,
filled_quantity: u32,
pending_quantity: u32,
status_message: String,
status_message_raw: Option<String>,
exchange_order_id: String,
parent_order_id: Option<String>,
order_id: String,
variety: OrderVariety,
order_timestamp: String,
exchange_timestamp: Option<String>,
is_amo: bool,
order_ref_id: String,
order_request_id: String,
guid: Option<String>,
},
PositionData {
update_type: PortfolioUpdateType,
exchange: ExchangeSegment,
multiplier: f64,
product: ProductType,
instrument_token: String,
instrument_key: String,
average_price: f64,
buy_value: f64,
overnight_quantity: u32,
day_buy_value: f64,
day_buy_price: f64,
overnight_buy_amount: f64,
overnight_buy_quantity: u32,
day_buy_quantity: u32,
day_sell_value: f64,
day_sell_price: f64,
overnight_sell_amount: f64,
overnight_sell_quantity: u32,
day_sell_quantity: u32,
quantity: u32,
sell_value: f64,
buy_price: f64,
sell_price: f64,
},
}