How to query data from InfluxDB into Backtrader?
Bozz srinikorn last edited by
As the topic, I would like to import data from influxDB into my Strategy, In backtrader.
And i saw the influxfeed.py, I don't understand how to use that class with my Strategy,
The import data step, It's should have ETL or config right ?
No idea how to work with Influx.
class InfluxDB(btfeeds.DataBase): params = ( ('host', 'localhost'), ('port', '8086'), ('username', None), ('password', None), ('database', 'backtest'), ('timeframe', bt.TimeFrame.Days), ('startdate', None), ('high', 'high'), ('low', 'low'), ('open', 'open'), ('close', 'close'), ('volume', 'volume'), ('ointerest', 'oi'), ) if __name__ == "__main__": cerebro = bt.Cerebro() cerebro.addstrategy(Strategy) data = InfluxDB() cerebro.adddata(data)
Anyone have tutorial for this?
There is no tutorial. You have to provide values for the parameters. The code will do the query for you.
It has exactly the same usage pattern as any other data feed, but the code will connect to an Influx Database to fetch the data from it.