Submitting Orders order
Submit orders to your connected exchange accounts.
Submit
Submit an order.
Send
- message array ["submit", "order", order, requestId?]
- instruction string = "submit"
- Specifies a message to submit data.
- topic string = "order"
- Specifies the type of data is order.
- order object
- The order parameters.
- broker string "FXCM" | "OANDA" | "BitMEX" | "Binance" | "Bitfinex"
- (Required) The broker or exchange you are submitting the order to.
- symbol string
- (Required) The market you are trading. This must match exactly the exchange's instrument identifier.
- side string "BUY" | "SELL"
- (Required) The side you are trading.
- type string "MARKET" | "LIMIT" | "STOP_LIMIT" | "STOP" | "MARKET_IF_TOUCHED" | "LIMIT_IF_TOUCHED" | "PEGGED"
- (Required) The order type.
- quantity number
- (Required) The size of the order.
- limitPrice number
- The price at which a limit order should execute. Required for LIMIT and STOP_LIMIT orders.
- stopPrice number
- The price required to trigger a market or limit order. Required for STOP and STOP_LIMIT orders.
- timeInForce string "GTC" | "DAY" | "IOC" | "FOK" | "OPG"
- (Optional) Instruction to the exchange to cancel or expire an order on certain conditions.
- requestId string
- (Optional) Any string to correlate the response.
Example:
socket.send(JSON.stringify(["submit", "order", {
broker: "BitMEX",
symbol: "XBTUSD",
side: "BUY",
type: "LIMIT",
quantity: 100,
limitPrice: 20000,
}]))
Receive
Where a requestId
is sent, the response will take the form:
- message array [requestId, error?, data?]
- requestId string
- The client specified request identifier.
- error string
- (Optional) Any error handling the order submission.
- order any
- (Optional) The order parameters submitted.
Note that this is not a confirmation that the exchange has accepted the order, only that the system has accepted the submission and forwarded it to the exchange. The actual order will arrive on the "orders"
channel, see Private Channels - Orders.
Where no requestId
is sent, if the order is accepted, a message will be sent on the "message"
channel. Any error will be sent on the "error"
channel.
Was this page useful? If you find any errors or have any questions please get in touch at support@cloud9trader.com.