Principles of Financial Computing Course

Principles of Financial Computing

Time: 9:10 ~ 12:10 Friday (Spring Semester)
Location: Room 111 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



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, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 ]

  1. 2022.02.18
  2. 2022.02.25
  3. 2022.03.04
  4. 2022.03.11
  5. 2022.03.18 & 1st assignment due
  6. 2022.03.25
  7. 2022.04.01
  8. 2022.04.08
  9. 2022.04.15
  10. 2022.04.22 & 2nd assignment due
  11. 2022.04.29
  12. 2022.05.06
  13. 2022.05.13 video 1 video 2 video 3
  14. 2022.05.20 & 3rd assignment due video 1 video 2 video 3
  15. 2022.05.27 video 1 video 2 video 3
  16. 2022.06.03
  17. 2022.06.10 (optional) video 1 video 2 video 3
  18. 2022.06.17 & 4th 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.
  1. Write a program to generate an amortization schedule of repaying a loan. Inputs: (1) L (loan amount in dollars), (2) r (interest rate in percent, for example, 12 instead of 0.12), (3) n (duration of the loan in years), and (4) m (how many payments per annum). Output: A csv file for the amortization schedule. The schedule shall have five columns: (1) Time (0, 1, 2, ...), (2) Payment (each payment amount), (3) Interest (the interest part of each payment), (4) Principal (the principal part of each payment), and (5) Remaining principal. Please check the example output file in here. IMPORTANT notes: (1) The Time column must be integers (no floating-point numbers). (2) The Payment, Interest, Principal, and Remaining principal columns must be floating-point numbers up to 2 decimal points. (3) The order of the columns must be respected. (4) The headers of the columns must be as in the sample file. (5) Start from Time 0 instead of Time 1. This means the value of the first row will be 0, 0, 0, 0, L. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using the CEIBA system (CSIE 7134) before 08:00 AM of March 18, 2022. No late submissions will be accepted. Compress your files into a single file and name it StudentID_HW_1 for easy reference. Example: R91922054_HW_1. If Python is not your programming language please demonstrate your code to 盧與明 during the office hour or make an appointment with him to do so. (You still have to submit the files before the deadline.)
  2. Write a binomial tree program to price a down-and-in partial barrier put. The barrier only exists from T/3 to T (inclusively), where T is the time to maturity. Inputs: (1) S (stock price), (2) K (strike price), (3) r (interest rate), (4) s (volatility), (5) T (time to maturity in number of days), (6) H (barrier), and (7) n (number of time steps per day). Output: Option price. For example, suppose that S = 95, K = 100, r = 10 (%), s = 25 (%), T = 200 (days), and H = 90. The put price is about 6.6237 at n = 3 and 6.6304 at n = 6. IMPORTANT notes: (1) The interest rate and volatility should be in percent. For example, if the interest rate is 1% and volatility 10%, the inputs are 1 and 10, respectively. (2) The barrier level H may not be aligned with a level of tree nodes. In that case, use the highest price on the tree that is lower than H as the effective barrier. (3) Assume 1 year has 365 days. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using the CEIBA system (CSIE 7134) before 08:00 AM of April 22, 2022. No late submissions will be accepted. Compress your files into a single file and name it StudentID_HW_2 for easy reference. Example: R91922054_HW_2. If Python is not your programming language, please demonstrate your code to 盧與明 during the office hour or make an appointment with him to do so. (You still have to submit the files before the deadline.)
  3. Implement the Brownian bridge approach to price a down-and-in partial barrier put. The barrier only exists from T/3 to T (inclusively), where T is the time to maturity. Inputs: (1) S (stock price), (2) K (strike price), (3) r (interest rate), (4) s (volatility), (5) T (time to maturity of days), (6) H (barrier), (7) n (number of time steps per day), (8) N (number of simulation path). Output: Option price and the standand error. IMPORTANT notes: (1) The interest rate and volatility should be in percent. For example, if the interest rate is 1% and volatility 10%, the inputs are 1 and 10, respectively. (2) Assume 1 year has 365 days. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using the CEIBA system (CSIE 7134) before 08:00 AM of May 20, 2022. No late submissions will be accepted. Compress your files into a single file and name it StudentID_HW_3 for easy reference. Example: R91922054_HW_2. If Python is not your programming language, please demonstrate your code to 盧與明 during the office hour or make an appointment with him to do so. (You still have to submit the files before the deadline.)
  4. Calibrate the Black-Derman-Toy model to obtain the binomial interest rate tree. Inputs: (1) spot rates of riskless zero-coupon bonds (in percent), (2) yield volatilities of the same bonds (in percent) except the first bond as its yield does not have volatility. Output: the binomial interest rate tree. For example, suppose the spot rates are 10, 11, 12, 12.5, and 13 (%) for the 1-, 2-, 3-, 4-, and 5-year zero-coupon bonds, respectively, and the yield volatilities are 19, 18, 17, and 16 (%) for the 2-, 3-, 4-, 5-year zero-coupon bonds, respectively. Then a binomial interest rate tree that matches both term structures appears here. IMPORTANT notes: (1) The spot rates and volatilities should be in percent. For example, if the spot rate is 1% and volatility 10%, they are inputted as 1 and 10, respectively. (2) Your program should take two lines of input. The first line reads the spot rates and the second the yield volatilities. (3) In each line of input, the numbers shall be separated by space. (4) The times to matruities increment by one year. So 10 11 12 means the spot rates for the 1, 2, and, 3 years are 10 (%), 11 (%), and 12 (%), respectively. (5) Please print one line for each period of the binomial interest rate tree. So the output of the first line is 10, the second line is 14.32 9.79, the third line is 19.42 13.77 9.76, etc. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using the CEIBA system (CSIE 7134) before 08:00 AM of June 17, 2022. No late submissions will be accepted. Compress your files into a single file and name it StudentID_HW_4 for easy reference. Example: R91922054_HW_4. If Python is not your programming language, please demonstrate your code to 盧與明 during the office hour or make an appointment with him to do so. (You still have to submit the files before the deadline, however.)

Enrollments