DEV Community

Cover image for NSE Option Chain Data using Python

NSE Option Chain Data using Python

Mr.Shah on February 12, 2022

In Today's Article we are going to learn how to fetch Nifty and Bank Nifty Data using Python and it's going to be amazing. From where we ...
Collapse
 
kaurav1108 profile image
kaurav1108

Hi @shahstavan : Thank you for python program, I want to customise output as below
as in output i want to print the extra coloum as CENT and PENT and value inside those new 2 coloum based on total open interest number leangth.
eg. CE Open interest for 17400 strike = 12345678 then --> in CENT Coloum is should print first 3 digit of number : 123
eg. PE Open interest for 17400 strike = 456789 then --> in PENT Coloum is should print first 3 digit of number : 45
and leangth condition as :
if leangth is 6 digit then show 1st digit of number
if leangth is 7 digit then show 2st digit of number
if leangth is 8 digit then show 3st digit of number
if leangth is 9 digit then show 4st digit of number
can you help me with code.

Collapse
 
shahstavan profile image
Mr.Shah

Just format the output in Python code.

Collapse
 
kaurav1108 profile image
kaurav1108 • Edited

@shahstavan : Hi, I have updated code my self and its working fine as per my requirement.
Now i can you help me to run this code every 5 min and updated on some html page

Collapse
 
shahstavan profile image
Mr.Shah

Learn Flask or any other Framework and what you can do is reload the page every 5 minute automatically ๐ŸŒ›๐Ÿ™Œ

Thread Thread
 
thecodingsage profile image
Sivayogeith Umamaheswaran

lol, reloading the page is soooo wrong in 2023.

Collapse
 
pradip_ profile image
Pradip Mukhopadhyay

Hi,

Is the data reported by Bandl is correct?
E.g. I am seeing OI data is much lower scale compared to that of say reported by other Options tools (e.g. Opstra or SensiBull).
Like this shows data as lots? E.g.
03-Nov-2022 17550 CE ( 294.8) [ 1167 ] { 250 } | PE ( 44.5) [ 17693 ] { 8428 }

It's actually 17693 lots?

Collapse
 
anirudh12 profile image
Anirudh-12

yes, it's actually 17693 lots. If you what the data per lot you have to multiply the data by lot_size

Collapse
 
vegaonline profile image
Abhijit Bhattacharyya

This is nice example. How can one plot banknifty converting the json.loads data from this code to the dataframe?

Collapse
 
muhammed_nihal_c044fbb99c profile image
Muhammed Nihal

How can I contact you?

Collapse
 
taniksood profile image
taniksood

Hello dear, can you help me out with python code to fetch live data for NSE Top 20 Contracts pl ?

nseindia.com/market-data/equity-de...

Collapse
 
pradip_ profile image
Pradip Mukhopadhyay

Very nice, indeed very nice.
Sir if I want to find out top-5 OI (including both call and put), what sort of changes you propose?
Basically want to find out the market behavior during this hour.

Collapse
 
anbu222 profile image
Anbarasu A

Hello,

Is it possible to scan options price OHLC values as well and creating a scanner based on the OHLC values. Please share your thoughts.

Thank you in advance.

Collapse
 
pavitra profile image
Pavitra

can you add some example of stock like reliance support and resistance in code

Collapse
 
chintu35395015 profile image
Chintu

is it possible to add difference (CE,PE) column also for each strike price and total CE and PE

Collapse
 
arnavdas profile image
Arnav-Das

TYVM

Collapse
 
chandra6011 profile image
C P Patel ๐Ÿ‡ฎ๐Ÿ‡ณ

Thats great code... From where should one pick up Current time and date of Exchange and whether the "today" is an Expiry day or not..?

Collapse
 
arjunhack profile image
Salai Arjun

Hi bro, very good code.. I am automating my trading strategy into python code. Need some guidance. How can I contact u?