Skip to content

Get Orders

This page covers both order retrieval flows exposed by NubraTrader:

  • orders() to fetch all orders for the current trading day
  • get_order(order_id) to fetch one specific order by ID

LLM guidance

Use this page to fetch order snapshots after placement, modification, or cancellation. Use orders() for current-day lists and filtering, and get_order(order_id) for one specific order. Do not use this page for live event-driven order updates. For streaming execution events, use Realtime Order Updates.

Get All Orders For The Day

Use orders() when you want the current day order list along with optional filters for live, executed, or tagged orders.

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.trading.trading_data import NubraTrader

nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
trader = NubraTrader(nubra, version="V2")

result = trader.orders()
live_orders = trader.orders(live=True)
executed_orders = trader.orders(executed=True)
tagged_orders = trader.orders(tag="example_single_order")

Accessing Data

# First order
print(result.root[0].order_id)
print(result.root[0].order_status)
print(result.root[0].order_price)
print(result.root[0].avg_filled_price)
print(result.root[0].last_traded_price)
print(result.root[0].display_name)
print(result.root[0].exchange_order_id)
print(result.root[0].ref_id)

# Second order
print(result.root[1].order_id)
print(result.root[1].order_status)
print(result.root[1].order_price)
print(result.root[1].avg_filled_price)
print(result.root[1].last_traded_price)
print(result.root[1].display_name)
print(result.root[1].exchange_order_id)
print(result.root[1].ref_data.ref_id)

Request Attributes

Attribute Type Meaning
live bool fetch only currently active orders
executed bool fetch only executed orders
tag str fetch only orders matching the given tag

Response Structure

class GetAllOrdersV2:
    root: list[CreateOrderResponseV2]

Each item in root follows the same response shape used for placed orders, including fields such as order_id, order_status, order_price, ref_data, and tag.

Get Order By ID

Use get_order(order_id) when you already have a specific order_id and want the latest known state of that order.

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.trading.trading_data import NubraTrader

nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
trader = NubraTrader(nubra, version="V2")

result = trader.get_order(2394981)
print(result.order_status)

Accessing Data

print(result.order_id)
print(result.ref_id)
print(result.order_status)
print(result.avg_filled_price)
print(result.order_price)
print(result.LTP)
print(result.exchange)
print(result.price_type)
print(result.validity_type)

if result.ref_data:
    print(result.ref_data.ref_id)
    print(result.ref_data.asset)
    print(result.ref_data.nubra_name)

if result.algo_params:
    print(result.algo_params.trigger_price)

Request Attributes

Attribute Type Meaning
order_id int unique ID of the order to fetch

Request Contract

Method Input Meaning
get_order(order_id) one order_id fetch one order by ID
orders(live=False, executed=False, tag=None) filters fetch the current day order list with optional filtering

Response Contract

Common fields returned on individual order responses include:

Field Type Meaning
order_id int order identifier
ref_id int instrument reference ID
order_type enum order type
order_side enum buy or sell
order_price int order price
order_qty int order quantity
filled_qty int filled quantity
avg_filled_price int average fill price
order_status enum order status
ref_data RefData instrument metadata
LTP or last_traded_price int LTP field when present

orders() returns a list-like root model of those order response objects.

Example Order Lifecycle

# Fetch details before modify
before_mod = trader.get_order(order_id)
print("Before Modify:")
print(before_mod)

# Modify order
modify_res = trader.modify_order_v2(
    order_id=order_id,
    request={
        "order_price": 134400,
        "order_qty": 1,
        "exchange": "NSE",
        "order_type": "ORDER_TYPE_STOPLOSS",
        "price_type": "LIMIT",
        "algo_params": {"trigger_price": 134390},
    },
)
print("Modify Response:")
print(modify_res)

# Fetch details after modify
after_mod = trader.get_order(order_id)
print("After Modify:")
print(after_mod)

Typical progression:

  • before modify, status can still be pending and acknowledgement fields may be empty
  • after modify or exchange acknowledgement, status and timestamp fields can update

Important Rules

Important Rules

  • order_id is the primary lookup key for get_order().
  • Use orders() for all current-day order listings and filtering, not for single-order lookup by ID.
  • Only one of live=True or executed=True should be set in the same orders() request.
  • Interpret order prices and LTP fields using exchange-native integer units such as paise for NSE instruments.
  • Inspect order state before and after modify or cancel workflows when state transitions matter.
  1. Modify Order
  2. Cancel Order
  3. Place Order
NEO Assistant