Skip to content

Derivatives

Classes

OptionChain

A class to fetch and process option chain data from NSE (National Stock Exchange).

Parameters:

Name Type Description Default
symbol str

Trading symbol (e.g., 'NIFTY', 'BANKNIFTY' or any equity symbol)

required
expiry_date str

Expiry date of the options

required

Attributes:

Name Type Description
option_chain DataFrame

Processed option chain data

call_option_data DataFrame

Call options data

put_option_date DataFrame

Put options data

option_pain float

Maximum pain strike price

Methods:

Name Description
get_option_price

Get the option price (last traded, bid, or ask) for a specific option

get_synthetic_futures

Calculate synthetic futures price for a given strike price

Functions

get_option_price
get_option_price(strike, opt_type, txn_type=None)

Get the option price (last traded, bid, or ask) for a specific option.

Parameters:

Name Type Description Default
strike float

Strike price of the option

required
opt_type str

Option type ('CE' for Call or 'PE' for Put)

required
txn_type str

Transaction type ('buy', 'sell', or None for last price)

None

Returns:

Type Description
float

Option price based on the specified parameters

get_synthetic_futures
get_synthetic_futures(strike)

Calculate synthetic futures price for a given strike price. Synthetic Futures price = Strike + Call - Put

Parameters:

Name Type Description Default
strike float

Strike price for which to calculate synthetic futures

required

Returns:

Type Description
float

Synthetic futures price

plot_pain_analysis
plot_pain_analysis()

Plot pain analysis for the option chain.