BlockchainCommons/spotbit

SpotBit should allow the user to specify candle resolution for price data

wolfmcnally opened this issue · 0 comments

SpotBit needs a way that the client can request historical date in a time range that is also "chunked" into larger time bins on the server side before being sent to the client.

For instance, if SpotBit collects one candle for each exchange every 10 minutes, then a month of data for one exchange is 4,320 candles, and for a year it would be 52,560 candles.

It would be helpful if, in addition to specifying a time range of interest, the client could also request a larger "chunk size" than whatever the rate of ingestion of candles to the server. For instance, if I want to create a 30-day price chart, with one candle each day, I only need 30 candles. it would be much faster if the server upon request chunked the 4,320 candles into 30 day-wide candles and returned those to the client. If I wanted 30 days with hourly resolution, this would only be 30 * 24 = 720 candles.

Since the chunked date represents historical information, and is therefore unchanging, SpotBit could even cache those results for use in other requests, assuming a standard bin widths and alignments.

SpotBit could even proactively chunk the data it's receiving into bins of standard useful sizes, like hour, day, week, month, and year, and make those bin sizes easily available through its API. This would cost some processing and storage, but result in much faster query responses.

Queries for un-chunked candles at the highest resolution available could still be supported.