Skip to content
Exchange

The take-home gym

1 file4 KB

A look inside

The first lines of options-gym.zip. The whole file is in your library once you get it.

# ABOUTME: Options from zero, the take-home gym: payoff, breakeven, value split, spread and delta drills on simulated prices.
# ABOUTME: Standard library only. Fictional tickers, a pricing model at zero rates; never market data and never a trade idea.
"""Practise options arithmetic in the terminal.

    python options_gym.py            # eight mixed questions
    python options_gym.py payoff 5   # five payoff questions
    python options_gym.py --seed 7   # the same set every time

Every price here is made up by a model. Nothing suggests what to buy or sell.
"""
from __future__ import annotations

import argparse
import math
import random
from dataclasses import dataclass
from typing import Callable

MULTIPLIER = 100  # shares per standard US equity contract (course convention; check OCC specs)
TICKERS = ["ACME", "KETTLE", "LUMEN", "FERNLEAF", "TIDEWAY", "HALCYON", "MARIGOLD"]


def ncdf(x: float) -> float:
    """Standard normal cumulative distribution."""
…and 175 more lines.

What is inside

  • options-gym.zip4 KB

How to use it

Payoff, breakeven, value split, spread and delta drills in the terminal, on simulated prices for made-up tickers. Nothing here is market data, and nothing suggests what to buy or sell.

Needs Python 3.9 or later and nothing else. Run python options_gym.py for eight mixed questions, or python options_gym.py spread 5 for five spread questions. It counts 100 shares per contract, the usual size for a US equity option.

Run before it was listed

Tested 2026-11-27: pytest: 19 passed.