Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| developers:websocket:orders [2025/03/14 22:10] – chad | developers:websocket:orders [2026/03/05 16:43] (current) – [AutoOCO Order] frank | ||
|---|---|---|---|
| Line 344: | Line 344: | ||
| An AutoOCO Order is a batch of three orders: | An AutoOCO Order is a batch of three orders: | ||
| * A Trigger Order that initiates the trade. | * A Trigger Order that initiates the trade. | ||
| - | * Two OCO Orders (Take Profit and Stop Loss) that execute based on the trigger order' | + | * Two OCO Orders (Take Profit and Stop Loss) that are submitted with prices that are differentials to the fill price of the trigger order. |
| If the Trigger Order fills, the OCO Orders are submitted. If the OCO Orders begin filling, any remaining volume in the Trigger Order is canceled. | If the Trigger Order fills, the OCO Orders are submitted. If the OCO Orders begin filling, any remaining volume in the Trigger Order is canceled. | ||
| Example OrderSubmit message for an AutoOCO order: | Example OrderSubmit message for an AutoOCO order: | ||
| + | |||
| + | < | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==== Take Profit and Stop Loss ==== | ||
| + | |||
| + | Take profit and stop loss orders are a type of OCO order. The first order in the batch is the **Trigger Order**. Once it fills, the **Take Profit** and **Stop Loss** orders are submitted. | ||
| + | |||
| + | Example OrderSubmit message for a Take Profit / Stop Loss order: | ||
| < | < | ||
| Line 355: | Line 437: | ||
| | | ||
| | | ||
| - | | + | |
| | | ||
| { | { | ||
| Line 369: | Line 451: | ||
| | | ||
| | | ||
| - | | + | |
| }, | }, | ||
| { | { | ||
| Line 376: | Line 458: | ||
| | | ||
| | | ||
| - | | + | |
| } | } | ||
| ] | ] | ||
| Line 382: | Line 464: | ||
| </ | </ | ||
| + | When the **Trigger Order** executes, the **Take Profit** and **Stop Loss** orders are placed. If the price reaches the take profit level, the stop loss order is canceled, and vice versa. | ||
| + | ==== Flatten Position ==== | ||
| - | ==== Take Profit and Stop Loss ==== | + | A Flatten Position Order closes the entire position in the specified market by submitting an offsetting order at market price. |
| - | Take profit and stop loss orders are a type of OCO order. The first order in the batch is the **Trigger | + | Example |
| - | + | ||
| - | Example OrderSubmit | + | |
| < | < | ||
| Line 396: | Line 478: | ||
| | | ||
| | | ||
| - | | ||
| | | ||
| { | { | ||
| - | BuySell = BuySell.Buy, | + | |
| - | PriceType = PriceType.Limit, | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | }, | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | }, | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| } | } | ||
| ] | ] | ||
| Line 423: | Line 486: | ||
| </ | </ | ||
| - | When the **Trigger Order** executes, | + | < |
| + | The Flatten Position order automatically determines | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Order Status Summary Messages Reference ===== | ||
| + | When displaying order status to end users, combining the '' | ||
| + | ^ Order Status ^ Order Change ^ Status Summary Message ^ Notes ^ | ||
| + | | **Finished States** | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | Finished | '' | ||
| + | | **Rejected States** | ||
| + | | Rejected | '' | ||
| + | | Rejected | //(Other changes)// | " | ||
| + | | **Working States** | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | '' | ||
| + | | Working | //(Any change with fills)// | "{Base Message}, Partial Fill" | Appended when TotalFillVolume > 0 | | ||
| + | | **None (Pre-Submission) States** | ||
| + | | None | None | " | ||
| + | | None | '' | ||
| + | | None | '' | ||
| + | | None | '' | ||
| + | | None | '' | ||
| + | | **Held States** | ||
| + | | Held | //(Any)// | "Held on Server..." | ||