Skip to main content

synthetic_cid

Function synthetic_cid 

Source
pub fn synthetic_cid(exchange_order_id: &str) -> ClientOrderId
Expand description

Stable stand-in cid for an order that was not placed by us (phone, another robot): the broker gives no order_request_id, but ReconcileReport::foreign needs a non-nil cid. Derived from the exchange order id (FNV-1a), never produced by Uuid::new_v4.

The same exchange id always gives the same value, so repeated reports of one foreign order line up. The value is not a key you can send back to the broker: the broker does not know it.

§Examples

use brokapi_tbank::cid::synthetic_cid;

assert_eq!(synthetic_cid("EX1"), synthetic_cid("EX1"));
assert_ne!(synthetic_cid("EX1"), synthetic_cid("EX2"));