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

Return empty response instead of 404 for no trades/market holidays - Historic Quotes ( NBBO ) #23

Closed
sharok opened this issue May 22, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@sharok
Copy link

sharok commented May 22, 2020

Is your feature request related to a problem? Please describe.
Sometimes request to /v2/ticks/stocks/nbbo/{ticker}/{date} returns 404 and the following response:

{
"error":"Unknown database error ( Error Code: 001 )",
"errorcode":"001",
"status":"ERROR",
"success":false
}

After some testing, I have figured out that this response happens when the market was closed( holiday).

The current behavior says that something went wrong and some libraries throw exceptions because status is 404.

Describe the solution you'd like
If there is no data for the specific day, then the response should be 200 and contains an empty results field.

@sharok sharok added the enhancement New feature or request label May 22, 2020
@jrbell19
Copy link

This is actually something that we are planning to make more clear in the responses we send out.

@qrpike
Copy link
Contributor

qrpike commented May 26, 2020

@jbonzo thoughts? This DB code is thrown when we do not have any data for that date at all, for any ticker ( weekends / holidays ).

If there is a DB table for that date, then we would return an empty array ( with 200 ) if there is no data.

@jbonzo
Copy link

jbonzo commented May 27, 2020

Yeah I think a good way to frame it is asking what it means if /v2/ticks/stocks/nbbo/AAPL/2020-05-26 were to 404. I think you could either interpret that as the resource AAPL stocks on 2020-05-26 are not found or you could interpret it as the resource AAPL stocks on any day cannot be found, since there are two resource identifiers in the endpoint.

I think for this endpoints, and others like it, the date parameter isn't regarded as a resource identifier since the resource is identified by the ticker and each date is a different instance in a timeseries. I think our endpoints should follow the following logic:

For a given ticker t where t does exist, then return a 404 since there is no resource for that request URI. For any date d for a ticker t that does exist, return a 200 with an empty set as the result body.

Tl;DR

  • If ticker exists always 200
  • If ticker doesn't exist then 404

@spazmodius
Copy link

Empty results are the right response for valid tickers during time periods in which no quotes occurred. This would include weekends, holidays, overnight, maybe even trading halts.

However, for genuinely missing data from Polygon's database, a non-200 response is more correct. It is the equivalent of throwing an exception, because the normal return value cannot hold the exceptional result.

@KshitizSharmaV
Copy link

Data not available for 15th June for any of the tickers

https://api.polygon.io/v2/ticks/stocks/nbbo/AAPL/2020-06-15?limit=10&apiKey=XXXXXXXXX

{"error":"Unknown database error
( Error Code: 001 _)",
"errorcode":"001",
"status":"ERROR",
"success":false}

Please fix this issue, API keeps failing again & again for NBBO data. This is a well-known issue, historic quotes are important for any kind of analysis to estimate the cost of a trade.

@matichenor matichenor changed the title Does not return 404 status response for Historic Quotes ( NBBO ) Return empty response instead of 404 for no trades/market holidays - Historic Quotes ( NBBO ) Feb 9, 2022
@jrbell19 jrbell19 closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants