-
Notifications
You must be signed in to change notification settings - Fork 65
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
TWS datetime/pandas issue - Latest OSX and TWS #114
Comments
After following the patch that fixes for ib data parsing here; it worked briefly, then breaks again with this: Traceback (most recent call last): |
From the 1st stack trace this is due to a timestamp formatting issue in ib_broker.py. Short term hacky solution: Change: |
@stan4git thanks for the assistance stan, unfortunately the error persists.. ValueError: Error parsing datetime string "20180816 11:17:59" at position 9 The above exception was the direct cause of the following exception: Traceback (most recent call last): |
As I mentioned in another thread, there is already one pull request to fix this. #112 exec_time=pd.to_datetime(exec_detail.m_time, infer_datetime_format=True) |
Thanks @stan4git , but neither fix have worked for me. Unfortunately, I am still getting thrown an error with either fix you have suggested. |
Dear Zipline Maintainers,
Before I tell you about my issue, let me describe my environment:
Environment
Operating System: (Mac OS 10.13.6)
Python Version:
3.6.3
How did you install Zipline: (
pip
)Python packages:
alembic==0.9.9 alpha-vantage==2.0.0 bcolz==0.12.1 Bottleneck==1.2.1 certifi==2018.4.16 chardet==3.0.4 click==6.7 contextlib2==0.5.5 cycler==0.10.0 cyordereddict==1.0.0 Cython==0.28.3 DateTime==4.2 decorator==4.3.0 empyrical==0.4.3 ib==0.8.0 IbPy2==0.8.0 idna==2.7 intervaltree==2.1.0 kiwisolver==1.0.1 Logbook==1.4.0 lru-dict==1.1.6 lxml==4.2.1 Mako==1.0.7 MarkupSafe==1.0 matplotlib==2.2.2 multipledispatch==0.5.0 networkx==1.11 numexpr==2.6.5 numpy==1.14.4 pandas==0.18.1 pandas-datareader==0.6.0 patsy==0.5.0 pyparsing==2.2.0 PyQt5==5.11.2 PyQt5-sip==4.19.12 python-dateutil==2.7.3 python-editor==1.0.3 pytz==2018.4 requests==2.19.0 requests-file==1.4.3 requests-ftp==0.3.1 scipy==1.1.0 simplejson==3.16.0 six==1.11.0 sortedcontainers==2.0.4 SQLAlchemy==1.2.8 statsmodels==0.9.0 tables==3.4.4 toolz==0.9.0 urllib3==1.23 wrapt==1.10.11 zipline-live==1.1.0.5 zope.interface==4.5.0
Now that you know a little about me, let me tell you about the issue I am
having:
Description of Issue
Here is how you can reproduce this issue on your machine:
Reproduction Steps
...
What steps have you taken to resolve this already?
I have attempted to reinstall zipline and its dependencies, uninstalled and reinstalled IB TWS, I have created a new account on TWS, which will work fine, until submitting and order, at which point the order will throw an error due to its datetime string, by my understanding.
...
Anything else?
Here is a description of the error:
(venv-zipline-live) HYPERiON:live Derek$ zipline run -f alpha-live.py --state-file alpha-live.state --realtime-bar-target realtime-bars/ --broker ib --broker-uri localhost:4001:1232 --bundle quantopian-quandl --data-frequency minute
[2018-07-31 16:49:09.683764] INFO: IB Broker: Connecting: localhost:4001:1232
Server Version: 76
TWS Time at connection:20180731 09:49:08 PST
[2018-07-31 16:49:09.804428] ERROR: IB Broker: <class 'str'> returned a result with an error set
ValueError: Error parsing datetime string "20180731 08:40:00" at position 9
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/ib/ext/EReader.py", line 107, in run
while not self.isInterrupted() and self.processMsg(self.readInt()):
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/ib/ext/EReader.py", line 744, in processMsg
self.eWrapper().execDetails(reqId, contract, exec_)
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/zipline/gens/brokers/ib_broker.py", line 353, in execDetails
exec_time=pd.to_datetime(exec_detail.m_time),
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/pandas/util/decorators.py", line 91, in wrapper
return func(*args, **kwargs)
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/pandas/tseries/tools.py", line 291, in to_datetime
unit=unit, infer_datetime_format=infer_datetime_format)
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/pandas/tseries/tools.py", line 429, in _to_datetime
return _convert_listlike(np.array([arg]), box, format)[0]
File "/Users/Derek/venv-zipline-live/lib/python3.6/site-packages/pandas/tseries/tools.py", line 398, in _convert_listlike
require_iso8601=require_iso8601
File "pandas/tslib.pyx", line 2134, in pandas.tslib.array_to_datetime (pandas/tslib.c:41972)
File "pandas/tslib.pyx", line 2269, in pandas.tslib.array_to_datetime (pandas/tslib.c:40684)
File "pandas/tslib.pyx", line 2229, in pandas.tslib.array_to_datetime (pandas/tslib.c:39919)
File "pandas/src/datetime.pxd", line 141, in datetime._string_to_dts (pandas/tslib.c:85631)
SystemError: <class 'str'> returned a result with an error set
[2018-07-31 16:49:09.808153] ERROR: IB Broker: [None] None (<class 'str'> returned a result with an error set)
[2018-07-31 16:49:09.808440] ERROR: IB Broker: IB Connection closed
[2018-07-31 16:49:09.836936] ERROR: IB Broker: [504] Not connected (-1)
...
Sincerely,
$ HypeSound
The text was updated successfully, but these errors were encountered: