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

Polygon issue with historical Option data #285

Closed
davidlatte opened this issue Sep 7, 2023 · 0 comments · Fixed by #286
Closed

Polygon issue with historical Option data #285

davidlatte opened this issue Sep 7, 2023 · 0 comments · Fixed by #286
Assignees

Comments

@davidlatte
Copy link
Collaborator

Problems Seen

  • Option contracts have no Pre-Market data
  • get_historical_data() on an option asset early in market will request a Polygon "from" time before MarketOpen.
    • First timestamp returned by Polygon will be at MarketOpen
  • Lumibot code says "returned start date is later than my requested start date ... something bad happened so try again". Then even more bad things happen, but really this should have been expected behavior

Solution

So, I want to kill two birds with one stone. I want to:

  • pad all Polygon queries with +/- 1day and cache that.
  • will only pass in Dates, not Datetimes

This solves:

  • expected start will always be >= cached start
  • There can no longer possibly be any intra-day gaps in cached data because we always pad out and the data can then always be found.
  • Trust Polygon ... just query it once, never have to loop through and query it again.
  • Can throw an exception if something unexpected happened, but "requery" won't help so don't bother.

Cons:

  • We will cache extra data than what was strictly requested. But this should be fine because:
    • 1 day worth of data is pretty small. 1min candles = 390 rows / day

Agreed in chat that extra data isn't much of a Con.

@davidlatte davidlatte self-assigned this Sep 7, 2023
@davidlatte davidlatte linked a pull request Sep 8, 2023 that will close this issue
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 a pull request may close this issue.

1 participant