Market Quotes¶
quote() returns an order-book snapshot for one instrument. Use it when you need bid and ask depth, last traded price, traded quantity, and volume instead of a lightweight top-line price check.
When To Use This Page¶
Use this page when you need to:
- fetch market depth for a specific instrument
- inspect bid and ask levels
- read last traded price and quantity together with the order book
- build quote widgets or depth-aware trading tools
LLM guidance
Use quote() only when order-book depth is required. If you only need the latest price and percentage change, prefer Current Price.
Basic Usage¶
from nubra_python_sdk.marketdata.market_data import MarketData
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
market_data = MarketData(nubra)
quote = market_data.quote(ref_id=69353, levels=5)
print(quote)
Accessing Response Fields¶
order_book = quote.orderBook
print(f"Reference ID: {order_book.ref_id}")
print(f"Timestamp: {order_book.timestamp}")
print(f"Last Traded Price: {order_book.last_traded_price}")
print(f"Last Traded Quantity: {order_book.last_traded_quantity}")
print(f"Volume: {order_book.volume}")
print(f"Bid Levels: {len(order_book.bid)}")
print(f"Ask Levels: {len(order_book.ask)}")
for bid in order_book.bid:
print(f"Bid price={bid.price} quantity={bid.quantity} orders={bid.num_orders}")
for ask in order_book.ask:
print(f"Ask price={ask.price} quantity={ask.quantity} orders={ask.num_orders}")
SDK Surface¶
from nubra_python_sdk.marketdata.market_data import MarketData
MarketData.quote(ref_id: int, levels: int)
Request Contract¶
| Parameter | Type | Required | Example | Meaning |
|---|---|---|---|---|
ref_id |
int |
yes | 69353 |
Nubra instrument reference ID |
levels |
int |
yes | 5 |
order-book depth to fetch, typically from 1 to 20 |
Response Contract¶
| Field | Type | Nullable | Meaning |
|---|---|---|---|
orderBook |
OrderBook |
no | quote response container |
orderBook.ref_id |
int |
no | instrument reference ID |
orderBook.timestamp |
int |
no | quote timestamp |
orderBook.bid |
list[OrderLevel] |
yes | bid-side depth |
orderBook.ask |
list[OrderLevel] |
yes | ask-side depth |
orderBook.last_traded_price |
int |
yes | last traded price |
orderBook.last_traded_quantity |
int |
yes | last traded quantity |
orderBook.volume |
int |
yes | traded volume |
Reference Response Shape¶
class OrderBookWrapper:
orderBook: OrderBook
class OrderBook:
ref_id: int
timestamp: int
bid: list[OrderLevel]
ask: list[OrderLevel]
last_traded_price: int
last_traded_quantity: int
volume: int
class OrderLevel:
price: int
quantity: int
num_orders: int
Implementation Notes¶
- Use smaller depth values when full 20-level depth is not necessary.
- Bid levels are ordered from highest to lowest price.
- Ask levels are ordered from lowest to highest price.
Important Rules
quote()requires a validref_id, not just a trading symbol.- Resolve instruments first instead of hardcoding
ref_idvalues across environments. levelscontrols quote depth and should stay within the supported range, typically1to20.last_traded_priceand order-book prices are returned in exchange-native integer units such as paise for NSE instruments.- This is a snapshot response, not a realtime streaming feed.
- Use Current Price instead of
quote()when you do not need order-book depth.
What To Read Next¶
The most common next pages are: