Dhan APIs Market Data

Understanding Market Data

When working in the market, it is possible that you could be able to see names such as SEM_EXM_EXCH_ID or SEM_TRADING_SYMBOL.

Let’s see what each signifies.


Lets Connect

1 SEM_EXM_EXCH_ID — Exchange ID

It indicates which exchange in which it is traded.

Example:

  • NSE = National Stock Exchange
  • BSE = Bombay Stock Exchange

2 SEM_SEGMENT — Market Segment

Indicates what segment where an instrument trades.

Example:

  • EQ = Equity (stocks)
  • OPTIDX = Index Options
  • FUTSTK = Stock Futures

3 SEM_SMST_SECURITY_ID — Security ID

unique identification number that is assigned to every trader in the database of exchanges.

Example:

  • 12345 = Reliance Industries in NSE’s database

4 SEM_INSTRUMENT_NAME — Instrument Type

Defines the kind of instrument like Index or Stock. Option or Future.

Example:

  • OPTIDX = Option on an Index (like NIFTY)
  • FUTSTK = Future of a Stock

5 SEM_EXPIRY_CODE — Expiry Code

The expiry date is represented in a codified format.

Example:

  • 20240814 = 14th August 2024

6 SEM_TRADING_SYMBOL — Trading Symbol

This is the official symbol used to trade the instrument.

Example:

  • NIFTY24AUG24000CE = NIFTY, August 2024, 24000 Call Option

7 SEM_LOT_UNITS — Lot Size

The number of units contained in a lot of bulk or derivative trades.

Example:

  • NIFTY Option Lot = 75

8 SEM_CUSTOM_SYMBOL — Custom Symbol

An defined by the user name that makes it easier to reference.

Example:

  • Instead of RELIANCEIND-EQ, you set it as REL-EQ

9 SEM_EXPIRY_DATE — Expiry Date

The actual date of expiration of an option or future.

Example:

  • 14-AUG-2024

SEM_STRIKE — Strike Price

The reached-upon the strike cost for an option contract.

Market Data Functions in TSL

Below are a few most important functions used to gat

1 Get Latest Price – LTP

Finds the latest trading price of a share or index currently.

data = tsl.get_ltp_data(names=['CRUDEOIL', 'NIFTY'])
crudeoil_ltp = data['CRUDEOIL']

2 Get Full Quote Data

The complete live details of a security, such as LTP price, bid/ask volumes, as well as other information about the market.

data = tsl.get_quote_data(names=['CRUDEOIL', 'NIFTY'])
crudeoil_quote_data = data['CRUDEOIL'] #Full current detail

3 Get OHLC Data

It displays the openHighLow, and Close prices of a instrument or a stock during the specified timeframe.

data = tsl.get_ohlc_data(names=['CRUDEOIL', 'NIFTY'])
crudeoil_ohlc_data = data['CRUDEOIL']

4 Get Historical Data

Offers historical price and volume information for a instrument or stock over months, days, weeks or even years.

data = tsl.get_historical_data(tradingsymbol='NIFTY', exchange='NSE', timeframe="DAY")   
data = tsl.get_historical_data(tradingsymbol='ACC', exchange='NSE', timeframe="1")

Make use of "1""5""15" for minutes, or "DAY" for daily candles.

5 ATM, OTM, and ITM Strike Selection

Helps you choose the best option strike prices:

  • ATM = At The Money (strike price to be close to the current market price)
  • OTM means Out of the Money (strike price from the market price)
  • ITM = In The Money (strike price that is already profitable if exercised right now)

ATM Example:

CE_symbol_name, PE_symbol_name, strike_price = tsl.ATM_Strike_Selection(Underlying='NIFTY', Expiry=0)

OTM Example:

CE_symbol_name, PE_symbol_name, CE_OTM_price, PE_OTM_price = tsl.OTM_Strike_Selection(Underlying='NIFTY', Expiry=0, OTM_count=5)

ITM Example:

CE_symbol_name, PE_symbol_name, CE_ITM_price, PE_ITM_price = tsl.ITM_Strike_Selection(Underlying='NIFTY', Expiry=0, ITM_count=1)

6 Get Option Greeks

Calculates sensitivity and risk values (Delta, Gamma, Theta, Vega) that show the way an option’s price could alter with the market’s movements.

all_values = tsl.get_option_greek(
    strike=24400, expiry=0, asset='NIFTY',
    interest_rate=10, flag='all_val', scrip_type='CE'
)

Through these functions and definitions you can access, analyze market data efficiently to automate trading or analytics or for strategies.

Your Business Potential with Our Proven Strategies

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Your Algo Trading Partner. Trade Smart, Trade Right “Trade Algo!

Company

Blog

Privacy Policy

Help

Address: Rani Bagh, Delhi – 110034

Phone: 701-153-3217

Terms And Conditions

Refund & Cancellation Policy

Subscribe Us Today

Stay Ahead in Trading – Subscribe for Updates and Insights

Address: Rani Bagh, Delhi – 110034 | Phone: 701-153-3217 | Email: [email protected]

 Copyright © 2025 – TradeHull