联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-03-09 10:52

Assignment 3

Due: March 18th, 2019 at 9:59 am

Question 1: Quantmod package (30 Points)

Quantmod is a powerful package when downloading daily equity data. During the class time, I

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 31, 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 MACD line one the equity you selected. When generate the

MACD line, please use the default setting. Later, explain to me what is MACD, and what

is the meaning for the following arguments in the function: fast, slow, signal.

Question 2: Basic statistics value and self-defined function (20

Points)

In this question, you need to design a self-defined function to calculate skewness and kurtosis

for the return sequences you obtained from Question 1. To help you build this function, please

following instructions:

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 skewness and kurtosis for your input. The object you want to return should

be a “report”, this report should contain the value of skewness and kurtosis. 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 already study the MACD and how it is calculated using the default setting.

However, you may notice that the MACD has a missing part for the initial days in Jan. This

time, you need to calculate the MACD and signal line by your self and make a plot for these

two line. Additional requirements are following:

1

1. Investigate how MACD is calculated in detail. Make sure you will have the full MACD

line for the equity you selected (For example, you observe 250 points in the data you

downloaded from Question 1. Than, you shall have 250 MACD points)

2. Make a single figure which contains both equity price movement (1 plot), and the MACD

line and signal line (1 plot). Make sure you have proper setting for the plot. This time,

legend is required.

3. Based on your MACD value and signal line value, how many time you receive the buy

signal and how many time you receive the sell signal?

Bonus: Intro to HFT (20 points)

Use BA.csv from previous homework, this time let’s do something new

Read BA.csv, this time I need you to subtract all Trade information

Divide your data set into 5 minutes time interval. For example, 9:30 - 9:35, 9:35 - 9:40, ...

In total, you should have 78 time intervals.

For each time interval, record the first trade price as ps, the last trade price as pe. Use ps

and pe to calculate return (either type). Save all the returns into a vector.

Is this return sequence stationary? Is this return sequence Normal distributed?


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp