Revert "services/horizon: Limit time range to max of number of buckets in trades aggregation query (#2856)" #2893
+14
−110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 85c4f66.
Unfortunately, the performance fix for
/trade_aggregations
in 85c4f66 does not work correctly if there are no trades for the requested market, range and resolution within a given limit (i.e. no data in a bucket in a range).As an example, consider a market with no trades on weekends and the following params:
start_time
= Monday, 1st day of the month (for simplicity),end_time
= Sunday, 14th,resolution
= 1 day,limit
= 7 days.Before 85c4f66 Horizon returned 7 buckets for each day: Monday-Friday and Monday, Tuesday the following week. With 85c4f66 it returns just 5 buckets because the
end_time
would be overwritten to EOD, Sunday, 7th. This code works great when all buckets in the range are non-empty, however, if there's at least one empty bucket it will return less thanlimit
buckets.