{"id":3727,"date":"2023-05-15T20:05:17","date_gmt":"2023-05-15T20:05:17","guid":{"rendered":"https:\/\/lucylabs.gatech.edu\/ml4t\/?page_id=3727"},"modified":"2023-05-15T20:11:03","modified_gmt":"2023-05-15T20:11:03","slug":"project-5-documentation","status":"publish","type":"page","link":"https:\/\/lucylabs.gatech.edu\/ml4t\/summer2023\/project-5-documentation\/","title":{"rendered":"PROJECT 5: MARKETSIM"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; 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;4.16&#8243; _module_preset=&#8221;default&#8221; 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.16&#8243; _module_preset=&#8221;233b2ccd-507b-4110-a16f-5059e25c14a0&#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-marketsim\">\n<h1 style=\"text-align: center;\">Project 5: Marketsim<\/h1>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"text-decoration: underline;\">marketsim.py<\/span><\/h2>\n<p>&nbsp;<\/p>\n<dl class=\"function\">\n<dt id=\"marketsim.compute_portvals\"><code class=\"sig-name descname\">compute_portvals<\/code><span class=\"sig-paren\">(<\/span><em class=\"sig-param\">orders_file=&#8217;.\/orders\/orders.csv&#8217;<\/em>, <em class=\"sig-param\">start_val=1000000<\/em>, <em class=\"sig-param\">commission=9.95<\/em>, <em class=\"sig-param\">impact=0.005<\/em><span class=\"sig-paren\">)<\/span><\/dt>\n<dd>\n<p>Computes the portfolio values.<\/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>orders_file<\/strong> (<em>str<\/em><em> or <\/em><em>file object<\/em>) \u2013 Path of the order file or the file object<\/li>\n<li><strong>start_val<\/strong> (<em>int<\/em>) \u2013 The starting value of the portfolio<\/li>\n<li><strong>commission<\/strong> (<em>float<\/em>) \u2013 The fixed amount in dollars charged for each transaction (both entry and exit)<\/li>\n<li><strong>impact<\/strong> (<em>float<\/em>) \u2013 The amount the price moves against the trader compared to the historical data at each transaction<\/li>\n<\/ul>\n<\/dd>\n<dt class=\"field-even\">Returns<\/dt>\n<dd class=\"field-even\">\n<p>the result (portvals) as a single-column dataframe, containing the value of the portfolio for each trading day in the first column from start_date to end_date, inclusive.<\/p>\n<\/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<dl class=\"function\">\n<dt id=\"marketsim.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>Helper function to test code<\/p>\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 5: Marketsim &nbsp; &nbsp; marketsim.py &nbsp; compute_portvals(orders_file=&#8217;.\/orders\/orders.csv&#8217;, start_val=1000000, commission=9.95, impact=0.005) Computes the portfolio values. Parameters orders_file (str or file object) \u2013 Path of the order file or the file object start_val (int) \u2013 The starting value of the portfolio commission (float) \u2013 The fixed amount in dollars charged for each transaction (both entry and [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":3602,"menu_order":0,"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-3727","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/3727","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=3727"}],"version-history":[{"count":2,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/3727\/revisions"}],"predecessor-version":[{"id":3741,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/3727\/revisions\/3741"}],"up":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/3602"}],"wp:attachment":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/media?parent=3727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}