Questions tagged [nsepy]

A Python Library to get publicly available data on National Stock Exchange of India (NSE) website.

About NSEpy

From the NSEpy documentation:

NSEpy is a library to extract historical and realtime data from NSE’s website. This Library aims to keep the API very simple.

Python is a great tool for data analysis along with the scipy stack and the main objective of NSEpy is to provide analysis ready data-series for use with scipy stack. NSEpy can seamlessly integrate with Technical Analysis library (Acronymed TA-Lib, includes 200 indicators like MACD, RSI). This library would serve as a basic building block for automatic/semi-automatic algorithm trading systems or backtesting systems for Indian markets.

Latest stable release:

NSEpy 0.6 - 10 March 2018

Resources

Official Resources

34 questions
1
vote
1 answer

Pandas index.get_loc giving keyerror for time series data

The following code works fine. import pandas as pd #import numpy as np import matplotlib.pyplot as plt from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'inline') sym = 'SPY' df_close = pd.DataFrame() df_temp =…
Arun Kamath
  • 49
  • 1
  • 1
  • 6
1
vote
2 answers

Why does nsepy get_history return an empty dataframe for stocks?

Running this with nsepy 0.4 and Python 2.7 returns an empty dataframe. This was working until last week. from nsepy import get_history as gh from datetime import date stk1 =…
Thewalker
  • 11
  • 1
  • 3
0
votes
0 answers

How to get Yearly and Quarterly Data from NSEpy for a stock?

In Python, we can download daily data (1 row for 1 day) from NSEpy using the below code: from datetime import date from nsepy import get_history sbin = get_history(symbol='SBIN', start=date(2015,1,1), …
Ash
  • 375
  • 1
  • 3
  • 14
0
votes
1 answer

Convert multiple downloaded time series share to pandas dataframe

i downloaded the information about multiple shares using nsepy library for the last 10 days, but could not save it in the pandas dataframe. Below code to download the multiples share data: import datetime from datetime import date from nsepy import…
user286076
  • 131
  • 3
  • 14
0
votes
0 answers

get_index_pe_history is not working for Nifty Small cap index in NSEpy package

In NSEpy package get_index_pe_history is not working for Nifty Small cap index. It fails to fetch the data sym = 'NIFTY Smallcap 250' get_index_pe_history(symbol=sym,start=date(2015,1,1),end=date(2022,9,23))
Lal
  • 23
  • 5
0
votes
1 answer

Unable to fetch the data for the multiple stocks from the nsepy by using python

Code: import numpy as np import pandas as pd from datetime import datetime,date,time,timedelta from nsepy import get_history stocks = ['JSWSTEEL','RELIANCE','AXISBANK','HCLTECH','TECHM'] start = datetime.today() - timedelta(365) end =…
0
votes
1 answer

create dataframe for each value in a list

I am writing a code for downloading the historical data for multiple stocks. The code is as given: import pandas as pd from nsepy import get_history from datetime import date stock =…
Huzefa Sadikot
  • 561
  • 1
  • 7
  • 22
0
votes
1 answer

How to convert a python class 'str' to a class 'tuple' without the opening and closing quotation marks

I am trying to achieve a tuple which I eventually would be uploading to PostgreSQL database as a Bulk Update. Do let me know if I am going wrong or if there are better ways to achieve my goal. My code is as below: index = [] n = -1 for stock in…
Fred
  • 211
  • 2
  • 9
0
votes
1 answer

Split daily data into Weekly data

I am using the nsepy module to get the data for 2 week for SBIN share. Code : from nsepy import get_history from datetime import date import pandas as pd today = date.today() # print(today) sbin = get_history(symbol='SBIN', start=date( 2020,…
girish
  • 33
  • 1
  • 8
0
votes
2 answers

How do I get date column from nsepy get-history function

I am not able to get this date column which is visible in the below given image. I want to store this date in another dataframe I have tried this: sbin['Date'] but its not working complete code: from datetime import date import datetime from nsepy…
Akshay
  • 1,019
  • 12
  • 21
0
votes
1 answer

NSEPY is not working.Timeout error while connecting

I am using nsepy for data analysis since more than one year.But its not working now days. i did all possible try to fix this ,uninstall and reinstall .tried with both python 2.7 and 3.7 but nothing is working it seems . all the time same timeout…
0
votes
2 answers

Python: NSEpy Module: Not able to fetch Futures live data

I am using below code to pull live Nifty quote from NSEpy module but getting error. Code: from nsepy import get_quote nifty = get_quote('NIFTY', series='EQ', instrument='FUTIDX', expiry='26SEP2019') print(nifty) Error: nifty =…
0
votes
0 answers

Convert dict(x,y) to df in Python

How to convert the output into a dataframe? It is basically a dictionary. Tried _from dict. Python code: startdate = datetime.date(2017,1,12) expirydate = datetime.date(2017,1,19) data = dict() for x in range(0,3): for y in range(1,8): …
0
votes
1 answer

How to get relevant data say only the "Underlying Price" from the get_history function without the date

I have posted here part of the code. I want to get, say only the "Strike Price" information from nifty_opn but what I am getting here is that the strike_price information contains the date as well, something like this: 2014-12-01 2100 How to do…
0
votes
1 answer

I'm trying to get stock history using nsepy, but nsepy.get_history() call is returning empty for symbol 'PVR'

I'm trying to get stock history using nsepy. get_history() call is returning history for all the symbols except 'PVR', which is empty. This is the code PVR = get_history(symbol='PVR', start=date(2018,5,1), …