pub struct Instrument {
pub instrument_token: u32,
pub exchange_token: u32,
pub trading_symbol: String,
pub name: String,
pub last_price: f64,
pub expiry: Option<NaiveDate>,
pub strike: f64,
pub tick_size: f64,
pub lot_size: u32,
pub instrument_type: InstrumentType,
pub segment: Segment,
pub exchange: Exchange,
}
Expand description
Instrument data structure
Fields§
§instrument_token: u32
Instrument token (unique identifier)
exchange_token: u32
Exchange token
trading_symbol: String
Trading symbol
name: String
Company name or instrument name
last_price: f64
Last price
expiry: Option<NaiveDate>
Expiry date (for derivatives, None for equity)
strike: f64
Strike price (for options, 0.0 for others)
tick_size: f64
Tick size (minimum price movement)
lot_size: u32
Lot size (minimum quantity for trading)
instrument_type: InstrumentType
Instrument type
segment: Segment
Segment
exchange: Exchange
Exchange
Implementations§
Source§impl Instrument
impl Instrument
Sourcepub fn is_call_option(&self) -> bool
pub fn is_call_option(&self) -> bool
Check if the instrument is a call option
Sourcepub fn is_put_option(&self) -> bool
pub fn is_put_option(&self) -> bool
Check if the instrument is a put option
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the instrument has expired
Sourcepub fn expires_today(&self) -> bool
pub fn expires_today(&self) -> bool
Check if the instrument expires today
Sourcepub fn days_to_expiry(&self) -> Option<i64>
pub fn days_to_expiry(&self) -> Option<i64>
Get days to expiry (None for non-expiring instruments)
Sourcepub fn is_itm(&self, underlying_price: f64) -> Option<bool>
pub fn is_itm(&self, underlying_price: f64) -> Option<bool>
Check if the instrument is in-the-money (for options)
Sourcepub fn is_atm(&self, underlying_price: f64, tolerance: f64) -> Option<bool>
pub fn is_atm(&self, underlying_price: f64, tolerance: f64) -> Option<bool>
Check if the instrument is at-the-money (for options)
Sourcepub fn is_otm(&self, underlying_price: f64) -> Option<bool>
pub fn is_otm(&self, underlying_price: f64) -> Option<bool>
Check if the instrument is out-of-the-money (for options)
Sourcepub fn intrinsic_value(&self, underlying_price: f64) -> Option<f64>
pub fn intrinsic_value(&self, underlying_price: f64) -> Option<f64>
Calculate intrinsic value (for options)
Sourcepub fn tick_value(&self) -> f64
pub fn tick_value(&self) -> f64
Calculate the tick value in rupees
Trait Implementations§
Source§impl Clone for Instrument
impl Clone for Instrument
Source§fn clone(&self) -> Instrument
fn clone(&self) -> Instrument
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more