- 🌱 I’m currently learning
- 🔭 I’m currently working on ...
- 📫 How to reach me: open mypage
Library to collect NSE data in pandas dataframe
Home Page: http://nsedt.nse.pratikanand.co.in/
License: Apache License 2.0
1.First error ,this is shown once only
PS C:\data\stockmarket> python z_prototyping.py
{
"time": "12/07/2023 06:21:19 PM",
"lineno": "139",
"name": "[root]",
"loglevel": "ERROR",
"process": "15880",
"filename": "equity.py",
"funcName": "get_price",
"logmessage": "https://www.nseindia.com/api/historical/securityArchives?symbol=TCS&from=18-07-2023&to=06-09-2023&dataType=priceVolumeDeliverable&series=EQ got exception: Please try again in a minute.. Please try again later.",
}
Traceback (most recent call last):
File "C:\data\stockmarket\z_prototyping.py", line 12, in
print(eq.get_price(start_date, end_date, symbol="TCS"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\equity.py", line 140, in get_price
raise exc
File "C:\python\Lib\site-packages\nsedt\equity.py", line 136, in get_price
dataframe = future.result()
^^^^^^^^^^^^^^^
File "C:\python\Lib\concurrent\futures_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\concurrent\futures_base.py", line 401, in __get_result
raise self.exception
File "C:\python\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\utils_init.py", line 81, in fetch_url
raise ValueError("Please try again in a minute.")
ValueError: Please try again in a minute.
2.After the above error is shown once ,then this error keeps on occuring when i use the function
PS C:\data\stockmarket> python z_prototyping.py
Traceback (most recent call last):
File "C:\data\stockmarket\z_prototyping.py", line 12, in
print(eq.get_price(start_date, end_date, symbol="TCS"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\equity.py", line 95, in get_price
cookies = utils.get_cookies()
^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\utils_init_.py", line 46, in get_cookies
raise ValueError("Retry again in a minute.")
ValueError: Retry again in a minute.
--I have been using this on google colab and it works everytime,but doesnt run on my local linux and windows sytem the above error keeps occuring. Any help and suggestion on how i can get it working ,pls help.
After the lastest merge v0.0.12, its throwing
from nsedt.reports import *
Traceback (most recent call last):
File "", line 1, in
File "/Users/witchking/Code/scuti/nsedt/nsedt/reports.py", line 7, in
from nsedt.utils import get_cookies, fetch_csv, format_date, fetch_zip
File "/Users/witchking/Code/scuti/nsedt/nsedt/utils/init.py", line 19, in
from fake_http_header import FakeHttpHeader
ModuleNotFoundError: No module named 'fake_http_header'
Although, I have added in requirements.txt and setup.py
I would like to inquire if options data is accessible.
I am interested in knowing if options data is provided.
Describe the bug
Sometimes, mostly right after the day closure of nse, when i try to run nsedt library to see Close Price, I can see empty dataframe returned.
To Reproduce
https://www.nseindia.com/api/quote-equity?symbol=SBIN returns correct data, but not nsedt lib.
Time of Execution :
2023-10-09 16:31:15 IST
2023-10-09 13:01:15 CET
Name: nsedt
Version: 0.0.10
Please check the uploaded screenshots.
Expected behavior
Correct dataframe is returned instead of empty dataframe.
I hope there is any time constraints to execute nsedt ?
Screenshots
Valid response from nseindia
Empty dataframe from nsedt
Returns an empty data frame when given an input "NIFTY 50" OR "NIFTY50" OR "BANK NIFTY" OR "BANKNIFTY" OR "NIFTY BANK" OR "NIFTYBANK"
Describe the bug
Wrong Close Price for stock POWERGRID - NSE, for multiple dates in Sep 2023. Its w2wk high is only 204, but we are getting > 260 multiple days in Sep 2023
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Correct value is returned for Close Price
Screenshots
Below screenshot is from our library while fetching ("POWERGRID", "01-09-2023", "19-09-2023")
Below screenshot is from google, which says POWERGRID never went above 260 in last 1 year.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Hi,
Is it possible to get hourly data? (each candle is 1 hour)
Thanks.
Tried running the code as mentioned in the README.md. Got an error..
AttributeError
Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_24156\278695389.py in <module>
5 end_date = "03-05-2023"
6 print(eq.get_corpinfo(start_date, end_date, symbol="TCS"))
----> 7 print(eq.get_event(start_date, end_date))
8 print(eq.get_event())
AttributeError: module 'nsedt.equity' has no attribute 'get_event'
Sir your project is very helpful. Please add 'No of trades' which is present in nse bhavcopy so that we can get no of trades.
TODO:
Describe the bug
ValueError: Retry again in a minute.
To Reproduce
Steps to reproduce the behavior:
from nsedt import equity as eq
from datetime import date
import pandas as pd
from datetime import datetime,timedelta
start_date= datetime.today() - timedelta(365)
end_date= datetime.today()
print(start_date.date())
print(end_date.date())
finalDF=pd.DataFrame()
for i,sym in enumerate(eq.get_symbols_list()):
try:
tempDF=eq.get_price(start_date, end_date, symbol=sym)[['Date','Close Price']]
if finalDF.shape[0]==0:
finalDF=pd.concat([finalDF,tempDF],axis=0)
else:
finalDF=pd.merge(finalDF,tempDF,how='left',on='Date')
except Exception as e:
print(f'ERROR for {i,sym}: ',e)
Expected behavior
I was fetching one year data for all sym by for loop in a dataframe
Desktop (please complete the following information):
Additional Information
NSE got my ip making too many request so I think they blocked my ip address
is there any way to fake Ip address also?
Describe the bug
nsedt is giving wrong Close Price w.r.to NSE India, Google or TradingView. After NSE hours, say 4:00 PM CET, when we are checking all 3 - NSE India / Google / TradingView have same value, but when we fetch same stock value via nsedt, it gives some other value.
To Reproduce
Please refer screenshot attached.
Name: nsedt
Version: 0.0.10
Expected behavior
nsedt should give same value as nseindia/google.
Screenshots
I did an analysis on 9th Oct 2023 for 5 stocks. All 5 had incorrect Close Price for nsedt but same for NSE India/Google/TradingView.
Incorrect value from nsedt library - 3638.35
Correct value from NSE India
Correct Close Price from Google
Correct Close Price from TradingView
I want to download historical data of the below Indices but unable to do so. Can some please explain how can i do this because i cannot find any documentation.
Originally posted by @sandybansal83 in #29 (comment)
unified date format for all APIs%d-%m-%Y
Irrespective of the start. end date specified, it returns a data frame of length 50. Probably we need to adjust the window size. Or do you see any other better solution of getting more data at once?
hi , i am getting below error on first run of application . any suggestion .
from nsedt import equity as eq
ImportError: cannot import name 'equity' from 'nsedt' (unknown location)
Add series column in DF o/p and series option in API with default EQ
Right now I see that we have fixed headers for making api requests to NSE. Problem with this is, if many users are requesting the NSE api, then NSE blocks the given headers. So no new reqports file will be downloaded for same headers.
Solution that I like to propose it, to use python header faker library to mock headers and then shoot request. That way all different users will have their own set of headers and wont get blocked.
split equity.py
create a separate module for price, infos and other
This will help in adding more APIs in a easier manner.
I tried to get nifty50 data, but dates input and the output don't match, this problem does not happen with equity
code
from nsedt import indices as eq
from datetime import date
start_date = date(2023, 9, 4)
end_date = date(2023, 9, 7)
print(eq.get_price(start_date, end_date, symbol="NIFTY 50"))
output
Open Price High Price Close Price Low Price Date Total Traded Quantity Total Traded Value
0 19525.05 19545.15 19528.80 19432.85 2023-09-03T18:30:00.000Z 396071122 24822.79
1 19564.65 19587.05 19574.90 19525.75 2023-09-04T18:30:00.000Z 303958622 24029.89
2 19581.20 19636.45 19611.05 19491.50 2023-09-05T18:30:00.000Z 512974083 32500.52
Output is 3rd 4th and 5th of September whereas input was 4 to 7
File "/Users/nijanjyakhwo/Splash-Trade-Automation/Strategy/IndicatorBased/NSEDT/nsedt.py", line 1, in
from nsedt import derivatives as de
File "/Users/nijanjyakhwo/Splash-Trade-Automation/Strategy/IndicatorBased/NSEDT/nsedt.py", line 1, in
from nsedt import derivatives as de
ImportError: cannot import name 'derivatives' from partially initialized module 'nsedt' (most likely due to a circular import) (/Users/nijanjyakhwo/Splash-Trade-Automation/Strategy/IndicatorBased/NSEDT/nsedt.py)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.