Expand description
Stop orders: the request of the shared interface to ALOR’s stop and stop-limit orders, and back.
ALOR has two kinds of stop orders, and both keep the trigger price and the condition (more, less, …):
a stop order (a market order is made on trigger) and a stop-limit order (a limit order is made, with
its own price). The shared interface has three kinds:
| Request | ALOR |
|---|---|
StopLoss, TakeProfit without limit_price | a stop order. The condition follows the side and the kind (a sell stop-loss triggers when the price falls to the trigger price, a sell take-profit when it rises to it) |
StopLoss, TakeProfit with limit_price, StopLimit | a stop-limit order (a StopLimit without limit_price is refused) |
A stop order read back has the kind StopLoss or TakeProfit (from the side and the condition) and a
stop-limit order has the kind StopLimit: ALOR does not keep which of the two a bot meant.
Constants§
- GTC_
HORIZON_ SECS - The stop orders of ALOR end at a given time; a stop order that is “good till cancel” gets this long.
Functions§
- build
- The wire request and whether it is a stop-limit order (
true) or a stop order (false). - cid_of
- The cid in the comment of a stop order record, if it is ours.
- condition
- The trigger condition for the side and the kind.
- end_
time - The end of the stop order, Unix seconds, from the expiry.
now_secsis the time now. - snapshot
- A stop order of the portfolio as a snapshot. The cid is the one the connector found (
Noneif the order is not ours).Noneif the record lacks the side, the quantity or the trigger price. - state_
of - The state of a stop order from its
status: aworkingone waits for the trigger.