Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fanglei80 opened this issue Jun 26, 2018 · 3 comments
Closed

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

fanglei80 opened this issue Jun 26, 2018 · 3 comments

Comments

@fanglei80
Copy link

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
Copy link

can you provide the full trace back please?

@fanglei80
Copy link
Author

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
Copy link

To make it easier to read please format your message.

This is easy

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants