pub async fn stop_without_answer_keeps_its_cid<U: StopOrderExecutor + ?Sized>(
ud: &U,
id: &InstrumentId,
stop_price: Price,
lose: impl Fn(bool),
)Expand description
A stop order the broker took, whose answer was lost, comes back in the list with its cid.
The failure that costs money: the stop order is at the broker and the bot was told nothing. lose turns the
fault of the imitation on (true: the broker takes a stop order, then the answer is lost) and off (false).
The connector must not send again and must not lose the link between the stop order and the cid. Steps:
- With the fault on,
place_stopis [Error::Unknown]. - The same
cidagain isRejected(duplicate_place): a stop order is never sent twice. active_stop_ordersshows exactly one stop order, and itscidis the one that was sent. Whether the broker returns the number or the connector finds the stop order by what was asked for, the bot sees the same.cancel_stopby thatcidremoves it.
§Panics
With [conformance:stop_without_answer_keeps_its_cid] <reason>.
§Examples
brokapi_conformance::reconcile(&ud).await;
brokapi_conformance::stop_without_answer_keeps_its_cid(&ud, &sber, Price::from(200), |lose| {
opts.stop_answer_lost.store(lose, Ordering::SeqCst)
})
.await;