theoretically optimal strategy ml4tduncan hines banana cake mix recipes
64 lines 2.0 KiB Raw Permalink Blame History import pandas as pd from util import get_data from collections import namedtuple Position = namedtuple("Pos", ["cash", "shares", "transactions"]) def author(): return "felixm" def new_positions(positions, price): This project has two main components: First, you will research and identify five market indicators. All work you submit should be your own. The directory structure should align with the course environment framework, as discussed on the. Why there is a difference in performance: Now that we have found that our rule based strategy was not very optimum, can we apply machine learning to learn optimal rules and achieve better results. Benchmark (see definition above) normalized to 1.0 at the start: Plot as a, Value of the theoretically optimal portfolio (normalized to 1.0 at the start): Plot as a, Cumulative return of the benchmark and portfolio, Stdev of daily returns of benchmark and portfolio, Mean of daily returns of benchmark and portfolio, sd: A DateTime object that represents the start date, ed: A DateTime object that represents the end date. Purpose: Athletes are trained to choose the pace which is perceived to be correct during a specific effort, such as the 1500-m speed skating competition. import datetime as dt import pandas as pd import numpy as np from util import symbol_to_path,get_data def You should implement a function called author() that returns your Georgia Tech user ID as a string in each .py file. Any content beyond 10 pages will not be considered for a grade. The report is to be submitted as. Individual Indicators (up to 15 points potential deductions per indicator): If there is not a compelling description of why the indicator might work (-5 points), If the indicator is not described in sufficient detail that someone else could reproduce it (-5 points), If there is not a chart for the indicator that properly illustrates its operation, including a properly labeled axis and legend (up to -5 points), If the methodology described is not correct and convincing (-10 points), If the chart is not correct (dates and equity curve), including properly labeled axis and legend (up to -10 points), If the historical value of the benchmark is not normalized to 1.0 or is not plotted with a green line (-5 points), If the historical value of the portfolio is not normalized to 1.0 or is not plotted with a red line (-5 points), If the reported performance criteria are incorrect (See the appropriate section in the instructions above for required statistics). Please keep in mind that the completion of this project is pivotal to Project 8 completion. Describe how you created the strategy and any assumptions you had to make to make it work. The tweaked parameters did not work very well. By analysing historical data, technical analysts use indicators to predict future price movements. You should also report, as a table, in your report: Your TOS should implement a function called testPolicy() as follows: Your testproject.py code should call testPolicy() as a function within TheoreticallyOptimalStrategy as follows: The df_trades result can be used with your market simulation code to generate the necessary statistics. An improved version of your marketsim code accepts a trades DataFrame (instead of a file). Readme Stars. We encourage spending time finding and research indicators, including examining how they might later be combined to form trading strategies. Create a Theoretically optimal strategy if we can see future stock prices. (-2 points for each item), If the required code is not provided, (including code to recreate the charts and usage of correct trades DataFrame) (up to -100 points), If all charts are not created and saved using Python code. That means that if a stock price is going up with a high momentum, we can use this as a signal for BUY opportunity as it can go up further in future. You are constrained by the portfolio size and order limits as specified above. Thus, these trade orders can be of type: For simplicity of discussion, lets assume, we can only issue these three commands SHORT, LONG and HOLD for our stock JPM, and our portfolio can either be in these three states at a given time: Lets assume we can foresee the future price and our tasks is create a strategy that can make profit. 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). SMA is the moving average calculated by sum of adjusted closing price of a stock over the window and diving over size of the window. Close Log In. Also, note that it should generate the charts contained in the report when we run your submitted code. The purpose of the present study was to "override" self-paced (SP) performance by instructing athletes to execute a theoretically optimal pacing profile. 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. Deductions will be applied for unmet implementation requirements or code that fails to run. Not submitting a report will result in a penalty. Use the time period January 1, 2008, to December 31, 2009. Legal values are +1000.0 indicating a BUY of 1000 shares, -1000.0 indicating a SELL of 1000 shares, and 0.0 indicating NOTHING. (-5 points if not), Is there a chart for the indicator that properly illustrates its operation, including a properly labeled axis and legend? We do not anticipate changes; any changes will be logged in this section. Theoretically Optimal Strategy will give a baseline to gauge your later project's performance against. SUBMISSION. A tag already exists with the provided branch name. Epoxy Flooring UAE; Floor Coating UAE; Self Leveling Floor Coating; Wood Finishes and Coating; Functional Coatings. It is usually worthwhile to standardize the resulting values (see Standard Score). 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]). Please keep in mind that the completion of this project is pivotal to Project 8 completion. Create a set of trades representing the best a strategy could possibly do during the in-sample period using JPM. The indicators selected here cannot be replaced in Project 8. Some indicators are built using other indicators and/or return multiple results vectors (e.g., MACD uses EMA and returns MACD and Signal vectors). The report will be submitted to Canvas. Your report should useJDF format and has a maximum of 10 pages. 6 Part 2: Theoretically Optimal Strategy (20 points) 7 Part 3: Manual Rule-Based Trader (50 points) 8 Part 4: Comparative Analysis (10 points) . import pandas as pd import numpy as np import datetime as dt import marketsimcode as market_sim import matplotlib.pyplot For example, Bollinger Bands alone does not give an actionable signal to buy/sell easily framed for a learner, but BBP (or %B) does. 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. (up to -100 points), If any charts are displayed to a screen/window/terminal in the Gradescope Submission environment. By looking at Figure, closely, the same may be seen. Code implementing a TheoreticallyOptimalStrategy (details below). You may not use an indicator in Project 8 unless it is explicitly identified in Project 6. You will submit the code for the project in Gradescope SUBMISSION. Buy-Put Option A put option is the opposite of a call. Develop and describe 5 technical indicators. For each indicator, you should create a single, compelling chart (with proper title, legend, and axis labels) that illustrates the indicator (you can use sub-plots to showcase different aspects of the indicator). ML4T is a good course to take if you are looking for light work load or pair it with a hard one. We propose a novel R-tree packing strategy that produces R-trees with an asymptotically optimal I/O complexity for window queries in the worst case. Note that an indicator like MACD uses EMA as part of its computation. Please note that util.py is considered part of the environment and should not be moved, modified, or copied. The optimal strategy works by applying every possible buy/sell action to the current positions. You will submit the code for the project to Gradescope SUBMISSION. Your TOS should implement a function called testPolicy() as follows: Your testproject.py code should call testPolicy() as a function within TheoreticallyOptimalStrategy as follows: The df_trades result can be used with your market simulation code to generate the necessary statistics. You should submit a single PDF for the report portion of the assignment. However, it is OK to augment your written description with a, Do NOT copy/paste code parts here as a description, It is usually worthwhile to standardize the resulting values (see. Stockchart.com School (Technical Analysis Introduction), TA Ameritrade Technical Analysis Introduction Lessons, (pick the ones you think are most useful), Investopedias Introduction to Technical Analysis, Technical Analysis of the Financial Markets, A good introduction to technical analysis. You may find our lecture on time series processing, the Technical Analysis video, and the vectorize_me PowerPoint to be helpful. Here is an example of how you might implement author(): Implementing this method correctly does not provide any points, but there will be a penalty for not implementing it. In Project-8, you will need to use the same indicators you will choose in this project. Momentum refers to the rate of change in the adjusted close price of the s. It can be calculated : Momentum[t] = (price[t] / price[t N])-1. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Here are the statistics comparing in-sample data: The manual strategy works well for the train period as we were able to tweak the different thresholds like window size, buy and selling threshold for momentum and volatility. Assignments received after Sunday at 11:59 PM AOE (even if only by a few seconds) are not accepted without advanced agreement except in cases of medical or family emergencies. Some indicators are built using other indicators and/or return multiple results vectors (e.g., MACD uses EMA and returns MACD and Signal vectors). In your report (described below), a description of each indicator should enable someone to reproduce it just by reading the description. selected here cannot be replaced in Project 8. Our bets on a large window size was not correct and even though the price went up, the huge lag in reflection on SMA and Momentum, was not able to give correct BUY and SELL opportunity on time. We encourage spending time finding and research indicators, including examining how they might later be combined to form trading strategies. Packages 0. 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 . However, it is OK to augment your written description with a pseudocode figure. The following textbooks helped me get an A in this course: We will be utilizing SMA in conjunction with a, few other indicators listed below to optimize our trading strategy for real-world. 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). 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. We want a written detailed description here, not code. The indicators selected here cannot be replaced in Project 8. . (up to 3 charts per indicator). Transaction costs for TheoreticallyOptimalStrategy: Commission: $0.00, Impact: 0.00. Include charts to support each of your answers. You are allowed unlimited submissions of the p6_indicatorsTOS_report.pdf. We have you do this to have an idea of an upper bound on performance, which can be referenced in Project 8. Calling testproject.py should run all assigned tasks and output all necessary charts and statistics for your report. Textbook Information. Framing this problem is a straightforward process: Provide a function for minimize() . There is no distributed template for this project. Each document in "Lecture Notes" corresponds to a lesson in Udacity. It is not your 9 digit student number. Description of what each python file is for/does. (Round to four decimal places) Find the, What is the value of the autocorrelation function of lag order 0? Cannot retrieve contributors at this time. Only use the API methods provided in that file. After that, we will develop a theoretically optimal strategy and. Create a set of trades representing the best a strategy could possibly do during the in-sample period using JPM. 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. Provide one or more charts that convey how each indicator works compellingly. You should create the following code files for submission. If you need to use multiple values, consider creating a custom indicator (e.g., my_SMA(12,50), which internally uses SMA(12) and SMA(50) before returning a single results vector). Note: The format of this data frame differs from the one developed in a prior project. Anti Slip Coating UAE Calling testproject.py should run all assigned tasks and output all necessary charts and statistics for your report. You are constrained by the portfolio size and order limits as specified above. The, Suppose that the longevity of a light bulb is exponential with a mean lifetime of eight years. , with the appropriate parameters to run everything needed for the report in a single Python call. , where folder_name is the path/name of a folder or directory. Code implementing your indicators as functions that operate on DataFrames. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. You should create a directory for your code in ml4t/manual_strategy and make a copy of util.py there. Theoretically optimal (up to 20 points potential deductions): Is the methodology described correct and convincing? If you need to use multiple values, consider creating a custom indicator (e.g., my_SMA(12,50), which internally uses SMA(12) and SMA(50) before returning a single results vector). This file should be considered the entry point to the project. All work you submit should be your own. A simple strategy is to sell as much as there is possibility in the portfolio ( SHORT till portfolio reaches -1000) and if price is going up in future buy as much as there is possibility in the portfolio( LONG till portfolio reaches +1000). The report is to be submitted as. Your, # code should work correctly with either input, # Update Portfolio Shares and Cash Holdings, # Apply market impact - Price goes up by impact prior to purchase, # Apply commission - To be applied on every transaction, regardless of BUY or SELL, # Apply market impact - Price goes down by impact prior to sell, 'Theoretically Optimal Strategy vs Benchmark'. # Curr Price > Next Day Price, Price dipping so sell the stock off, # Curr Price < Next Day Price, stock price improving so buy stock to sell later, # tos.testPolicy(sd=dt.datetime(2010,1,1), ed=dt.datetime(2011,12,31)). Provide a compelling description regarding why that indicator might work and how it could be used. Your report should use. Enter the email address you signed up with and we'll email you a reset link. Please submit the following file to Canvas in PDF format only: Please submit the following files to Gradescope, We do not provide an explicit set timeline for returning grades, except that everything will be graded before the institute deadline (end of the term). An improved version of your marketsim code accepts a trades DataFrame (instead of a file). Make sure to answer those questions in the report and ensure the code meets the project requirements. . As an, Please solve these questions.. PBL SESSION 1: REVENUE CYCLE ZARA Son Bhd is a well-known manufacturing company supplying Baju Kurung and Baju Melayu, a traditional costume of the Malays. Thus, the maximum Gradescope TESTING score, while instructional, does not represent the minimum score one can expect when the assignment is graded using the private grading script. 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). If this had been my first course, I likely would have dropped out suspecting that all . It should implement testPolicy() which returns a trades data frame (see below). No credit will be given for coding assignments that do not pass this pre-validation. Code implementing your indicators as functions that operate on DataFrames. This is a text file that describes each .py file and provides instructions describing how to run your code. Assignments received after Sunday at 11:59 PM AOE (even if only by a few seconds) are not accepted without advanced agreement except in cases of medical or family emergencies. Ensure to cite any sources you reference and use quotes and in-line citations to mark any direct quotes. # def get_listview(portvals, normalized): You signed in with another tab or window. Second, you will develop a theoretically optimal strategy (TOS), which represents the maximum amount your portfolio can theoretically return. In Project-8, you will need to use the same indicators you will choose in this project. You will have access to the data in the ML4T/Data directory but you should use ONLY the API . The JDF format specifies font sizes and margins, which should not be altered. For our discussion, let us assume we are trading a stock in market over a period of time. other technical indicators like Bollinger Bands and Golden/Death Crossovers. A Game-Theoretically Optimal Defense Paradigm against Traffic Analysis Attacks using Multipath Routing and Deception . Make sure to cite any sources you reference and use quotes and in-line citations to mark any direct quotes. In this project, you will develop technical indicators and a Theoretically Optimal Strategy that will be the ground layer of a later project. Because it produces a collection of points that are an, average of values before that moment, its also known as a rolling mean. If you submit your code to Gradescope TESTING and have not also submitted your code to Gradescope SUBMISSION, you will receive a zero (0). 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. We do not provide an explicit set timeline for returning grades, except that everything will be graded before the institute deadline (end of the term). This class uses Gradescope, a server-side autograder, to evaluate your code submission. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. You are constrained by the portfolio size and order limits as specified above. When the short period mean falls and crosses the, long period mean, the death cross occurs, travelling in the opposite way as the, A golden cross indicates a future bull market, whilst a death cross indicates, a future down market. Be sure you are using the correct versions as stated on the. No credit will be given for code that does not run in the Gradescope SUBMISSION environment. No credit will be given for coding assignments that do not pass this pre-validation. Develop and describe 5 technical indicators. Be sure to describe how they create buy and sell signals (i.e., explain how the indicator could be used alone and/or in conjunction with other indicators to generate buy/sell signals). This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Theoretically, Optimal Strategy will give a baseline to gauge your later project's performance. These should be incorporated into the body of the paper unless specifically required to be included in an appendix. In this case, MACD would need to be modified for Project 8 to return your own custom results vector that somehow combines the MACD and Signal vectors, or it would need to be modified to return only one of those vectors. In the case of such an emergency, please contact the, Complete your assignment using the JDF format, then save your submission as a PDF. Within each document, the headings correspond to the videos within that lesson. 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 . We have applied the following strategy using 3 indicators : Bollinger Bands, Momentum and Volatility using Price Vs SMA. SMA can be used as a proxy the true value of the company stock. You may not use any code you did not write yourself. The main method in indicators.py should generate the charts that illustrate your indicators in the report. Three examples of Technical indicators, namely Simple moving average, Momentum and Bollinger Bands. For large deviations from the price, we can expect the price to come back to the SMA over a period of time. which is holding the stocks in our portfolio. This assignment is subject to change up until 3 weeks prior to the due date. The report is to be submitted as report.pdf. This file should be considered the entry point to the project. and has a maximum of 10 pages. Gradescope TESTING does not grade your assignment. TheoreticallyOptimalStrategy.pyCode implementing a TheoreticallyOptimalStrategy object (details below). This assignment is subject to change up until 3 weeks prior to the due date. Technical analysis using indicators and building a ML based trading strategy. The main part of this code should call marketsimcode as necessary to generate the plots used in the report. Do NOT copy/paste code parts here as a description. Considering how multiple indicators might work together during Project 6 will help you complete the later project. Before the deadline, make sure to pre-validate your submission using Gradescope TESTING. Students, and other users of this template code are advised not to share it with others, or to make it available on publicly viewable websites including repositories, such as github and gitlab. Please submit the following file(s) to Canvas in PDF format only: Do not submit any other files. BagLearner.py. In this project, you will develop technical indicators and a Theoretically Optimal Strategy that will be the ground layer of a later project (i.e., project 8). Ten pages is a maximum, not a target; our recommended per-section lengths intentionally add to less than 10 pages to leave you room to decide where to delve into more detail. Neatness (up to 5 points deduction if not). A tag already exists with the provided branch name. Use only the data provided for this course. Watermarked charts may be shared in the dedicated discussion forum mega-thread alone. About. Note: Theoretically Optimal Strategy does not use the indicators developed in the previous section. (You may trade up to 2000 shares at a time as long as you maintain these holding requirements.). @param points: should be a numpy array with each row corresponding to a specific query. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. These metrics should include cumulative returns, the standard deviation of daily returns, and the mean of daily returns for both the benchmark and portfolio. Here we derive the theoretically optimal strategy for using a time-limited intervention to reduce the peak prevalence of a novel disease in the classic Susceptible-Infectious-Recovered epidemic . The average number of hours a . SMA helps to iden-, tify the trend, support, and resistance level and is often used in conjunction with. You are constrained by the portfolio size and order limits as specified above. This is an individual assignment. result can be used with your market simulation code to generate the necessary statistics. Include charts to support each of your answers. The ultimate goal of the ML4T workflow is to gather evidence from historical data that helps decide whether to deploy a candidate strategy in a live market and put financial resources at risk. Please submit the following file to Canvas in PDF format only: Do not submit any other files. Deductions will be applied for unmet implementation requirements or code that fails to run. 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. In my opinion, ML4T should be an undergraduate course. We have you do this to have an idea of an upper bound on performance, which can be referenced in Project 8. 1 watching Forks. Develop and describe 5 technical indicators. ML4T / manual_strategy / TheoreticallyOptimalStrateg. While Project 6 doesnt need to code the indicators this way, it is required for Project 8, In the Theoretically Optimal Strategy, assume that you can see the future. A tag already exists with the provided branch name. Ten pages is a maximum, not a target; our recommended per-section lengths intentionally add to less than 10 pages to leave you room to decide where to delve into more detail. The Theoretically Optimal Strategy will give a baseline to gauge your later projects performance. 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 Resources. Charts should also be generated by the code and saved to files. You may find our lecture on time series processing, the Technical Analysis video, and the vectorize_me PowerPoint to be helpful. Short and long term SMA values are used to create the Golden and Death Cross. This framework assumes you have already set up the local environment and ML4T Software. It is usually worthwhile to standardize the resulting values (see https://en.wikipedia.org/wiki/Standard_score). TheoreticallyOptimalStrategy.py Code implementing a TheoreticallyOptimalStrategy object (details below).It should implement testPolicy () which returns a trades data frame (see below). More info on the trades data frame is below. You may also want to call your market simulation code to compute statistics. At a minimum, address each of the following for each indicator: The total number of charts for Part 1 must not exceed 10 charts.