pub struct LogReturn { /* private fields */ }Expand description
A finite log return value.
Implementations§
Source§impl LogReturn
impl LogReturn
Sourcepub fn new(value: f64) -> Result<LogReturn, ReturnError>
pub fn new(value: f64) -> Result<LogReturn, ReturnError>
Creates a log return from a finite value.
§Errors
Returns ReturnError::NonFiniteReturn when value is not finite.
Sourcepub fn from_prices(
start_price: f64,
end_price: f64,
) -> Result<LogReturn, ReturnError>
pub fn from_prices( start_price: f64, end_price: f64, ) -> Result<LogReturn, ReturnError>
Computes a log return as ln(end_price / start_price).
§Errors
Returns ReturnError when either price is not finite, the start price is not positive,
or the end price is not positive.
Trait Implementations§
Source§impl PartialOrd for LogReturn
impl PartialOrd for LogReturn
impl Copy for LogReturn
impl StructuralPartialEq for LogReturn
Auto Trait Implementations§
impl Freeze for LogReturn
impl RefUnwindSafe for LogReturn
impl Send for LogReturn
impl Sync for LogReturn
impl Unpin for LogReturn
impl UnsafeUnpin for LogReturn
impl UnwindSafe for LogReturn
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