Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Why are periods stored in the database? #2532

Open
jorisw opened this issue Dec 3, 2020 · 4 comments
Open

Why are periods stored in the database? #2532

jorisw opened this issue Dec 3, 2020 · 4 comments

Comments

@jorisw
Copy link
Contributor

jorisw commented Dec 3, 2020

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

@XL-Reaper
Copy link
Contributor

My guess would be that they are being collected for the simulation / backtesting.

@jorisw
Copy link
Contributor Author

jorisw commented Dec 28, 2020

There is no code in the repo that ever reads them, though. All getPeriods does is gain access to the period collection.

@mmdiego
Copy link
Contributor

mmdiego commented Feb 5, 2021

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?

@jorisw
Copy link
Contributor Author

jorisw commented Feb 6, 2021

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants