首页 > > 详细

调试R、R调试、辅导留学生R设计、Book Pricer

1 (of 2)
Weighting 10%
Assignment Circulated 16:00 Thursday 22 February 2018
Deadline 12:00 Thursday 15 March 2018
Submission Mode Electronic only
http://www.csc.liv.ac.uk/cgi-bin/submit.pl
Learning Outcomes
Assessed
This assignment will address the following learning outcomes:
•Have an understanding of market microstructure and its
impact on trading.
•Understand the spectrum of computer-based trading
applications and techniques, from profit-seeking trading
strategies to execution algorithms.
•Understand the benchmarks used to evaluate execution
algorithms.
Purpose of Assessment The goal of this assignment is to implement a limit order book
pricer
Marking Criteria Correctness (80%); Readability (20%). See the end of this
document.
Submission necessary
in order to satisfy
module requirements
No
Late Submission
Penalty
Standard UoL policy; note that no resubmissions after the
deadline will be considered.
Expected time taken Roughly 8 hours
Please submit a single file called x3xx.R, where x3xx is your CS username (which you use to
log on to the submission system; yours might look quite different).
This file must contain a function called pricer, whose form. and functionality is described
below. The file may also contain other functions used by pricer, but the function pricer
should not be called within the file.
Warning
Your code will be put through the department's automatic plagiarism and collusion
detection system. Student's found to have plagiarized or colluded will likely receive a
mark of zero. Do not discuss or show your work to other students. Several students
were found to have plagiarised in previous years and this had serious consequences
for their studies (two students had their studies terminated and left without a degree).
To aid with marking, your code will be put through a number of automatic tests, so you
must ensure that it is written as specified below.
Learning Outcomes
The syllabus for COMP226 can be found here:
http://intranet.csc.liv.ac.uk/teaching/modules/module.php?code=COMP226
This assignment will address the following two learning outcomes:
•Have an understanding of market microstructure and its impact on trading.
•Understand the spectrum of computer-based trading applications and techniques, from
profit-seeking trading strategies to execution algorithms.
•Understand the benchmarks used to evaluate execution algorithms.
Marking
The marking will be as follows:
•80% for correctness; this will be determined primarily by automatic tests. If your code
fails many of these then a mark will be decided via manual testing of your code.
•20% for readability of your code; first and foremost you should ensure that your code
so is correct. The next most important thing is that it can be understood by others; to
aid its readability your are encouraged to include clear informative comments.
Background
In this exercise you will write an R program to analyse the log file of a limit order book
market.
The log file contains messages that describe changes to the book. Each message either
•adds an order to the book, or
•reduces the size of an order in the book (possibly removing the order entirely).
Problem
The function pricer should take three arguments as follows
pricer 0) {
# do stuff, for example
print(oneLine)
}
close(con)
The line by line approach will be slow. For a very large file it may not be possible to read the
whole file into memory in which case one would typically use an incremental approach but
reading in chunks rather than lines (read.table allows that).
Note
One problem you have to solve for Assignment 1 is that there are two types of
message with different fields. There are different ways to approach this, and it's left to
you to decide what to do.
Why don't you start right a way and load some of the sample data for Assignment 1 into R.
Data Output
There is a function write.table, however for Assignment 1 one you may just want to write
each output line as it is produced (rather than store the output and only write it to a file in
the end).
One way to write the output incrementally is with cat.
> price cat(file="test.out","The price is", price, "\n")
Now look in your working directory and you will find the file test.out.
> file.show("test.out")
The price is 100
(END)
For Assignment 1 you may want to append to a file, which cat does as follows:
> price cat(file="test.out",append=TRUE,"The price is now", price, "\n")
> file.show("test.out")
The price is 100
The price is now 101
(END)
By the way, cat will write to the console if a file is not provided to it as an argument.
One other function you will need is format. The best way to check that your program for
Assignment 1 is correct is to run it on the sample input and compare your output with the
sample output; the easiest way to do this is with a text file comparison tool such a diff on
Linux/Unix systems. For diff tools on other platforms see
http://stackoverflow.com/questions/12625/best-diff-tool
Anyway, use these diff tools to make your output identical to the sample output, and
format can help you do that. For example,
> prices cat(prices, '\n')
800.5 800.25 800
> cat(format(prices,nsmall=2),'\n')
800.50 800.25 800.00
Calling the function pricer
You need to make sure that when your source code is sourced with something like
source('x3xx.R')
that is gives no errors, and, will then allow the automatic tests to call pricer somewhat like
what follows.
pricer(infile="PATH_TO_INPUT",outpfile="PATH_TO_OUTPUT",targetsize=50)
Do not include the call to pricer in the file you submit.
That's it. Good luck, and if you have questions please ask in the practicals or in the lectures.
MAKE SURE YOU READ THIS DOCUMENT CAREFULLY - ALMOST ALL THE
INFORMATION YOU NEED TO COMPLETE THIS ASSIGNMENT IS EITHER HERE IN
THIS DOCUMENT OR IN THE SLIDES OR WORKSHEETS.
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!