-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
buyapple.py example: TypeError: 'zipline._protocol.BarData' object is not subscriptable #2830
Comments
I have the same issue. I have the feeling the tutorial is not for the newest version of zipline 2.2.0. But it is just a guess. |
so data[] got deprecated in 2.0 then it removed for 2.2.0 As said the doc is not updated. Here is a working version with 2.2.0:
|
Confirming that @mike576's fix:
does work in a notebook cell. The code in the tutorial for what to put in a notebook cell is incorrect.
The code in the section A simple example is the similar to @mike576's.
I didn't read the tutorial carefully enough and should have compared the code in both sections. Thanks @mike576 ! |
***@***.***邮箱联系我,谢谢!
|
Dear Zipline Maintainers,
Before I tell you about my issue, let me describe my environment:
Environment
name: ml4t
channels:
dependencies:
$ uname --all
)$ python --version
$ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
pip
,conda
, orother (please explain)
)$ pip freeze
or$ conda list
When i try to run the basic zipline example from https://zipline.ml4trading.io/beginner-tutorial.html
%load_ext zipline
%%zipline --start 2016-1-1 --end 2018-1-1 -o buyapple_out.pickle --no-benchmark
from zipline.api import symbol, order, record
def initialize(context):
pass
def handle_data(context, data):
order(symbol('AAPL'), 10)
record(AAPL=data[symbol('AAPL')].price)
I get a TypeError: "zipline._protocol.BarData' object is not subscriptable"
I set my api key & ingested the quandl data.
What am I missing out here?
The text was updated successfully, but these errors were encountered: