Skip to main content

REJECT_PRICE

Constant REJECT_PRICE 

Source
pub const REJECT_PRICE: Price;
Expand description

A limit order at exactly this price is refused by every mock (the broker says no).

Scenarios use it to get a definite refusal on demand. The refusal must be a clear answer from the broker side, not a timeout, so the library reports it as an error other than [brokapi_core::Error::Unknown]. The value is a price the mocks agree on. It has no meaning at a live broker, never send it there.

§Examples

A refused order is an error, and it leaves the connector able to take the next order:

use brokapi_conformance::REJECT_PRICE;
brokapi_conformance::reconcile(&ud).await; // opens the command gate
let refused = ud
    .place(PlaceOrderRequest {
        cid: ClientOrderId::new_v4(),
        instrument: sber,
        side: Side::Buy,
        order_type: OrderType::Limit,
        qty: Qty::from(10),
        price: Some(REJECT_PRICE),
    })
    .await;
assert!(refused.is_err());
assert!(!matches!(refused, Err(Error::Unknown)), "a refusal is a clear answer");