Blog

Singapore Kaggle Master

Dr William Wu Chengyuan is ranked among the Top 5 Kaggle competitors based in Singapore.

On Kaggle, competitors are ranked globally based on their performance in machine learning competitions. Rankings are determined by medal placements, leaderboard positions, and overall competition points.

โšก Kaggle competitions typically involve:

  • End-to-end model development
  • Feature engineering
  • Cross-validation strategies
  • Ensemble methods
  • Efficient experimentation leveraging state-of-the-art algorithms

๐Ÿ‘ค Profile Highlights:

  • Rank: Kaggle Master ๐ŸŽ–๏ธ
  • Category: Competitions ๐Ÿ’ป
  • National Ranking: Top 5 in Singapore ๐Ÿ‡ธ๐Ÿ‡ฌ
  • Peak Global Ranking: 93rd out of 200,000+ competitors (Top 0.1%) ๐ŸŒ
  • Focus Areas: Large Language Models (LLMs) ๐Ÿค–, Machine Learning ๐Ÿ“ˆ, and Deep Learning ๐Ÿง 

๐Ÿ† Kaggle Gold Medals:

Dr William Wu works in artificial intelligence and machine learning, with practical experience in building predictive models and optimizing performance under real-world constraints.

๐Ÿ”— LinkedIn: https://www.linkedin.com/in/wu-chengyuan/

๐Ÿ”— Kaggle: https://www.kaggle.com/williamwu88

Black-Scholes-Merton Derivation (Part 3: Equating Portfolio Value & Option Value Evolutions)

This is a continuation ofย Black-Scholes-Merton Derivation (Part 2: Option Value Evolution).

A hedging portfolio starts with initial capital X(0) and invests in the stock and money market account so that the portfolio value X(t) at each time t\in [0,T] is equal to c(t,S(t)). This is equivalent to the condition that e^{-rt}X(t)=e^{-rt}c(t,S(t)) for all t.

One way to impose this equality is to ensure that

\displaystyle d(e^{-rt}X(t))=d(e^{-rt}c(t,S(t))) for all t\in [0,T) and X(0)=c(0,S(0)).

Comparing the expressions d(e^{-rt}X(t)) and d(e^{-rt}c(t,S(t))) calculated previously in Part 1 and Part 2 respectively, we see that we require the following to hold:

\displaystyle\begin{aligned}&\Delta(t)(\alpha-r)S(t)\, dt+\Delta(t)\sigma S(t)\, dW(t)\\&=\left[-rc(t,S(t))+c_t(t,S(t))+\alpha S(t)c_x(t,S(t))+\frac{1}{2}\sigma^2 S^2(t)c_{xx}(t,S(t))\right]\, dt\\&\quad+\sigma S(t)c_x(t,S(t))\, dW(t)\end{aligned}

 

Comparing the dW(t) terms, we get \Delta(t)=c_x(t,S(t)). This is known as the delta-hedging rule.

Next, comparing the dt terms, we have

\displaystyle\begin{aligned}&(\alpha-r)S(t)c_x(t,S(t))\\&=-rc(t,S(t))+c_t(t,S(t))+\alpha S(t)c_x(t,S(t))+\frac{1}{2}\sigma^2 S^2(t)c_{xx}(t,S(t))\end{aligned}

 

Simplifying and rearranging, we get \displaystyle rc(t,S(t))=c_t(t,S(t))+rS(t)c_x(t,S(t))+\frac{1}{2}\sigma^2S^2(t)c_{xx}(t,S(t))

Let x=S(t), then we have derived the Black-Scholes-Merton partial differential equation:

\boxed{\displaystyle c_t(t,x)+rxc_x(t,x)+\frac{1}{2}\sigma^2x^2 c_{xx}(t,x)=rc(t,x)} for all t\in [0,T), x\geq 0.

 

The terminal condition to be satisfied is c(T,x)=(x-K)^+, where K is the strike price of the call option.

Reference

Shreve, Steven E. Stochastic calculus for finance II: Continuous-time models. Vol. 11. New York: Springer, 2004.

Black-Scholes-Merton Derivation (Part 2: Option Value Evolution)

This is a continuation ofย Black-Scholes-Merton Derivation (Part 1: Portfolio Value Evolution).

Let c(t,x) denote the value of a European call option at time t, where x=S(t) is the stock price at that time.

According to the Ito-Doeblin formula, the differential of c(t,S(t)) is

\displaystyle\begin{aligned}dc(t,S(t))&=c_t(t,S(t))\, dt+c_x(t,S(t))\, dS(t)+\frac{1}{2}c_{xx}(t,S(t))\, dS(t)\, dS(t)\\&=c_t(t,S(t))\, dt+c_x(t,S(t))(\alpha S(t)\, dt+\sigma S(t)\, dW(t))+\frac{1}{2}c_{xx}(t,S(t))\sigma^2 S^2(t)\, dt\\&=\left[ c_t(t,S(t))+\alpha S(t) c_x(t,S(t))+\frac{1}{2}\sigma^2 S^2(t)c_{xx}(t,S(t))\right]\, dt\\&\quad+\sigma S(t)c_x(t,S(t))\, dW(t)\end{aligned}

 

The second equality uses the definition of the stock modeled by geometric Brownian motion dS(t)=\alpha S(t)\, dt+\sigma S(t)\, dW(t), as well as the identities dW(t)\, dW(t)=dt, dt\, dW(t)=dW(t)\, dt=0, and dt\, dt=0.

Next, we compute the differential of the discounted option price e^{-rt}c(t,S(t)). Let f(t,x)=e^{-rt}x. According to the Ito-Doeblin formula, we have

\displaystyle\begin{aligned}d(e^{-rt}c(t,S(t)))&=df(t,c(t,S(t)))\\&=f_t(t,c(t,S(t)))\, dt+f_x(t,c(t,S(t)))\, dc(t,S(t))\\&\quad+\frac{1}{2}f_{xx}(t,c(t,S(t)))\, dc(t,S(t))\, dc(t,S(t))\\&=-re^{-rt}c(t,S(t))\,dt+e^{-rt}\, dc(t,S(t))\\&=e^{-rt}[-rc(t,S(t))+c_t(t,S(t))+\alpha S(t)c_x(t,S(t))\\&\quad+\frac{1}{2}\sigma^2S^2(t)c_{xx}(t,S(t))]\, dt+e^{-rt}\sigma S(t)c_x(t,S(t))\, dW(t).\end{aligned}

 

The third equality is due to f_t(t,x)=-re^{-rt}x, f_x(t,x)=e^{-rt}, and f_{xx}(t,x)=0.

Reference

Shreve, Steven E. Stochastic calculus for finance II: Continuous-time models. Vol. 11. New York: Springer, 2004.

Black-Scholes-Merton Derivation (Part 1: Portfolio Value Evolution)

First, we define the following variables.

X(t): The value of the portfolio at time t. The portfolio invests in a money market account paying a constant interest rate r and in a stock modeled by geometric Brownian motion

dS(t)=\alpha S(t)\, dt+\sigma S(t)\, dW(t).

\Delta(t): At time t, the portfolio holds \Delta(t) shares of stock.

The remainder of the portfolio value X(t)-\Delta(t)S(t) is invested in the money market account.

The differential dX(t) is due to two factors, the capital gain \Delta(t)\, dS(t) on the stock position and the interest earnings r(X(t)-\Delta(t)S(t))\, dt on the cash position.

Mathematically, we have

\begin{aligned} dX(t)&=\Delta(t)\, dS(t)+r(X(t)-\Delta(t)\, S(t))\, dt\\&=\Delta(t)(\alpha S(t)\, dt+\sigma S(t)\, dW(t))+r(X(t)-\Delta (t)S(t))\, dt\\&=rX(t)\, dt+\Delta(t)(\alpha-r)S(t)\, dt+\Delta(t)\sigma S(t)\, dW(t).\end{aligned}

 

The interpretation of the three terms in the last line above is as follows:

rX(t)\, dt: reflects an average underlying rate of return r on the portfolio

\Delta(t)(\alpha-r)S(t)\, dt: reflects a risk premium \alpha-r for investing in the stock

\Delta(t)\sigma S(t)\, dW(t): a volatility term proportional to the size of the stock investment

Next, we consider the discounted stock price e^{-rt}S(t) and the discounted portfolio value e^{-rt}X(t). We let f(t,x)=e^{-rt}x, and apply the Ito-Doeblin formula (for an Ito process) to get the following.

Differential of the discounted stock price:

\begin{aligned}d(e^{-rt}S(t))&=df(t,S(t))\\&=f_t(t,S(t))\, dt+f_x(t,S(t))\, dS(t)+\frac{1}{2}f_{xx}(t,S(t))\, dS(t)\, dS(t)\\&=-re^{-rt}S(t)\, dt+e^{-rt}\, dS(t)+0\\&=-re^{-rt}S(t)\, dt+e^{-rt}[\alpha S(t)\, dt+\sigma S(t)\, dW(t)]\\&=(\alpha-r)e^{-rt}S(t)\, dt+\sigma e^{-rt}S(t)\, dW(t)\end{aligned}

 

Differential of the discounted portfolio value:

\begin{aligned}d(e^{-rt}X(t))&=df(t,X(t))\\&=f_t(t,X(t))\, dt+f_x(t,X(t))\, dX(t)+\frac{1}{2}f_{xx}(t,X(t))\, dX(t)\, dX(t)\\&=-re^{-rt}X(t)\, dt+e^{-rt}\, dX(t)+0\\&=-re^{-rt}X(t)\, dt+e^{-rt}[rX(t)\, dt+\Delta(t)(\alpha-r)S(t)\, dt+\Delta(t)\sigma S(t)\, dW(t)]\\&=\Delta(t)(\alpha-r)e^{-rt}S(t)\, dt+\Delta(t)\sigma e^{-rt}S(t)\, dW(t)\\&=\Delta(t)\, d(e^{-rt}S(t))\end{aligned}

 

The last line shows that change in the discounted portfolio value is solely due to change in the discounted stock price (note that the term reflecting underlying rate of return r has vanished in the second-last line).

Reference

Shreve, Steven E. Stochastic calculus for finance II: Continuous-time models. Vol. 11. New York: Springer, 2004.

Ito-Doeblin Formula

The Ito-Doeblin Formula is an important formula in stochastic calculus, analogous to the chain rule in ordinary calculus. It has many applications in finance, including the derivation of the Black-Scholes-Merton equation.

Let f(x) be a differentiable function and W(t) be a Brownian motion.

The Ito-Doeblin formula in differential form is:

\displaystyle\boxed{df(W(t))=f'(W(t))\, dW(t)+\frac{1}{2}f''(W(t))\, dt}

 

The main difference (compared to ordinary calculus) is that there is an extra term due to the fact that W has nonzero quadratic variation.

Integrating this expression, we get the Ito-Doeblin formula in integral form:

\displaystyle\boxed{f(W(t))-f(W(0))=\int_0^t f'(W(u))\, dW(u)+\frac{1}{2}\int_0^t f''(W(u))\, du}

 

There is also a slightly more generalized version that allows f to be a function of both t and x.

Ito-Doeblin Formula for Brownian Motion

Let f(t,x) be a function where the partial derivatives f_t(t,x), f_x(t,x), and f_{xx}(t,x) are continuous, and let W(t) be a Brownian motion. Then, for all T\geq 0,

\displaystyle\boxed{\begin{aligned}f(T,W(T))=&f(0,W(0))+\int_0^T f_t(t,W(t))\, dt\\&+\int_0^T f_x(t,W(t))\, dW(t)+\frac{1}{2}\int_0^T f_{xx}(t,W(t))\, dt\end{aligned}}

 

The Ito-Doeblin formula in differential form is:

\displaystyle\boxed{df(t,W(t))=f_t(t,W(t))\, dt+f_x(t,W(t))\, dW(t)+\frac{1}{2}f_{xx}(t,W(t))\, dt}

Reference

Shreve, Steven E. Stochastic calculus for finance II: Continuous-time models. Vol. 11. New York: Springer, 2004.

Algebraic Topology in Finance

Compiled a list of papers applying (algebraic) topology to finance at: https://blog.nus.edu.sg/wuchengyuan/topology-in-finance/

Interestingly, topology seems best at detecting financial crashes, but can also predict stock price movement, do clustering and classification of financial time series, and more.

This 3 minute video explains very well how algebraic topology (in particular persistent homology) can be applied to finance:

Mathematics Genealogy

Mathematics Genealogy is an interesting website where one can trace the academic genealogy of a researcher (in the field of math/applied math), all the way to mathematicians of previous centuries.

Personal Mathematical Genealogy

  1. Friedrich Leibniz (Father of Gottfried Leibniz who was the co-inventor of calculus)
  2. Jakob Thomasius
  3. Otto Mencke
  4. Johann Christoph Wichmannshausen
  5. Christian August Hausen
  6. Abraham Gotthelf Kรคstner
  7. Johann Tobias Mayer
  8. Enno Heeren Dirksen
  9. Karl Gustav Jacob Jacobi
  10. Wilhelm Scheibner
  11. William Edward Story
  12. Solomon Lefschetz
  13. Norman Steenrod
  14. George W. Whitehead
  15. John Moore
  16. Peter May
  17. Frederick Cohen
  18. Jie Wu (PhD Supervisor)
  19. Chengyuan Wu

Website Links

  • Kaggle (Free GPU usage for deep learning; slightly more user-friendly than Google Colab)
  • Applied Algebraic Topology Research Network (Organized by University of Minnesota; there are frequent online talks on the subject of applied algebraic topology)
  • Math Genealogy (Mathematicians can trace their mathematical ancestry on this website)
  • Papers With Code (Automatically generated collection of papers with code; sometimes there are errors in the automatic generation)
  • DeepAI (Research, guides, news portal in the field of artificial intelligence)

Website Links

WordPress Homepage (https://wcymath.wordpress.com/)

  1. Frontiers Loop (Research Network)
  2. Kaggle (Useful for Datasets and GPU)
  3. ResearchGate (Research Network)
  4. ScholarBank (NUS institutional repository)
  5. GitHub (Code hosting platform)
  6. NUSMods (NUS academic timetable planner)
  7. Math Genealogy (Math academic genealogy)
  8. Publons (Track peer review and editorial contributions)
  9. Microsoft Academic (Web search engine for academic literature)
  10. ORCID (Open Researcher Contributor Identification Initiative)
  11. Scopus (Abstract and citation database)
  12. Google Sites (Structured wiki- and web page-creation tool)