REST API empty array/collection response and 550 error explained.
Question
Requesting OHLCV via REST API why I can get an empty JSON array as a response instead of 550 error?
When the request is failed with 550 error and when the empty response (empty JSON array, XML or CSV) is delivered?
Answer
In the, for example, REST OHLCV data, you are requesting the data in the time range and receiving the collection (JSON Array) in response, which could contain 0 or multiple objects. When we don't have the object, then it will be not visible in the array, and if there are no objects in the range, then the collection will be empty. It's a correct response, and it's a better solution than responding with a 550 error as the response is correct from the data structure perspective.
The 550 error code is related to the specific object requested (JSON object) like the current exchange rate between BTC/USD. In this type of requests, we need to respond with a single object, and when we do not have it, then the whole request will be failed with 550 HTTP response code.
The OHLCV periods is not generated when there are no trades in the period as min, max, first, last (low, high, open, close) are undefined. We have the parameter `include_empty_items` which you can use to display those items, but only `time_period_start`, `time_period_end` will be visible.
More information available at the relevant sections of the documentation:
Comments
0 comments
Article is closed for comments.