pub struct PriceLevels { /* private fields */ }Expand description
The price grid of an order flow series.
§Examples
use ferrochart_orderflow::PriceLevels;
// 0.25 ticks, two ticks per row: rows 0.5 apart.
let levels = PriceLevels::new(0.25, 2)?;
assert_eq!(levels.level(100.2), Some(200));
assert_eq!(levels.level(100.26), Some(201));
assert_eq!(levels.price(201), 100.5);
assert_eq!(levels.edges(201), (100.25, 100.75));Implementations§
Source§impl PriceLevels
impl PriceLevels
Sourcepub fn new(tick_size: f64, row_size: u32) -> Result<Self>
pub fn new(tick_size: f64, row_size: u32) -> Result<Self>
Rows of row_size ticks of tick_size.
§Errors
Error::InvalidArgument if tick_size is not finite and positive
or row_size is 0.
Trait Implementations§
Source§impl Clone for PriceLevels
impl Clone for PriceLevels
impl Copy for PriceLevels
Source§impl Debug for PriceLevels
impl Debug for PriceLevels
Source§impl PartialEq for PriceLevels
impl PartialEq for PriceLevels
impl StructuralPartialEq for PriceLevels
Auto Trait Implementations§
impl Forget for PriceLevels
impl Freeze for PriceLevels
impl Move for PriceLevels
impl RefUnwindSafe for PriceLevels
impl Send for PriceLevels
impl Sync for PriceLevels
impl Unpin for PriceLevels
impl UnsafeUnpin for PriceLevels
impl UnwindSafe for PriceLevels
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