mhallsmoore / qstrader

QuantStart.com - QSTrader backtesting simulation engine.
https://www.quantstart.com/qstrader/
MIT License
2.88k stars 856 forks source link

ValueError: could not convert string to float: Close #266

Closed fanglei80 closed 7 months ago

fanglei80 commented 6 years ago

hello, don't know if anyone can help me, i keep receiving this Value error message while entering the following syntax: price_handler = IQFeedIntradayCsvBarPriceHandler( csv_dir, events_queue, tickers, start_date=start_date ) After that i tried to modify the source code of qstrader, iq_feed_intraday_csv_bar.py making conversion of Close data of type string to float, but doesn't work at all. Many thanks!

JamesKBowler commented 6 years ago

can you provide the full trace back please?

fanglei80 commented 6 years ago

hi Thanks a lot for your reply! here is the full version of the track back. I can provide you with the data, model trained and other related source files if needed :-))

ValueError Traceback (most recent call last)

in () 83 tickers = ["AREX"] 84 filename = None ---> 85 run(config, testing, tickers, filename) in run(config, testing, tickers, filename) 31 end_date = datetime.datetime(2014, 3, 11) 32 price_handler = IQFeedIntradayCsvBarPriceHandler( ---> 33 csv_dir, events_queue, tickers, start_date=start_date 34 ) 35 /home/fanglei/venv/qstraderp3/lib/python3.5/site-packages/qstrader/price_handler/iq_feed_intraday_csv_bar.py in __init__(self, csv_dir, events_queue, init_tickers, start_date, end_date) 33 if init_tickers is not None: 34 for ticker in init_tickers: ---> 35 self.subscribe_ticker(ticker) 36 self.start_date = start_date 37 self.end_date = end_date /home/fanglei/venv/qstraderp3/lib/python3.5/site-packages/qstrader/price_handler/iq_feed_intraday_csv_bar.py in subscribe_ticker(self, ticker) 92 row0 = dft.iloc[0] 93 ---> 94 close = PriceParser.parse(row0["Close"]) 95 96 ticker_prices = { /home/fanglei/venv/qstraderp3/lib/python3.5/site-packages/multipledispatch/dispatcher.py in __call__(self, *args, **kwargs) 208 self._cache[types] = func 209 try: --> 210 return func(*args, **kwargs) 211 212 except MDNotImplementedError: /home/fanglei/venv/qstraderp3/lib/python3.5/site-packages/qstrader/price_parser.py in parse(x) 37 @dispatch(str) 38 def parse(x): # flake8: noqa ---> 39 return int(float(x) * PriceParser.PRICE_MULTIPLIER) 40 41 @staticmethod ValueError: could not convert string to float: 'Close'
JamesKBowler commented 6 years ago

To make it easier to read please format your message.

This is easy

Aren't you just passing a string to the parser somewhere?