use crate::{
core::{
instrument::Instrument,
trade::{Side, Trade},
},
currencies::currency::Currency,
indices::marketindex::MarketIndex,
time::{date::Date, daycounter::DayCounter},
};
pub struct EquityForward {
identifier: String,
market_index: MarketIndex,
delivery_date: Date,
strike: f64,
currency: Currency,
day_counter: DayCounter,
}
impl EquityForward {
#[must_use]
pub const fn new(
identifier: String,
market_index: MarketIndex,
delivery_date: Date,
strike: f64,
currency: Currency,
day_counter: DayCounter,
) -> Self {
Self {
identifier,
market_index,
delivery_date,
strike,
currency,
day_counter,
}
}
#[must_use]
pub fn market_index(&self) -> MarketIndex {
self.market_index.clone()
}
#[must_use]
pub const fn delivery_date(&self) -> Date {
self.delivery_date
}
#[must_use]
pub const fn strike(&self) -> f64 {
self.strike
}
#[must_use]
pub const fn currency(&self) -> &Currency {
&self.currency
}
#[must_use]
pub const fn day_counter(&self) -> &DayCounter {
&self.day_counter
}
}
impl Instrument for EquityForward {
fn identifier(&self) -> String {
self.identifier.clone()
}
}
pub struct EquityForwardTrade {
instrument: EquityForward,
trade_date: Date,
notional: f64,
side: Side,
}
impl EquityForwardTrade {
#[must_use]
pub const fn new(
instrument: EquityForward,
trade_date: Date,
notional: f64,
side: Side,
) -> Self {
Self {
instrument,
trade_date,
notional,
side,
}
}
#[must_use]
pub const fn notional(&self) -> f64 {
self.notional
}
}
impl Trade<EquityForward> for EquityForwardTrade {
fn instrument(&self) -> &EquityForward {
&self.instrument
}
fn trade_date(&self) -> Date {
self.trade_date
}
fn side(&self) -> Side {
self.side
}
}