InfluxDB feed bug.
-
Hi, i see that issues on GitHub are disabled. He is a bug.
backtrader/feeds/influxfeed.py
line 91qstr = ('SELECT mean("{open_f}") AS "open", mean("{high_f}") AS "high", ' 'mean("{low_f}") AS "low", mean("{close_f}") AS "close", ' 'mean("{vol_f}") AS "volume", mean("{oi_f}") AS "openinterest" ' 'FROM "{dataname}" ' 'WHERE time {begin} ' 'GROUP BY time({timeframe}) fill(none)').format( open_f=self.p.open, high_f=self.p.high, low_f=self.p.low, close_f=self.p.close, vol_f=self.p.volume, oi_f=self.p.ointerest, timeframe=tf, begin=st, dataname=self.p.dataname)
Wrong parameter name:
dataname=self.p.dataname
should bedataname=self.p.database
The feed starts working after change.
-
This was a contribution. And have you tried using the parameter
dataname
? -
@backtrader yes. there is no such parameter. Only
database
params = ( ('host', '127.0.0.1'), ('port', '8086'), ('username', None), ('password', None), ('database', None), ('timeframe', bt.TimeFrame.Days), ('startdate', None), ('high', 'high_p'), ('low', 'low_p'), ('open', 'open_p'), ('close', 'close_p'), ('volume', 'volume'), ('ointerest', 'oi'), )
-
@backtrader said in InfluxDB feed bug.:
And have you tried using the parameter dataname?
@nikolai said in InfluxDB feed bug.:
@backtrader yes.
You obviously haven't tried it.
@nikolai said in InfluxDB feed bug.:
there is no such parameter. Only database
dataname
is a parameter common to all data feeds in the ecosystem. The meaning of thedatabase
parameter is left to the original author, but the use ofdataname
in the context in which is used in the code is 100% ok.Furhtermore, the parameters for each data feed are listed in the documentation. See
-
@backtrader, thanks for help. I finally figured out the problem. There should be both parameters.
database
is used for DB connection anddataname
is used for DB query.data = bt.feeds.InfluxDB(host='xxx.xxx.xxx.xxx', port='8086', username='admin', password=keyring.get_password("system", "admin"), database='MOEX_RTS_3_19', dataname='MOEX_RTS_3_19', timeframe=bt.TimeFrame.Minutes, startdate='2019-01-13T12:00:00Z', high='high', low='low', open='open', close='close', volume='volume', ointerest='oi')