Skip to content

Realtime Order Updates

Use OrderUpdate to receive realtime order-state and trade-execution callbacks over WebSocket.

For Trading API V3 order workflows, call socket.connect(TradingAPIVersion.V3). The SDK parses V3 order-stream messages into NubraToClientIntentUpdateInfoWrapper.

  • on_order_update receives non-fill intent-order events such as accepted, rejected, modified, cancelled, triggered, or trail-updated updates
  • on_trade_update receives fill events when the V3 wrapper contains trade_fill
  • on_portfolio_update is also available on the client when portfolio refresh events are enabled in the stream

LLM guidance

Use this page when the application needs event-driven Trading API V3 order or trade state over WebSocket. Generate OrderUpdate(...).connect(TradingAPIVersion.V3) for V3 order workflows. Use Get Orders for fetched order snapshots, and use order placement or modification pages when the goal is to send trading requests rather than consume live updates.

Basic Usage

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.ticker import orderupdate
from nubra_python_sdk.trading.trading_enum import TradingAPIVersion

nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)

def on_order_update(msg):
    print("[OrderUpdate]", msg.intent_order_id, msg.order_status)

    order = msg.intent_order_response
    if order:
        print(order.execution_mode)
        print(order.entry_price)
        print(order.rejection_msg)

def on_trade_update(msg):
    fill = msg.trade_fill
    if fill:
        print("[TradeUpdate]", fill.ref_id, fill.trade_qty, fill.trade_price)

def on_connect(msg):
    print("[status]", msg)

def on_close(reason):
    print("[closed]", reason)

def on_error(err):
    print("[error]", err)

socket = orderupdate.OrderUpdate(
    client=nubra,
    on_order_update=on_order_update,
    on_trade_update=on_trade_update,
    on_connect=on_connect,
    on_close=on_close,
    on_error=on_error,
)

socket.connect(TradingAPIVersion.V3)
socket.keep_running()

Callback Contract

Callback V3 payload Meaning
on_connect(msg) str connection confirmation message
on_close(reason) str close reason
on_error(err) str socket or callback error
on_order_update(msg) NubraToClientIntentUpdateInfoWrapper non-fill Trading API V3 intent-order update
on_trade_update(msg) NubraToClientIntentUpdateInfoWrapper fill update where msg.trade_fill is present
on_portfolio_update(msg) portfolio update wrapper streamed portfolio refresh event when emitted

How V3 Updates Are Classified

For Trading API V3, the SDK receives intent-order updates and queues them as NubraToClientIntentUpdateInfoWrapper.

  • if msg.trade_fill is present, the SDK dispatches the event to on_trade_update
  • if msg.trade_fill is absent, the SDK dispatches the event to on_order_update

Use the convenience properties msg.intent_order_id, msg.order_status, and msg.trade_fill for common routing logic. Use msg.intent_order_response when the application needs the full order snapshot embedded in the update.

V3 Wrapper Fields

Field Type Meaning
intent_order_response IntentOrderResponseWrapper full Trading API V3 order snapshot embedded in the update
intent_order_response_type IntentOrderResponseTypeEnum update type such as accept, reject, fill, entry-triggered, exit-triggered, trail-updated, executed, or unsolicited cancel
intent_order_request_type IntentOrderRequestTypeEnum request category such as new, modify, or cancel
intent_order_id int convenience property for intent_order_response.intent_order_id
order_status NubraIntentOrderStatusEnum convenience property for intent_order_response.order_status
trade_fill TradeFillWrapper convenience property for fill data when present

V3 Intent Order Response Fields

Field Type Meaning
intent_order_response.intent_order_id int Trading API V3 order identifier
intent_order_response.order_status NubraIntentOrderStatusEnum current order status
intent_order_response.intent_order_type str intent order type
intent_order_response.is_multi bool whether the update is for a multi-leg strategy
intent_order_response.ref_id int single-leg reference ID
intent_order_response.refdata RefDataWrapper instrument metadata
intent_order_response.legs list[IntentLegWrapper] flexi / multi-leg strategy leg details
intent_order_response.order_side str strategy or order side when returned
intent_order_response.delivery_type str delivery type
intent_order_response.price_type str price type
intent_order_response.validity_type str validity type
intent_order_response.good_till_date int good-till date/time when returned
intent_order_response.execution_mode str execution mode
intent_order_response.entry_price int entry price
intent_order_response.order_price int order price
intent_order_response.ltp int latest traded price
intent_order_response.order_qty int order quantity
intent_order_response.filled_qty int filled quantity
intent_order_response.filled_price int filled price
intent_order_response.filled_at int fill timestamp
intent_order_response.expiry_time int expiry timestamp
intent_order_response.entry_config IntentEntryConfigWrapper entry trigger or timed-entry state
intent_order_response.exit_triggers list[IntentExitTriggerWrapper] stop-loss, target, trailing, or timed-exit trigger state
intent_order_response.entry_open list[IntentLegOpenWrapper] open entry leg details when returned
intent_order_response.exit_open list[IntentLegOpenWrapper] open exit leg details when returned
intent_order_response.iceberg_info IntentIcebergParamsWrapper iceberg slicing fields when returned
intent_order_response.trade_fill TradeFillWrapper fill details when present
intent_order_response.nubra_timestamps NubraIntentTimestampsWrapper lifecycle timestamps
intent_order_response.position_id str linked position ID when available
intent_order_response.strat_tags list[str] strategy tags
intent_order_response.echo_fields str echo metadata
intent_order_response.rejection_msg str rejection reason when rejected

V3 Nested Fields

Trade Fill

Field Meaning
trade_fill.ref_id filled instrument reference ID
trade_fill.trade_qty filled trade quantity
trade_fill.trade_price filled trade price

Entry Config

Field Meaning
entry_config.entry_time timed entry timestamp
entry_config.condition_operator condition operator when multiple conditions are present
entry_config.conditions[].kind.ltp_condition_kind entry LTP condition kind
entry_config.conditions[].threshold entry condition threshold
entry_config.conditions[].status entry condition status

Exit Triggers

Field Meaning
exit_triggers[].kind trigger kind such as stop-loss, target profit, trailing stop, or exit time
exit_triggers[].condition_kind condition kind
exit_triggers[].trigger_price trigger price
exit_triggers[].limit_price limit price
exit_triggers[].trail_jump trailing stop jump
exit_triggers[].status exit trigger status
exit_triggers[].algo_trigger_price algorithm trigger price when returned
exit_triggers[].algo_limit_price algorithm limit price when returned
exit_triggers[].exit_time timed-exit timestamp

Legs

Field Meaning
legs[].ref_id leg reference ID
legs[].unit_qty signed leg quantity; positive values are buy legs and negative values are sell legs
legs[].order_qty leg order quantity
legs[].filled_qty leg filled quantity
legs[].filled_price leg fill price
legs[].refdata leg instrument metadata

Lifecycle Timestamps

Field Meaning
nubra_timestamps.intent_created_at intent order creation timestamp
nubra_timestamps.sent_to_colo_at time sent to execution layer
nubra_timestamps.filled_at fill timestamp
nubra_timestamps.cancelled_at cancellation timestamp
nubra_timestamps.last_modified_at last modification timestamp

V3 Event Types

Field Values
intent_order_response_type 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
intent_order_request_type INTENT_ORDER_REQUEST_TYPE_NEW, INTENT_ORDER_REQUEST_TYPE_MOD, INTENT_ORDER_REQUEST_TYPE_CANCEL
order_status INTENT_ORDER_STATUS_OPEN, INTENT_ORDER_STATUS_EXECUTED, INTENT_ORDER_STATUS_CANCELLED, INTENT_ORDER_STATUS_REJECTED, INTENT_ORDER_STATUS_GTE, INTENT_ORDER_STATUS_EXPIRED

Important Rules

Important Rules

  • Call socket.connect(TradingAPIVersion.V3) for Trading API V3 order workflows.
  • This is a realtime streaming feed, not a snapshot API.
  • Use msg.intent_order_id and msg.order_status for common V3 routing.
  • Use msg.trade_fill to identify V3 fill events.
  • For flexi / multi-leg strategies, inspect intent_order_response.legs[]; the strategy still has one intent_order_id.
  • Price fields such as entry_price, order_price, filled_price, trade_price, and ltp are typically returned in exchange-native integer units such as paise for NSE instruments.
  • Keep the process alive with keep_running() or your own long-lived thread or event-management flow.
  • Use Get Orders when you need a fetched snapshot of current order state instead of a live stream.
  1. Get Orders
  2. Place Order
  3. Modify Order
  4. Cancel Order
NEO Assistant