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

Installation & Wi-Fi

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).

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 preprocessing, visualization, and backtesting

Mathematical tools

Financial time series analysis

Pricing models & calibration

Risk management

Machine learning

Automated execution

Performance issues

Wish list

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

Date Summary
2019.8.7
  • syllabus
  • using jupyter notebook
  • programming basic
    • computation model (CPU and memory)
    • variables and naming
    • simple data types (int, float, str)
    • arithmetic operators (+-*/, //, %, **)
    • first built-in data structure: list with slicing
    • assignment operator (=), rational operators (<, ==, >), logical operators (and/or)
    • selection (if-elif-else)
    • iteration (for-in, while) with jump statements (break, continue, pass)
    • application: Monte Carlo simulation, bisection method for root-finding
2019.8.10
  • programming basic (cont'd)
    • data structures
      • list, tuple, dictionary, and set
      • looping techniques: enumerate, zip, reverse, sorted
      • list/dictionary/tuple/set comprehension
    • functions
      • user-defined function
      • variable scope
      • default arguments
    • functional programming
      • functional programming (map, filter)
      • lambda expressions
      • generator (yield)
    • object-oriented programming
      • class and object: ... in python, everything is an object.
      • user-defined class: attributes and methods
      • magic methods
      • (single) inheritance and method overriding
      • file I/O and with-as
      • try-except-else-finally
      • applications: file i/o, exceptions, datetime
    • misc: scripts, modules, import
2019.8.14
  • using spyder (spyder official website)
  • data processing
    • data acquisition
      • data crawlers (or you can buy financial data from those famous information suppliers)
    • pandas: dataframe
    • data visualization
    • backtesting
      • net present value
      • maximum draw down (MDD)
      • Sharpe ratio
2019.8.17
  • numerical and scientific packages
    • vectorization
    • matrix computation
    • interpolation
    • optimization
    • statistics
    • numerical integration
    • application: modern portfolio theory
2019.8.21
  • financial time series analysis
    • multivariate linear regression: capital asset pricing model (CAPM), Fama-French 3-factor model
    • autoregressive moving-average (ARMA) model
    • generalized autoregressive conditional heteroskedasticity (GARCH) model
    • vector autoregression (VAR) model
    • cointegrated VAR using vector error correction (VEC) model
2019.8.24
  • 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
  • option basics and pricing models
    • valuation framework
    • Monte Carlo simulation
    • binomial option pricing model (BOPM)
    • QuantLib tutorial
2019.8.28
  • model calibration
    • implied volatility
    • CIR model
    • Heston model
2019.8.31
  • risk management
    • value at risk (VaR)
    • dynamic delta hedging
2019.9.4
  • machine learning tutorial
    • LASSO regression and ridge regression
    • logistic regression
    • support vector machine (SVM)
    • decision tree and random forest
    • principal component analysis (PCA)
    • k-mean/clustering
    • reinforcement learning: Q-learning
2019.9.7
  • automated execution (?)
  • performance issues
    • row major vs. column major
    • performance profiling
    • multiprocess/multithreading and Amdahl's law
    • dynamic compiling
  • Sample code

    Gradebook

    References

    Python programming

    Financial markets & asset pricing

    Financial time series analysis & optimization

    Portfolio management

    Program/algorithmic trading

    Machine learning

    Blockchain

    Misc