Posted by: Sourav | June 7, 2017

Download Historical stock data from Indian stock market(NSE) using nsepy and pandas,Python Teacher Sourav,Kolkata 09748184075


from nsepy import get_history, get_index_pe_history
from datetime import date

sbin = get_history(symbol=’SBIN’,
start=date(2015,1,1),
end=date(2015,1,10))
sbin[[ ‘VWAP’, ‘Turnover’]].plot(secondary_y=’Turnover’)

nifty = get_history(symbol=”NIFTY”,
start=date(2015,1,1),
end=date(2015,1,10),
index=True)
nifty[[‘Close’, ‘Turnover’]].plot(secondary_y=’Turnover’)

 

#Futures and Options historical data
nifty_fut = get_history(symbol=”NIFTY”,
start=date(2015,1,1),
end=date(2015,1,10),
index=True,
futures=True, expiry_date=date(2015,1,29))

stock_opt = get_history(symbol=”SBIN”,
start=date(2015,1,1),
end=date(2015,1,10),
option_type=”CE”,
strike_price=300,
expiry_date=date(2015,1,29))

#Index P/E ratio history
nifty_pe = get_index_pe_history(symbol=”NIFTY”,
start=date(2015,1,1),
end=date(2015,1,10))

 

print nifty_fut

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: