Summary
Several functions referenced in documentation and examples are either broken at runtime or do not exist in nsepython 2.97. This was verified against live NSE API responses on 2026-04-27.
Environment
- nsepython: 2.97 (latest)
- Python: 3.13
- OS: Windows 11
- Date: 2026-04-27
Issue 1: get_beta() throws KeyError: 'data' at runtime
from nsepython import get_beta
result = get_beta('RELIANCE')
# KeyError: 'data'
This is the same root cause as #74 — the underlying NSE API endpoint returns a response without a data key, and nsepython doesn't handle the missing key.
Expected: Return beta value or raise a descriptive exception.
Actual: Unhandled KeyError: 'data'.
Issue 2: dividend_timeline() does not exist
import nsepython
result = nsepython.dividend_timeline('RELIANCE')
# AttributeError: module 'nsepython' has no attribute 'dividend_timeline'
This function is referenced in various examples and community posts but does not exist in the current module. If it was removed, the removal should be documented. If it was never implemented, the references should be corrected.
Issue 3: share_holding() does not exist
import nsepython
result = nsepython.share_holding('RELIANCE')
# AttributeError: module 'nsepython' has no attribute 'share_holding'
Same as above — referenced but not implemented. The NSE API does have a shareholding endpoint (/api/corporates-holdings) so this could be implemented.
Issue 4: nse_eq() metadata does not include P/B ratio
import nsepython
meta = nsepython.nse_eq('RELIANCE')
# meta['metadata'] has: pdSymbolPe, pdSectorPe
# But NO pdSymbolPb or any book value field
The metadata dict includes P/E (pdSymbolPe) but not P/B. The NSE quote page shows P/B ratio, so the data exists on the website — it may be available from a different API endpoint or field name.
Suggested Fix
For issues 1-3, add defensive error handling — check for key existence before accessing, and raise descriptive exceptions (NSEEndpointError or similar) instead of raw KeyError/AttributeError.
For issue 4, investigate whether the NSE API exposes P/B in a different endpoint or field.
Related Issues
Summary
Several functions referenced in documentation and examples are either broken at runtime or do not exist in nsepython 2.97. This was verified against live NSE API responses on 2026-04-27.
Environment
Issue 1:
get_beta()throwsKeyError: 'data'at runtimeThis is the same root cause as #74 — the underlying NSE API endpoint returns a response without a
datakey, and nsepython doesn't handle the missing key.Expected: Return beta value or raise a descriptive exception.
Actual: Unhandled
KeyError: 'data'.Issue 2:
dividend_timeline()does not existThis function is referenced in various examples and community posts but does not exist in the current module. If it was removed, the removal should be documented. If it was never implemented, the references should be corrected.
Issue 3:
share_holding()does not existSame as above — referenced but not implemented. The NSE API does have a shareholding endpoint (
/api/corporates-holdings) so this could be implemented.Issue 4:
nse_eq()metadata does not include P/B ratioThe metadata dict includes P/E (
pdSymbolPe) but not P/B. The NSE quote page shows P/B ratio, so the data exists on the website — it may be available from a different API endpoint or field name.Suggested Fix
For issues 1-3, add defensive error handling — check for key existence before accessing, and raise descriptive exceptions (
NSEEndpointErroror similar) instead of rawKeyError/AttributeError.For issue 4, investigate whether the NSE API exposes P/B in a different endpoint or field.
Related Issues