command.trade_order.submit
Submit a trade order.
Method
command.trade_order.submit
Description
Submits a new trade order to an exchange. Supports market, limit, and stop orders with various time-in-force options.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
tradingAccountId | string | Yes | Trading account to use |
instrumentId | string | Yes | Instrument to trade |
orderSide | string | Yes | Order side (BUY, SELL) |
orderType | string | Yes | Order type |
quantity | string | Yes | Order quantity |
limitPrice | string | No* | Limit price (required for LIMIT orders) |
stopPrice | string | No* | Stop price (required for STOP orders) |
timeInForce | string | No | Time in force (default: GTC) |
orderQuantityType | string | No | Quantity type (BASE, QUOTE) |
quantityRounding | string | No | Rounding mode (DOWN, UP, NEAREST) |
*Required depending on order type.
Order Types
| Type | Description | Required Fields |
|---|---|---|
MARKET | Execute at market price | quantity |
LIMIT | Execute at limit price or better | quantity, limitPrice |
STOP_MARKET | Market order triggered at stop price | quantity, stopPrice |
STOP_LIMIT | Limit order triggered at stop price | quantity, limitPrice, stopPrice |
Time In Force Options
| Option | Description |
|---|---|
GTC | Good till cancelled |
IOC | Immediate or cancel |
FOK | Fill or kill |
Result
Returns the submitted trade order object.
Trade Order Object
| Field | Type | Description |
|---|---|---|
tradeOrderId | string | Unique order identifier |
status | string | Initial status (PENDING) |
| ... | ... | Other order fields |
Usage
# Market buy order
result = await client.rpc("command.trade_order.submit", {
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"instrumentId": "BINANCE:BTC/USDT",
"orderSide": "BUY",
"orderType": "MARKET",
"quantity": "0.1"
})
# Limit sell order
result = await client.rpc("command.trade_order.submit", {
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"instrumentId": "BINANCE:BTC/USDT",
"orderSide": "SELL",
"orderType": "LIMIT",
"quantity": "0.1",
"limitPrice": "55000.00",
"timeInForce": "GTC"
})
Example Response
{
"tradeOrderId": "770e8400-e29b-41d4-a716-446655440002",
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"venue": "BINANCE",
"instrumentId": "BINANCE:BTC/USDT",
"baseAsset": "BTC",
"quoteAsset": "USDT",
"orderSide": "BUY",
"orderType": "LIMIT",
"timeInForce": "GTC",
"status": "PENDING",
"limitPrice": "50000.00",
"quantity": "0.1",
"executedQuantity": "0",
"executedCost": "0",
"createdAt": 1703052635110,
"updatedAt": 1703052635110
}
Notes
- Subscribe to the trading account channel for real-time order updates
- Quantity precision must match instrument specifications
- Use
query.instrument.listto check supported order types