Writing

Notes on things I'm building or trying to understand. Mostly ML, finance and Python.

2026

  1. What I learned market-making ~$1M of Polymarket sports bets

    Thirteen months of running a small market-making bot on Polymarket sports markets: where the profit came from, what changed, and why I paused it.

    market-makingpolymarketprediction-markets

  2. Building a Parquet-backed data API, end to end

    An HTTP API over a single Parquet file: polars scan_parquet per request, tests that never touch the real data, and a Railway deploy. Plus a follow-up to my last post, where the page cache that makes local reads fast turns out to be billed as memory.

    railwaypolarsfastapiparquetdev

  3. Digging Into Factor Modelling via Alternative Data

    A start-to-finish tour of multi-factor modelling

    financefactor-models

  4. How to Add Login and a Paywall to a Streamlit App

    Using Stripe + Streamlit for a simple paywalled application

    streamlitstripedev

  5. Why Reading Parquet from S3 Is Slow (Even In-Network) and What I Did Instead

    S3 in-network reads still have a ~300ms latency floor. Downloading parquet files to ephemeral disk at startup gave me local-disk speeds (~3ms) for free on Railway.

    railwaypolarss3prediction-marketsdev

  6. Optimising Query Transformations for Retrieval: A Negative Result

    Could some form of derivative-free optimisation help with transforming retrieval queries for better RAG?

    pydantic-aipydanticvalidationllmai

2025

  1. Integrating Pydantic AI with Streamlit: Async Challenges and Fragment Optimisations

    Trying to use Streamlit's nice chat UI with Pydantic AI

    pydantic-aistreamlitllmaidev

  2. Pydantic AI Output Validators: Runtime Validation with Dependencies

    Using Pydantic AI's output validators for runtime validation that depends on context, with automatic retry handling when validation fails.

    pydantic-aipydanticvalidationllmai

  3. Building a Caching System with FastHTML

    Enable high performance dashboards/APIs by caching precomputed recent data.

    fasthtmldev

  4. Stock Embeddings - Learning Distributed Representations for Financial Assets

    Identifying meaningful relationships between the price movements of financial assets is a challenging but important problem in finance. While recent machine learning research often focuses on price forecasting, modeling asset correlations has lagged. Inspired by successes in natural language processing (NLP), we propose a neural model for training stock embeddings. This model uses historical returns data to learn nuanced relationships between financial assets. We describe our approach, discuss its potential applications, and present evaluation results demonstrating its utility in real-world financial analytics tasks compared to benchmarks.

    machine-learningfinanceembeddingsnlpresearch

  5. Triggering Multiple Routes from a Single Form - FastHTML & HTMX

    Using hx-trigger and hx-include to improve page load times etc.

    fasthtmlhtmxdev

2020

  1. LSTM Networks | A Detailed Explanation

    A Comprehensive Introduction to LSTMs. >100k views on Medium. Migrating to here after Toward Data Science moved away from Medium.

    machine-learninglstmresearch