[Fix] Issue #97 - derivatives_df() API endpoint fix#117
Merged
Conversation
…ivatives to /api/historicalOR/foCPV - NSE deprecated the old derivatives endpoint which was returning 404 - New endpoint requires 'year' parameter in request - Adds support for current market data (futures and options) - Fixes issue #97 where derivatives_df() was not working
- Added test_derivatives_raw_futures() - tests futures data retrieval - Added test_derivatives_raw_options() - tests options data retrieval - Added test_derivatives_df() - tests DataFrame output for derivatives - All tests pass with new NSE API endpoint - Ensures derivatives_df(), derivatives_csv(), and derivatives_raw() work correctly
- Updated API_REFERENCE.md with note about historical data availability - Updated CHANGELOG.md with v0.33.1 release notes - Bumped version from 0.33.0 to 0.33.1 (patch release) - Documented API endpoint change and data retention limitations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Issue #97: derivatives_df() and derivatives_csv() were failing with 404 errors when fetching derivatives data.
The old API endpoint was returning 'Resource not found' errors, making it impossible to retrieve derivatives historical data.
Root Cause
NSE deprecated the old /api/historical/fo/derivatives endpoint. The library was still using this defunct endpoint which now returns 404.
Solution
Changes
Testing
✅ All 12 NSE tests pass (including 3 new derivative tests)
✅ Verified derivatives_df() works with current market data (NIFTY March 2026 options)
✅ Backwards compatible - no API changes for users
Notes