Every once in a while I get an order gets triggered from the "next" function but does not get executed in the "notify_order" function.
- What would be the best way to start debugging a problem like this?
- What are some common causes?
Every once in a while I get an order gets triggered from the "next" function but does not get executed in the "notify_order" function.
I have been having problems importing data ever since Yahoo got rid of their Yahoo Finance API. I am trying to load a CSV data file from Google Finance into a dataframe and then into backtrader.
I use pandas "read_csv" to load the data into a dataframe, then btfeeds.PandasData to load it into backtrader:
dataframe = pd.read_csv('/path/to/twtr.csv')
data = btfeeds.PandasData(
dataname=dataframe,
fromdate=(datetime.datetime(2013, 11, 7)),
todate=(datetime.datetime(2017, 8, 22))
)
I receive the following error:
Starting Portfolio Value: 10000.00
Traceback (most recent call last):
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/technical/MACD Strategy/MACD_slope.py", line 185, in <module>
thestrats = cerebro.run()
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/Quantstrats/lib/python3.4/site-packages/backtrader/cerebro.py", line 794, in run
runstrat = self.runstrategies(iterstrat)
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/Quantstrats/lib/python3.4/site-packages/backtrader/cerebro.py", line 857, in runstrategies
data.preload()
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/Quantstrats/lib/python3.4/site-packages/backtrader/feed.py", line 420, in preload
while self.load():
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/Quantstrats/lib/python3.4/site-packages/backtrader/feed.py", line 461, in load
_loadret = self._load()
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/Quantstrats/lib/python3.4/site-packages/backtrader/feeds/pandafeed.py", line 221, in _load
line[0] = self.p.dataname.ix[self._idx, colindex]
File "/Users/m4punk/Documents/Coding/python/QuantTrading/Quant-Strategies/Quantstrats/lib/python3.4/site-packages/backtrader/linebuffer.py", line 222, in __setitem__
self.array[self.idx + ago] = value
TypeError: a float is required
[Finished in 1.5s with exit code 1]