Here is an example of how you might implement, Create testproject.py and implement the necessary calls (following each respective API) to, , with the appropriate parameters to run everything needed for the report in a single Python call. If we plot the Bollinger Bands with the price for a time period: We can find trading opportunity as SELL where price is entering the upper band from outside the upper band, and BUY where price is lower than the lower band and moving towards the SMA from outside. This file has a different name and a slightly different setup than your previous project. Charts should also be generated by the code and saved to files. View TheoreticallyOptimalStrategy.py from CS 4646 at Kenesaw Secondary School. Complete your assignment using the JDF format, then save your submission as a PDF. If you use an indicator in Project 6 that returns multiple results vectors, we recommend taking an additional step of determining how you might modify the indicator to return one results vector for use in Project 8. BagLearner.py. To review, open the file in an editor that reveals hidden Unicode characters. Use the revised market simulator based on the one you wrote earlier in the course to determine the portfolio valuation. In your report (described below), a description of each indicator should enable someone to reproduce it just by reading the description. These should be incorporated into the body of the paper unless specifically required to be included in an appendix. import TheoreticallyOptimalStrategy as tos from util import get_data from marketsim.marketsim import compute_portvals from optimize_something.optimization import calculate_stats def author(): return "felixm" def test_optimal_strategy(): symbol = "JPM" start_value = 100000 sd = dt.datetime(2008, 1, 1) ed = dt.datetime(2009, 12, 31) The specific learning objectives for this assignment are focused on the following areas: Please keep in mind that the completion of this project is pivotal to Project 8 completion. a) 1 b)Above 0.95 c)0 2.What is the value of partial autocorrelation function of lag order 1? Here is an example of how you might implement author(): Create testproject.py and implement the necessary calls (following each respective API) to. TheoreticallyOptimalStrategy.py Code implementing a TheoreticallyOptimalStrategy object (details below).It should implement testPolicy () which returns a trades data frame (see below). Enter the email address you signed up with and we'll email you a reset link. You may not use stand-alone indicators with different parameters in Project 8 (e.g., SMA(5) and SMA(30)). You are encouraged to submit your files to Gradescope TESTING, where some basic pre-validation tests will be performed against the code. . You are constrained by the portfolio size and order limits as specified above. Charts should be properly annotated with legible and appropriately named labels, titles, and legends. In your report (described below), a description of each indicator should enable someone to reproduce it just by reading the description. As max(col1) = 1 , max(col2) = 2 , max(col3) = 1, min(row1) = -1 , min(row2) = 0 , min(row3) = -1 there is not a simultaneous row min and row max a . The technical indicators you develop here will be utilized in your later project to devise an intuition-based trading strategy and a Machine Learning based trading strategy. You are encouraged to develop additional tests to ensure that all project requirements are met. The. Create a Manual Strategy based on indicators. Code implementing a TheoreticallyOptimalStrategy object, It should implement testPolicy() which returns a trades data frame, The main part of this code should call marketsimcode as necessary to generate the plots used in the report, possible actions {-2000, -1000, 0, 1000, 2000}, # starting with $100,000 cash, investing in 1000 shares of JPM and holding that position, # # takes in a pd.df and returns a np.array. df_trades: A single column data frame, indexed by date, whose values represent trades for each trading day (from the start date to the end date of a given period). ML4T is a good course to take if you are looking for light work load or pair it with a hard one. This movement inlines with our indication that price will oscillate from SMA, but will come back to SMA and can be used as trading opportunities. Assignments should be submitted to the corresponding assignment submission page in Canvas. section of the code will call the testPolicy function in TheoreticallyOptimalStrategy, as well as your indicators and marketsimcode as needed, to generate the plots and statistics for your report (more details below). ML4T / manual_strategy / TheoreticallyOptimalStrateg. Neatness (up to 5 points deduction if not). The file will be invoked using the command: This is to have a singleentry point to test your code against the report. Fall 2019 ML4T Project 6. to develop a trading strategy using technical analysis with manually selected indicators. Zipline is a Pythonic event-driven system for backtesting, developed and used as the backtesting and live-trading engine by crowd-sourced investment fund Quantopian. Read the next part of the series to create a machine learning based strategy over technical indicators and its comparative analysis over the rule based strategy. While such indicators are okay to use in Project 6, please keep in mind that Project 8 will require that each indicator return one results vector. DO NOT use plt.show() (, up to -100 if all charts are not created or if plt.show() is used), Your code may use the standard Python libraries, NumPy, SciPy, matplotlib, and Pandas libraries. You are encouraged to develop additional tests to ensure that all project requirements are met. This project has two main components: First, you will develop a theoretically optimal strategy (TOS), which represents the maximum amount your portfolio can theoretically return. Before the deadline, make sure to pre-validate your submission using Gradescope TESTING. +1000 ( We have 1000 JPM stocks in portfolio), -1000 (We have short 1000 JPM stocks and attributed them in our portfolio). D) A and C Click the card to flip Definition Develop and describe 5 technical indicators. Compare and analysis of two strategies. We should anticipate the price to return to the SMA over a period, of time if there are significant price discrepancies. The report will be submitted to Canvas. The implementation may optionally write text, statistics, and/or tables to a single file named p6_results.txt or p6_results.html. Readme Stars. We can calculate Price/SMA (PSMA) values and use them to generated buy or, and above can indicate SELL. Please keep in mind that the completion of this project is pivotal to Project 8 completion. Please note that there is no starting .zip file associated with this project. . 0 stars Watchers. If you submit your code to Gradescope TESTING and have not also submitted your code to Gradescope SUBMISSION, you will receive a zero (0). The value of momentum can be used an indicator, and can be used as a intuition that future price may follow the inertia. You are allowed to use up to two indicators presented and coded in the lectures (SMA, Bollinger Bands, RSI), but the other three will need to come from outside the class material (momentum is allowed to be used). Are you sure you want to create this branch? file. . The indicators should return results that can be interpreted as actionable buy/sell signals. Describe the strategy in a way that someone else could evaluate and/or implement it. The main part of this code should call marketsimcode as necessary to generate the plots used in the report. We will learn about five technical indicators that can. In the case of such an emergency, please, , then save your submission as a PDF. In this project, you will develop technical indicators and a Theoretically Optimal Strategy that will be the ground layer of a later project. a)Equal to the autocorrelation of lag, An investor believes that investing in domestic and international stocks will give a difference in the mean rate of return. A tag already exists with the provided branch name. Provide a table that documents the benchmark and TOS performance metrics. You may find our lecture on time series processing, the Technical Analysis video, and the vectorize_me PowerPoint to be helpful. To facilitate visualization of the indicator, you might normalize the data to 1.0 at the start of the date range (i.e., divide price[t] by price[0]). Create a set of trades representing the best a strategy could possibly do during the in-sample period using JPM. Include charts to support each of your answers. Charts should be properly annotated with legible and appropriately named labels, titles, and legends. Transaction costs for TheoreticallyOptimalStrategy: In the Theoretically Optimal Strategy, assume that you can see the future. Using these predictions, analysts create strategies that they would apply to trade a security in order to make profit. Spring 2019 Project 6: Manual Strategy From Quantitative Analysis Software Courses Contents 1 Revisions 2 Overview 3 Template 4 Data Details, Dates and Rules 5 Part 1: Technical Indicators (20 points) 6 Part 2: Theoretically Optimal Strategy (20 points) 7 Part 3: Manual Rule-Based Trader (50 points) 8 Part 4: Comparative Analysis (10 points) 9 Hints 10 Contents of Report 11 Expectations 12 . The report is to be submitted as. You will have access to the ML4T/Data directory data, but you should use ONLY the API functions in util.py to read it. You are allowed unlimited submissions of the p6_indicatorsTOS_report.pdf. In the Theoretically Optimal Strategy, assume that you can see the future. Theoretically optimal (up to 20 points potential deductions): Is the methodology described correct and convincing? We do not anticipate changes; any changes will be logged in this section. (-2 points for each item if not), Is the required code provided, including code to recreate the charts and usage of correct trades DataFrame? For our report, We are are using JPM stock, SMA is a type of moving mean which is created by taking the arithmetic mean, of a collection of data. The algorithm first executes all possible trades . You may not use the Python os library/module. You are allowed unlimited submissions of the report.pdf file to Canvas. It is not your, student number. We encourage spending time finding and research. Create testproject.py and implement the necessary calls (following each respective API) to indicators.py and TheoreticallyOptimalStrategy.py, with the appropriate parameters to run everything needed for the report in a single Python call. This is an individual assignment. selected here cannot be replaced in Project 8. Please address each of these points/questions in your report. We hope Machine Learning will do better than your intuition, but who knows? Allowable positions are 1000 shares long, 1000 shares short, 0 shares. Code implementing a TheoreticallyOptimalStrategy (details below). Rules: * trade only the symbol JPM You are encouraged to perform any unit tests necessary to instill confidence in your implementation. It is not your 9 digit student number. The average number of hours a . @returns the estimated values according to the saved model. You must also create a README.txt file that has: The secret regarding leverage and a secret date discussed in the YouTube lecture do not apply and should be ignored. import datetime as dt import pandas as pd import numpy as np from util import symbol_to_path,get_data def You may also want to call your market simulation code to compute statistics. You should create a directory for your code in ml4t/manual_strategy and make a copy of util.py there. For this activity, use $0.00 and 0.0 for commissions and impact, respectively. This is the ID you use to log into Canvas. Description of what each python file is for/does. We have you do this to have an idea of an upper bound on performance, which can be referenced in Project 8. While such indicators are okay to use in Project 6, please keep in mind that Project 8 will require that each indicator return one results vector. Regrading will only be undertaken in cases where there has been a genuine error or misunderstanding. No credit will be given for code that does not run in this environment and students are encouraged to leverage Gradescope TESTING prior to submitting an assignment for grading. Ensure to cite any sources you reference and use quotes and in-line citations to mark any direct quotes. Allowable positions are 1000 shares long, 1000 shares short, 0 shares. You are constrained by the portfolio size and order limits as specified above. Simple Moving average Deductions will be applied for unmet implementation requirements or code that fails to run.