pub struct PortfolioConfig {
pub assets: Vec<AssetConfig>,
pub correlations: Vec<f64>,
pub risk_free_rate: f64,
pub time_horizon: f64,
}Expand description
Portfolio configuration.
Fields§
§assets: Vec<AssetConfig>Assets in the portfolio.
correlations: Vec<f64>Correlation matrix (flattened, row-major). If empty, assets are assumed uncorrelated.
risk_free_rate: f64Risk-free rate (annual).
time_horizon: f64Time horizon for simulation (years).
Implementations§
Source§impl PortfolioConfig
impl PortfolioConfig
Sourcepub fn equity_only() -> Self
pub fn equity_only() -> Self
Create a simple equity portfolio.
Sourcepub fn balanced_60_40() -> Self
pub fn balanced_60_40() -> Self
Create a 60/40 stock/bond portfolio.
Sourcepub fn total_value(&self) -> f64
pub fn total_value(&self) -> f64
Calculate total portfolio value.
Sourcepub fn num_assets(&self) -> usize
pub fn num_assets(&self) -> usize
Get number of assets.
Sourcepub fn correlation(&self, i: usize, j: usize) -> f64
pub fn correlation(&self, i: usize, j: usize) -> f64
Get correlation between two assets.
Trait Implementations§
Source§impl Clone for PortfolioConfig
impl Clone for PortfolioConfig
Source§fn clone(&self) -> PortfolioConfig
fn clone(&self) -> PortfolioConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PortfolioConfig
impl Debug for PortfolioConfig
Source§impl Default for PortfolioConfig
impl Default for PortfolioConfig
Source§impl<'de> Deserialize<'de> for PortfolioConfig
impl<'de> Deserialize<'de> for PortfolioConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PortfolioConfig
impl RefUnwindSafe for PortfolioConfig
impl Send for PortfolioConfig
impl Sync for PortfolioConfig
impl Unpin for PortfolioConfig
impl UnsafeUnpin for PortfolioConfig
impl UnwindSafe for PortfolioConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more