{"id":2457,"date":"2022-01-09T18:08:47","date_gmt":"2022-01-09T18:08:47","guid":{"rendered":"https:\/\/lucylabs.gatech.edu\/ml4t\/project-2-documentation\/"},"modified":"2022-01-10T11:58:21","modified_gmt":"2022-01-10T11:58:21","slug":"project-2-documentation","status":"publish","type":"page","link":"https:\/\/lucylabs.gatech.edu\/ml4t\/spring2022\/project-2-documentation\/","title":{"rendered":"Project 2 Documentation"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;3.22&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_row _builder_version=&#8221;3.25&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.14.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<div class=\"document\">\n<div class=\"documentwrapper\">\n<div class=\"bodywrapper\">\n<div class=\"body\" role=\"main\">\n<div class=\"section\" id=\"module-optimization\">\n<h1 style=\"text-align: center;\">Project 2: Optimize Something Documentation<\/h1>\n<h2><span style=\"text-decoration: underline;\"><\/span><\/h2>\n<p><span style=\"text-decoration: underline;\"><\/span><\/p>\n<h2><span style=\"text-decoration: underline;\">optimization.py<\/span><\/h2>\n<p>&nbsp;<\/p>\n<dl class=\"function\">\n<dt><code class=\"sig-name descname\">optimize_portfolio<\/code><span class=\"sig-paren\">(<\/span><em class=\"sig-param\">sd=datetime.datetime(2008, 1, 1, 0, 0), ed=datetime.datetime(2009, 1, 1, 0, 0), syms=[&#8216;GOOG&#8217;, &#8216;AAPL&#8217;, &#8216;GLD&#8217;, &#8216;XOM&#8217;], gen_plot=False<\/em><span class=\"sig-paren\">)<\/span><\/dt>\n<dd>\n<p>This function should find the optimal allocations for a given set of stocks. You should optimize for maximum Sharpe<br \/>Ratio. The function should accept as input a list of symbols as well as start and end dates and return a list of<br \/>floats (as a one-dimensional NumPy array) that represent the allocations to each of the equities. You can take<br \/>advantage of routines developed in the optional assess portfolio project to compute daily portfolio value and<br \/>statistics.<\/p>\n<dl class=\"field-list simple\">\n<dt class=\"field-odd\">Parameters<\/dt>\n<dd class=\"field-odd\">\n<ul class=\"simple\">\n<li><strong>sd<\/strong> (<em>datetime<\/em>) \u2013 A datetime object that represents the start date, defaults to 1\/1\/2008<\/li>\n<li><strong>ed<\/strong> (<em>datetime<\/em>) \u2013 A datetime object that represents the end date, defaults to 1\/1\/2009<\/li>\n<li><strong>syms<\/strong> (<em>list<\/em>) \u2013 A list of symbols that make up the portfolio (note that your code should support any<br \/>symbol in the data directory)<\/li>\n<li><strong>gen_plot<\/strong> (<em>bool<\/em>) \u2013 If True, create a plot named plot.png. The autograder will always call your<br \/>code with gen_plot = False.<\/li>\n<\/ul>\n<\/dd>\n<dt class=\"field-even\">Returns<\/dt>\n<dd class=\"field-even\">A tuple containing the portfolio allocations, cumulative return, average daily returns,<br \/>standard deviation of daily returns, and Sharpe ratio<\/dd>\n<dt class=\"field-odd\">Return type<\/dt>\n<dd class=\"field-odd\">\n<p>tuple<\/p>\n<\/dd>\n<\/dl>\n<\/dd>\n<\/dl>\n<dl class=\"function\">\n<dt id=\"optimization.test_code\"><code class=\"sig-name descname\">test_code<\/code><span class=\"sig-paren\">(<\/span><span class=\"sig-paren\">)<\/span><\/dt>\n<dd>\n<p>This function WILL NOT be called by the auto grader.<\/p>\n<\/dd>\n<\/dl>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!-- \/divi:html --> <!-- divi:html --><\/p>\n<div class=\"clearer\"><\/div>\n<p><!-- \/divi:html --> <!-- divi:html --><\/p>\n<div class=\"footer\">\u00a92020, ML4T Staff |\u00a0Powered by <a href=\"http:\/\/sphinx-doc.org\/\">Sphinx 2.2.0<\/a> &amp; <a href=\"https:\/\/github.com\/bitprophet\/alabaster\">Alabaster 0.7.12<\/a><\/div>\n<p><!-- \/divi:html --><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project 2: Optimize Something Documentation optimization.py &nbsp; optimize_portfolio(sd=datetime.datetime(2008, 1, 1, 0, 0), ed=datetime.datetime(2009, 1, 1, 0, 0), syms=[&#8216;GOOG&#8217;, &#8216;AAPL&#8217;, &#8216;GLD&#8217;, &#8216;XOM&#8217;], gen_plot=False) This function should find the optimal allocations for a given set of stocks. You should optimize for maximum SharpeRatio. The function should accept as input a list of symbols as well as start [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":2441,"menu_order":21,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-2457","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/comments?post=2457"}],"version-history":[{"count":4,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2457\/revisions"}],"predecessor-version":[{"id":2546,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2457\/revisions\/2546"}],"up":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2441"}],"wp:attachment":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/media?parent=2457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}