Skip to content

Get order1

Get Order by ID

Retrieve real-time status and details of any specific order using its order ID.

Usage

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

# Initialize the Nubra SDK client
# Use NubraEnv.UAT for testing or NubraEnv.PROD for production
nubra = InitNubraSdk(NubraEnv.UAT)  # or NubraEnv.PROD

##using totp login and .env file 
#nubra = InitNubraSdk(NubraEnv.UAT, totp_login= True ,env_creds = True)

trade = NubraTrader(nubra, version= "V1")

result = trade.get_order(795)

Accessing Data

# Top-level order details
print(f"Order ID: {result.order_id}")
print(f"Ref ID: {result.ref_id}")
print(f"Average Filled Price: {result.avg_filled_price}")
print(f"Order Price: {result.order_price}")
print(f"Last Traded Price: {result.last_traded_price}")

# Nested ref_data details
print(f"Ref Data - Ref ID: {result.ref_data.ref_id}")
print(f"Ref Data - Asset: {result.ref_data.asset}")
print(f"Ref Data - Nubra Name: {result.ref_data.nubra_name}")

Request Attribute

Attribute Type Description
order_id int Unique ID of the order to fetch

Response Structure

class RefData:
    ref_id: int
    option_type: Optional[str]
    token: Optional[int]
    stock_name: str
    nubra_name: str
    lot_size: Optional[int]
    asset: str
    exchange: str
    derivative_type: Optional[str]

class GetOrderResponse:
    order_id: int
    exchange_order_id: Optional[int]
    ref_id: Optional[int]
    display_name: Optional[str]
    order_type: Optional[str]
    order_side: Optional[OrderSideEnum]
    order_price: Optional[int]
    order_qty: Optional[int]
    leg_size: Optional[int]
    filled_qty: Optional[int]
    avg_filled_price: Optional[int]
    order_status: Optional[OrderStatusEnum]
    last_modified: Optional[datetime]
    ref_data: Optional[RefData]
    last_traded_price: Optional[int] 
    order_delivery_type: Optional[DeliveryTypeEnum]
    execution_type: Optional[ExecutionTypeEnum]
    duration: Optional[int]
    max_prate: Optional[int]
    trigger_price: Optional[int]

Response Attributes

Attribute Description
order_id Unique ID of the order
exchange_order_id order ID assigned by the exchange
ref_id The instrument reference id received from Instrument API (e.g., "69353")
display_name Represents the internal name of the traded instrument
order_type Type of order (Limit, Market)
order_side Buy or Sell
order_price Price at which order is placed (in paise)
order_qty Total quantity ordered
leg_size Size of each leg in the order
filled_qty Quantity already filled
avg_filled_price Average price of filled quantity (in paise)
order_status Current status of the order
last_modified Last modification time
last_traded_price Last traded price of the instrument (in paise)
order_delivery_type CNC, Intraday
max_prate Max participation rate for execution logic
execution_type LIMIT, MARKET, STOPLOSS , ICEBERG
trigger_price Trigger price for stop-loss orders

Get All Orders for the Day

Fetch a complete list of all orders placed during the trading day, along with their current status.

Usage

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

# Initialize the Nubra SDK client
# Use NubraEnv.UAT for testing or NubraEnv.PROD for production
nubra = InitNubraSdk(NubraEnv.UAT)  # or NubraEnv.PROD

##using totp login and .env file 
#nubra = InitNubraSdk(NubraEnv.UAT, totp_login= True ,env_creds = True)

trade = NubraTrader(nubra, version= "V1")

result = trade.orders()

Request Attribute

Attribute Type Description
live bool
executed bool

Accessing Data

# Order 1 details
print(f"Order ID: {result.root[0].order_id}")
print(f"Basket ID: {result.root[0].basket_id}")
print(f"Order Price: {result.root[0].order_price}")
print(f"Avg Filled Price: {result.root[0].avg_filled_price}")
print(f"Last Traded Price: {result.root[0].last_traded_price}")
print(f"Display Name: {result.root[0].display_name}")
print(f"Exchange Order ID: {result.root[0].exchange_order_id}")
print(f"Max Prate: {result.root[0].max_prate}")
print(f"Ref ID: {result.root[0].ref_id}")

# Order 2 details
print(f"Order ID: {result.root[1].order_id}")
print(f"Basket ID: {result.root[1].basket_id}")
print(f"Order Price: {result.root[1].order_price}")
print(f"Avg Filled Price: {result.root[1].avg_filled_price}")
print(f"Last Traded Price: {result.root[1].last_traded_price}")
print(f"Display Name: {result.root[1].display_name}")
print(f"Exchange Order ID: {result.root[1].exchange_order_id}")
print(f"Max Prate: {result.root[1].max_prate}")
print(f"Ref ID: {result.root[1].ref_data.ref_id}")

Response structure

class RefData:
    ref_id: int
    option_type: Optional[str]
    token: Optional[int]
    stock_name: str
    nubra_name: str
    lot_size: Optional[int]
    asset: str
    exchange: str
    derivative_type: Optional[str]

class GetOrderResponse:
    order_id: int
    exchange_order_id: Optional[int]
    ref_id: Optional[int]
    display_name: Optional[str]
    order_type: Optional[str]
    order_side: Optional[OrderSideEnum]
    order_price: Optional[int]
    order_qty: Optional[int]
    leg_size: Optional[int]
    filled_qty: Optional[int]
    avg_filled_price: Optional[int]
    order_status: Optional[str]
    last_modified: Optional[datetime]
    ref_data: Optional[RefData]
    last_traded_price: Optional[int] 
    order_delivery_type: Optional[DeliveryTypeEnum]
    execution_type: Optional[ExecutionTypeEnum]
    duration: Optional[int]
    max_prate: Optional[int]
    trigger_price: Optional[int]

class GetAllOrder:
    root:List[GetOrderResponse]

Response attribute

Field Description
root List of all orders placed for the day.

Note: Each order object inside the root list follows the same structure as the Get Order by ID response, which includes attributes like order_idorder_priceorder_statusref_data, and more.