Peyman Kor
  • Peyman Kor
  • Blog
  • Data & AI Portfolio
  • Reinforcement Learning Course
  • Publications
  • Awards

On this page

  • 1 Introduction to Option Pricing
    • 1.1 Example: American Put Option
  • 2 American Option vs European Option
  • 3 American Option Pricing As Sequential Decision Making
  • 4 Reinforcement Learning
    • 4.1 Five Elements of Reinforcement Learning
  • 5 Reinforcement Learning for American Option Pricing
    • 5.1 RL Elements for Option Pricing
    • 5.2 Q-Learning for Option Pricing
    • 5.3 Learning the Optimal Policy
  • 6 Python Implementation
    • 6.1 1. Generating Training Data
    • 6.2 2. Calculate Feature Vectors
    • 6.3 3. Train Q-Learning Model
    • 6.4 4. Generate Test Data
    • 6.5 5. Apply Learned Policy (from step 3) and calculate the option price
  • 7 Comparison with the traditional method (LSMC)
  • 8 Summary and Key Takeaways
    • 8.1 Key Takeaways

American Option Pricing with Reinforcement Learning: A Hands-On Python Tutorial

rl
option
A short hands-on tutorial on option pricing with reinforcement learning
Author

Peyman Kor

Published

July 21, 2025

1 Introduction to Option Pricing

American options are a type of financial derivative that give the holder the right, but not the obligation, to buy or sell an underlying asset at a specified price on or before a certain date. Two main types of American options are:

  • Call Option: Gives the holder the right to buy the underlying asset at the strike price.
  • Put Option: Gives the holder the right to sell the underlying asset at the strike price.

An example of how American option work would be useful.

1.1 Example: American Put Option

Imagine you have a put option on a stock with the following details:

  • Option Type: American Put Option
  • Strike Price (K): $100
  • Underlying Asset Price (x): $95 initially - Day 0
  • Expiration Date: 3 days from now
  • Premium (Initial Price of Option): $5

The above info is all the information you have about the option. However, you do not know how the price of underlying asset (can be simple Apple stock) will change over the next 3 days.

To make example workable, let’s assume the price of the underlying asset will change as follows:

  • Price of Underlying Asset over the next 3 days:

    Day Asset Price (x)
    0 $95
    1 $92
    2 $90
    3 $97

The holder can choose to exercise the option at any time before or on the expiration date.

For example, lets assume the holder of the option exercises the option on day 2. This means the holder can sell the underlying asset for $100 (Strike Price, look up the put option definition) and buy back the stock at $92 (price of the underlying asset on day 2):

The profit of the holder is then:

\[ Profit = (K - x_t) - Premium \]

\[ Profit = (100 - 92) - 5 = 3 \]

The holder can choose to exercise the option at any time before or on the expiration date. However, the question is when is the optimal time to exercise the option? (day 1, or day 2, or day 3?), and of course, you can not know the price of the underlying asset in the future, at day 0.

I think one visualization that can help to understand the option price is the following: