{"id":1659,"date":"2021-05-17T08:28:20","date_gmt":"2021-05-17T08:28:20","guid":{"rendered":"http:\/\/lucylabs.gatech.edu\/ml4t\/?page_id=1659"},"modified":"2021-06-30T06:28:34","modified_gmt":"2021-06-30T06:28:34","slug":"project-5","status":"publish","type":"page","link":"https:\/\/lucylabs.gatech.edu\/ml4t\/summer2021\/project-5\/","title":{"rendered":"Project 5"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_row _builder_version=&#8221;4.4.5&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_text _builder_version=&#8221;4.9.7&#8243; header_font=&#8221;|700||on|||||&#8221;]<\/p>\n<h1 style=\"text-align: center;\">Project 5: Marketsim<\/h1>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.4.5&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_text _builder_version=&#8221;4.9.4&#8243; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Revisions<\/h2>\n<p><span>This assignment is subject to change up until 3 weeks prior to the due date. We do not anticipate changes; any changes will be logged in this section.<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.4.5&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_text _builder_version=&#8221;4.9.7&#8243; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>About The Project<\/h2>\n<p><span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW84307677 BCX4\"><span class=\"NormalTextRun SCXW84307677 BCX4\">In this project, you will create a market simulator that accepts trading orders and keeps track of a portfolio\u2019s value over time.<\/span><span class=\"NormalTextRun SCXW84307677 BCX4\"> It also then assesses the performance of that portfolio.<\/span><span class=\"NormalTextRun SCXW84307677 BCX4\"> <\/span><span class=\"NormalTextRun SCXW84307677 BCX4\">You will submit the code for the project in <\/span><span class=\"NormalTextRun SpellingErrorV2 SpellingErrorHighlight SCXW84307677 BCX4\">Gradescope<\/span><span class=\"NormalTextRun SCXW84307677 BCX4\"> SUBMISSION<\/span><span class=\"NormalTextRun SCXW84307677 BCX4\">. There is no report associated with this project<\/span><span class=\"NormalTextRun SCXW84307677 BCX4\">.<\/span><\/span><span class=\"EOP SCXW84307677 BCX4\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<h2>Starter Code<\/h2>\n<p><span data-contrast=\"none\">To make it easier to get started on the project and focus on the concepts involved, you will be given a starter framework. This framework assumes you have already set up the <\/span><a href=\"http:\/\/lucylabs.gatech.edu\/ml4t\/summer2021\/local-environment\/\" target=\"_blank\" rel=\"noopener\"><span data-contrast=\"none\">local environment<\/span><\/a><span data-contrast=\"none\"> and <\/span><a href=\"http:\/\/lucylabs.gatech.edu\/ml4t\/summer2021\/software-setup\/\" target=\"_blank\" rel=\"noopener\"><span data-contrast=\"none\">ML4T Software<\/span><\/a><span data-contrast=\"none\">. The framework for Project 5 can be obtained from: <a href=\"https:\/\/www.dropbox.com\/s\/15wavohktb2ack2\/marketsim_2021Sum.zip?dl=1\" target=\"_blank\" rel=\"noopener\">Marketsim_2021Summer.zip<\/a>.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">Extract its contents into the base directory (e.g., ML4T_2021Summer). This will add a new folder called \u201cmarketsim\u201d to the course directly structure.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;http:\/\/lucylabs.gatech.edu\/ml4t\/wp-content\/uploads\/2021\/06\/market_sim_dir-1.png&#8221; title_text=&#8221;market_sim_dir&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>Within the marketsim folder are one directory and two files:<\/p>\n<ul>\n<li>grade_marketsim.py<br \/>The local grading \/ pre-validation script. This is the same script that will be executed in the Gradescope TESTING Environment<\/li>\n<li>marketsim.py<br \/>Student implementations will replace your compute_portvals() function within this file, modifying or replacing the existing stub code the is provided in the file.<\/li>\n<li>orders directory<br \/>A director that contains several order files that can be used with this project.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.4.5&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_text _builder_version=&#8221;4.9.7&#8243; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Task &amp; Requirements<\/h2>\n<h3>Part 1: Basic simulator (90 points)<\/h3>\n<p>Your job is to implement your market simulator as a function,\u00a0compute_portvals()\u00a0that returns a DataFrame with one column. You should implement it within the file\u00a0marketsim.py. It should adhere to the following API:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;ZGVmIGNvbXB1dGVfcG9ydHZhbHMob3JkZXJzX2ZpbGUgPSAiLi9vcmRlcnMvb3JkZXJzLmNzdiIsIHN0YXJ0X3ZhbCA9IDEwMDAwMDAsIGNvbW1pc3Npb24gPSA5Ljk1LCBpbXBhY3QgPSAwLjAwNSk6CiAgICAjIFRPRE86IFlvdXIgY29kZSBoZXJlCiAgICByZXR1cm4gcG9ydHZhbHM=&#8221; language=&#8221;python&#8221; _builder_version=&#8221;4.9.7&#8243;]ZGVmIGNvbXB1dGVfcG9ydHZhbHMob3JkZXJzX2ZpbGUgPSAiLi9vcmRlcnMvb3JkZXJzLmNzdiIsIHN0YXJ0X3ZhbCA9IDEwMDAwMDAsIGNvbW1pc3Npb24gPSA5Ljk1LCBpbXBhY3QgPSAwLjAwNSk6CiAgICAjIFRPRE86IFlvdXIgY29kZSBoZXJlCiAgICByZXR1cm4gcG9ydHZhbHM=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<p>The start date and end date of the simulation are the first and last dates with orders in the\u00a0orders_file. The arguments are as follows:<\/p>\n<ul>\n<li>orders_file\u00a0is the name of a file from which to read orders, and<\/li>\n<li>start_val\u00a0is the starting value of the portfolio (initial cash available)<\/li>\n<li>commission\u00a0is the fixed amount in dollars charged for each transaction (both entry and exit)<\/li>\n<li>impact\u00a0is the amount the price moves against the trader compared to the historical data at each transaction. Impact of 0.01 in the API corresponds to an impact of 1%.<\/li>\n<\/ul>\n<p>Return the result (portvals) as a single-column\u00a0pandas.DataFrame\u00a0(column name does not matter), containing the value of the portfolio for each trading day in the first column from\u00a0start_date\u00a0to\u00a0end_date, inclusive.<\/p>\n<p>The files containing orders are CSV files with the following columns:<\/p>\n<ul>\n<li>Date (yyyy-mm-dd)<\/li>\n<li>Symbol (e.g. AAPL, GOOG)<\/li>\n<li>Order (BUY or SELL)<\/li>\n<li>Shares (no. of shares to trade)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>For example:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;RGF0ZSxTeW1ib2wsT3JkZXIsU2hhcmVzCjIwMDgtMTItMyxBQVBMLEJVWSwxMzAKMjAwOC0xMi04LEFBUEwsU0VMTCwxMzAKMjAwOC0xMi01LElCTSxCVVksNTA=&#8221; _builder_version=&#8221;4.9.7&#8243;]RGF0ZSxTeW1ib2wsT3JkZXIsU2hhcmVzCjIwMDgtMTItMyxBQVBMLEJVWSwxMzAKMjAwOC0xMi04LEFBUEwsU0VMTCwxMzAKMjAwOC0xMi01LElCTSxCVVksNTA=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>Your simulator should calculate the total value of the portfolio for each day using\u00a0<strong>adjusted closing prices<\/strong>. The value for each day is cash plus the current value of equities. The resulting data frame should contain values like this:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;MjAwOC0xMi0zIDEwMDAwMDAKMjAwOC0xMi00IDk5OTQxOC45MAoyMDA4LTEyLTUgOTk5NzU0LjMwCi4uLg==&#8221; _builder_version=&#8221;4.9.7&#8243; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]MjAwOC0xMi0zIDEwMDAwMDAKMjAwOC0xMi00IDk5OTQxOC45MAoyMDA4LTEyLTUgOTk5NzU0LjMwCi4uLg==[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p><strong>How It Should Work<\/strong><\/p>\n<p>Your code should keep account of how many shares of each stock are in the portfolio on each day and how much cash is available on each day. Note that negative shares and negative cash are possible. Negative shares mean that the portfolio is in a short position for that stock. Negative cash means that you\u2019ve borrowed money from the broker.<\/p>\n<p>When a BUY order occurs, you should add the appropriate number of shares to the count for that stock and subtract the appropriate cost of the shares from the cash account. The cost should be determined using the adjusted close price for that stock on that day.<\/p>\n<p>When a SELL order occurs, it works in reverse: You should subtract the number of shares from the count and add to the cash account.<\/p>\n<p><strong>Evaluation<\/strong><\/p>\n<p>We will evaluate your code by calling\u00a0compute_portvals()\u00a0with multiple test cases. No other function in your code will be called by us, so do not depend on \u201cmain\u201d code being called. Do not depend on global variables.<\/p>\n<p>\u00a0For debugging purposes, you should write your own additional helper function to call\u00a0compute_portvals()\u00a0with your own test cases. We suggest that you report the following factors:<\/p>\n<ul>\n<li>Plot the price history over the trading period.<\/li>\n<li>Sharpe ratio (Always assume you have 252 trading days in a year. And risk-free rate = 0) of the total portfolio<\/li>\n<li>Cumulative return of the total portfolio<\/li>\n<li>Standard deviation of daily returns of the total portfolio<\/li>\n<li>Average daily return of the total portfolio<\/li>\n<li>Ending value of the portfolio<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<h3>Part 2: Transaction Costs (10 points)<\/h3>\n<p><strong><em>Note:<\/em><\/strong> We strongly encourage you to get the basic simulator working before you implement the transaction cost and market impact components of this project. Ok, now on to transaction costs.<\/p>\n<p>Transaction costs are an important consideration for investing strategy. Transaction costs include things like commissions, slippage, market impact, and tax considerations. High transaction costs encourage less frequent trading, and accordingly a search for strategies that payout over longer periods of time rather than just intraday or over several days. For this project, we will consider two components of transaction cost: Commissions and market impact.<\/p>\n<ul>\n<li>Commissions: For each trade that you execute, charge a commission according to the parameter sent. Treat that as a deduction from your cash balance.<\/li>\n<li>Market impact: For each trade that you execute, assume that the stock price moves against you according to the\u00a0impact\u00a0parameter. So, if you are buying, assume the price goes up before your purchase. Similarly, if selling, assume the price drops 50 bps before the sale. For simplicity treat the market impact penalty as a deduction from your cash balance.<\/li>\n<\/ul>\n<p>Both penalties should be applied for <strong>EACH <\/strong>transaction, for instance, depending on the parameter settings, a complete entry and exit will cost 2 * $9.95, plus 0.5% of the entry price and 0.5% of the exit price.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<h3>Part 3: Implement author() function (deduction if not implemented)<\/h3>\n<p>You should implement a function called\u00a0author()\u00a0that returns your Georgia Tech user ID as a string. This is the ID you use to log into Canvas. It is not your 9 digit student number. Here is an example of how you might implement author():<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;ZGVmIGF1dGhvcigpOgoJcmV0dXJuICd0YjM0JyAjIHJlcGxhY2UgdGIzNCB3aXRoIHlvdXIgR2VvcmdpYSBUZWNoIHVzZXJuYW1lLg==&#8221; language=&#8221;python&#8221; _builder_version=&#8221;4.9.7&#8243;]ZGVmIGF1dGhvcigpOgoJcmV0dXJuICd0YjM0JyAjIHJlcGxhY2UgdGIzNCB3aXRoIHlvdXIgR2VvcmdpYSBUZWNoIHVzZXJuYW1lLg==[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p><span>And here\u2019s an example of how it could be called from a testing program:<\/span><\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;aW1wb3J0IG1hcmtldHNpbSBhcyBtcwpwcmludChtcy5hdXRob3IoKSk=&#8221; language=&#8221;python&#8221; _builder_version=&#8221;4.9.7&#8243;]aW1wb3J0IG1hcmtldHNpbSBhcyBtcwpwcmludChtcy5hdXRob3IoKSk=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<div><span>Implementing this method correctly does not provide any points, but there will be a penalty for not implementing it.<\/span><\/div>\n<div><\/div>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.4.5&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_text _builder_version=&#8221;4.9.7&#8243; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Technical Requirements<\/h2>\n<p>Your project must be coded in Python 3.6. and run in the Gradescope SUBMISSION environment.<\/p>\n<p>When utilizing any of the example order files, the code must run in less than 10 seconds per test case.<\/p>\n<p>Use only the functions in util.py to read in stock data. Only use the API methods provided in that file. Please note that util.py is considered part of the environment and should not be moved, modified, or copied. For grading, we will use our own unmodified version<\/p>\n<p>You should use pandas\u2019 read_csv function to read the orders files.<\/p>\n<p>The \u201csecret\u201d regarding leverage and a \u201csecret date\u201d discussed in the YouTube lecture do not apply and should be ignored.<\/p>\n<p>Note: The Sharpe ratio uses the sample standard deviation.\u00a0<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Hints &amp; Resources<\/h2>\n<p>Here is a video outlining an approach to solving this problem [<a href=\"https:\/\/www.youtube.com\/watch?v=TstVUVbu-Tk\" target=\"_blank\" rel=\"noopener\">YouTube video<\/a>].<\/p>\n<p>Hint, use code like this to read in the orders file:<\/p>\n<ul>\n<li>orders_df = pandas.read_csv(orders_file, index_col=&#8217;Date&#8217;, parse_dates=True, na_values=[&#8216;nan&#8217;])<\/li>\n<\/ul>\n<p>In terms of execution prices, you should assume you get the <strong>adjusted close<\/strong> price for the day of the trade.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;||||||||&#8221; header_font=&#8221;||||||||&#8221; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Contents of Report<\/h2>\n<p>There is no report associated with this assignment.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.4.5&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.4.5&#8243;][et_pb_text _builder_version=&#8221;4.9.7&#8243; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Testing<\/h2>\n<p>To test your code, you can modify the provided test_code() function in the marketsim.py file. You are encouraged to perform any unit tests necessary to instill confidence that the generated datasets will produce the desired learner results.<\/p>\n<p>Additionally, we have provided the grade_marketsim.py file that can be used for your tests. This file is the same script that will be run when the code is submitted to Gradescope TESTING. This file is not a complete test suite and does not match the more stringent private grader that is used in Gradescope SUBMISSION. To run and test that the file will run from within the marketsim directory, use the command:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;UFlUSE9OUEFUSD0uLi86LiBweXRob24gZ3JhZGVfbWFya2V0c2ltLnB5IA==&#8221; _builder_version=&#8221;4.9.7&#8243;]UFlUSE9OUEFUSD0uLi86LiBweXRob24gZ3JhZGVfbWFya2V0c2ltLnB5IA==[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>You are encouraged to submit your files to Gradescope TESTING, where some basic pre-validation tests will be performed against the code. Gradescope TESTING does not grade your assignment. No credit will be given for coding assignment fails in Gradescope SUBMISSION that has also failed to pass this pre-validation in Gradescope TESTING.<\/p>\n<p>You are allowed unlimited resubmissions to Gradescope TESTING. Please refer to the <a href=\"http:\/\/lucylabs.gatech.edu\/ml4t\/summer2021\/gradescope\/\" target=\"_blank\" rel=\"noopener\">Gradescope Instructions<\/a> for more information.<\/p>\n<h3>Additional Example Tests\/Checks (Orders File Code Check Examples)<\/h3>\n<p>Example orders files are available in the orders subdirectory. You can use these for additional testing.<\/p>\n<p>Here are some additional test cases:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.dropbox.com\/s\/vkvpo3kas8ona25\/testcases_mc2p1.zip?dl=1\" target=\"_blank\" rel=\"noopener\">testcases_mc2p1.zip<\/a><\/li>\n<li><a href=\"https:\/\/www.dropbox.com\/s\/duene6lrebwq3wo\/additional_orders.zip?dl=1\" target=\"_blank\" rel=\"noopener\">additional_orders.zip<\/a><\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<h3>Short Code Check Example<\/h3>\n<p>Here is a very, very short example that you can use to check your code. Starting conditions:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;c3RhcnRfdmFsID0gMTAwMDAwMA==&#8221; _builder_version=&#8221;4.9.7&#8243;]c3RhcnRfdmFsID0gMTAwMDAwMA==[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p><span>For the orders file <\/span><tt>orders-short.csv<\/tt><span>, the orders are:<\/span><\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;RGF0ZSxTeW1ib2wsT3JkZXIsU2hhcmVzCjIwMTEtMDEtMDUsQUFQTCxCVVksMTUwMAoyMDExLTAxLTIwLEFBUEwsU0VMTCwxNTAw&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]RGF0ZSxTeW1ib2wsT3JkZXIsU2hhcmVzCjIwMTEtMDEtMDUsQUFQTCxCVVksMTUwMAoyMDExLTAxLTIwLEFBUEwsU0VMTCwxNTAw[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p><span>The daily value of the portfolio (spaces added to help things line up):<\/span><\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;MjAxMS0wMS0wNSAgICAgOTk3NDk1Ljc3NQoyMDExLTAxLTA2ICAgICA5OTcwOTAuNzc1CjIwMTEtMDEtMDcgICAgMTAwMDY2MC43NzUKMjAxMS0wMS0xMCAgICAxMDEwMTI1Ljc3NQoyMDExLTAxLTExICAgIDEwMDg5MTAuNzc1CjIwMTEtMDEtMTIgICAgMTAxMzA2NS43NzUKMjAxMS0wMS0xMyAgICAxMDE0OTQwLjc3NQoyMDExLTAxLTE0ICAgIDEwMTkxMjUuNzc1CjIwMTEtMDEtMTggICAgMTAwNzQyNS43NzUKMjAxMS0wMS0xOSAgICAxMDA0NzI1Ljc3NQoyMDExLTAxLTIwICAgICA5OTMwMzYuMzc1&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]MjAxMS0wMS0wNSAgICAgOTk3NDk1Ljc3NQoyMDExLTAxLTA2ICAgICA5OTcwOTAuNzc1CjIwMTEtMDEtMDcgICAgMTAwMDY2MC43NzUKMjAxMS0wMS0xMCAgICAxMDEwMTI1Ljc3NQoyMDExLTAxLTExICAgIDEwMDg5MTAuNzc1CjIwMTEtMDEtMTIgICAgMTAxMzA2NS43NzUKMjAxMS0wMS0xMyAgICAxMDE0OTQwLjc3NQoyMDExLTAxLTE0ICAgIDEwMTkxMjUuNzc1CjIwMTEtMDEtMTggICAgMTAwNzQyNS43NzUKMjAxMS0wMS0xOSAgICAxMDA0NzI1Ljc3NQoyMDExLTAxLTIwICAgICA5OTMwMzYuMzc1[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p><span>For reference, here are the <\/span><b>adjusted close<\/b><span> values for AAPL on the relevant days:<\/span><\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;ICAgICAgICAgICAgICBBQVBMCjIwMTEtMDEtMDUgIDMzMi41NwoyMDExLTAxLTA2ICAzMzIuMzAKMjAxMS0wMS0wNyAgMzM0LjY4CjIwMTEtMDEtMTAgIDM0MC45OQoyMDExLTAxLTExICAzNDAuMTgKMjAxMS0wMS0xMiAgMzQyLjk1CjIwMTEtMDEtMTMgIDM0NC4yMAoyMDExLTAxLTE0ICAzNDYuOTkKMjAxMS0wMS0xOCAgMzM5LjE5CjIwMTEtMDEtMTkgIDMzNy4zOQoyMDExLTAxLTIwICAzMzEuMjY=&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]ICAgICAgICAgICAgICBBQVBMCjIwMTEtMDEtMDUgIDMzMi41NwoyMDExLTAxLTA2ICAzMzIuMzAKMjAxMS0wMS0wNyAgMzM0LjY4CjIwMTEtMDEtMTAgIDM0MC45OQoyMDExLTAxLTExICAzNDAuMTgKMjAxMS0wMS0xMiAgMzQyLjk1CjIwMTEtMDEtMTMgIDM0NC4yMAoyMDExLTAxLTE0ICAzNDYuOTkKMjAxMS0wMS0xOCAgMzM5LjE5CjIwMTEtMDEtMTkgIDMzNy4zOQoyMDExLTAxLTIwICAzMzEuMjY=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p><span>The full results:<\/span><\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;RGF0YSBSYW5nZTogMjAxMS0wMS0wNSAwMDowMDowMCB0byAyMDExLTAxLTIwIDAwOjAwOjAwCgpTaGFycGUgUmF0aW8gb2YgRnVuZDogLTEuMDAwMTUwMjUzNjMKU2hhcnBlIFJhdGlvIG9mICRTUFg6IDAuODgyMTY4Njc5Nzc2CgpDdW11bGF0aXZlIFJldHVybiBvZiBGdW5kOiAtMC4wMDQ0NzA1OTUzNzY3MQpDdW11bGF0aXZlIFJldHVybiBvZiAkU1BYOiAwLjAwMjg5ODQxNDQ4ODk0CgpTdGFuZGFyZCBEZXZpYXRpb24gb2YgRnVuZDogMC4wMDY3ODA3MzI3NDQ1OApTdGFuZGFyZCBEZXZpYXRpb24gb2YgJFNQWDogMC4wMDU0NDkzMzUyMTk5MQoKQXZlcmFnZSBEYWlseSBSZXR1cm4gb2YgRnVuZDogLTAuMDAwNDI3MjEwMTkzMzA4CkF2ZXJhZ2UgRGFpbHkgUmV0dXJuIG9mICRTUFg6IDAuMDAwMzAyODI3MjA1NTQ3CgpGaW5hbCBQb3J0Zm9saW8gVmFsdWU6IDk5MzAzNi4zNzU=&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]RGF0YSBSYW5nZTogMjAxMS0wMS0wNSAwMDowMDowMCB0byAyMDExLTAxLTIwIDAwOjAwOjAwCgpTaGFycGUgUmF0aW8gb2YgRnVuZDogLTEuMDAwMTUwMjUzNjMKU2hhcnBlIFJhdGlvIG9mICRTUFg6IDAuODgyMTY4Njc5Nzc2CgpDdW11bGF0aXZlIFJldHVybiBvZiBGdW5kOiAtMC4wMDQ0NzA1OTUzNzY3MQpDdW11bGF0aXZlIFJldHVybiBvZiAkU1BYOiAwLjAwMjg5ODQxNDQ4ODk0CgpTdGFuZGFyZCBEZXZpYXRpb24gb2YgRnVuZDogMC4wMDY3ODA3MzI3NDQ1OApTdGFuZGFyZCBEZXZpYXRpb24gb2YgJFNQWDogMC4wMDU0NDkzMzUyMTk5MQoKQXZlcmFnZSBEYWlseSBSZXR1cm4gb2YgRnVuZDogLTAuMDAwNDI3MjEwMTkzMzA4CkF2ZXJhZ2UgRGFpbHkgUmV0dXJuIG9mICRTUFg6IDAuMDAwMzAyODI3MjA1NTQ3CgpGaW5hbCBQb3J0Zm9saW8gVmFsdWU6IDk5MzAzNi4zNzU=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<h3><span class=\"mw-headline\" id=\"More_Comprehensive_Examples\">More Comprehensive Examples<\/span><\/h3>\n<h4><span class=\"mw-headline\" id=\"orders.csv\"><tt>orders.csv<\/tt><\/span><\/h4>\n<p>We provide an example, <tt>orders.csv<\/tt> that you can use to test your code, and compare with others. All of these runs assume a starting portfolio of 1000000 ($1M).<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;RGF0YSBSYW5nZTogMjAxMS0wMS0xMCAwMDowMDowMCB0byAyMDExLTEyLTIwIDAwOjAwOjAwCgpTaGFycGUgUmF0aW8gb2YgRnVuZDogMC45OTc2NTQ1MjE4NzgKU2hhcnBlIFJhdGlvIG9mICRTUFg6IDAuMDE4MzM4OTgwNzQ0MwoKQ3VtdWxhdGl2ZSBSZXR1cm4gb2YgRnVuZDogMC4xMDg4NzI2OTg1NDQKQ3VtdWxhdGl2ZSBSZXR1cm4gb2YgJFNQWDogLTAuMDIyNDA1OTg1NDMwMgoKU3RhbmRhcmQgRGV2aWF0aW9uIG9mIEZ1bmQ6IDAuMDA3MzA1MDk5MTY4MzUKU3RhbmRhcmQgRGV2aWF0aW9uIG9mICRTUFg6IDAuMDE0OTcxNjA5MTUyMgoKQXZlcmFnZSBEYWlseSBSZXR1cm4gb2YgRnVuZDogMC4wMDA0NTkwOTg2NTU0OTMKQXZlcmFnZSBEYWlseSBSZXR1cm4gb2YgJFNQWDogMS43Mjk1OTA5NTM0ZS0wNQoKRmluYWwgUG9ydGZvbGlvIFZhbHVlOiAxMTA2MDI1LjgwNjU=&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]RGF0YSBSYW5nZTogMjAxMS0wMS0xMCAwMDowMDowMCB0byAyMDExLTEyLTIwIDAwOjAwOjAwCgpTaGFycGUgUmF0aW8gb2YgRnVuZDogMC45OTc2NTQ1MjE4NzgKU2hhcnBlIFJhdGlvIG9mICRTUFg6IDAuMDE4MzM4OTgwNzQ0MwoKQ3VtdWxhdGl2ZSBSZXR1cm4gb2YgRnVuZDogMC4xMDg4NzI2OTg1NDQKQ3VtdWxhdGl2ZSBSZXR1cm4gb2YgJFNQWDogLTAuMDIyNDA1OTg1NDMwMgoKU3RhbmRhcmQgRGV2aWF0aW9uIG9mIEZ1bmQ6IDAuMDA3MzA1MDk5MTY4MzUKU3RhbmRhcmQgRGV2aWF0aW9uIG9mICRTUFg6IDAuMDE0OTcxNjA5MTUyMgoKQXZlcmFnZSBEYWlseSBSZXR1cm4gb2YgRnVuZDogMC4wMDA0NTkwOTg2NTU0OTMKQXZlcmFnZSBEYWlseSBSZXR1cm4gb2YgJFNQWDogMS43Mjk1OTA5NTM0ZS0wNQoKRmluYWwgUG9ydGZvbGlvIFZhbHVlOiAxMTA2MDI1LjgwNjU=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<h4><span class=\"mw-headline\" id=\"orders2.csv\"><tt>orders2.csv<\/tt><\/span><\/h4>\n<p>The other sample file is <tt>orders2.csv<\/tt> that you can use to test your code and compare with others.<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;RGF0YSBSYW5nZTogMjAxMS0wMS0xNCAwMDowMDowMCB0byAyMDExLTEyLTE0IDAwOjAwOjAwCgpTaGFycGUgUmF0aW8gb2YgRnVuZDogMC41NTI2MDQ5MDc5ODcKU2hhcnBlIFJhdGlvIG9mICRTUFg6IC0wLjE3NzIwMzAxOTkwNgoKQ3VtdWxhdGl2ZSBSZXR1cm4gb2YgRnVuZDogMC4wNTM4NDExMTk2OTUxCkN1bXVsYXRpdmUgUmV0dXJuIG9mICRTUFg6IC0wLjA2Mjk1ODE1MTYxOTIKClN0YW5kYXJkIERldmlhdGlvbiBvZiBGdW5kOiAwLjAwNzI4MTcyOTEwMzIzClN0YW5kYXJkIERldmlhdGlvbiBvZiAkU1BYOiAwLjAxNTA1NjQ4NTU3MjQKCkF2ZXJhZ2UgRGFpbHkgUmV0dXJuIG9mIEZ1bmQ6IDAuMDAwMjUzNDgzMDg1ODk4CkF2ZXJhZ2UgRGFpbHkgUmV0dXJuIG9mICRTUFg6IC0wLjAwMDE2ODA3MTY0ODkwMgoKRmluYWwgUG9ydGZvbGlvIFZhbHVlOiAxMDUxMDg4LjA5MTU=&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]RGF0YSBSYW5nZTogMjAxMS0wMS0xNCAwMDowMDowMCB0byAyMDExLTEyLTE0IDAwOjAwOjAwCgpTaGFycGUgUmF0aW8gb2YgRnVuZDogMC41NTI2MDQ5MDc5ODcKU2hhcnBlIFJhdGlvIG9mICRTUFg6IC0wLjE3NzIwMzAxOTkwNgoKQ3VtdWxhdGl2ZSBSZXR1cm4gb2YgRnVuZDogMC4wNTM4NDExMTk2OTUxCkN1bXVsYXRpdmUgUmV0dXJuIG9mICRTUFg6IC0wLjA2Mjk1ODE1MTYxOTIKClN0YW5kYXJkIERldmlhdGlvbiBvZiBGdW5kOiAwLjAwNzI4MTcyOTEwMzIzClN0YW5kYXJkIERldmlhdGlvbiBvZiAkU1BYOiAwLjAxNTA1NjQ4NTU3MjQKCkF2ZXJhZ2UgRGFpbHkgUmV0dXJuIG9mIEZ1bmQ6IDAuMDAwMjUzNDgzMDg1ODk4CkF2ZXJhZ2UgRGFpbHkgUmV0dXJuIG9mICRTUFg6IC0wLjAwMDE2ODA3MTY0ODkwMgoKRmluYWwgUG9ydGZvbGlvIFZhbHVlOiAxMDUxMDg4LjA5MTU=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Submission Instructions<\/h2>\n<p><strong>This is an individual assignment<\/strong>. All work you submit should be your own. Make sure to cite any sources you reference and use quotes and in-line citations to mark any direct quotes. Citations within the code should be captured as comments.<\/p>\n<p>Late work is not accepted without advanced agreement except in cases of medical or family emergencies. In the case of such an emergency, please <a href=\"https:\/\/gatech-advocate.symplicity.com\/care_report\/index.php\/pid986879?\" target=\"_blank\" rel=\"noopener\"><span>contact the Dean of Students<\/span><\/a>.<\/p>\n<h3>Report Submission<\/h3>\n<p>There is no report submission associated with this assignment.<\/p>\n<h3>Code Submission<\/h3>\n<p>This class uses Gradescope, a server-side autograder, to evaluate your code submission. No credit will be given for code that does not run in the Gradescope SUBMISSION environment. Students are encouraged to leverage Gradescope TESTING prior to submitting an assignment for grading.<\/p>\n<p>Please submit the following file to Gradescope <u>SUBMISSION<\/u>:<\/p>\n<ul>\n<li><strong>marketsim.py<\/strong><\/li>\n<\/ul>\n<p>Do not submit any other files. Note: Only the compute_portvals() function will be tested.<\/p>\n<p>You are allowed a MAXIMUM of three (3) code submissions to Gradescope SUBMISSION.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Rubric<\/h2>\n<h3>Report<\/h3>\n<ul>\n<li>No Report<\/li>\n<\/ul>\n<h3>Code<\/h3>\n<ul>\n<li>See Auto-Grader<span><\/span><\/li>\n<\/ul>\n<h3>Auto-Grader [100 points]<\/h3>\n<ul>\n<li>Basic simulator: (90 points) 10 test cases: We will test your code against 10 cases (9 points per case) without transaction costs. Points per case are allocated as follows:\n<ul>\n<li>2.0: Correct number of days reported in the DataFrame (should be the number of trading days between the start date and end date, inclusive).<\/li>\n<li>5.0: Correct portfolio value on the last day +-0.1%<\/li>\n<li>1.0: Correct Sharpe Ratio +-0.1%<\/li>\n<li>1.0: Correct average daily return +-0.1%<\/li>\n<\/ul>\n<\/li>\n<li>Transaction costs: (10 points) 5 test cases: We will test your code against 5 cases as follows:\n<ul>\n<li>2.0: Two test cases that evaluate commissions only (impact = 0)<\/li>\n<li>2.0: Two test cases that evaluate impact only (commission = 0)<\/li>\n<li>1.0: One test case with non-zero commission and impact.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; header_2_font=&#8221;|||on|on||||&#8221;]<\/p>\n<h2>Allowed<\/h2>\n<ul>\n<li>Your code may use the standard Python libraries, NumPy, SciPy, matplotlib and Pandas libraries. Be sure you are using the correct versions as stated on the <a href=\"http:\/\/lucylabs.gatech.edu\/ml4t\/summer2021\/local-environment\/\" target=\"_blank\" rel=\"noopener\">ML4T Local Environment Setup<\/a><\/li>\n<li>Code provided by the instructor or is allowed by the instructor to be shared.<\/li>\n<li>To read in \u2018orders\u2019 files, you may use the pandas.read_csv() function.<\/li>\n<li>Code that displays \u201cwarning\u201d messages to the terminal or console.<\/li>\n<li>Students are allowed to share statistics from the <em><u>additional orders files<\/u><\/em> provided in the project wiki (above) in the Students Results thread alone.<\/li>\n<li>Unladen African swallows.<span><\/span><\/li>\n<\/ul>\n<h2>Prohibited<\/h2>\n<ul>\n<li>No readings of stock files by any other means other than the functions provided in the util.py file. The \u2018orders\u2019 files can be read using pandas.read_csv().<\/li>\n<li>You may not use any libraries not listed in the \u201callowed\u201d section above.<\/li>\n<li>You may not use any code you did not write yourself.<\/li>\n<li>Code that takes longer than 10 seconds per test case to run.<\/li>\n<li>You may not use any classes (other than Random) that create their own instance variables for later use (e.g., learners like kdtree).<\/li>\n<li>The compute_portvals() function may not send any output to the screen\/console\/terminal.<\/li>\n<li>Code must not create extra directories.<\/li>\n<li>Code must not use of global variables.<\/li>\n<li>Code must not use absolute import statements, such as: <em>from folder_name import optimization<\/em>, where \u201cfolder_name\u201d is the path\/name of a folder or directory.<\/li>\n<li>You must <strong>not <\/strong>share tables and charts.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project 5: MarketsimRevisions This assignment is subject to change up until 3 weeks prior to the due date. We do not anticipate changes; any changes will be logged in this section.About The Project In this project, you will create a market simulator that accepts trading orders and keeps track of a portfolio\u2019s value over time. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":1607,"menu_order":11,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<!-- wp:divi\/placeholder \/-->","_et_gb_content_width":"","footnotes":""},"class_list":["post-1659","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1659","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=1659"}],"version-history":[{"count":6,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1659\/revisions"}],"predecessor-version":[{"id":1980,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1659\/revisions\/1980"}],"up":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/1607"}],"wp:attachment":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/media?parent=1659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}