1

Why is my data frame empty? If I execute the get_history() function for stocks like SBIN, the code works. But it doesn't work for currency derivatives like USDINR.

pip install nsepy

from nsepy import get_history
from datetime import date
import matplotlib

usdinr = get_history(symbol="USDINR", start=date(2019,6,1), 
                 end=date(2019,6,10), option_type="CE",
                 strike_price=69.25,expiry_date=date(2019,6,21))
print(usdinr)

enter image description here

  • Please add the relevant parts of your code in the question as text (formatted as code). – rdas Jun 10 '19 at 06:49
  • I believe NSEPY does not have a provision for currency derivatives and only works for stocks/options/futures/etc. (as of 10th June 2019) – Devanshi Ruparel Jun 10 '19 at 12:14

1 Answers1

0

Show Code:

from nsepy import get_history
from history import *
from datetime import date
import datetime as dt
import sys
datas="ti"
end_day = date.today()    
start_day = end_day - timedelta(90)
print(datas, start_day, end_day)
print(stock) 

Output is :

=============== RESTART: D:\Web_Python\History_Data - Dummy.py =============== ('ti', datetime.date(2019, 9, 19), datetime.date(2019, 12, 18))

did not return data

I want this code for my website https://barawakar.com/

Sailendra
  • 1,318
  • 14
  • 29