Skip to main content

active_orders_lifecycle

Function active_orders_lifecycle 

Source
pub async fn active_orders_lifecycle<U: OrderExecutor + ?Sized>(
    ud: &U,
    id: &InstrumentId,
    price: Price,
)
Expand description

active_orders follows the order: a placed order is listed with its details, a cancelled one is gone.

Steps and checks:

  1. Place a buy limit order, three lots, at price (rate-limit refusals are waited out and retried under a fresh cid).
  2. active_orders() lists the order under its cid, with the same instrument, side Buy, three lots and price price, and a state that is not Cancelled, Filled or Rejected.
  3. Cancel it. active_orders() no longer lists it.

price must be far from the market and accepted by the mock. The command gate must be open, so call reconcile first. The mock must keep placed orders in its active list.

§Panics

With [conformance:active_orders_lifecycle] <reason> when a call fails or a check fails.

§Examples

brokapi_conformance::reconcile(&ud).await;
brokapi_conformance::active_orders_lifecycle(&ud, &sber, Price::from(100)).await;