zenbot
zenbot copied to clipboard
Why are periods stored in the database?
System information
- Have I written custom code (as opposed to using zenbot vanilla): Yes, lots
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS 11.0.1
-
Zenbot version (commit ref, or version):
f91355a
-
Zenbot branch:
unstable
- NodeJS version: 14
-
Exact command to reproduce (include everything):
zenbot trade binance.ETH-USDT --strategy my-strategy
- Did I make any changes to conf-sample.js?: Just API keys
Describe the problem
trade.js
calls getPeriods
to access the periods
Mongo collection. It saves new periods there as it collects new trades.
Then that's it. The periods collection is never used again.
Why is zenbot storing periods, never to be used again?
Source code / Error logs
commands/trade.js:465
calls getPeriods
commands/trade.js:737
calls savePeriod
My guess would be that they are being collected for the simulation / backtesting.
There is no code in the repo that ever reads them, though. All getPeriods
does is gain access to the period collection.
If this is true, maybe we can add an option in conf.js to configure if we want to store past data during trading or not. I'm now trading several coins at the same time and I'm not interested in keeping their history, so this option would be great to save disk space. @jorisw What do you think? Have you confirm this behavior?
@mmdiego As far as storing candle periods goes, I think that should be removed entirely, as it's not used anywhere.
As far as storing trades goes, which Zenbot bases all its operations on, I'd say it would be good to remove trades that are further in the past than you will ever need pre-roll for. Now this entirely depends on your indicators and the timeframe interval(s) at which you operate. If you're trading on 1d
intervals for example, you'll need to keep a lot more data around than if you were trading based on 1m
intervals. I would recommend that users decide this for themselves and maybe clear out old data based on this. I have written my own code for this, but a feature + option for this could certainly be helpful to users.