Principles of Financial Computing Course

Principles of Financial Computing

Location: Room 105 of the CSIE building.


On Wall Street, being right on the fundamentals and
wrong on the timing is the same as just being wrong.
---Jonathan Cohen

Where is the risk management at J.P. Morgan Chase?
--- Bloomberg News, January 16, 2002

10. Of course, I make a lot investing.
I only teach so I can help young people.
--- Top Ten Lies Finance Professors Tell Their Students


A single-semester course for the students of the Department of Finance and the Department of Computer Science and Information Engineering.
Required course for the Financial Engineering Track in the Department of Finance's Master's program.


To Students,

You will learn a perhaps different perspective on finance, especially as it pertains to pricing and software engineering. Our emphasis on computation should add a new dimension and toolbox to your existing knowledge and financial sense. (But see Enrollments below.)
It is your responsibility to learn to write in high-level programming languages. We cannot impart that skill in the class. If the mathematics proves hard going, you are expected to fill in the gap by self-reading. The technicalities are not beyond a motivated graduate student's reach.


The major topics covered in the course, time permitting, are listed below for your reference.


Notes [ 2003, 2004, 2005, 2006, 2007, 2008 ]

  1. 2008.02.20
  2. 2008.02.27
  3. 2008.03.05
  4. 2008.03.12
  5. 2008.03.19 & 1st assignment due
  6. 2008.03.26
  7. 2008.04.02 & 2nd assignment due
  8. 2008.04.09
  9. 2008.04.16
  10. 2008.04.23 & 3rd assignment due
  11. 2008.04.30
  12. 2008.05.07
  13. 2008.05.14 & 4th assignment due
  14. 2008.05.21
  15. 2008.05.28 & 5th assignment due
  16. 2008.06.04
  17. 2008.06.11
  18. 2008.06.18: 6th assignment due

Programming Exercises

Homework should be turned in on time. No late homework will be accepted without legitimate reasons. There will be four to six programming assignments. You are expected to write your own codes and turn in your source code. Do not copy or collaborate with fellow students. Never ask your friends to write programs for you. Never give your code to other students or publish your code because it may be copied and you in turn may be suspected of copying other's code! Do program carefully. It is much more important to get the numbers right than to get a pretty user interface running. etc.
  1. Write a program to calculate the spot rates and forward rates from coupon bond prices (% of par) and their coupon rates (%). Also compute each coupon bond's duration based on the duration measure on p. 60's first displayed formula. All times are period-based for convenience. The complexity should be linear in n, the number of bonds. Inputs: coupon bond prices (% of par; the ith maturing at period i), period coupon rates (% of par). Outputs: spot rates (%), forward rates (%). For example, let n=3. So there are 3 coupon bonds. Suppose the coupon rates are [ 0%, 10%, 10% ] and the corresponding bond prices are [ 92.5925, 90, 89 ], for the coupon bonds of maturity 1, 2, and 3 periods, respectively. Then the spot rates are [ 8.00%, 16.72%, 14.96% ], the forward rates are [ 8.00%, 26.15%, 11.52% ], and the durations for the 3 coupon bonds are [ 0.926, 1.633, 2.361 ]. Due: March 19, 2008. Please send your source code, executable code, and an explanation file (how to run it? what is the programming language used?) using the CEIBA system before 9:00 AM of March 19, 2007. Name your files StudentID_HW_1 for easy reference. Example: R91723054_HW_1. Even if you need to make an appointment with §d©ÓÞ³ for demonstration because of the unusual software you use, you still have to submit the files before the deadline.
  2. Write a program to price American calls. Also output the deltas and gammas. Inputs: S, X, t (year), s (%), r (%), continuous dividend yield q (%), n (number of periods between two exercise points, an even number). The American call can be exercised only at time T/2 and later. For example, suppose S = 40, X = 40, t = 1.0 (year), s = 40(%), r = 6(%), and q = 0(%). The price is about 7.373514, the delta is about 0.636502, and the gamma is about 0.023634 (for n = 100). Suppose one sets q = 2(%). Then the price is about 6.876802, the delta is about 0.605515, and the gamma is about 0.023547 (for n = 100). Due: April 2, 2008. Please send your source code, executable code, and an explanation file (how to run it? what is the programming language used?) using the CEIBA system before 9:00 AM of April 2, 2008. Name your files StudentID_HW_2 for easy reference. Example: R91723054_HW_2. Even if you need to make an appointment with §dºå for demonstration because of the unusual software you use, you still have to submit the files before the deadline.
  3. Write a program to price American-style Asian calls based on the CRR binomial tree and output the delta as well. The payoff function is max(average - X, 0). Of course, if the holder exercises early, then average means the running average. Note that running average includes the current stock price. Inputs: S, t (year), s (%), r (%), n, and k (number of states per node). For example, when S = 50, X = 50, t = 0.5 (year), s = 30%, r = 10 (%), n = 40, and k = 5, the price is about 4.53587 and the delta is about 0.617642. Due: April 23, 2008. Please send your source code, executable code, and an explanation file (how to run it? what is the programming language used?) using the CEIBA system before 9:00 AM of April 23, 2008. Name your files StudentID_HW_3 for easy reference. Example: R91723054_HW_3. Even if you need to make an appointment with ¹ù»ñ¥É for demonstration because of the unusual software you use, you still have to submit the files before the deadline.
  4. Write a tree program to price discretely monitored European single-barrier down-and-out calls. Inputs: S, X, barrier H, t (year), s (%), r (%), m and n. Here, m is the number of monitoring days (today not counted) and n is the number of periods between adjacent monitoring days. (The total number of periods is m*n.) Assume H < S. For example, the price is about 9.415281 when S = 95, X = 100, H = 90, t = 1 (year), s = 25 (%), r = 10 (%), m = 6, and n = 89. Due: May 14, 2008. Please send your source code, executable code, and an explanation file (how to run it? what is the programming language used?) using the CEIBA system before 9:00 AM of May 14, 2008. Name your files StudentID_HW_4 for easy reference. Example: R91723054_HW_4. Even if you need to make an appointment with §d©ÓÞ³ for demonstration because of the unusual software you use, you still have to submit the files before the deadline.
  5. (to be finalized) Write a Monte Carlo program to price the option in problem 4. Inputs: S, X, barrier H, t (year), s (%), r (%), m and the number of paths n. As before, m is the number of monitoring points (today is not a monitoring point). So T/m years elapse from one monitoring point to the next. You should calculate (1) price, (2) delta, and (3) gamma and compare them with the tree algorithms in problem 4. You may experiment with variance-reduction techniques. Due: May 28, 2008. Please send your source code, executable code, and an explanation file (how to run it? what is the programming language used?) using the CEIBA system before 9:00 AM of May 28, 2008. Name your files StudentID_HW_5 for easy reference. Example: R91723054_HW_5. Even if you need to make an appointment with §dºå for demonstration because of the unusual software you use, you still have to submit the files before the deadline.
  6. Write a Monte Carlo program to price 2-asset single-barrier European knock-out calls. Inputs: S1, S2, X, barrier H (on S1), t (year), s1 (%), s2 (%), r (%), r (%), number of paths n, and number of time points (including today) m. The terminal payoff is max((S1 + S2)/2 - X, 0). Assume H > S1. For example, the price is about 3.08754-3.46407 (courtesy of ³\¬°¤¸ William Wei-Yuan Hsu) when S1 = 100, S2 = 100, X = 95, H = 130, t = 1 (year), s1 =30 (%), s2 =25 (%), r =0.5 (%), and r =1.51 (%). Due: May 28, 2008. Please send your source code, executable code, and an explanation file (how to run it? what is the programming language used?) using the CEIBA system before 9:00 AM of May 28, 2008. Name your files StudentID_HW_5 for easy reference. Example: R91723054_HW_5. Even if you need to make an appointment with TBA for demonstration because of the unusual software you use, you still have to submit the files before the deadline.

Enrollments