Skip to main content

message_cid

Function message_cid 

Source
pub fn message_cid(msg: &OrderMessage) -> Option<ClientOrderId>
Expand description

The cid of the order an orders/events/ws message is about.

The two ids of the message mean: clientOrderId is the id of the request that caused the message, originalClientOrderId is the order that was changed (docs: “идентификатор измененной заявки”). For a cancel the request id is a fresh id of the cancel, for a replace the new order’s id. So:

  • only one of them is a UUID: that one (the docs sample of a fill has clientOrderId empty);
  • both are, and the message is a cancel, a replace or a cancel in progress (orderStatus 4, 5, 6): originalClientOrderId, the order the news is about, not the id of the request;
  • both are, any other status: clientOrderId, the id of the order that was placed or changed.

Not verified against the live API: which id the broker puts in which field for each kind of message. None when neither is a UUID.