# 代做Quantmod package作业、代写Java，c++编程语言作业、代写Python课程作业、代做data作业帮做SPSS|代写Python程序

Assignment 3
Due: Oct 21st, 2019 at 9:59 am
Question 1: Quantmod package (30 Points)
only present part of the functions from this package. To solve this question, you are required
to use functions from this package.
1. Download 1 year length data for an equity (You can select any equity you like), set the
start time as Jan. 1st, 2018 and end time as Dec 31st, 2018.
2. Calculate daily return using functions from this package. In this question, you shall calculate
both simple return and log return. (The two return sequences will be used in the
next question.)
3. Use chartseries() to add a Relative Strength Index line one the equity you selected. When
visualize this index, please use the default setting. Later, explain how to use this index in
Question 2: Basic statistics value and self-defined function (20
Points)
In this question, you need to design a self-defined function to calculate the first moment up to
the fourth moment for the return sequences you obtained from Question 1. To help you build
1. Your input should be a vector. Other than this format, your function should stop working
and send the user a warning message.
2. Calculate the first moment up to fourth moment for your input.
3. The object you want to return should be a “report”, this report should contain values
from step 2. Meanwhile, you should tell the user the data is left skew or right skew, heavy
tail or short tail.
Question 3: Data visualization (50 points)
In Question 1, you are required to generate the Relative Strength Index using the function from
Quantmod. In this question, you are required to generate this index by yourself without using
1. The final goal is generating a figure which contains two plots. One for the equity price
movement. Another one for the index. Make sure you have proper title, x-label, y-label,
legend and etc. in your plot.
2. Investigate how to calculate the RSI index in detail. Make sure you will have the index
value for all trading days between Jan. 1st, 2018 and Dec 31st, 2018. (Hint: you may
need extra equity data to replicate the same result as you have in Question 1)
3. Based on the index value you get, how many times you observe a strong selling signal
(higher than 70)? How many times you observe a strong buying signal? (lower than 30)
Bonus: Discussion on the Relative Strength Index (50 Points)
Let’s do something new on the Relative Strength Index. Instead of using a fixed threshold in
1. In order to accomplish this task, you need to prepare two data sets: A training data set
which contains 1 year length of data, a testing data set which contains 6 months of equity
data. (0 Points)
2. Based on the RSI values you obtained from the training data set. Find out which statistical
distribution it may apply to. In order to achieve this goal, you need to try at least three
different distributions. (10 Points)
3. Determine the threshold for the buying/selling signal. Let’s say this, when the index value
is outside the 95% confidence interval, you will buy/sell this equity accordingly. (10 Points)
4. Implement the threshold you set up from the previous step to the test data set. How much
money you may earn/loss after 6 month trading? Assume every time you observe this
you should not hold any equity in your hand. (20 Points)
5. Comment on your final result and discuss about the algorithm performance. In this part, 