pocketful logo light
pocketful logo light

Snapquote Data

Snapquote data refers to a snapshot or instantaneous view of essential market data for a specific financial instrument at a particular moment in time. It typically includes key information such as the instrument’s last traded price, bid and ask prices, trading volume, and possibly other relevant metrics. This data is crucial for real-time monitoring of market conditions and can help traders react swiftly to changes in prices and trading activity.

To get the snapquote data, the first step is to subscribe the instrument for which we need the data.

Below is the list of exchange codes which will be required while subscribing to a particular instrument.

exchange_code = {
    "NSE" : 1,
    "NFO" : 2,
    "CDS" : 3,
    "MCX" : 4,
    "BSE" : 6,
    "BFO" : 7
}

Subscribe instruments to get market data

You can subscribe or unsubscribe single or multiple instruments to get market data.

To subscribe only one instrument.

snapquotedata_payload= {'exchangeCode': 1, 'instrumentToken': 'token'}
response = pocket_ws.subscribe_snapquote_data(snapquotedata_payload)

To subscribe multiple instrument.

multiple_snapquotedata_payload = {}
response = pocket_ws.subscribe_multiple_snapquote_data(snapquotedata_payload)

Example

snapquotedata_payload= {'exchangeCode': 1, 'instrumentToken': 1333}
response = pocket_ws.subscribe_snapquote_data(snapquotedata_payload)

Read Data

snapquote_data = pocket_ws.read_snapquote_data()
print(snapquote_market_data)
snapquote_data = pocket_ws.read_multiple_snapquote_data()
print(snapquote_market_data)

Snapquote Response

{
  "mode": 4,
  "exchange_code": 1,
  "instrument_token": 1333,
  "buyers": [
    3,
    3,
    1,
    2,
    6
  ],
  "bidPrices": [
    145100,
    145095,
    145090,
    145085,
    145080
  ],
  "bidQtys": [
    121,
    53,
    64,
    76,
    130
  ],
  "sellers": [
    1,
    4,
    1,
    3,
    4
  ],
  "askPrices": [
    145110,
    145135,
    145140,
    145145,
    145150
  ],
  "askQtys": [
    33,
    441,
    68,
    113,
    324
  ],
  "averageTradePrice": 145026,
  "open": 145000,
  "high": 145930,
  "low": 144415,
  "close": 145545,
  "totalBuyQty": 653906,
  "totalSellQty": 870361,
  "volume": 9438681
}

Response Parameter

Field NameDescription
modeThe mode of market data transmission.
exchange_codeThe code representing the exchange.
instrument_tokenUnique identifier for the financial instrument.
buyersArray representing buyer data.
bidPricesArray representing bid prices.
bidQtysArray representing bid quantities.
sellersArray representing seller data.
askPricesArray representing ask prices.
askQtysArray representing ask quantities.
averageTradePriceAverage price of recent trades.
openOpening price for the trading session.
highHighest price reached during the session.
lowLowest price reached during the session.
closeClosing price for the trading session.
totalBuyQtyTotal quantity of buy orders.
totalSellQtyTotal quantity of sell orders.
volumeTotal trading volume for the session.

Unsubscribe the instrument to stop receiving the data.

response = pocket_ws.unsubscribe_snapquote_data(snapquotedata_payload)
response = pocket_ws.unsubscribe_multiple_snapquote_data(snapquote_payload)