8000 builtins.AttributeError: 'Series' object has no attribute 'ix' · Issue #33 · ematvey/pybacktest · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
builtins.AttributeError: 'Series' object has no attribute 'ix' #33
Open
@enjoysmath

Description

@enjoysmath

This is an issue with the pictured hello world code (bottom left).

image

Actually, here is the shortest MWE:


import matplotlib
import matplotlib.pyplot as plt
import pybacktest
import pandas as pd

short_ma = 50
long_ma = 200

ohlc = pybacktest.load_from_yahoo('AAPL', start=2000)
ohlc.tail()

ms = ohlc.C.rolling(short_ma).mean()
ml = ohlc.C.rolling(long_ma).mean()

buy = cover = (ms > ml) & (ms.shift() < ml.shift())  # ma cross up
sell = short = (ms < ml) & (ms.shift() > ml.shift())  # ma cross down

bt = pybacktest.Backtest(locals(), 'ma_cross')

print(bt.summary())

matplotlib.rcParams['figure.figsize'] = (15.0, 8.0)

bt.plot_equity()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0