One runnable snippet a week
Short notes from the practical side of finance data work — risk ratios, returns arithmetic, reconciliation, SQL for market data. Every note ships one snippet you can run, and links to a free interactive lesson to practise it.
Subscribe via RSSSharpe vs Sortino in 5 lines of Python
Same mean, same volatility — two different risk-adjusted ratios. Compute Sharpe and Sortino in five lines of NumPy and learn when they disagree.
Read the noteLog returns vs simple returns: which one do you sum?
Up 10% then down 10% is not flat — it is −1%. Three lines of NumPy show why quants sum log returns over time but weight simple returns across assets.
Read the noteMax drawdown in one SQL window query
No Python needed: a running MAX() OVER a date ordering turns any price table into a drawdown series. One CTE, one window function, five worst days.
Read the noteThe anti-join: find the trades your ledger is missing
Reconciliation is 90% of back-office data work. One pandas merge with indicator=True finds missing trades and quantity breaks in a single pass.
Read the note