Closed srinathpriya closed 1 year ago
Hey, I'm facing the same issue as u, how did u resolve it? pls let me know, thanks in advance
@genos186 can you please share the scrip code you are getting the issue for? If you can also share a stacktrace and open a new issue, it would be great!
q=b.getQuote('500002')
print(q)
The scrip code used is for ABB company, which is an active company. For the above piece of code, I'm getting error as follows:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-7-af34d2740b49> in <module>
----> 1 q=b.getQuote('534976')
2 pprint(q)
1 frames
/usr/local/lib/python3.8/dist-packages/bsedata/quote.py in quote(scripCode)
104 continue
105
--> 106 if res['priceBand'] != '':
107 for tbody in soup('tbody'):
108 try:
KeyError: 'priceBand'
any solution for this
Please provide a solution for this issue. Stuck because of this and please let me know if there are any alternative to get the value of securityID key
If u guys want BSE data then, we would have to fix the source code of the bse library, currently no solution for that. But if u guys want stock details of NSE stocks that consist of the same stocks, then u can use nsetools
Hi @genos186, Just to confirm once again, i need the securityID key (For info, listed below a Screenshot). Please suggest me any other way to find that key.
In nsetools library, u can use the function called get_stock_codes(), where the "symbol" column is similar to "securityID" in bsedata library.
from nsetools import Nse
import pandas as pd
nse=Nse()
stocks=pd.Series(nse.get_stock_codes())
stocks
Output:
SYMBOL NAME OF COMPANY
20MICRONS 20 Microns Limited
21STCENMGM 21st Century Management Services Limited
360ONE 360 ONE WAM LIMITED
3IINFOLTD 3i Infotech Limited
...
ZOTA Zota Health Care LImited
ZUARI Zuari Agro Chemicals Limited
ZUARIIND ZUARI INDUSTRIES LIMITED
ZYDUSLIFE Zydus Lifesciences Limited
ZYDUSWELL Zydus Wellness Limited
Length: 1869, dtype: object
For ur example of V-mart company from nsetools, we get the same security code but with different key name called 'SYMBOL':
stocks[stocks=='V-Mart Retail Limited'].index[0]
Output:
'VMART'
just published a new version on pypi, which should fix this issue. please upgrade to the latest version.
I am using the below code to fetch data from BSE but I am getting error. Not sure the reason for the error need help. Thanks
=======================CODE============================== from pprint import pprint from bsedata.bse import BSE b = BSE() print (b)
b.getQuote('541151') pprint(b) =========================ERROR=================================== Driver Class for Bombay Stock Exchange (BSE) Traceback (most recent call last): File "D:\Data\BSE Test.py", line 9, in
b.getQuote('541151')
File "C:\Users\srinath\AppData\Local\Programs\Python\Python38\lib\site-packages\bsedata\bse.py", line 60, in getQuote
return quote.quote(scripCode)
File "C:\Users\srinath\AppData\Local\Programs\Python\Python38\lib\site-packages\bsedata\quote.py", line 96, in quote
if res['priceBand'] != '':
KeyError: 'priceBand'