Galts-Gulch / avarice

Multi-Indicator Python3 OKCoin CN & Intl Trading Bot/Infrastructure
Other
91 stars 29 forks source link

databases grow indefinitely #18

Closed alanfuji closed 9 years ago

alanfuji commented 9 years ago

I've noticed that there is no limit to the amount of past data kept in both the SQLite and shelve databases. Eventually an error about page size, and other shelve read/write errors are thrown - at this point I saw that the *.shelve.db file was over 2 GB. This was an extreme case with short candles so it grew pretty fast, but it's an issue for long runs regardless.

As a quick fix you could splice off the end of the list in the writelist function, i.e. temp = temp[-storageMax:]. It would be nice if it was possible to set the storageMax based on what's needed by the config.

I don't have a one-liner fix for the SQLite table, and haven't encountered problems yet, but it is important to look at since the entire market history is being loaded every interval.

As a side note, it seems every indicator is being calculated and stored, even if I'm just using one.

I hope to find time to contribute to the code in the near future, finding my way around it now.

-alanfuji

RealJohnGalt commented 9 years ago

Hi Alan, Thanks for looking at the software. Some of this is due to parts of the software not being upgraded with the rest. Early on when there were fewer indicators and more simple TradeIndicator handling, much of the intent was to have all indicators run constantly for custom strategies to be developed in strategies.py. Some indicators also depend on each other for simpler calculations (e.g. DEMA on EMA, *StochRSI on RSI). I'm currently working on a set of changes which imperfectly solve this issue. Here are the planned/developed changes:

RealJohnGalt commented 9 years ago

I finally got a chance to work on these changes. I'm currently testing them in https://github.com/Galts-Gulch/avarice/commits/indicator-rewrite

RealJohnGalt commented 9 years ago

That branch has been merged, and the release has been tagged. This issue is now mostly fixed.