Principles of Financial Computing Course

Principles of Financial Computing

Time: 9:10 ~ 12:10 Wednesday (Spring Semester)
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, 2009, 2010, 2011, 2012 ]

  1. 2012.02.22
  2. 2011.03.02
  3. 2011.03.09
  4. 2011.03.16 & 1st assignment due
  5. 2011.03.23
  6. 2011.03.30
  7. 2011.04.06 & 2nd assignment due
  8. 2011.04.13
  9. 2011.04.20 & 3rd assignment due
  10. 2011.04.27
  11. 2011.05.04
  12. 2011.05.11 & 4th assignment due
  13. 2011.05.18
  14. 2011.05.25
  15. 2011.06.01 & 5th assignment due
  16. 2011.06.08
  17. 2011.06.15
  18. 2011.06.22 & 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.
  1. Write a program to calculate the modified duration and convexity of a cash flow given the zero-coupon bond prices. All times are period-based for convenience. The calculations should be based on the ideas on p. 137 of the lecture note given on March 9, 2011. Inputs: longest maturity n (number of periods), n zero-coupon bond prices (% of par), n cash flows (% of par). Output: modified duration, convexity. For example, assume n=4, zero-coupon bond prices are [95, 93, 88, 86], the cash flows are [1, 2, 3, 101]. The duration and convexity are 3.755421701 and 17.89837025, respectively. 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 16, 2011. 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 program to price American calls on a stock paying a dividend yield. If the ex-dividend date falls between two steps, assume the earlier time step is the ex-dividend date. Inputs: S (stock price), σ (volatility), X (strike price), t (year), n (the total number of periods), δ (dividend yield 1 > δ >0), m (the total number of ex-dividend dates at or before expiration), r (interest rate). For example, suppose S = 160, σ = 0.08, X = 130, t = 10, n = 10, δ = 0.05, m = 5, r = 0.04. For American calls, the price is about 37.4486. 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 6, 2011. 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 American single-barrier down-and-out puts and output its delta and gamma. Inputs: S (stock price), X (strike price), H (barrier), T (year), s (%volatility) , r (%risk-free rate), n (number of periods, an even number). Assume H < S. The American put can be exercised only at time T/2 or later. For example, suppose S = 50, X = 50, H = 20, T = 1 (year), s = 30(%), r = 10 (%), and n=100. The price is about 4.061974, the delta is about -0.363722, and the gamma is about 0.028153. 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 20, 2011. Compress your files into a single file and name it StudentID_HW_3 for easy reference. Example: R98723054_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 program to price American-style arithmetic average-rate calls based on the CRR binomial tree and output the delta. 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, X, t (year), s (%), r (%), n, and k (number of states per node). For example, when S = 100, X = 50, t = 2 (year), s = 30%, r = 10 (%), n = 40, and k = 5, the price is about 57.6465 and the delta is about 0.9478. 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 May 11, 2011. Compress your files into a single file and name it StudentID_HW_4 for easy reference. Example: R98723054_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 a Monte Carlo Simulation program to price a 3-asset single-barrier European knock-out call with delta and gamma with respect to S1. Inputs: S1, S2, S3, X, barrier H (on S1), t (year), s1 (%), s2 (%), s3 (%), r (%) (the correlation between any two assets), r (%), number of paths n, and number of time points (including today) m. The terminal payoff is max( (S1 + S2 + S3)/3 - X, 0). Assume H > S1. The option will be knocked out if the first asset hits the barrier H. For example, the price is about 4.1571 ~ 4.3850, the delta is about -0.0506, and the gamma is about -0.0181 when S1 = 50, S2 = 50, S3 = 50, X = 50, H = 80, t = 1 (year), s1 =30 (%), s2 =30 (%), s3 =30 (%), r = 20 (%), and r = 10 (%). You may experiment with either variance reduction and/or the Brownian bridge method to see if results will converge faster. Please send your source code, executable code, and an explanation file (e.g., how to run it? what is the programming language used?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 01:00 AM of June 1, 2011. Compress your files into a single file and name it StudentID_HW_5 for easy reference. Example: R98723054_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 call option on a zero-coupon bond that matures at year y with a par value of 1 dollar. Use trees for the CIR model. Inputs: x (year), y (year), r (%) (initial short rate), b (%) and m (%), s (%) and number of partitions n, strike price X (% of par). For example, the option price is about 5.87267 (% of par) when x = 1, y = 2, r = 4 (%), b = 20 (%), m = 4 (%), s = 10 (%), n = 30, and X = 90 (%). Please send your source code, executable code, and an explanation file (e.g., how to run it? what is the programming language used?) using the CEIBA system (922 U0270)/CEIBA system (723 M9500) before 11:00 PM of June 26, 2011. 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