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, 2023, 2024 ]

  1. 2024.02.23
  2. 2024.03.01
  3. 2024.03.08
  4. 2024.03.15
  5. 2024.03.22 & 1st assignment due
  6. 2024.03.29
  7. 2025.04.05 holiday
  8. 2024.04.12
  9. 2024.04.19 & 2nd assignment due
  10. 2024.04.26
  11. 2024.05.03
  12. 2024.05.10 & 3rd assignment due
  13. 2024.05.17
  14. 2024.05.24
  15. 2024.05.31
  16. 2024.06.07 & 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 for repaying a loan. There are two interest rates. Inputs: (1) L (loan amount in dollars), (2) r1 (annual interest rate in percent for the first n1 periods, so 12 instead of 0.12), (3) r2 (annual interest rate in percent for the remaining periods), (4) n1 (number of periods when the interest rate is r1), (5) n (duration of the loan in years), and (6) m (the number of payments per annum). Output: A csv file for the amortization schedule and the total interest paid. The schedule shall have five columns: (1) Time (0, 1, 2, ...), (2) The level payment amount, (3) Interest (the interest part of each payment), (4) Principal (the principal part of each payment), and (5) Remaining principal. For example, if L = 10,000,000, r1 = 8%, r2 = 3%, n1 = 120, n = 20, and m = 12, the example output file is here and the total interest is 8593339.37. 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 NTU COOL before 08:00 AM of March 17, 2023. 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 Bermudan option. The early exercise time points are T/4 and 3T/4 from now, where T is the time to maturity. The payoff function is max(K - S + 1,0). Inputs: (1) S (stock price), (2) K (strike price), (3) r (annual interest rate continuously compounded), (4) s (annual volatility), (5) T (time to maturity in years), (6) n (number of time steps). Output: Option price. For example, suppose that S = 100, K = 100, r = 5 (%), s = 30 (%), and T = 0.5 (years). The option price is about 7.8052 at n = 100 and 7.8015 at n = 200. IMPORTANT NOTES: (1) The interest rate and volatility should be in percent. For example, if the interest rate is 5% and volatility 30%, the inputs are 5 and 30, respectively. (2) No need to make sure the early exercise dates are aligned with time steps of the tree. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using NTU COOL before 08:00 AM of April 14, 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. Write a trinomial tree program to price a down-and-out barrier call. Inputs: (1) S (stock price), (2) K (strike price), (3) r (interest rate), (4) s (annual volatility), (5) T (time to maturity in years), (6) H (barrier), and (7) n (number of time steps). Output: Option price. For example, suppose that S = 95, K = 100, r = 10 (%), s = 25 (%), H = 90, and T = 1. The option price is about 5.9899 at n = 75 and 5.9977 at n = 400. IMPORTANT notes: (1) The interest rate and volatility should be in percent. For example, if the interest rate is 5% and volatility 30%, the inputs are 5 and 30, respectively. (2) The trinomial tree must matches the barrier. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using NTU COOL before 08:00 AM of May 12, 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_3. 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. Implement the Least Square Monte Carlo method to price an American option. Use 1, x, x2, x3 as the basis functions. (1) S (stock price), (2) K (strike price), (3) r (interest rate), (4) s (volatility), (5) T (time to maturity in years), (6) n (number of time steps), (7) N (number of simulation paths). 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. Please send your source code, executable code, and a brief explanation file if necessary (e.g., how to run it?) using NTU COOL before 08:00 AM of June 9, 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.)

Enrollments