Skip to main content

Module order

Module order 

Expand description

Order and execution mapping.

Constants§

LIST_STATUS_ACTIVE
Order status of the list: 3 = active.
PLAIN_LIST_TYPES
Order types of the order LIST (POST /orders/search) that are plain orders: 1 market, 2 limit, 3 iceberg, 10 limit for 30 days. Types 4..7 and 11 are conditional (stop) orders.
STOP_LIST_TYPES
Order types of the list that are conditional orders: 4 stop-limit, 5 and 11 take-profit, 6 stop-loss, 7 take-profit and stop-loss.

Functions§

map_order_ack
Builds an [OrderAck] for a client order id and the broker’s order id. The ack carries the local receive time only, the broker gives no time with it.
map_order_record
A plain order of the list. cid is what the caller knows about this order (the list does not carry our clientOrderId).
map_order_status
Maps an order status answer to an Event::Order. None when the client order id is not a UUID or the answer has no report.
map_place_response
Maps the plain answer of a place request (status: OK) to an Event::Order that says “acknowledged”.
map_state_list
The latest report of an answer with a data list (GET /orders, /orders*/sync) as a snapshot. known_cid is the cid the caller asked about (a status answer is about that order); without it the ids of the answer are used.
map_stop_record
A conditional order of the list as one or two stop snapshots (two for type 7, a take-profit and stop-loss pair: the pair is one order at the broker, shown as its two legs with the same ids). None for plain orders.
map_ws_order_message
Maps a message of the order events WebSocket to an Event::Order.
message_cid
The cid of the order an orders/events/ws message is about.
rejection_reason
true when the report says the broker refused the order (orderStatus 8), with its reason.