Struct MdCore
pub struct MdCore { /* private fields */ }Expand description
Market data core: turns stream frames into events and keeps the state behind them.
Per subscription it holds the local order book (rebuilt from action rows), the ids of trades already seen (a reconnect replays recent trades, a repeat is dropped), the M10 candle being built from M5 bars, and the stream status.
Implements BrokerCore from brokapi-sansio. See the module docs for an example.
Implementations§
§impl MdCore
impl MdCore
pub fn desired(&self) -> &SubscriptionSet
pub fn desired(&self) -> &SubscriptionSet
The subscriptions the core was told to serve (set by apply).
pub fn status(&self, sub: SubscriptionId) -> Option<SubStatus>
pub fn status(&self, sub: SubscriptionId) -> Option<SubStatus>
Stream status of subscription sub. None for an id the core does not know.
pub fn take_restarts(&mut self) -> Vec<SubscriptionId>
pub fn take_restarts(&mut self) -> Vec<SubscriptionId>
Streams to reopen because their local book became unusable. Drains the list.
Trait Implementations§
§impl BrokerCore for MdCore
impl BrokerCore for MdCore
§fn poll_transmit(&mut self) -> Option<Outbound>
fn poll_transmit(&mut self) -> Option<Outbound>
gRPC streams are opened by the stream tasks, nothing is queued for a socket.
§type Frame = MdFrame
type Frame = MdFrame
The inbound frame type: for example
String for WebSocket text, or a decoded message.§fn on_frame(&mut self, frame: MdFrame, now: Instant, out: &mut EventSink)
fn on_frame(&mut self, frame: MdFrame, now: Instant, out: &mut EventSink)
Handles one inbound transport frame received at
now. Read more§fn poll_timeout(&self) -> Option<Instant>
fn poll_timeout(&self) -> Option<Instant>
§fn on_timeout(&mut self, _now: Instant, _out: &mut EventSink)
fn on_timeout(&mut self, _now: Instant, _out: &mut EventSink)
Handles a timer that fired.
now is the time the timer was due.Auto Trait Implementations§
impl Freeze for MdCore
impl RefUnwindSafe for MdCore
impl Send for MdCore
impl Sync for MdCore
impl Unpin for MdCore
impl UnsafeUnpin for MdCore
impl UnwindSafe for MdCore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].