Algo Trading. How to view option chain? Python , Fyers
How to View Option Chain?
def create_option():
f=open("E:\Coder\option.txt","r")
strike=f.read()
data = {"symbols":"NSE:NIFTY50-INDEX"}
output=fyers.quotes(data)
ltp=output["d"][0]["v"]["lp"]
atStrike=int(ltp)
atStrike=int(ltp-(ltp%50))
atStrike+=100
i=1
while(i<=10):
if(i<5):
button=Button(root,text=strike[0:10]+str(atStrike)+"CE",width=20)
button.grid(row=i,column=0)
button.bind('<Button>',buyOrder)
tempEntry=Entry(root,width=24)
tempEntry.grid(row=i,column=1)
option.append(button)
price.append(tempEntry)
atStrike-=50
elif(i==5):
button=Button(root,text=strike[0:10]+str(atStrike)+"CE",width=20)
button.grid(row=i,column=0)
button.bind('<Button>',buyOrder)
tempEntry=Entry(root,width=24)
tempEntry.grid(row=i,column=1)
option.append(button)
price.append(tempEntry)
atStrike=atStrike-100
elif(i>5):
button=Button(root,text=strike[0:10]+str(atStrike)+"PE",width=20)
button.grid(row=i,column=0)
button.bind('<Button>',buyOrder)
tempEntry=Entry(root,width=24)
tempEntry.grid(row=i,column=1)
option.append(button)
price.append(tempEntry)
atStrike+=50
i+=1
def optionPrices():
i=0
while(i<len(option)):
data = {"symbols":"NSE:"+option[i]["text"]}
output=fyers.quotes(data)
ltp=output["d"][0]["v"]["lp"]
price[i].delete(0,"end")
price[i].insert(0,ltp)
i+=1
How to do this?
Comments
Post a Comment