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

Missing Price Band attribute #5

Closed
sdabhi23 opened this issue Jul 13, 2019 · 8 comments · Fixed by #15
Closed

Missing Price Band attribute #5

sdabhi23 opened this issue Jul 13, 2019 · 8 comments · Fixed by #15
Labels
bug Something isn't working WIP Work in progress

Comments

@sdabhi23
Copy link
Owner

sdabhi23 commented Jul 13, 2019

I have observed a very weird behavior in few responses where the price band attribute is not found on the page.

Reproduced randomly and accidentally in browser as well (on https://m.bseindia.com)

Cause: Unknown

Work around: Opened a stock page from https://bseinda.com which was also missing Price Band and force refresh it (shortcut key for Firefox: Ctrl + F5, for Chrome: Shift + F5).

@shikharparikh
Copy link

The PriceBand error still exists for a variety of stocks. I tried pinging the website every 1 minute, but after 4-6 iterations, PriceBand error shows up. Please advise @sdabhi23

@sdabhi23
Copy link
Owner Author

@shikharparikh I am still looking for the root cause. Currently, I have implemented a temporary workaround which will prevent the code from throwing an error. Can you please elaborate on the kind of behaviour you are expecting?

@shikharparikh
Copy link

shikharparikh commented May 18, 2020

So basically, I am using the getQuote function every minute to get the currentValue, pChange and Change for a list of 18 stocks in my portfolio. I have managed to concurrently grab the above mentioned parameters for these 18 stocks. However, somewhere between the 4th and 6th iteration, the PriceBand error is thrown. I am using bsedata for a reporting application and to have a "Live minute by minute" generation of P&L for my portfolio.
Suggestion: can you include a try / except mechanism that returns an NA value if the priceBand or any other parameter is unavailable if continuously pinged. I also added a variable sleep functionality yet the priceBand error always comes up

@sdabhi23
Copy link
Owner Author

Can you please share the version of bsedata that you are using? I have already done the try/catch implementation as a temporary fix

@shikharparikh
Copy link

I am currently on 0.3.1

@sdabhi23
Copy link
Owner Author

Can you please share the stack trace of the error?

@shikharparikh
Copy link

/usr/local/lib/python3.6/dist-packages/bsedata/bse.py in getQuote(self, scripCode)
58 :return: a dictionary which contain details about the stock
59 """
---> 60 return quote.quote(scripCode)
61
62 def getIndices(self, category):

/usr/local/lib/python3.6/dist-packages/bsedata/quote.py in quote(scripCode)
94 continue
95
---> 96 if res['priceBand'] != '':
97 for tbody in soup('tbody'):
98 try:

KeyError: 'priceBand'

@sdabhi23
Copy link
Owner Author

@shikharparikh seems like BSE has made some changes to the site. This error is caused due to another missing attribute and completely unrelated to this bug. I'll look into this and release a new version at the earliest. Until then can you try using try and except blocks in your driver code as a work around?

@sdabhi23 sdabhi23 added WIP Work in progress and removed help wanted Extra attention is needed labels Jun 14, 2020
@sdabhi23 sdabhi23 mentioned this issue Jun 14, 2020
sdabhi23 added a commit that referenced this issue Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working WIP Work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants