Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issue with equity_history function #26

Closed
paragyadav opened this issue May 23, 2023 · 6 comments
Closed

Having issue with equity_history function #26

paragyadav opened this issue May 23, 2023 · 6 comments

Comments

@paragyadav
Copy link

The previous api call is not working. Update it to new api call : https://www.nseindia.com/api/historical/cm/equity?symbol=TRIDENT&series=[%22EQ%22]&from=23-04-2023&to=23-05-2023

@Gunjit-V
Copy link

Can you please elaborate the issue?

@paragyadav
Copy link
Author

try running this,
import nsepython stockName = 'TRIDENT' startDate = '08-04-2023' endDate = '25-05-2023' nsepython.equity_history(stockName,'EQ',startDate,endDate)

getting below error:
`JSONDecodeError Traceback (most recent call last)
in
----> 1 nsepython.equity_history(stockName,'EQ',startDate,endDate)

~/opt/anaconda3/lib/python3.8/site-packages/nsepython/rahu.py in equity_history(symbol, series, start_date, end_date)
547 #total=total.append(equity_history_virgin(symbol,series,start_date,temp_date))
548 #total=total.concat(equity_history_virgin(symbol,series,start_date,temp_date))
--> 549 total = pd.concat([total, equity_history_virgin(symbol, series, start_date, temp_date)])
550
551

~/opt/anaconda3/lib/python3.8/site-packages/nsepython/rahu.py in equity_history_virgin(symbol, series, start_date, end_date)
515 url = 'https://www.nseindia.com/api/historical/cm/equity?symbol=' + symbol + '&series=["' + series + '"]&from=' + start_date + '&to=' + end_date
516
--> 517 payload = nsefetch(url)
518 return pd.DataFrame.from_records(payload["data"])
519

~/opt/anaconda3/lib/python3.8/site-packages/nsepython/rahu.py in nsefetch(payload)
16 if(mode=='local'):
17 def nsefetch(payload):
---> 18 output = requests.get(payload,headers=headers).json()
19 return output
20

~/opt/anaconda3/lib/python3.8/site-packages/requests/models.py in json(self, **kwargs)
896 # used.
897 pass
--> 898 return complexjson.loads(self.text, **kwargs)
899
900 @Property

~/opt/anaconda3/lib/python3.8/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
355 parse_int is None and parse_float is None and
356 parse_constant is None and object_pairs_hook is None and not kw):
--> 357 return _default_decoder.decode(s)
358 if cls is None:
359 cls = JSONDecoder

~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):

~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
`

@paragyadav paragyadav changed the title Update NSE API call Having issue with equity_history function May 29, 2023
@Gunjit-V
Copy link

Gunjit-V commented Jun 1, 2023

The new api call is already there in function equity_history_virgin. I uncommented it but still the api is not returning any data hence the error is coming. My best guess is there is some problem with authorization. I tried changing headers but still no progress.

@Gunjit-V
Copy link

Gunjit-V commented Jun 2, 2023

I have changed the headers and added a function to fetch cookies which may or may not be required (not sure). The equity_history function should work if the pull request gets merged.
I am not sure if other historical data functions will work with old URL.
Here is the reference - NSE-HISTORICAL

@PARKER-X
Copy link

How can i get live data anyone plz tell me fast

Repository owner deleted a comment from RuchiTanmay Aug 21, 2023
@aeron7
Copy link
Owner

aeron7 commented Aug 21, 2023

I do not use Github for Issue Fixation. Please do not open Issues here.

Follow -> For Support and Beta Functions - https://forum.unofficed.com/t/nsepython-documentation/376/107

@aeron7 aeron7 closed this as completed Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants