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
- References
- F. J. Fabozzi,
Fixed Income Mathematics: Analytical & Statistical Techniques. 4th ed. McGraw-Hill, 2006.
- F. J. Fabozzi and Steven V. Mann (Ed.),
The Handbook of Fixed Income Securities. 8th ed.
Irwin, 2012.
-
J. C. Hull,
Options, Futures, and Other Derivatives. 9th ed. Prentice-Hall, 2014.
- R. Jarrow
and S. Turnbull,
Derivative Securities.
2nd ed.
South-Western, 1999.
- S. N. Neftci, Principles of Financial Engineering. 2nd ed.
Academic Press, 2008.
- P.
Ritchken,
Derivative Markets: Theory, Strategy, and Applications.
HarperCollins, 1996.
- S. M. Sundaresan,
Fixed Income Markets and Their Derivatives. 3rd ed.
Academic Press, 2009.
- Articles
-
The Financial Modelers' Manifesto
-
Goldman Sachs Is a Tech Company (April 12, 2015)
-
The Medallion Fund, an Employees-Only Offering for the Quants at Renaissance Technologies, Is the Blackest Box in all of Finance (November 21, 2016)
-
The Most In-demand Programming Languages on Wall Street (January 28, 2015)
-
The Top Ten Technology Skills at BAML, Barclays, Credit Suisse, Citi, Goldman Sachs, JPMorgan, Morgan Stanley and UBS (April 16, 2015)
- Internet Resources
- Teaching Assistant(s)
- Software
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.
- Time value of money
- Bonds, mortgages, and annuities
- Duration, convexity, and
immunization
- Yield curve,
forward rate, and spot rate
- Option pricing theory
and its wide-ranging applications
- Black-Scholes analysis
- binomial option pricing model (BOPM)
- Futures,
forwards, and other derivatives
- The combinatorics of random walks
-
Martingale,
Brownian motion,
stochastic calculus, and
Ito integral
- Risk-neutral valuation
- Risk management
- Fixed-income securities with embedded options
and interest rate derivatives
- Mortgage-backed securities (MBS)
- Numerical methods
- Monte Carlo methods
- Variance reduction (efficiency-improving) techniques
- Least-squares technique
- Quasi-Monte Carlo method
- Solving partial differential equations
- Yield curve fitting
- GARCH models
- Interest rate models and
calibration
-
2024.02.23
-
2024.03.01
-
2024.03.08
-
2024.03.15
-
2024.03.22
& 1st assignment due
-
2024.03.29
-
2025.04.05
holiday
-
2024.04.12
-
2024.04.19
& 2nd assignment due
-
2024.04.26
-
2024.05.03
-
2024.05.10
& 3rd assignment due
-
2024.05.17
-
2024.05.24
-
2024.05.31
-
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.
-
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!
The graders will not attempt to sort out who the original coders are because we are not running a court here.
-
Do program carefully.
It is much more important to get the numbers right than to get a
pretty user interface running.
-
Write a program for loan amortization swapping. Consider an n1-year, V-dollar loan at an r1 interest rate. At the end of year n2 (n2 < n1), however, there is an opportunity to swap the loan (i.e., the remaining principal) into a new loan
with an r2 interest rate for the remaining n1-n2 years, of course under a new amortization. An F-dollar fee is charged at the end of year n2 if the loan is swapped. Both loans have the same number of payments per annum, m.
Inputs:
- V: original loan amount in dollars;
- m: number of payments per annum, an integer;
- n1: duration of the original loan in years, an integer;
- r1: annual interest rate of the original loan, compounded m times per annum;
- n2: the year that loan swapping is possible;
- r2: annual interest rate of the new loan, also compounded m times per annum;
- F: swapping fee.
Outputs:
- total principal paid in the first n2 years;
- total interest paid in the first n2 years;
- total interest paid from the end of year n2 (excluded) to the end of year n1 if the loan is not swapped (so the r1 interest rate is maintained);
- total interest paid from the end of year n2 (excluded) to the end of year n1 if the loan is swapped to the new r2 interest rate;
- the IRR for the whole n1 years (the fee F considered) if the loan is swapped;
- does swapping the loan lower the IRR? Answer 1 for yes, 0 for no difference, and -1 for no.
For example, if V = 1000000, m = 12, n1 = 2, r1 = 0.060, n2 = 1, r2 = 0.025, F = 888,
the outputs are 485041.840313, 46805.482720, 16889.163346, 6999.998244, 0.051895, 1.
Input format (for Python codes): "python3 F08922011_HW_1.py 1000000 12 2 0.060 1 0.025 888". Output format: "485041.840313, 46805.482720, 16889.163346, 6999.998244, 0.051895, 1".
Please send your source (and executable) code and a brief explanation txt file (if the code is not written in Python, describe how to run it) using NTU COOL before 08:00 AM of March 22, 2024. No late submissions will be accepted. Compress all files into a single zip file, and name it ID_HW_i.zip, where ID is your student ID in uppercase and i is the number of the homework (example: F08922011_HW_1.zip). If the code is not written in Python, you may be asked to demonstrate your code to TA 許家豪 and you still have to submit the files before the deadline.
-
Write a binomial tree program to price Bermudan put options, where early exercise is only allowed on specific dates.
Inputs:
- S: stock price;
- X: strike price;
- r: continuously compounded annual interest rate;
- s: annual volatility;
- T: time to maturity in days, which is an integer and also an exercise date;
- m: number of periods per day for the tree, an integer;
- E: early exercise dates from now, a list of integers.
Output:
The price of the Bermudan put option.
For example, if S = 100, X = 110, r = 0.03, s = 0.3, T = 60, m = 5, and E = [10, 20, 30, 40, 50], the output is 11.248139.
Input format (for Python codes, replace your student ID with uppercase): "python3 F08922011_HW_2.py 100 110 0.03 0.3 60 5 10 20 30 40 50". Output format: "11.248657".
Please send your source (and executable) code and a brief explanation txt file (if the code is not written in Python, describe how to run it) using NTU COOL before 08:00 AM (GMT+8) 2024 April 19. No late submissions will be accepted. Compress all files into a single zip file, and name it ID_HW_i.zip, where ID is your student ID in uppercase and i is the number of the homework (example: F08922011_HW_2.zip). If the code is not written in Python, you may be asked to demonstrate your code to TA 許家豪 and you still have to submit the files before the deadline.
-
Write a trinomial tree program to price a up-and-out barrier put. The trinomial tree must match the barrier.
Inputs:
- S: stock price;
- X: strike price;
- r: continuously compounded annual interest rate;
- s: annual volatility;
- T: time to maturity in days, which is an integer, and there are 365 days in a year;
- H: up-and-out barrier;
- n: number of time steps in T, which is an integer.
Output:
The price of the up-and-out barrier put option.
For example, if S = 100, X = 110, r = 0.03, s = 0.3, T = 60, H = 120, and n = 100, the output is 11.089643.
Input Format (for Python codes, replace your student ID with uppercase): "python3 F08922011_HW_3.py 100 110 0.03 0.3 60 120 100". Output Format: "11.089643".
Please send your source (and executable) code and a brief explanation txt file (if the code is not written in Python, describe how to run it) using NTU COOL before 08:00 AM 2024 May 10. No late submissions will be accepted. Compress all files into a single zip file, and name it ID_HW_i.zip, where ID is your student ID in uppercase and i is the number of the homework (example: F08922011_HW_3.zip). If the code is not written in Python, you may be asked to demonstrate your code to TA 許家豪 and you still have to submit the files before the deadline.
-
Write a least-squares Monte Carlo program to price an American-style Asian put, and use 1, x, x2 as the basis functions. Note that the put's payoff, when exercised early, uses the running average. Output its price and delta.
Inputs:
- S: stock price, which is a float;
- X: strike price, which is a float;
- T: time to maturity in days, which is an integer, and there are 365 days in a year;
- r: continuously compounded annual interest rate, which is a float;
- s: annual volatility, which is a float;
- n: number of time steps in T, which is an integer;
- N: number of simulation paths, which is an integer.
Output:
(1) Price of the put;
(2) Delta of the put (caluclated by S × 1.01 and S × 0.99).
For example, if S = 100, X = 100, T = 365, r = 0.05, s = 0.3, n = 100, and N = 10000, the example outputs are 5.483093 and -0.407075. Note that
Input Format (for Python codes, replace your student ID with uppercase): "python3 F08922011_HW_4.py 100 100 365 0.05 0.3 100 10000". Output Format: "5.483093, -0.407075".
Please send your source (and executable) code and a brief explanation txt file (if the code is not written in Python, describe how to run it) using NTU COOL before 08:00 AM 2024 June 7. No late submissions will be accepted. Compress all files into a single zip file, and name it ID_HW_i.zip, where ID is your student ID in uppercase and i is the number of the homework (example: F08922011_HW_4.zip). If the code is not written in Python, you may be asked to demonstrate your code to TA 閮勗振鞊?and you still have to submit the files before the deadline.
Enrollments
-
Non-programmers will be strongly discouraged
as the probability of passing this course is slim,
if possible at all.
-
It is not impossible to pick up programming skills before
the first assignment.
-
Financial knowledge is a plus, but again it can be picked up if you are motivated.