pub struct MarketState {
pub price: Decimal,
pub spread_percent: Decimal,
pub volume: Decimal,
pub status: MarketStatus,
pub last_update: DateTime<Utc>,
}Expand description
Simulated market state for a single instrument.
Fields§
§price: DecimalCurrent price.
spread_percent: DecimalBid-ask spread as a percentage.
volume: Decimal24h volume.
status: MarketStatusCurrent market status.
last_update: DateTime<Utc>Last update time.
Implementations§
Source§impl MarketState
impl MarketState
Sourcepub const fn with_spread(self, spread_percent: Decimal) -> Self
pub const fn with_spread(self, spread_percent: Decimal) -> Self
Sets the spread percentage.
Sourcepub const fn with_status(self, status: MarketStatus) -> Self
pub const fn with_status(self, status: MarketStatus) -> Self
Sets the market status.
Sourcepub fn to_market_data(&self, symbol: &str, currency: &str) -> MarketData
pub fn to_market_data(&self, symbol: &str, currency: &str) -> MarketData
Converts to MarketData.
Trait Implementations§
Source§impl Clone for MarketState
impl Clone for MarketState
Auto Trait Implementations§
impl Forget for MarketState
impl Freeze for MarketState
impl Move for MarketState
impl RefUnwindSafe for MarketState
impl Send for MarketState
impl Sync for MarketState
impl Unpin for MarketState
impl UnsafeUnpin for MarketState
impl UnwindSafe for MarketState
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