这个作业是用R语言实现投资算法交易

Algorithmic Trading, COMP0051, 2020
This assignment is worth 20% of the overall mark.
Standard and non-standard calculators are permitted
Tasks
1. Initialise the random number generator of your chosen programming package using a
seed equal to your student number.
2. Generate a price time series using the equation
p(t) = p0(1+A∗ sin(ωt +0.5η(t)))
where t ranges from 0 to 1 in 1000 time steps, p0 = 100, A = 0.1, and ω = 100. η(t) is a
sequence of i.i.d Gaussian random variables with zero mean and unit variance.
3. Define 3 self-financing long-only trading strategies with initial cash C0 = 1000. The selffinancing condition for the update of cash and volume at each time step is given by
TV(t) = C(t) + p(t)V(t) = C(t +1) + p(t)V(t +1),
for all time steps t. The long-only condition is given by V(t) ≥ 0 for all time steps. No
borrowing is also considered, C(t) ≥ 0 for all time steps.
4. Define the return of a trading strategy a at time t as,
ra(t) = log
TVa(t)
TVa(t −1)

5. Compute 3 representative performance indicators, Sharpe ratio and two alternatives introduced during lectures, to evaluate the trading strategies. If appropriate, for each of them
provide two independent measures: within a training set and within a test set, representing
70% and 30% of the data, respectively.
6. For the hypotheses that the strategies have a non-zero Sharpe ratio, use a statistical test
covered in the lectures to control for Family Wise Error Rate (FWER) at a confidence
level of 5%. Create another price series of the same size using the same data generating
process and re-evaluate the Sharpe ratio of the strategies. Did the procedure help in
reducing type 1 errors?
7. Summarise and present results with plots and tables.
COMP0051 1 TURN OVER
Written report A single written report in pdf (maximum 10 pages, code included) structured
into:
• Introduction
• Methodology
• Results
• Discussion
• Bibliography
• Appendix (including code)
will need to be submitted to Moodle before the deadline of Tuesday 07/04/2020 at 17:00.
Coding and Editing Students are allowed to use any programming language and any editing
software for the report.
Marking The marking will be based on the following criteria:
• Clarity of presentation and explanations;
• Justification of the methodology;
• Validity of results;
• Consistency of language and mathematical notation;
• Critical interpretation of results.
COMP0051 2 END OF PAPER