pub struct Position {Show 30 fields
pub account_id: String,
pub trading_symbol: String,
pub exchange: Exchange,
pub instrument_token: u32,
pub product: Product,
pub quantity: i32,
pub overnight_quantity: i32,
pub multiplier: f64,
pub average_price: f64,
pub close_price: f64,
pub last_price: f64,
pub value: f64,
pub pnl: f64,
pub m2m: f64,
pub unrealised: f64,
pub realised: f64,
pub buy_quantity: u32,
pub buy_price: f64,
pub buy_value: f64,
pub buy_m2m: f64,
pub sell_quantity: u32,
pub sell_price: f64,
pub sell_value: f64,
pub sell_m2m: f64,
pub day_buy_quantity: u32,
pub day_buy_price: f64,
pub day_buy_value: f64,
pub day_sell_quantity: u32,
pub day_sell_price: f64,
pub day_sell_value: f64,
}
Expand description
Position data structure
Fields§
§account_id: String
Account ID
trading_symbol: String
Trading symbol
exchange: Exchange
Exchange
instrument_token: u32
Instrument token
product: Product
Product type
quantity: i32
Net quantity (positive for long, negative for short)
overnight_quantity: i32
Overnight quantity
multiplier: f64
Multiplier for the instrument
average_price: f64
Average price at which the position was taken
close_price: f64
Close price
last_price: f64
Last price from exchange
value: f64
Current value of the position
pnl: f64
P&L (profit and loss)
m2m: f64
M2M (Mark to Market) P&L
unrealised: f64
Unrealised P&L
realised: f64
Realised P&L
buy_quantity: u32
Buy quantity
buy_price: f64
Buy price
buy_value: f64
Buy value
buy_m2m: f64
Buy M2M
sell_quantity: u32
Sell quantity
sell_price: f64
Sell price
sell_value: f64
Sell value
sell_m2m: f64
Sell M2M
day_buy_quantity: u32
Day buy quantity
day_buy_price: f64
Day buy price
day_buy_value: f64
Day buy value
day_sell_quantity: u32
Day sell quantity
day_sell_price: f64
Day sell price
day_sell_value: f64
Day sell value
Implementations§
Source§impl Position
impl Position
Sourcepub fn is_profitable(&self) -> bool
pub fn is_profitable(&self) -> bool
Check if the position is profitable
Sourcepub fn abs_quantity(&self) -> u32
pub fn abs_quantity(&self) -> u32
Get the absolute quantity
Sourcepub fn pnl_percentage(&self) -> f64
pub fn pnl_percentage(&self) -> f64
Calculate the P&L percentage
Sourcepub fn market_value(&self) -> f64
pub fn market_value(&self) -> f64
Get the current market value of the position
Sourcepub fn is_day_position(&self) -> bool
pub fn is_day_position(&self) -> bool
Check if this is a day position (intraday)
Sourcepub fn is_overnight_position(&self) -> bool
pub fn is_overnight_position(&self) -> bool
Check if this is an overnight position
Sourcepub fn change_from_close(&self) -> f64
pub fn change_from_close(&self) -> f64
Calculate the change from close price
Sourcepub fn change_percentage_from_close(&self) -> f64
pub fn change_percentage_from_close(&self) -> f64
Calculate the change percentage from close price
Sourcepub fn net_day_quantity(&self) -> i32
pub fn net_day_quantity(&self) -> i32
Get net day quantity
Sourcepub fn has_day_activity(&self) -> bool
pub fn has_day_activity(&self) -> bool
Check if there was day trading activity