Principles of Financial Computing Course

Principles of Financial Computing

Time: 9:10 ~ 12:10 Wednesday (Spring Semester)
Location: 館二 205


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, 2009, 2010, 2011, 2012 ]

  1. 2012.02.22
  2. 2012.02.29
  3. 2012.03.07
  4. 2012.03.14 & 1st assignment due
  5. 2012.03.21
  6. 2012.03.28 Multicharts
  7. 2012.04.04 & 2nd assignment due
  8. 2012.04.11
  9. 2012.04.18
  10. 2012.04.25 & 3rd assignment due
  11. 2012.05.02
  12. 2012.05.09 & 4th assignment due
  13. 2012.05.16
  14. 2012.05.23
  15. 2012.05.30 & 5th assignment due
  16. 2012.06.06
  17. 2012.06.13 & 金國興教授:程式交易應用於可轉債的套利與避險(Ⅰ) & (Ⅱ)
  18. 2012.06.20 & 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.
Treat each homework as an examination.
Do program carefully. It is much more important to get the numbers right than to get a pretty user interface running.
  1. Write a program to calculate all 1-period forward rates from zero-coupon bond prices. All times are period-based for convenience. Inputs: longest maturity n (number of periods), n zero-coupon bond prices (% of par), Output: all 1-period forward rates f(0,1), f(1,2), ..., f(n-1,n) in %. For example, assume n=4 and zero-coupon bond prices are [97, 92, 80, 78]. The 1-period forward rates are f(0,1)=3.0927835, f(1,2)=5.4347826, f(2,3)=15, f(3,4)=2.5641026. Please send your source code, executable code, and an explanation file (e.g., how to run it?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of March 14, 2012. Compress your files into a single file and name it StudentID_HW_1 for easy reference. Example: R91723054_HW_1. 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.
  2. Write a binomial tree program to calculate the price, delta and gamma of American puts on a stock paying a continuous dividend yield. Inputs: S (stock price), X (strike price), σ (volatility), t (year), n (the total number of periods), δ (continuous dividend yield), r (interest rate). For example, suppose S = 100, X = 100, σ = 0.3, t = 1, n = 100, δ = 0.05, and r = 0.1. The American put price is about 9.5709, the delta is about -0.3994 and the gamma is about 0.0146. Please send your source code, executable code, and an explanation file (how to run it? what is the time complexity?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of April 4, 2012. Compress your files into a single file and name it StudentID_HW_2 for easy reference. Example: R91723054_HW_2. 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.
  3. Write a CRR binomial tree program to price European single-barrier down-and-out calls. Write anthoer program based on pp. 416--417 to price the same option. Inputs: S (stock price), X (strike price), H (barrier), T (year), s (volatility in %), r (risk-free rate in %), n (number of periods). Assume H <S. The knock-out stock prices on the tree are those that are at or below H. For example, suppose S = 100, X = 90, H = 80, T = 1 (year), s = 25 (%), r = 15 (%), and n=100. The option price under CRR is about 23.3627 and under the other model is 23.5201. Please send your source code, executable code, and an explanation file (e.g., how to run it? what is the programming language used? what is the time complexity?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of April 25, 2012. Compress your files into a single file and name it 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 binomial tree program for arithmetic American Asian puts on a non-dividend-paying stock. Output its price, delta, and gamma. The gamma is based on p. 682 with e=0.2. Of course, if the holder exercises early, the payoff is max(X - average, 0), where average means the running average. Inputs: S (stock price), X (strike price), t (year), n (the total number of periods), s (volatility in %), r (interest rate in %), k (the number of running averages on each node). For example, suppose S = 95, X = 100, t = 2, n = 100, s = 20(%), r = 15 (%), and k = 100. For arithmetic American Asian puts, the option price under binomial tree is about 5.644079, the delta is about -0.764680, and the gamma is about 0.04535. Please send your source code, executable code, and an explanation file (how to run it? what is the time complexity?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of May 9, 2012. Compress your files into a single file and name it StudentID_HW_4 for easy reference. Example: R91723054_HW_4. 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.
  5. Write 2 programs for pricing European binary calls (pp. 677~682 of the slides) on a non-dividend-paying stock. One uses a trinomial tree, and the other the Monte Carlo method. Output its price, delta, and gamma from both. For trinomial tree, you may use the one on p. 590. (If you decide to use the trinomial tree on pp. 591ff, the convergence may be slightly better by treating the strike price as the barrier in determining your l.) For Monte Carlo method, one time step suffices as the lecture notes show. If you use any nontrivial ideas in either the trinomial tree or Monte Carlo to improve convergence or accuracy, please record them in your explaining notes. (Antithetic variates, e.g., will not be considered nontrivial.) Inputs: S (stock price), X (strike price), t (year), n (total number of periods), s (volatility in %), r (interest rate in %), m (number of sample paths of simulation; an antithetic method will produce twice that number of paths), and e (see pp. 679ff). For example, suppose S = 100, X = 90, t = 2, n = 1000, s = 40(%), r = 5 (%), m = 1000000, and e=0.001. For the trinomial tree, the price, delta, and gamma are about 0.47805, 0.006262, and -0.00007036, respectively. For Monte Carlo, our price is around [0.48112, 0.48158], our delta is around [0.0039934, 0.0092489], and our gamma is around [-4.796, 5.1489]. Please send your source code, executable code, and an document file (what is the formulas you had used? how to run it? what is the time complexity?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of May 30, 2012. Compress your files into a single file and name it StudentID_HW_5 for easy reference. Example: R91723054_HW_5. 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.
  6. Write a program to price an x-year European call option on a zero-coupon bond that matures at year y with a par value of 1 and output its delta. Use the trinomial tree for the Hull-White model on pp. 1023ff. In particular, use the jmax=jmin version on p. 1031. Delta is the first differential of the option price with respect to the bond price. The market spot rate curve is A - B e- C t (annualized and continuously compounded). Inputs: x (year), y (year), a, s (%), number of partitions n, strike price X (% of par), A, B, and C. For example, the option price is about 0.017 and the delta is about 0.158 when x = 1, y = 4, a = 0.1, s = 10 (%), n = 100, X = 90 (%), A = 0.2, B= 0.15, and C=0.1. Please send your source code, executable code, and an explanation file (how to run it? what is the time complexity?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of June 20, 2012. Compress your files into a single file and name it StudentID_HW_6 for easy reference. Example: R91723054_HW_6. 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.

Enrollments