HardlyDifficult / Crypnostic

WIP - C# API for various Crypto Exchanges
MIT License
26 stars 5 forks source link

Auto-Refresh OrderBooks #46

Closed ghost closed 6 years ago

ghost commented 6 years ago

To do the algorithm I have in mind, I need to get the orderbooks for every exchange for every coin. Doing that takes roughly an hour, because the orderbooks aren't cached.

An option in the CrypnosticConfig along the lines of cacheOrderbooksOnRefresh would be nice and pretty much a must-have for my kind of algorithm.

HardlyDifficult commented 6 years ago

Getting every book is going to be expensive. Let me know what options your thinking of.

To leverage the OrderBook cache, use the maxCacheAgeInSeconds param --- set this high and it should return very quickly the second time around.

HardlyDifficult commented 6 years ago

Maybe we add an opt-in update book for a pair. Eg sub to event on the pair of interest.. we add to a list and pull those when we update prices.

You could sub to all.. but for perf your use case must allow some filtering out shitcoins right? :)

HardlyDifficult commented 6 years ago

Change order book to a class with it's own event

HardlyDifficult commented 6 years ago

I split out a task for the throttle.

ghost commented 6 years ago

I get where you're coming from, and I get what the throttle is for, but before using the API I just did a Task[] for the exchanges and they just got their orderbooks in a foreach loop for every tradingPair and it took about 30sec that way ^^ I don't know if that's a "legit" way of doing it tho

Answer to: "You could sub to all.. but for perf your use case must allow some filtering out shitcoins right? :)" - hardlyDifficult

HardlyDifficult commented 6 years ago

We can do better than 1 hour. Let's track the perf under #49 There are a few options...

HardlyDifficult commented 6 years ago

FYI @Krachwumm updated #49, perf should be better. I tested and it looks like every book across every exchange takes about 2 mins now.