{"id":2469,"date":"2022-01-09T18:08:49","date_gmt":"2022-01-09T18:08:49","guid":{"rendered":"https:\/\/lucylabs.gatech.edu\/ml4t\/project-8-documentation\/"},"modified":"2022-01-10T11:58:33","modified_gmt":"2022-01-10T11:58:33","slug":"project-8-documentation","status":"publish","type":"page","link":"https:\/\/lucylabs.gatech.edu\/ml4t\/spring2022\/project-8-documentation\/","title":{"rendered":"Project 8 Documentation"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;3.22&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#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; theme_builder_area=&#8221;post_content&#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; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.5.6&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/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-StrategyLearner\">\n<h1 style=\"text-align: center;\">Project 8: Strategy Evaluation<\/h1>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"text-decoration: underline;\">StrategyLearner.py<\/span><\/h2>\n<p>&nbsp;<\/p>\n<dl class=\"class\">\n<dt id=\"StrategyLearner.StrategyLearner\"><em class=\"property\">class <\/em><code class=\"sig-prename descclassname\">StrategyLearner.<\/code><code class=\"sig-name descname\">StrategyLearner<\/code><span class=\"sig-paren\">(<\/span><em class=\"sig-param\">verbose=False<\/em>, <em class=\"sig-param\">impact=0.0<\/em>, <em class=\"sig-param\">commission=0.0<\/em><span class=\"sig-paren\">)<\/span><\/dt>\n<dd>\n<p>A strategy learner that can learn a trading policy using the same indicators used in ManualStrategy.<\/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>verbose<\/strong> (<em>bool<\/em>) \u2013 If \u201cverbose\u201d is True, your code can print out information for debugging.<br \/> If verbose = False your code should not generate ANY output.<\/li>\n<li><strong>impact<\/strong> (<em>float<\/em>) \u2013 The market impact of each transaction, defaults to 0.0<\/li>\n<li><strong>commission<\/strong> (<em>float<\/em>) \u2013 The commission amount charged, defaults to 0.0<\/li>\n<\/ul>\n<\/dd>\n<\/dl>\n<dl class=\"method\">\n<dt id=\"StrategyLearner.StrategyLearner.add_evidence\"><code class=\"sig-name descname\">add_evidence<\/code><span class=\"sig-paren\">(<\/span><em class=\"sig-param\">symbol=&#8217;IBM&#8217;<\/em>, <em class=\"sig-param\">sd=datetime.datetime(2008<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">0<\/em>, <em class=\"sig-param\">0)<\/em>, <em class=\"sig-param\">ed=datetime.datetime(2009<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">0<\/em>, <em class=\"sig-param\">0)<\/em>, <em class=\"sig-param\">sv=10000<\/em><span class=\"sig-paren\">)<\/span><\/dt>\n<dd>\n<p>Trains your strategy learner over a given time frame.<\/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>symbol<\/strong> (<em>str<\/em>) \u2013 The stock symbol to train on<\/li>\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>sv<\/strong> (<em>int<\/em>) \u2013 The starting value of the portfolio<\/li>\n<\/ul>\n<\/dd>\n<\/dl>\n<\/dd>\n<\/dl>\n<dl class=\"method\">\n<dt id=\"StrategyLearner.StrategyLearner.testPolicy\"><code class=\"sig-name descname\">testPolicy<\/code><span class=\"sig-paren\">(<\/span><em class=\"sig-param\">symbol=&#8217;IBM&#8217;<\/em>, <em class=\"sig-param\">sd=datetime.datetime(2009<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">0<\/em>, <em class=\"sig-param\">0)<\/em>, <em class=\"sig-param\">ed=datetime.datetime(2010<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">1<\/em>, <em class=\"sig-param\">0<\/em>, <em class=\"sig-param\">0)<\/em>, <em class=\"sig-param\">sv=10000<\/em><span class=\"sig-paren\">)<\/span><\/dt>\n<dd>\n<p>Tests your learner using data outside of the training data<\/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>symbol<\/strong> (<em>str<\/em>) \u2013 The stock symbol that you trained on on<\/li>\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>sv<\/strong> (<em>int<\/em>) \u2013 The starting value of the portfolio<\/li>\n<\/ul>\n<\/dd>\n<dt class=\"field-even\">Returns<\/dt>\n<dd class=\"field-even\">A DataFrame with values representing trades for each day. Legal values are +1000.0 indicating<br \/> a BUY of 1000 shares, -1000.0 indicating a SELL of 1000 shares, and 0.0 indicating NOTHING.<br \/> Values of +2000 and -2000 for trades are also legal when switching from long to short or short to<br \/> long so long as net holdings are constrained to -1000, 0, and 1000.<\/dd>\n<dt class=\"field-odd\">Return type<\/dt>\n<dd class=\"field-odd\">\n<p>pandas.DataFrame<\/p>\n<\/dd>\n<\/dl>\n<\/dd>\n<\/dl>\n<\/dd>\n<\/dl>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!-- \/divi:html --><\/p>\n<p><!-- divi:html --><\/p>\n<div class=\"clearer\"><\/div>\n<p><!-- \/divi:html --><\/p>\n<p><!-- 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 8: Strategy Evaluation &nbsp; &nbsp; StrategyLearner.py &nbsp; class StrategyLearner.StrategyLearner(verbose=False, impact=0.0, commission=0.0) A strategy learner that can learn a trading policy using the same indicators used in ManualStrategy. Parameters verbose (bool) \u2013 If \u201cverbose\u201d is True, your code can print out information for debugging. If verbose = False your code should not generate ANY output. [&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-2469","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2469","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=2469"}],"version-history":[{"count":3,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2469\/revisions"}],"predecessor-version":[{"id":2547,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/2469\/revisions\/2547"}],"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=2469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}