Open goodboy opened 3 years ago
@guilledk apologies for leading you astray here. The post on kraken's support page says it all: https://support.kraken.com/hc/en-us/articles/218198197-How-to-retrieve-historical-time-and-sales-trading-history-using-the-REST-API-Trades-endpoint-
TLDR:
So this is actually even better news then I had hoped since we'll now be able to retrieve data usable for real forward testing and well simulated backtests.
I'd like to instead focus on getting real-time 1s OHLC sampled charting and move away from using the OHLC
ws endpoint to instead use the trade stream; this will get us to basically the same results as from IB and traditional market feeds :)
Let me know what you think. I'm also cool to start this effort.
Back filling OHLC shm arrays has been added for the IB broker backend and we need this same functionality for any broker(s) we add.
The next natural one in line is
kraken
since they are our major NA supported crypto broker.Notes:
Client.bars()
since
parameter defined for the endpointHot tips for the implementation:
piker
's nascent "data feed api" can be viewed starting inpiker/data/__init__.py
where one will find the use oftractor
's streaming systemFeed
usingpiker.data.open_feed()
and stream from its.stream
attr - an ex of this in the charting code where the stream is passed down to an update task which real-time updates the graphics on the chartstream_quotes()
as is requested in the data feed client code "streaming routine" (as defined in tractor) (this is the "IPC endpoint" that theFeed.stream
maps to from above). So, each broker backend defines thisstream_quotes()
to provide real-time data to consumers oftractor
's IPC system.kraken
's implementation is hereib
's implementation is hereib
backend is by spawning a new task which does the backfilling into an underlying shared mem array directly - this machinery currently does not exist in thekraken
backend and likely figuring out a way to generalize this backgroung-backfiller-task as an api for brokers would be useful to accomplish as part of this work. Further, thekraken
stream_quotes()
implementation will likely have to move to usingtractor
's context streaming push api just like now used in theib
equivalent since we can't spawn tasks from an async generator function due to conflicts withtrio
's nursery semantics (and to some degree SC in general).kraken
's request limits - there might have to be some limit logic added as part of this to avoid throttling