backtrader
backtrader copied to clipboard
NoDataError exception is raised instead of returning False from IQFeed._load
Got the following exception raised when no data could be found in DTN for given symbol:
File "w:\backtrader\backtrader\stores\iqfeedstore.py", line 283, in get_history ascend=True) File "C:\Python36\lib\site-packages\pyiqfeed\conn.py", line 2161, in request_bars_in_period raise NoDataError(err_msg) pyiqfeed.exceptions.NoDataError: 'Request: HIT,SHOP,60,20080101 050000,20081231 50000,,000000,235959,1,H_0000000000,100,s,0\r\n, Error: !NO_DATA!'
I wonder if raising the NoDataError exception is a good solution here. Why not just return False from the IQFeed._load , which will indicate the end of bars?
In addition the following exception was raised during the error formatting:
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "scripts\store_iqfeed_to_influxdb.py", line 157, in
run_cerebro(symbol.rstrip(), args) File "scripts\store_iqfeed_to_influxdb.py", line 137, in run_cerebro cerebro.run(exactbars=args.exactbars) File "w:\backtrader\backtrader\cerebro.py", line 1172, in run runstrat = self.runstrategies(iterstrat) File "w:\backtrader\backtrader\cerebro.py", line 1255, in runstrategies data._start() File "w:\backtrader\backtrader\feed.py", line 203, in _start self.start() File "w:\backtrader\backtrader\feeds\iqfeed.py", line 143, in start self._st_start() File "w:\backtrader\backtrader\feeds\iqfeed.py", line 160, in _st_start self._timeframe, self._compression) File "w:\backtrader\backtrader\stores\iqfeedstore.py", line 296, in get_history error = "Unable to get historical data. Error:" % err TypeError: not all arguments converted during string formatting