pub struct BuyingPowerCalculator {
pub cash: f64,
pub portfolio_value: f64,
pub margin_multiplier: f64,
}Expand description
Buying power calculation helper.
Fields§
§cash: f64Cash balance.
portfolio_value: f64Portfolio value.
margin_multiplier: f64Margin multiplier (1.0 for cash, 2.0 for margin, 4.0 for day trading).
Implementations§
Source§impl BuyingPowerCalculator
impl BuyingPowerCalculator
Sourcepub fn new(
cash: f64,
portfolio_value: f64,
margin_multiplier: f64,
) -> BuyingPowerCalculator
pub fn new( cash: f64, portfolio_value: f64, margin_multiplier: f64, ) -> BuyingPowerCalculator
Create new calculator.
Sourcepub fn buying_power(&self) -> f64
pub fn buying_power(&self) -> f64
Calculate buying power.
Calculate maximum position size for a given price.
Trait Implementations§
Source§impl Clone for BuyingPowerCalculator
impl Clone for BuyingPowerCalculator
Source§fn clone(&self) -> BuyingPowerCalculator
fn clone(&self) -> BuyingPowerCalculator
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 moreAuto Trait Implementations§
impl Freeze for BuyingPowerCalculator
impl RefUnwindSafe for BuyingPowerCalculator
impl Send for BuyingPowerCalculator
impl Sync for BuyingPowerCalculator
impl Unpin for BuyingPowerCalculator
impl UnwindSafe for BuyingPowerCalculator
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