Skip to content

Realtime Order Updates

Use the order-update WebSocket stream to receive realtime Trading API V3 order-state and trade-execution events.

For REST API integrations, connect directly to the WebSocket endpoint, authenticate with the same session token used for REST calls, and decode binary protobuf messages. Trading API V3 order events are sent as NubraToClientIntentUpdate messages.

The stream separates two practical event categories:

  • non-fill intent-order events such as accepted, rejected, modified, cancelled, triggered, or trail-updated updates
  • fill events where the V3 update contains intentOrderResponse.tradeFill

Use Get Orders when you need a fetched snapshot instead of a live stream.

If the goal is debugging or operational validation, prefer logging the full decoded event object first and only then narrowing the fields you read in production logic.

WebSocket Endpoint

Use the UAT WebSocket URL for the current V3 rollout:

Environment WebSocket URL
UAT wss://uatapi.nubra.io/ws

REST Base URL

Use the UAT REST base URL for authentication and session management:

Environment REST base URL
UAT https://uatapi.nubra.io

Authentication

Order updates are pushed only for authenticated sessions. Use the same session token as the REST API login flow.

After the WebSocket opens, send this text message:

subscribe <session_token> notifications notification

If the WebSocket returns Invalid Token, re-authenticate and reconnect.

Message Envelope

WebSocket binary payloads are protobuf Any messages. The server sends an outer Any whose value contains another Any.

For Trading API V3, the inner Any.type_url ends with:

NubraToClientIntentUpdate

The inner Any.value is the corresponding NubraToClientIntentUpdate protobuf payload.

message Any {
  string type_url = 1;
  bytes value = 2;
}

Payload: NubraToClientIntentUpdate Proto

The Trading API V3 order-update payload is NubraToClientIntentUpdate.

message NubraToClientIntentUpdate {
  IntentOrderResponse intent_order_response = 1;
  IntentOrderResponseType intent_order_response_type = 2;
  IntentOrderRequestType intent_order_requst_type = 3;
}

message IntentOrderResponse {
  int64 intent_order_id = 1;
  NubraIntentOrderStatus order_status = 2;
  IntentEntryConfig entry_config = 3;
  repeated IntentExitTrigger exit_triggers = 4;
  repeated IntentLeg legs = 5;
  int64 filled_at = 6;
  OrderDeliveryType delivery_type = 7;
  PriceType price_type = 8;
  ValidityType validity_type = 9;
  repeated string strat_tags = 10;
  bool is_admin = 11;
  string echo_fields = 12;
  int64 order_qty = 13;
  int64 filled_qty = 14;
  int64 expiry_time = 15;
  int64 ltp = 16;
  int64 order_price = 17;
  int64 filled_price = 18;
  TradeFill trade_fill = 19;
  ExecutionMode execution_mode = 20;
  NubraIntentTimestamps nubra_timestamps = 21;
  string position_id = 22;
  int64 entry_price = 23;
  IcebergInfo iceberg_info = 24;
  RefData refdata = 25;
  int64 ref_id = 26;
  int64 good_till_date = 27;
  bool is_multi = 28;
  OrderSide order_side = 29;
  IntentOrderType intent_order_type = 30;
  string rejection_msg = 31;
}

Protocol field spelling

The proto field for request type is intent_order_requst_type; its default JSON name is intentOrderRequstType. Some SDK wrappers expose a normalized intent_order_request_type property, but direct REST WebSocket decoders should handle the raw protocol field name.

Nested Messages Proto

message TradeFill {
  int64 trade_qty = 1;
  int64 trade_price = 2;
  int64 ref_id = 3;
}

message IntentEntryConfig {
  repeated IntentEntryCondition conditions = 4;
  ConditionOperator condition_operator = 5;
  int64 entry_time = 6;
}

message IntentEntryCondition {
  ConditionKind kind = 1;
  int64 threshold = 2;
  IntentEntryTriggerStatus status = 3;
}

message ConditionKind {
  LTPConditionKind ltp_condition_kind = 1;
}

message IntentExitTrigger {
  IntentExitTriggerKind kind = 1;
  LTPConditionKind condition_kind = 2;
  int64 trigger_price = 3;
  int64 limit_price = 4;
  int64 trail_jump = 5;
  IntentExitTriggerStatus status = 6;
  int64 algo_trigger_price = 7;
  int64 algo_limit_price = 8;
  int64 exit_time = 9;
}

message IntentLeg {
  int64 ref_id = 1;
  int32 unit_qty = 2;
  int32 filled_qty = 3;
  int64 filled_price = 4;
  RefData refdata = 5;
  int32 order_qty = 6;
}

message NubraIntentTimestamps {
  int64 intent_created_at = 1;
  int64 sent_to_colo_at = 2;
  int64 filled_at = 3;
  int64 cancelled_at = 4;
  int64 last_modified_at = 5;
  int64 last_updated_at = 6;
}

message IcebergInfo {
  int32 number_of_legs = 1;
  int32 max_qty_per_leg = 2;
}

message RefData {
  int64 ref_id = 1;
  int64 zanskar_id = 2;
  string option_type = 3;
  int64 token = 4;
  string stock_name = 5;
  string series = 6;
  string zanskar_name = 7;
  int64 lot_size = 8;
  string asset = 9;
  string exchange = 10;
  string derivative_type = 11;
  string display_name = 12;
}

Shared Enums Proto

enum IntentOrderResponseType {
  INTENT_ORDER_RESPONSE_TYPE_INVALID = 0;
  INTENT_ORDER_RESPONSE_TYPE_ACCEPT = 1;
  INTENT_ORDER_RESPONSE_TYPE_REJECT = 2;
  INTENT_ORDER_RESPONSE_TYPE_FILLED = 3;
  INTENT_ORDER_RESPONSE_TYPE_ENTRY_TRIGGERED = 4;
  INTENT_ORDER_RESPONSE_TYPE_EXIT_SL_TRIGGERED = 5;
  INTENT_ORDER_RESPONSE_TYPE_EXIT_TP_TRIGGERED = 6;
  INTENT_ORDER_RESPONSE_TYPE_TRAIL_UPDATED = 7;
  INTENT_ORDER_RESPONSE_TYPE_EXECUTED = 8;
  INTENT_ORDER_RESPONSE_TYPE_UNSOLICITED_CANCEL = 9;
}

enum IntentOrderRequestType {
  INTENT_ORDER_REQUEST_TYPE_INVALID = 0;
  INTENT_ORDER_REQUEST_TYPE_NEW = 1;
  INTENT_ORDER_REQUEST_TYPE_MOD = 2;
  INTENT_ORDER_REQUEST_TYPE_CANCEL = 3;
}

enum NubraIntentOrderStatus {
  INTENT_ORDER_STATUS_INVALID = 0;
  INTENT_ORDER_STATUS_OPEN = 1;
  INTENT_ORDER_STATUS_EXECUTED = 2;
  INTENT_ORDER_STATUS_REJECTED = 3;
  INTENT_ORDER_STATUS_GTE = 4;
  INTENT_ORDER_STATUS_CANCELLED = 5;
  INTENT_ORDER_STATUS_EXPIRED = 6;
}

enum ExecutionMode {
  EXECUTION_MODE_INVALID = 0;
  EXECUTION_MODE_ENTRY = 1;
  EXECUTION_MODE_EXIT = 2;
  EXECUTION_MODE_ENTRY_AND_EXIT = 3;
}

enum IntentOrderType {
  INTENT_ORDER_TYPE_INVALID = 0;
  INTENT_ORDER_TYPE_REGULAR = 1;
  INTENT_ORDER_TYPE_TRIGGER = 2;
  INTENT_ORDER_TYPE_ICEBERG = 3;
  INTENT_ORDER_TYPE_FLEXI = 4;
}

enum IntentExitTriggerKind {
  INTENT_EXIT_TRIGGER_KIND_INVALID = 0;
  INTENT_EXIT_TRIGGER_KIND_STOPLOSS = 1;
  INTENT_EXIT_TRIGGER_KIND_TARGET_PROFIT = 2;
  INTENT_EXIT_TRIGGER_KIND_TRAILING_STOP = 3;
  INTENT_EXIT_TRIGGER_KIND_EXIT_TIME = 4;
}

enum IntentExitTriggerStatus {
  INTENT_EXIT_TRIGGER_STATUS_OPEN = 0;
  INTENT_EXIT_TRIGGER_STATUS_TRIGGERED = 1;
  INTENT_EXIT_TRIGGER_STATUS_FILLED = 2;
  INTENT_EXIT_TRIGGER_STATUS_CANCELLED = 3;
}

enum IntentEntryTriggerStatus {
  INTENT_ENTRY_TRIGGER_STATUS_OPEN = 0;
  INTENT_ENTRY_TRIGGER_STATUS_TRIGGERED = 1;
  INTENT_ENTRY_TRIGGER_STATUS_FILLED = 2;
  INTENT_ENTRY_TRIGGER_STATUS_CANCELLED = 3;
}

enum LTPConditionKind {
  LTP_CONDITION_KIND_INVALID = 0;
  LTP_CONDITION_KIND_ABOVE = 1;
  LTP_CONDITION_KIND_BELOW = 2;
  LTP_CONDITION_KIND_AT_OR_ABOVE = 3;
  LTP_CONDITION_KIND_AT_OR_BELOW = 4;
}

enum ConditionOperator {
  CONDITION_OPERATOR_INVALID = 0;
  CONDITION_OPERATOR_AND = 1;
  CONDITION_OPERATOR_OR = 2;
}

enum OrderSide {
  ORDER_SIDE_INVALID = 0;
  ORDER_SIDE_BUY = 1;
  ORDER_SIDE_SELL = 2;
}

enum OrderDeliveryType {
  ORDER_DELIVERY_TYPE_INVALID = 0;
  ORDER_DELIVERY_TYPE_CNC = 1;
  ORDER_DELIVERY_TYPE_IDAY = 2;
}

enum PriceType {
  PRICE_TYPE_INVALID = 0;
  PRICE_TYPE_LIMIT = 1;
  PRICE_TYPE_MARKET = 2;
}

enum ValidityType {
  VALIDITY_TYPE_INVALID = 0;
  VALIDITY_TYPE_DAY = 1;
  VALIDITY_TYPE_IOC = 2;
}

Price type compatibility

The realtime protocol exposes PRICE_TYPE_MARKET because Trading API V3 supports market-capable flows too. Keep websocket decoding aligned with the same placement rules documented elsewhere in this V3 track, including MARKET with IOC.

V3 Routing Logic

After decoding NubraToClientIntentUpdate:

Condition Treat as Meaning
intentOrderResponse.tradeFill is present and has tradeQty trade update Fill event.
intentOrderResponse.tradeFill is absent order update Non-fill intent-order event.

Use the embedded intent order response when the application needs the full order snapshot from the update.

In practice, many integrations start by printing the entire decoded NubraToClientIntentUpdate object and then progressively reading fields such as intentOrderResponse.intentOrderId, intentOrderResponse.orderStatus, intentOrderResponse.tradeFill, and intentOrderResponse.legs.

V3 Wrapper Fields

Field Type Meaning
intentOrderResponse IntentOrderResponse Full Trading API V3 order snapshot embedded in the update.
intentOrderResponseType string Update type such as accept, reject, fill, entry-triggered, exit-triggered, trail-updated, executed, or unsolicited cancel.
intentOrderRequstType string Request category such as new, modify, or cancel. This is the raw protocol JSON field spelling.

Intent Order Response Fields

Field Type Meaning
intentOrderResponse.intentOrderId int Trading API V3 order identifier.
intentOrderResponse.orderStatus string Current order status.
intentOrderResponse.intentOrderType string Intent order type.
intentOrderResponse.isMulti bool Whether the update is for a strategy order.
intentOrderResponse.refId int Single-leg reference ID when returned.
intentOrderResponse.refdata object Instrument metadata.
intentOrderResponse.legs array Strategy order leg details.
intentOrderResponse.orderSide string Strategy or order side when returned.
intentOrderResponse.deliveryType string Delivery type.
intentOrderResponse.priceType string Price type.
intentOrderResponse.validityType string Validity type.
intentOrderResponse.goodTillDate int Good-till date/time when returned.
intentOrderResponse.executionMode string Execution mode.
intentOrderResponse.entryPrice int Entry price.
intentOrderResponse.orderPrice int Order price.
intentOrderResponse.ltp int Latest traded price.
intentOrderResponse.orderQty int Order quantity.
intentOrderResponse.filledQty int Filled quantity.
intentOrderResponse.filledPrice int Filled price.
intentOrderResponse.filledAt int Fill timestamp.
intentOrderResponse.expiryTime int Expiry timestamp.
intentOrderResponse.entryConfig object Entry trigger or timed-entry state.
intentOrderResponse.exitTriggers array Stop-loss, target, trailing, or timed-exit trigger state.
intentOrderResponse.icebergInfo object Iceberg slicing fields when returned.
intentOrderResponse.tradeFill object Fill details when present.
intentOrderResponse.nubraTimestamps object Lifecycle timestamps.
intentOrderResponse.positionId string Linked position ID when available.
intentOrderResponse.stratTags string[] Strategy tags.
intentOrderResponse.echoFields string Echo metadata.
intentOrderResponse.rejectionMsg string Rejection reason when rejected.

Nested Fields

Trade Fill

Field Meaning
tradeFill.refId Filled instrument reference ID.
tradeFill.tradeQty Filled trade quantity.
tradeFill.tradePrice Filled trade price.

Entry Config

Field Meaning
entryConfig.entryTime Timed entry timestamp.
entryConfig.conditionOperator Condition operator when multiple conditions are present.
entryConfig.conditions[].kind.ltpConditionKind Entry LTP condition kind.
entryConfig.conditions[].threshold Entry condition threshold.
entryConfig.conditions[].status Entry condition status.

Exit Triggers

Field Meaning
exitTriggers[].kind Trigger kind such as stop-loss, target profit, trailing stop, or exit time.
exitTriggers[].conditionKind Condition kind.
exitTriggers[].triggerPrice Trigger price.
exitTriggers[].limitPrice Limit price.
exitTriggers[].trailJump Trailing stop jump.
exitTriggers[].status Exit trigger status.
exitTriggers[].algoTriggerPrice Algorithm trigger price when returned.
exitTriggers[].algoLimitPrice Algorithm limit price when returned.
exitTriggers[].exitTime Timed-exit timestamp.

Legs

Field Meaning
legs[].refId Leg reference ID.
legs[].unitQty Signed leg quantity; positive values are buy legs and negative values are sell legs.
legs[].orderQty Leg order quantity.
legs[].filledQty Leg filled quantity.
legs[].filledPrice Leg fill price.
legs[].refdata Leg instrument metadata.

Lifecycle Timestamps

Field Meaning
nubraTimestamps.intentCreatedAt Intent order creation timestamp.
nubraTimestamps.sentToColoAt Time sent to execution layer.
nubraTimestamps.filledAt Fill timestamp.
nubraTimestamps.cancelledAt Cancellation timestamp.
nubraTimestamps.lastModifiedAt Last modification timestamp.

V3 Event Types

Field Values
intentOrderResponseType INTENT_ORDER_RESPONSE_TYPE_ACCEPT, INTENT_ORDER_RESPONSE_TYPE_REJECT, INTENT_ORDER_RESPONSE_TYPE_FILLED, INTENT_ORDER_RESPONSE_TYPE_ENTRY_TRIGGERED, INTENT_ORDER_RESPONSE_TYPE_EXIT_SL_TRIGGERED, INTENT_ORDER_RESPONSE_TYPE_EXIT_TP_TRIGGERED, INTENT_ORDER_RESPONSE_TYPE_TRAIL_UPDATED, INTENT_ORDER_RESPONSE_TYPE_EXECUTED, INTENT_ORDER_RESPONSE_TYPE_UNSOLICITED_CANCEL
intentOrderRequstType INTENT_ORDER_REQUEST_TYPE_NEW, INTENT_ORDER_REQUEST_TYPE_MOD, INTENT_ORDER_REQUEST_TYPE_CANCEL
orderStatus INTENT_ORDER_STATUS_OPEN, INTENT_ORDER_STATUS_EXECUTED, INTENT_ORDER_STATUS_CANCELLED, INTENT_ORDER_STATUS_REJECTED, INTENT_ORDER_STATUS_GTE, INTENT_ORDER_STATUS_EXPIRED

Example JSON

This is an example of the decoded message shape after protobuf decoding.

{
  "intentOrderResponseType": "INTENT_ORDER_RESPONSE_TYPE_ACCEPT",
  "intentOrderRequstType": "INTENT_ORDER_REQUEST_TYPE_NEW",
  "intentOrderResponse": {
    "intentOrderId": 987654,
    "orderStatus": "INTENT_ORDER_STATUS_OPEN",
    "isMulti": false,
    "refId": 1842210,
    "deliveryType": "IDAY",
    "priceType": "LIMIT",
    "validityType": "DAY",
    "executionMode": "ENTRY",
    "entryPrice": 24600,
    "orderQty": 1,
    "filledQty": 0,
    "rejectionMsg": null
  }
}

Important Rules

Important Rules

  • This is a realtime streaming feed, not a snapshot API.
  • Send subscribe <session_token> notifications notification after opening the WebSocket.
  • For Trading API V3, decode inner protobuf messages whose type URL ends with NubraToClientIntentUpdate.
  • Use intentOrderResponse.tradeFill to identify V3 fill events.
  • For strategy orders, inspect intentOrderResponse.legs[]; the strategy still has one intentOrderId.
  • Price fields such as entryPrice, orderPrice, filledPrice, tradePrice, and ltp are typically returned in exchange-native integer units such as paise for NSE instruments.
  • For first-pass validation, print the full decoded event object before reducing it to selected fields.
  • Keep the process alive with your own long-lived WebSocket loop.
  • Use Get Orders when you need a fetched snapshot of current order state instead of a live stream.
  1. Get Orders
  2. Place Single Order
  3. Modify Order
  4. Cancel Order
NEO Assistant