Python Programming in Finance

Location: TBA, 德田館
Time: 1900 ~ 2200


``In the business world, the rearview mirror is always clearer than the windshield.''
-- Warren Buffett

Instructor Information

Recording Classroom Lectures Policy Recording of classroom lectures is prohibited unless advance written permission is obtained from the class instructor and any guest presenter(s).

Wi-Fi Access

Objectives

This course is an inter-disciplinary course in the fields of computer science, finance, and (a lot of) math:

These techniques are essential both in P & Q quant. Just for the record, this course is not to teach you how to get rich in your life but get rich in knowledge (such that you may get rich in the future).

Prerequisites

Text

Overview

Python crash course

Data acquisition and visualization

Mathematical tools

Modern portfolio theory

Financial time series analysis

Pricing theory

Risk management

Machine learning

Wish list

Schedule [ 298, 300, 305, 310, 312, 319, 321 ]

Date Summary
2019.8.7
  • syllabus
  • coding platform
  • programming basics
    • variables and naming
    • simple data types (float, str, bool)
    • arithmetic operators (+-*/, //, %, **), assignment operator (=), rational operators (<, ==, >), logical operators (and/or)
    • built-in data structures: list, dictionary, tuple
    • selection (if-elif-else)
    • iteration (for-in, while) with jump statements (break, continue, pass)
    • looping techniques: enumerate, zip, reverse, sorted
    • application: Monte Carlo simulation with random number generator, bisection method for root-finding
    • list/dictionary/tuple/set comprehension
2019.8.10
  • programming basics (cont'd)
    • functions
      • user-defined function
      • default arguments
    • functional programming
      • functional programming (map, filter)
      • lambda expressions
      • generator (yield)
    • object-oriented programming
      • class and object
      • applications: file i/o (with-as), exceptions (try-except-else-finally), datetime
  • data acquisition and visualization
    • package: ffn
    • customized data crawlers (or you can buy financial data from those famous information suppliers)
    • high-level data structure: pandas (mainly dataframe)
    • plotting: matplotlib, seaborn, mpl_finance, pygal, bokeh
    • backtesting
      • signal generation: technical analysis
      • performance evaluation: net present value, maximum draw down (MDD), Sharpe ratio
2019.8.17
  • numerical and scientific packages
    • vectorization
    • matrix computation
    • interpolation
    • regression
    • optimization
    • statistics
2019.8.21
  • modern portfolio theory
    • capital asset pricing model (CAPM)
    • Fama-French 3-factor model
    • Black-Litterman model
2019.8.24
  • financial time series analysis
    • autocorrelation
    • autoregressive moving-average (ARMA) model
    • generalized autoregressive conditional heteroskedasticity (GARCH) model
    • vector autoregression (VAR) model
    • cointegrated VAR using vector error correction (VEC) model
    • Granger causality: granger.ipynb
2019.8.28
  • pricing theory
    • valuation framework: fundamental theorem of asset pricing
      • arbitrage-free principle
      • complete market
      • efficient market hypothesis
      • martingale
    • binomial option pricing model (BOPM)
      • Euorpean options
      • American options
    • stochastic processes
      • random walk: geometric Brownian motion
      • square-root and mean-reverting process: CIR model
      • stochastic volatility model: Heston model
      • jump-diffusion process: Merton's model
    • Monte Carlo simulation
    • QuantLib tutorial
    • model calibration
      • implied volatility
      • CIR model
      • Heston model
2019.8.31
  • risk management
    • value at risk (VaR)
    • Sensitivity analysis: Greeks
    • static/dynamic hedging
2019.9.4
  • machine learning tutorial
    • regression with regularization: ridge regression & LASSO regression
    • logistic regression
    • support vector machine (SVM)
2019.9.7
  • machine learning tutorial (cont'd)
    • decision tree and random forest
    • principal component analysis (PCA)
2019.9.11
  • machine learning tutorial (cont'd)
    • k-means clustering
    • reinforcement learning: Q-learning
  • performance issues
    • row major vs. column major
    • performance profiling
    • multiprocessing/multithreading and Amdahl's law
    • dynamic compiling

Sample code

Gradebook

References

Python programming

Finance

Mathematics

Machine learning

Blockchain

Misc