Analysis NIFTY/BANKNIFTY option chain in your SMARTPHONE
Analysis NIFTY/BANKNIFTY option chain in your SMARTPHONE
When it comes to analyzing option chains for the NIFTY or any other financial instrument, both smartphones and laptops can be used effectively. However, each has its own advantages and considerations. Let's compare them in the context of analyzing option chains:
1. Portability: Smartphones are highly portable and can be easily carried anywhere, allowing you to access option chain data on the go. You can analyze the market and make informed decisions from anywhere, even while traveling.
2. Apps: There are several brokerage and financial apps available for smartphones that provide real-time option chain data, allowing you to monitor and analyze the market efficiently. These apps often offer user-friendly interfaces tailored for mobile devices.
3. Notifications: Smartphones enable push notifications, which can alert you to important market events, price movements, or changes in option chain data. You can stay updated and respond promptly to market conditions.
4. Accessibility: With the increasing power and capabilities of smartphones, you can access web-based platforms or use specialized apps to analyze option chains directly on your device. This convenience eliminates the need for carrying a separate device like a laptop.
CODE :-
import requests
import pandas as pd
import time
url = 'https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY'
headers = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36',
'accept-language': 'en,gu;q=0.9,hi;q=0.8',
'accept-encoding': 'gzip, deflate, br'}
session = requests.Session()
def importdata():
request = session.get(url,headers=headers)
cookies = dict(request.cookies)
response = session.get(url, headers=headers, cookies=cookies).json()
rdata = pd.DataFrame(response)
t_ce = rdata['filtered']['CE']['totOI']
t_pe = rdata['filtered']['PE']['totOI']
dt = rdata['records']['timestamp']
trend = t_pe - t_ce
t = dt.split(" ")
data = {
"Time" : t[1],
"COI" : t_ce,
"POI" : t_pe,
"Trend" : trend
}
return data
print("|-------------------------------------------------------|")
print("|{:<9}| {:<15}| {:<15}| {:<10}|".format(" Time"," Total Call OI"," Total Put OI","Trend"))
print("|-------------------------------------------------------|")
while True:
data = importdata()
print("|{:<9}| {:<12}| {:<12}| {:<10}|".format(data["Time"],data["COI"],data["POI"],data["Trend"]))
print("|-------------------------------------------------------|")
time.sleep(60)
Video Tutorial :-
Comments
Post a Comment