-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The problem
polygon.io users can only request a certain number of years of historical data, with this number dependent on their subscription plan. If a user requests historical data outside of the range that their plan allows the API will only return the results within the range. For example, a basic plan user that requests data from the last 3 years will only recieve data from the last 2.
Currently, there is no warning or message that informs users that this has happened, which is problemetic.
The solution
Write a function that checks that the results span the entire requested range. This is somewhat complicated because not every date will have results. 100% accurate warnings probably require knowing which days every market is open for. However, the differences between each level of the plan are substantial enough that it should be fairly simple to write a check that flags most issues. The simple check would only fail if the requested range is just above the limit of a plan. In that case the results may not span the requested range because the user has an insuffient plan. Alternatively, there could be multiple days of weekend+holiday that the market was closed for.