Difference between revisions of "CS4646 manual strategy"

From Quantitative Analysis Software Courses
Jump to navigation Jump to search
Line 16: Line 16:
  
 
Note that we may not test your code, so we may not know if you didn't organize your code as recommended, but this arrangement will be required for later projects, so it is worthwhile getting it set up this way.  The key requirement is that, if necessary, a TA should be able to run your code on a buffet machine and get the same results (e.g., statistics and charts) that we see in your report.
 
Note that we may not test your code, so we may not know if you didn't organize your code as recommended, but this arrangement will be required for later projects, so it is worthwhile getting it set up this way.  The key requirement is that, if necessary, a TA should be able to run your code on a buffet machine and get the same results (e.g., statistics and charts) that we see in your report.
 +
 +
 +
==Hints==
 +
 +
'''Overall, I recommend the following steps in the creation of your strategies:'''
 +
 +
* Indicator design hints:
 +
** For your X values: Identify and implement at least 3 technical features that you believe may be predictive of future return.
 +
** It is usually worthwhile to standardize the resulting values (see https://en.wikipedia.org/wiki/Standard_score).
 +
* Rule based design:
 +
** Use a cascade of if statements conditioned on the indicators to identify whether a LONG condition is met.
 +
** Use a cascade of if statements conditioned on the indicators to identify whether a SHORT condition is met.
 +
** The conditions for LONG and SHORT should be mutually exclusive.
 +
** If neither LONG or SHORT is triggered, the result should be DO NOTHING.
 +
** For debugging purposes, you may find it helpful to plot the value of the rule-based output (-1, 0, 1) versus the stock price.
 +
 +
==Contents of Report==
 +
 +
Describe each indicator you use in sufficient detail that someone else could reproduce it.  You should also provide a compelling description regarding why that indicator might work and how it could be used.  You should also provide one or more charts that convey how each indicator works in a compelling way. (up to 8 charts).
 +
 +
For the best possible strategy, describe how you created it and any assumptions you had to make to make it work.  Provide a chart that illustrates its performance versus the benchmark.
 +
 +
For your manual strategy, describe how you combined your indicators to create an overall signal.  How do you decide to enter and exit your positions and why?  Why do you believe (or not) that this is an effective strategy? Provide a chart.
 +
 +
Compare the performance of your manual strategy versus the benchmark for the in sample and out of sample time periods. Provide a chart.
 +
 +
Your report should be no more than 3000 words.  Your report should contain no more than 14 charts.  Penalties will apply if you violate these constraints.
 +
 +
==Expectations==
 +
 +
* In-sample backtests should perform very well.
 +
* Out-of-sample backtests should... (you should be able to complete this sentence).
 +
 +
==Clarifications==
 +
 +
* You may use data other than adjusted close if you wish.  The functions in util.py already can do this.
 +
* You may only have one position at a time: -1000 shares, + 1000 shares, 0 shares.
 +
* You may trade up to 2000 shares at a time to move from +/- 1000 shares to -/+ 1000 shares in a single day.  You may not have a position of +/- 2000 shares.
 +
* You do not need to check your available cash before making a trade.  In other words, you can have unlimited leverage, but you cannot exceed the position limits given.  This is a detailed way of saying "don't worry about cash".
 +
 +
==What to turn in==
 +
 +
Turn your project in via t-square. 
 +
 +
* Your report as <tt>report.pdf</tt>
 +
* All of your code, as necessary to run as <tt>.py</tt> files.
 +
* Document how to run your code in <tt>readme.txt</tt>.
 +
* No zip files please.
 +
 +
==Rubric==
 +
 +
Start with 100 points, deductions as follows:
 +
 +
Neatness (up to 5 points deduction if not).
 +
 +
Bonus for exceptionally well written reports or novel indicators (up to 2 points)
 +
 +
Indicators (up to 20 points potential deductions):
 +
* Is each indicator described in sufficient detail that someone else could reproduce it? (-5 points for each if not)
 +
* Is there a chart for each indicator that properly illustrates its operation? (-5 points for each if not)
 +
* Is at least one indicator different from those provided by the instructor's code or lectures? (-10 points if not)
 +
* Does the submitted code <tt>indicators.py</tt> properly reflect the indicators provided in the report (-20 points if not)
 +
 +
Best possible (up to 20 points potential deductions):
 +
* Is the methodology described correct and convincing? (-10 points if not)
 +
* Is the chart correct (dates and equity curve) (-10 points if not)
 +
* Is the chart correct (dates and equity curve) (-10 points if not)
 +
* Historic value of benchmark normalized to 1.0 with blue line (-5 if not)
 +
* Historic value of portfolio normalized to 1.0 with black line (-5 if not)
 +
* Are the reported performance criteria correct ? (-2 points for each item if not)
 +
 +
Manual rule-based trader (up to 50 points deductions):
 +
* Is the trading strategy described with clarity and in sufficient detail that someone else could reproduce it? (-20)
 +
* Does the provided chart(s) include:
 +
** Historic value of benchmark normalized to 1.0 with blue line (-10 if not)
 +
** Historic value of portfolio normalized to 1.0 with black line (-10 if not)
 +
** Are the appropriate date ranges covered? (-10 if not)
 +
** Are vertical lines included to indicate entries (-10 if not)
 +
* Does the submitted code <tt>ManualStrategy.py</tt> properly reflect the strategy provided in the report? (-20 if not)
 +
* Does the submitted code and report reflect an understanding of the subject matter (up to -30 if not)
 +
* Does the manual trading system provide higher cumulative return than the benchmark over the in-sample time period? (-10 if not)
 +
* Did the student use the correct symbol? (-10 if not)
 +
* Did the student use the date periods? (-10 if not)
 +
* Does the strategy obey holding constraints (-5 if not)
 +
 +
Comparative analysis (up to 10 points deductions):
 +
* Is the appropriate chart provided (-5 for each missing element, up to a maximum of -10)
 +
* Are differences between the in-sample and out-of-sample performances appropriately explained (-5)
 +
* Does the submitted code and report reflect an understanding of the subject matter (up to -5 if not)
 +
* Is the required table present and correct (up to -5 if not)
 +
 +
==Required, Allowed & Prohibited==
 +
 +
Required:
 +
* Your project must be coded in Python 2.7.x.
 +
* Your code must run on one of the university-provided computers (e.g. buffet02.cc.gatech.edu).
 +
* Use only util.py to read data.
 +
* All charts must be generated in Python, and you must provide the code you used.
 +
 +
Allowed:
 +
* You can develop your code on your personal machine, but it must also run successfully on one of the university provided machines.
 +
* Your code may use standard Python libraries.
 +
* You may use the NumPy, SciPy, matplotlib and Pandas libraries.  Be sure you are using the correct versions.
 +
* Code provided by the instructor, or allowed by the instructor to be shared.
 +
 +
Prohibited:
 +
* Generating charts using a method other than Python.
 +
* Any other method of reading data besides util.py
 +
* Any libraries not listed in the "allowed" section above.
 +
* Any code you did not write yourself

Revision as of 14:49, 2 March 2018

Overview

In this project you will develop a trading strategy using your intuition and Technical Analysis, and test it against a stock using your market simulator. In a later project, you will use your same indicators but with Machine Learning (instead of your intuition) to create a trading strategy. We hope Machine Learning will do better than your intuition, but who knows?

Template

There is no distributed template for this project. You should create a directory for your code in ml4t/manual_strategy and make a copy of util.py there. You will have access to the data in the ML4T/Data directory but you should use ONLY the code in util.py to read it.

You should create the following code files for submission. They should comprise ALL code from you that is necessary to run your evaluations.

  • indicators.py Your code that implements your indicators as functions that operate on dataframes. The "main" code in indicators.py should generate the charts that illustrate your indicators in the report.
  • marketsimcode.py An improved version of your marketsim code that accepts a "trades" data frame (instead of a file). More info on the trades data frame below.
  • ManualStrategy.py Code implementing a ManualStrategy object (your manual strategy). It should implement testPolicy() which returns a trades data frame (see below). The main part of this code should call marketsimcode as necessary to generate the plots used in the report.
  • BestPossibleStrategy.py Code implementing a BestPossibleStrategy object (details below). It should implement testPolicy() which returns a trades data frame (see below). The main part of this code should call marketsimcode as necessary to generate the plots used in the report.

Note that we may not test your code, so we may not know if you didn't organize your code as recommended, but this arrangement will be required for later projects, so it is worthwhile getting it set up this way. The key requirement is that, if necessary, a TA should be able to run your code on a buffet machine and get the same results (e.g., statistics and charts) that we see in your report.


Hints

Overall, I recommend the following steps in the creation of your strategies:

  • Indicator design hints:
    • For your X values: Identify and implement at least 3 technical features that you believe may be predictive of future return.
    • It is usually worthwhile to standardize the resulting values (see https://en.wikipedia.org/wiki/Standard_score).
  • Rule based design:
    • Use a cascade of if statements conditioned on the indicators to identify whether a LONG condition is met.
    • Use a cascade of if statements conditioned on the indicators to identify whether a SHORT condition is met.
    • The conditions for LONG and SHORT should be mutually exclusive.
    • If neither LONG or SHORT is triggered, the result should be DO NOTHING.
    • For debugging purposes, you may find it helpful to plot the value of the rule-based output (-1, 0, 1) versus the stock price.

Contents of Report

Describe each indicator you use in sufficient detail that someone else could reproduce it. You should also provide a compelling description regarding why that indicator might work and how it could be used. You should also provide one or more charts that convey how each indicator works in a compelling way. (up to 8 charts).

For the best possible strategy, describe how you created it and any assumptions you had to make to make it work. Provide a chart that illustrates its performance versus the benchmark.

For your manual strategy, describe how you combined your indicators to create an overall signal. How do you decide to enter and exit your positions and why? Why do you believe (or not) that this is an effective strategy? Provide a chart.

Compare the performance of your manual strategy versus the benchmark for the in sample and out of sample time periods. Provide a chart.

Your report should be no more than 3000 words. Your report should contain no more than 14 charts. Penalties will apply if you violate these constraints.

Expectations

  • In-sample backtests should perform very well.
  • Out-of-sample backtests should... (you should be able to complete this sentence).

Clarifications

  • You may use data other than adjusted close if you wish. The functions in util.py already can do this.
  • You may only have one position at a time: -1000 shares, + 1000 shares, 0 shares.
  • You may trade up to 2000 shares at a time to move from +/- 1000 shares to -/+ 1000 shares in a single day. You may not have a position of +/- 2000 shares.
  • You do not need to check your available cash before making a trade. In other words, you can have unlimited leverage, but you cannot exceed the position limits given. This is a detailed way of saying "don't worry about cash".

What to turn in

Turn your project in via t-square.

  • Your report as report.pdf
  • All of your code, as necessary to run as .py files.
  • Document how to run your code in readme.txt.
  • No zip files please.

Rubric

Start with 100 points, deductions as follows:

Neatness (up to 5 points deduction if not).

Bonus for exceptionally well written reports or novel indicators (up to 2 points)

Indicators (up to 20 points potential deductions):

  • Is each indicator described in sufficient detail that someone else could reproduce it? (-5 points for each if not)
  • Is there a chart for each indicator that properly illustrates its operation? (-5 points for each if not)
  • Is at least one indicator different from those provided by the instructor's code or lectures? (-10 points if not)
  • Does the submitted code indicators.py properly reflect the indicators provided in the report (-20 points if not)

Best possible (up to 20 points potential deductions):

  • Is the methodology described correct and convincing? (-10 points if not)
  • Is the chart correct (dates and equity curve) (-10 points if not)
  • Is the chart correct (dates and equity curve) (-10 points if not)
  • Historic value of benchmark normalized to 1.0 with blue line (-5 if not)
  • Historic value of portfolio normalized to 1.0 with black line (-5 if not)
  • Are the reported performance criteria correct ? (-2 points for each item if not)

Manual rule-based trader (up to 50 points deductions):

  • Is the trading strategy described with clarity and in sufficient detail that someone else could reproduce it? (-20)
  • Does the provided chart(s) include:
    • Historic value of benchmark normalized to 1.0 with blue line (-10 if not)
    • Historic value of portfolio normalized to 1.0 with black line (-10 if not)
    • Are the appropriate date ranges covered? (-10 if not)
    • Are vertical lines included to indicate entries (-10 if not)
  • Does the submitted code ManualStrategy.py properly reflect the strategy provided in the report? (-20 if not)
  • Does the submitted code and report reflect an understanding of the subject matter (up to -30 if not)
  • Does the manual trading system provide higher cumulative return than the benchmark over the in-sample time period? (-10 if not)
  • Did the student use the correct symbol? (-10 if not)
  • Did the student use the date periods? (-10 if not)
  • Does the strategy obey holding constraints (-5 if not)

Comparative analysis (up to 10 points deductions):

  • Is the appropriate chart provided (-5 for each missing element, up to a maximum of -10)
  • Are differences between the in-sample and out-of-sample performances appropriately explained (-5)
  • Does the submitted code and report reflect an understanding of the subject matter (up to -5 if not)
  • Is the required table present and correct (up to -5 if not)

Required, Allowed & Prohibited

Required:

  • Your project must be coded in Python 2.7.x.
  • Your code must run on one of the university-provided computers (e.g. buffet02.cc.gatech.edu).
  • Use only util.py to read data.
  • All charts must be generated in Python, and you must provide the code you used.

Allowed:

  • You can develop your code on your personal machine, but it must also run successfully on one of the university provided machines.
  • Your code may use standard Python libraries.
  • You may use the NumPy, SciPy, matplotlib and Pandas libraries. Be sure you are using the correct versions.
  • Code provided by the instructor, or allowed by the instructor to be shared.

Prohibited:

  • Generating charts using a method other than Python.
  • Any other method of reading data besides util.py
  • Any libraries not listed in the "allowed" section above.
  • Any code you did not write yourself