Project

Algorithmic Stock Trading Program

In this project, you will try your hand at simulated stock market trading! You will use historical stock market performance data for both Apple, Inc (stock: AAPL) and Microsoft, Inc (stock: MSFT) for over the last 15+ years. Only a minimal knowledge of stock trading is needed.

We will not attempt to deal with any of the deeper technicalities of stock trading; however, your project will attempt to make sensible buy, sell or hold decisions on stock data you are processing.

Your program, as a simulation, will be fed this historical stock data to ‘replay’ the days of trading for that stock. You will have your program act as if days are passing (day 0, day 1, day 2, …, etc), albeit much, much faster. Each ‘day’ you will look back at previous days and make decisions on how you intend to trade your stock that day (if at all.)

Your program will include a variety of functions, some you design entirely on your own simply because you need them, and others because I specified that you create them.

Central to your program will be two different functions in your code: one where I provide explicit rules for one stock trading algorithm and a second algorithm will be created using your own stock trading rules.

Milestones

This project will be broken up into multiple milestones, each cumulative to the milestones previous to it. This will pace your progress and to make certain you understand each distinct component of your program.

  1. Milestone I: Data Preparation (34/100 points)

    Read in the financial data into our Python program and organize the data for use.

  2. Milestone II: The “Moving Average” Trading Algorithm (33/100 points)

    Design a function that performs the ‘moving average’ algorithm for stock trading.

  3. Milestone III: Your Own Designed Trading Algorithm (33/100 points)

    Can you design your own interesting stock trading algorithm?

  4. Milestone IV: OOD and other Ideas [Extra Credit]

    We finish up this project with some extra-credit opportunities. I’ll ask you to explore some intermediate-level concepts like Object-Oriented design, and Modules.

General Submission Requirements

Each milestone has requirements specific to itself, in addition to the general ones described below. Each milestone builds on the milestones previous to it! Remember, you are building up a full program, component-by-component.

This is not a group project, and all submitted work must be done individually (original and unique to you.)

General Requirements

  1. Your project will be tested with at least two stock data sets, stock data for Apple. I reserve the right to test it with stock data of other companies, so be sure your code understands this.

  2. A Python file project.py will be submitted as your program. Each milestone will require that you submit a file of this same name, building on the code from the previous submission.

    If you do the extra credit portion, project.py and tradinglib.py (optional) will be the expected file names.

  3. Your final submission must have at least the following functions defined:

    • main()
    • test_data(col, day)
    • alg_moving_average()
    • alg_mine()

    You will certainly write additional functions of your own design and choosing to help these four functions do their job!

  4. The following docstring (properly edited with your information) needs to be the very first thing in your Python program file.

    """CSC 161 Project: Algorithmic Trading
    
    This project...
    
    Fox Mulder
    Lab Section TR 2:00-3:15pm
    Fall 2015
    """
    
  5. In addendum to the above point, any prototype code needs to be used exactly as I gave it to you (function names, parameters and their names, docstrings, return values, etc.)

  6. You must comment your code appropriately! Unclear parts of your code will receive point deductions.

  7. Your Python code needs to be style-checked using the online PEP 8 style checker found in CSC 161 Style, or an equivalent tool.

  8. Your Python module project.py must have the __main__, “top-level script environment check”, e.g.:

    if __name__ == '__main__':
        main()
    
  9. The due date for each milestone can be found on Blackboard.

  10. The project cannot be submitted late. You have plenty of time to work on this, don’t squander it.