new to backtrader
when getting starting with the documentation and implemnting the code, i get the error AttributeError: 'DataFrame' object has no attribute 'setenvironment' in the cerebro.adddata line you can check in the image below: the error when i run cerebro.adddata
i have already tried the solution mentionned in this Backtrader error: 'DataFrame' object has no attribute 'setenvironment' but nothing changed
if anyone has experienced this before and could help will be nice, this is the code i'm using and i don't know where the problem is:
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import datetime # For datetime objects
import os.path # To manage paths
import sys # To find out the script name (in argv[0])
import pandas as pd
import pandas_datareader as pdr
#import backtrader platform
import backtrader as bt
if __name__ == '__main__':
# Create a cerebro entity
cerebro = bt.Cerebro()
#create a data feed
data= pd.read_csv('EURUSD20102020')
#add the Data Feed to Cerebro
cerebro.adddata(data)
# Set our desired cash start
cerebro.broker.setcash(100000.0)
# Print out the starting conditions
print('Starting Portfolio value: %.2f' % cerebro.broker.get_value())
# Run over everything
cerebro.run()
# Print out the final result
print('Final Portfolio Value: %.2f' % cerebro.broker.get_value())