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

UsageError: Line magic function %%zipline not found. #2835

Open
threehappy opened this issue Apr 1, 2022 · 1 comment
Open

UsageError: Line magic function %%zipline not found. #2835

threehappy opened this issue Apr 1, 2022 · 1 comment

Comments

@threehappy
Copy link

%%zipline --start 2010-1-1 --end 2018-1-1 --data-frequency daily --no-benchmark
from zipline.api import order_target, record, symbol
import pandas as pd

def initialize(context):
context.i = 0
context.assets = [symbol('FB'), symbol('GOOG'), symbol('AMZN')]

def handle_data(context, data):
df = data.history(context.assets, fields=['price', 'volume'], bar_count=1, frequency="1d")
df = df.reset_index()

if context.i == 0:
    df.columns = ['date', 'asset', 'price', 'volume']
    df.to_csv('stock_data.csv', index=False)
else:
    df.to_csv('stock_data.csv', index=False, mode='a', header=None)
context.i += 1

when running above,error happen:
UsageError: Line magic function %%zipline not found.

@andycwang
Copy link

andycwang commented Apr 1, 2022 via email

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

2 participants