Skip to main content

stream_cut_degrades_until_reconcile

Function stream_cut_degrades_until_reconcile 

Source
pub async fn stream_cut_degrades_until_reconcile<U, C, CFut>(
    ud: &U,
    rx: &mut Receiver<Envelope>,
    id: &InstrumentId,
    price: Price,
    cut: C,
)
where U: OrderExecutor + ExecutionSource + ?Sized, C: FnOnce() -> CFut, CFut: Future<Output = ()>,
Expand description

The stream of own orders breaks: the bot is told, the gate closes, reconcile opens it.

cut breaks the order and fill streams from the broker side, and returns once the broker has done it (the connector then reopens the streams by itself). reopened says when the streams are open again. Steps and checks:

  1. subscribe_order_state and subscribe_executions; reopened is awaited once for the first open.
  2. cut(). An [Event::Reconnected] arrives for the order state subscription, and one for the executions subscription.
  3. place is [Error::Degraded] and sends nothing (active_orders shows no order of ours).
  4. reconcile(&[]) succeeds and opens the gate. A place goes through and is cancelled.

§Panics

With [conformance:stream_cut_degrades_until_reconcile] <reason>.