{"id":1335,"date":"2021-01-14T00:03:21","date_gmt":"2021-01-14T00:03:21","guid":{"rendered":"http:\/\/lucylabs.gatech.edu\/ml4t\/?page_id=1335"},"modified":"2021-01-14T02:16:30","modified_gmt":"2021-01-14T02:16:30","slug":"project-5","status":"publish","type":"page","link":"https:\/\/lucylabs.gatech.edu\/ml4t\/spring2021\/code-documentation\/project-5\/","title":{"rendered":"Project 5"},"content":{"rendered":"\n[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;3.22&#8243;][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;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#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; hover_enabled=&#8221;0&#8243;]<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[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]\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":1342,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<!-- wp:html -->\n<meta charset=\"utf-8\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<title>Project 5: Marketsim \u2014 ML4T 1.0 documentation<\/title>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"stylesheet\" href=\"_static\/alabaster.css\" type=\"text\/css\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"stylesheet\" href=\"_static\/pygments.css\" type=\"text\/css\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<script type=\"text\/javascript\" id=\"documentation_options\" data-url_root=\".\/\" src=\"_static\/documentation_options.js\"><\/script>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<script type=\"text\/javascript\" src=\"_static\/jquery.js\"><\/script>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<script type=\"text\/javascript\" src=\"_static\/underscore.js\"><\/script>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<script type=\"text\/javascript\" src=\"_static\/doctools.js\"><\/script>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<script type=\"text\/javascript\" src=\"_static\/language_data.js\"><\/script>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"index\" title=\"Index\" href=\"genindex.html\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"search\" title=\"Search\" href=\"search.html\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"next\" title=\"Project 7: Q-Learning Robot\" href=\"qlearning_robot.html\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"prev\" title=\"Project 4: Defeat Learners\" href=\"defeat_learners.html\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<link rel=\"stylesheet\" href=\"_static\/custom.css\" type=\"text\/css\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=0.9, maximum-scale=0.9\">\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<div class=\"document\">\n      <div class=\"documentwrapper\">\n        <div class=\"bodywrapper\">\n          \n\n          <div class=\"body\" role=\"main\">\n            \n  <div class=\"section\" id=\"module-marketsim\">\n<span id=\"project-5-marketsim\"><\/span><h1>Project 5: Marketsim<a class=\"headerlink\" href=\"#module-marketsim\" title=\"Permalink to this headline\">\u00b6<\/a><\/h1>\n<dl class=\"function\">\n<dt id=\"marketsim.compute_portvals\">\n<code class=\"sig-prename descclassname\">marketsim.<\/code><code class=\"sig-name descname\">compute_portvals<\/code><span class=\"sig-paren\">(<\/span><em class=\"sig-param\">orders_file='.\/orders\/orders.csv'<\/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><a class=\"headerlink\" href=\"#marketsim.compute_portvals\" title=\"Permalink to this definition\">\u00b6<\/a><\/dt>\n<dd><p>Computes the portfolio values.<\/p>\n<dl class=\"field-list simple\">\n<dt class=\"field-odd\">Parameters<\/dt>\n<dd class=\"field-odd\"><ul class=\"simple\">\n<li><p><strong>orders_file<\/strong> (<em>str<\/em><em> or <\/em><em>file object<\/em>) \u2013 Path of the order file or the file object<\/p><\/li>\n<li><p><strong>start_val<\/strong> (<em>int<\/em>) \u2013 The starting value of the portfolio<\/p><\/li>\n<li><p><strong>commission<\/strong> (<em>float<\/em>) \u2013 The fixed amount in dollars charged for each transaction (both entry and exit)<\/p><\/li>\n<li><p><strong>impact<\/strong> (<em>float<\/em>) \u2013 The amount the price moves against the trader compared to the historical data at each transaction<\/p><\/li>\n<\/ul>\n<\/dd>\n<dt class=\"field-even\">Returns<\/dt>\n<dd class=\"field-even\"><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\"><p>pandas.DataFrame<\/p>\n<\/dd>\n<\/dl>\n<\/dd><\/dl>\n\n<dl class=\"function\">\n<dt id=\"marketsim.test_code\">\n<code class=\"sig-prename descclassname\">marketsim.<\/code><code class=\"sig-name descname\">test_code<\/code><span class=\"sig-paren\">(<\/span><span class=\"sig-paren\">)<\/span><a class=\"headerlink\" href=\"#marketsim.test_code\" title=\"Permalink to this definition\">\u00b6<\/a><\/dt>\n<dd><p>Helper function to test code<\/p>\n<\/dd><\/dl>\n\n<\/div>\n\n\n          <\/div>\n          \n        <\/div>\n      <\/div>\n\n\n\n\n\n\n\n\n        <\/div>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<div class=\"clearer\"><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<div class=\"footer\">\n      \u00a92020, ML4T Staff.\n      \n      |\n      Powered by <a href=\"http:\/\/sphinx-doc.org\/\">Sphinx 2.2.0<\/a>\n      &amp; <a href=\"https:\/\/github.com\/bitprophet\/alabaster\">Alabaster 0.7.12<\/a>\n      \n    <\/div>\n<!-- \/wp:html -->","_et_gb_content_width":"","footnotes":""},"class_list":["post-1335","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1335","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=1335"}],"version-history":[{"count":1,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1335\/revisions"}],"predecessor-version":[{"id":1355,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1335\/revisions\/1355"}],"up":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1342"}],"wp:attachment":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/media?parent=1335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}