diff --git a/default.cfg.example b/default.cfg.example index 478576bc..441236cb 100644 --- a/default.cfg.example +++ b/default.cfg.example @@ -130,6 +130,7 @@ hideCoins = True #[ACCOUNTSTATS] #ReportInterval = 86400 +#DatabaseName = loan_history #[CHARTS] #DumpInterval = 21600 diff --git a/docs/configuration.rst b/docs/configuration.rst index 2ead85fa..16912930 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -384,6 +384,10 @@ There is an optional setting to change how frequently this plugin reports. By de [ACCOUNTSTATS] ReportInterval = 1800 +The name of the database file can also be configured in the same section:: + + DatabaseName = loan_history + Be aware that first initialization might take longer as the bot will fetch all the history. Profit Charts Plugin diff --git a/plugins/AccountStats.py b/plugins/AccountStats.py index 3a611ad7..a5f53461 100644 --- a/plugins/AccountStats.py +++ b/plugins/AccountStats.py @@ -33,6 +33,7 @@ def on_bot_init(self): self.init_db() self.check_upgrade() self.report_interval = int(self.config.get("ACCOUNTSTATS", "ReportInterval", 86400)) + self.database_name = self.config.get("ACCOUNTSTATS", "DatabaseName", "loan_history") def before_lending(self): for coin in self.earnings: @@ -49,7 +50,7 @@ def after_lending(self): # noinspection PyAttributeOutsideInit def init_db(self): - self.db = sqlite3.connect('market_data/loan_history.sqlite3') + self.db = sqlite3.connect('market_data/{0}.sqlite3'.format(self.database_name)) self.db.execute(DB_CREATE) self.db.commit()