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

added: feature to get historical option data #48

Merged
merged 6 commits into from
Apr 30, 2024

Conversation

jitendravarma
Copy link
Contributor

@jitendravarma jitendravarma commented Apr 28, 2024

We have an requirment to seek historical option data for a given strike price, currently we are doing it by a custom script. So thought of extending the support to the library itself.

URL we are trying to mimic is : https://www.nseindia.com/report-detail/fo_eq_security

How is it tested?
On my local system for various strike price and option data

Let me know if this looks okay to you!

@jitendravarma
Copy link
Contributor Author

Sample input:
get_historical_option_data("TATAMOTORS", "25-04-2024", "26-04-2024","CE", "1020", "2024", "30-May-2024")

"""
cookies = utils.get_cookies()
base_url = cns.BASE_URL
event_api = cns.FUTURES_PRICE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall I rename this variable as it same for both futures and options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have migrated the url to FNO_HISTORY and its reference.

@@ -21,6 +21,7 @@ def price(result):
"CH_TRADE_LOW_PRICE",
"CH_CLOSING_PRICE",
"CH_PREVIOUS_CLS_PRICE",
"CH_LAST_TRADED_PRICE",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add support for last price as its a very an important price for analysis.

@pratik141 pratik141 merged commit 37939bd into pratik141:main Apr 30, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants