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

Fix 30min interval of ^NSEI #2026

Closed
aleksfasting opened this issue Aug 15, 2024 · 1 comment
Closed

Fix 30min interval of ^NSEI #2026

aleksfasting opened this issue Aug 15, 2024 · 1 comment

Comments

@aleksfasting
Copy link
Contributor

Fix 30min interval of ^NSEI and indian exchange

Regarding #1436 and #1447

Summary

The Indian stock exchange opens at 09.15, so when requesting the history of '^NSEI' by 30 minute intervals, the resampling will not include the first 15 minutes of the day. Note: This only happens to 30 min intervals because of the specific handling of 30 min.


Solution

@ivan23kor created a pull request some time ago to solve the issue, but the solution is now outdated.

I propose a solution that checks what time the exchange opens and adds that to the offset that ivan suggested:

exchangeStartTime = pd.Timestamp(self._history_metadata["tradingPeriods"][0][0]["start"], unit='s')
offset = str(exchangeStartTime.minute % 30)+"min"
quotes2 = quotes.resample('30min', offset=offset)
aleksfasting added a commit to aleksfasting/yfinance that referenced this issue Aug 15, 2024
finds the offset of the opening time and adds it to quotes to find proper intervals
aleksfasting added a commit to aleksfasting/yfinance that referenced this issue Aug 15, 2024
Solution that checks the offset of the opening time of the stock exchange (mod 30 minutes) and adds it to the quotes
@aleksfasting
Copy link
Contributor Author

#2027 was merged. Issue is closed

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

No branches or pull requests

1 participant