animating-alpha-and-beta

Making an animation of alpha and beta for given stocks with matplotlib.

View the Project on GitHub

日本語(Qiita) haltaro

Requirements

Data

You have to add Histrical Data such as GOOG.csv to /data directry. For example, YAHOO! FINANCE helps you.

  1. Access to the summary page of symbol (ex. google(GOOG.csv).
  2. Click the Histrical Data at top of the page.
  3. Make sure Time Period: is the period you want, and Frequency: is Daily. Then click Download Data.
  4. Rename the file if necessary (ex: table.csv to `GOOG.c

python

Udacity

The codes depend on functions defined in Machine learning for trading at Udacity. Refer to the class (and take it!). You have to add udacity.py which defines get_data(), fill_missing_values(), and compute_daily_returns() to the current directry.

Model

fig/model.png

Hereinafter, we assume SPY as the benchmark. The figure shows daily-returns of SPY and GOOG from Dec. 1, 2006 to Dec. 1, 2016. The regression line can be defined as y = beta x + alpha.

How to use

import animab as ab

ab.animate_a_b()

Variables

License

MIT