Open abhilashchowdhary opened 6 years ago
Have the same problem. Is the assert statement really necessary? What if we just don't catch this "error"?
Update: removed the assert
line. Code seemed to continue running just fine. I'll try to compare my output on this custom zipline install to the output of same algorithm on quantopian and see how the results compare.
Also experiencing this issue. Any updates?
Dear Zipline Maintainers,
Before I tell you about my issue, let me describe my environment:
Environment
$ uname --all
)macOS Sierra
$ python --version
Python 2.7.13
$ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
64
pip
,conda
, orother (please explain)
)pip
$ pip freeze
or$ conda list
Now that you know a little about me, let me tell you about the issue I am having:
Description of Issue
cancle_all_orders_for_asset
at https://github.com/quantopian/zipline/blob/master/zipline/finance/blotter.py#L199 fails inassert not orders
becauseopen_orders
dictionary has a order which isn't open and thecancel
at https://github.com/quantopian/zipline/blob/master/zipline/finance/blotter.py#L178 cannot cancel a order that is not open .I get the following stack trace
Also, how do I change the
warn
flag equal toTrue
in the function call at https://github.com/quantopian/zipline/blob/master/zipline/finance/blotter.py#L199. Is there any way other than hardcoding it in the file ?I expected the
open_orders
to not contain order which is not openThe
open_orders
had a order which hadopen
flag asFalse
Following are the variables in
cancle_all_orders_for_asset
when it failsasset.auto_close_date = 2017-09-16 00:00:00+00:00
self.open_orders = defaultdict(<type 'list'>, {Equity(260 [BAS]): [Order({'status': 1, 'created': Timestamp('2016-12-23 21:00:00+0000', tz='UTC'), 'limit_reached': False, 'stop': None, 'amount': 0, 'stop_reached': False, 'commission': 0, 'reason': None, 'limit': None, 'sid': Equity(260 [BAS]), 'dt': Timestamp('2016-12-23 21:00:00+0000', tz='UTC'), 'id': 'a5ed9000087c4a5d9f5b059b68059067', 'filled': 0})], u'default_factory': []})
orders = <type 'list'>: [Order({'status': 1, 'created': Timestamp('2016-12-23 21:00:00+0000', tz='UTC'), 'limit_reached': False, 'stop': None, 'amount': 0, 'stop_reached': False, 'commission': 0, 'reason': None, 'limit': None, 'sid': Equity(260 [BAS]), 'dt': Timestamp('2016-12-23 21:00:00+0000', tz='UTC'), 'id': 'a5ed9000087c4a5d9f5b059b68059067', 'filled': 0})]
So order with the id
a5ed9000087c4a5d9f5b059b68059067
has the flagopen
asFalse
but it is still inopen_orders
Here is how you can reproduce this issue on your machine:
Reproduction Steps
1. 2. 3. ...
What steps have you taken to resolve this already?
...
Anything else?
...
Sincerely,
$ whoami