Fill This Form To Receive Instant Help
Homework answers / question archive / Assignment 2 Assignment: load your stock and SPY analyze trading strategies last question (last digit) is optional use numpy (math), matplotlib (but no pandas) In this assignment, you will implement and analyze the efol- lowing day trading strategy for Salesforce, Inc
Assignment 2
Assignment:
use numpy (math), matplotlib (but no pandas)
In this assignment, you will implement and analyze the efol- lowing day trading strategy for Salesforce, Inc. (CRM) and SPDR S&P 500 ETF Trust (SPY) stocks:
For your stock, for every day you have the ”Open” and ”Adj Clode” prices. You will investigate the performance of the fol- lowing ”day trading” strategy. You believe that a stock has ”inertia” (and assume that you will know the direction of the stock movement in the morning compared to last night’s clos- ing price). In fact, assume that you know the opening price just before the market opens). Your day trading strategy for your stock is the following:
Here is a simple example to illustrate:
For example, consider your strategy on Wednesday morning. The closing price on the previous day (tuesday) was $95 and the opening price on Wednesday is 92. The overnight return rate is 100% · (92 − 95)/95 = −3.2%. The stock fell overnight and you believe that it will continue falling in price for the rest of the day. Therefore, you sell short $100 dollars worth of stock (100/92 = 1.09 shares). At the end of the day, you buy 1.09 shares at the Wed closing price of 90: this will cost you 1.09 · 90 = 97.83. You profit is then 100 − 97.83 = 2.17
Now, consider your day trading startegy on Friday morning. The closing price on the previous day (Thursday) was $85 and the opening price on Friday is $90. The overnight return rate is 100% · (90 − 85)/85 = 5.9%. The stock rose overnight and you believe that it will continue rising in price for the rest of the day. Therefore, you buy $100 dollars worth of stock (100/90 = 1.11 shares). At the end of the day, you sell 1.11 shares at the Friday closing price of $95: this will give you 1.11·$95 = $105.45. You profit is then $105.45 − $100 = $5.45
Let us define some additional notation. Take a particular time period (e.g. year). Let |S| denote the number of days when you took the short position and let |L| be the number of days when you took the long position. Let |S + L| be number of days that you traded your stock (both long and short). Let P(S) be the total profit/loss for ”short position” days and P(S)/|S| be the average daily profit for ”short position” days. Similarly, Let P (L) be the total profit for ”long position” days and P(L)/|L| be the average daily profit for ”long position” days. Similarly, let P (L + S) be the total profit for ”long and short” position” days and P (L + S)/|L + S| be the average daily profit for such days. Similarly,
Questions: For all questions, you take the daily 5-year data for your stock and for S&P-500
For each of the 5 years, compute statistics on your trading days and summarize them in the following tables (one table for your stock and one table for S&P-500)
Please download the answer file using this link
https://drive.google.com/file/d/16umzDru8rf7Q4Lb2Jiy16owuCUvuYxL6/view?usp=sharing