Skip to content

capstone project for Udacity Machine Learning Nanodegree

Notifications You must be signed in to change notification settings

jamesredwards/mlnd-capstone

Repository files navigation

Pytrader

Pytrader is a small library making use of Scikit-learn's SVC, RandomForestClassifier and VotingClassifier classes to make predictions about the direction of stocks on the US stock exchanges.

The library presented here is the final version submitted for Udacity's Machine Learning Engineer Nanodegree.

The library therefore omits some of the functions that were used to train and test the model in development.

Requirements

  1. Python 3.4 or greater
  2. pandas (0.20.3)
  3. pandas-datareader (0.5.0)
  4. scikit-learn (0.19.0)
  5. nolds
  6. requests-cache-0.4.13

model_runner

A utility class to run the model on given stock tickers.

Note on Yahoo! Finace:

model_runner makes use of the pandas_datareader Yahoo! Finance API. requests_cache is used in order to be a good web citizen, however Yahoo made some changes to the Yahoo! Finance website recently and whilst the pandas_datareader folks have done a fantastic job updating the library, it seems a little more fragile than previously, so if it doesn't work first time it may be worth trying a couple of times.

model_runner(stock_tickers, model_filepath, start_date, end_date)

  • stock_tickers: list of one or more tickers
  • model_filepath: path to model pkl
  • start_date: default 31 March 2017
  • end_date: default today

Example usage

runner = pytrader_lite.model_runner(list_of_tickers,
                                    path_to_model,
                                    '31-Mar-2017',
                                    '16-Oct-2017')
runner.run()
...
display(runner.score_df)

About

capstone project for Udacity Machine Learning Nanodegree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published