use serde::{Deserialize, Serialize};
use crate::{
indices::marketindex::MarketIndex,
volatility::volatilityindexing::{SmileType, VolatilityType},
};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct VolatilitySurfaceConfiguration {
market_index: MarketIndex,
#[serde(default = "default_volatility_type")]
volatility_type: VolatilityType,
#[serde(default = "default_smile_type")]
smile_type: SmileType,
quotes: Vec<String>,
}
const fn default_volatility_type() -> VolatilityType {
VolatilityType::Black
}
const fn default_smile_type() -> SmileType {
SmileType::Strike
}
impl VolatilitySurfaceConfiguration {
#[must_use]
pub const fn new(
market_index: MarketIndex,
volatility_type: VolatilityType,
smile_type: SmileType,
quotes: Vec<String>,
) -> Self {
Self {
market_index,
volatility_type,
smile_type,
quotes,
}
}
#[must_use]
pub const fn market_index(&self) -> &MarketIndex {
&self.market_index
}
#[must_use]
pub const fn volatility_type(&self) -> &VolatilityType {
&self.volatility_type
}
#[must_use]
pub const fn smile_type(&self) -> SmileType {
self.smile_type
}
#[must_use]
pub fn quotes(&self) -> &[String] {
&self.quotes
}
}