pub struct AssetConfig {
pub name: String,
pub price: f64,
pub drift: f64,
pub volatility: f64,
pub position: f64,
}Expand description
Configuration for a single asset.
Fields§
§name: StringAsset name/identifier.
price: f64Current price.
drift: f64Expected annual return (drift).
volatility: f64Annual volatility (standard deviation).
position: f64Position size (number of units).
Implementations§
Source§impl AssetConfig
impl AssetConfig
Sourcepub fn new(
name: &str,
price: f64,
drift: f64,
volatility: f64,
position: f64,
) -> Self
pub fn new( name: &str, price: f64, drift: f64, volatility: f64, position: f64, ) -> Self
Create a new asset configuration.
Sourcepub fn stock(name: &str, price: f64, position: f64) -> Self
pub fn stock(name: &str, price: f64, position: f64) -> Self
Create a stock with typical parameters.
Trait Implementations§
Source§impl Clone for AssetConfig
impl Clone for AssetConfig
Source§fn clone(&self) -> AssetConfig
fn clone(&self) -> AssetConfig
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 AssetConfig
impl Debug for AssetConfig
Source§impl<'de> Deserialize<'de> for AssetConfig
impl<'de> Deserialize<'de> for AssetConfig
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 AssetConfig
impl RefUnwindSafe for AssetConfig
impl Send for AssetConfig
impl Sync for AssetConfig
impl Unpin for AssetConfig
impl UnsafeUnpin for AssetConfig
impl UnwindSafe for AssetConfig
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