This is my first study note on quantitative trading.
Recently, I had the Hermes Agent set up a quantitative trading wiki using llm-wiki, and fed two articles from @MrRyanChi into it.
#Law of Large Numbers Experiment
Simulating a 10,000 coin toss experiment in Python yields the following result:

In the plot above, the vertical axis represents cumulative proportion—the probability of landing heads across the first tosses.
This illustrates the core intuition behind the Law of Large Numbers: when is small (for instance, only 30% heads in the first 10 tosses), the sample mean fluctuates wildly. As increases, the curve tightens as though held by an invisible leash (), eventually converging almost perfectly.
The lower subplot plots the deviation: .
It shows the rate at which deviation decays. The red dashed lines mark the theoretical boundaries—the Central Limit Theorem tells us that roughly 95% of deviations fall within this envelope. As we can see, most of the blue fluctuations stay neatly confined within the red lines, and the bounds contract rapidly.
The connection to prediction markets like Polymarket is direct: when a market only has a handful of trades, prices can be pushed to absurd extremes by a few orders. But as trading volume climbs, market prices converge toward their true probabilities. A market maker’s edge stems precisely from providing liquidity when is small and volatility is high.
#Bayes’ Theorem
Formula interpretation: Given that event has occurred, the conditional probability of equals the prior probability of , multiplied by the likelihood of occurring assuming happens, divided by the marginal probability of itself.
This is not a static formula; it describes how to update the probability of after observing that has occurred. In engineering terms, it answers this question: How do we continuously update our beliefs under incomplete information and imperfect evidence?
#How Is This Useful in Quantitative Trading?
Translated into a trading context:
- Prior : Your assessment of market regime before looking at today’s market action (e.g., a 60% chance of a bull market).
- Likelihood : The probability of observing current market signals if the market is indeed in that regime.
- Posterior : Your updated assessment after synthesizing today’s incoming data.
Put more intuitively:
- You hold an initial belief (e.g., “I think there is a 50% probability this event happens”).
- Suddenly, new evidence arrives (e.g., breaking bullish news).
- You ask yourself two questions: If this event will indeed occur, how likely was this news? If this event won’t occur at all, how likely was this news?
- Based on the answers, you calibrate your prior belief (e.g., revising upwards from 50% to 58%).
#A Real-World Example on Polymarket
#The Kelly Criterion
Where is the optimal fraction of capital to wager, is the win probability, is the odds (payout multiple), and is the loss probability.
The Kelly Criterion answers a fundamental question: In a positive-expectation wager, what proportion of your bankroll should you bet each time to maximize long-term wealth growth?
It identifies the exact mathematical balance between maximizing expected payoff and controlling the risk of ruin.
Let’s derive it step by step:
#Setup
Assume your starting capital is , and you wager a fraction on each round (i.e., staking ).
Each round:
- With probability , you win, and your wealth becomes
- With probability , you lose, and your wealth becomes
Here is the payout ratio (net gain of dollars for every dollar staked upon winning).
#Step 1: Wealth After n Wagers
After betting times, assuming wins and losses:
This is a multiplicative process—each outcome scales your previous bankroll by a factor.
#Step 2: Why Not Simply Maximize Expected Value?
Intuitively, you might want to maximize . Let’s calculate:
Taking the derivative with respect to and setting it to zero reveals that whenever (a positive expectation game), you should choose —in other words, go all-in.
Yet going all-in is catastrophic: a single loss wipes out the entire bankroll to zero, from which recovery is impossible. Expected value is heavily inflated by rare paths where you win every round, masking the guarantee of eventual ruin.
Expected value maximization fails because it overlooks the multiplicative compounding structure of wealth growth.
#Step 3: Shift Objective—Maximize Long-Term Growth Rate
Take the logarithm of :
The average growth rate per round (logarithmic growth rate) over bets is:
As , by the Law of Large Numbers:
Thus, the long-term growth rate converges to:
This is the true objective function we need to maximize.
#Step 4: Differentiate with Respect to f
Differentiating with respect to :
Setting yields:
#Step 5: Verify That This Is a Maximum
Compute the second derivative of :
Since both terms are negative, always holds. The function is strictly concave, confirming that is indeed a global maximum.
#Step 6: Adapting to Polymarket’s Binary Structure
On Polymarket, you buy shares at market price , and if the event materializes, each share pays . Therefore:
- If you win, net profit is , giving odds
- If you lose, you lose , meaning units correspond to a loss proportion of
Substituting into , with :
Simplifying:
Your posterior probability minus market pricing, divided by the downside margin. The larger your edge, the heavier the position; with zero edge (), your allocation is zero.
The Kelly Criterion provides a rigorous mathematical framework for sizing positions, turning position management into a computable optimization problem.
#Practical Implications in Quantitative Trading
- Fractional Kelly in Practice
In live trading, practitioners overwhelmingly prefer Fractional Kelly (such as Half-Kelly). Full Kelly creates substantial psychological stress during inevitable drawdowns; while mathematically optimal, it is hyper-sensitive to estimation errors in . Sacrificing a slice of peak theoretical growth rate in exchange for a much smoother equity curve is a tradeoff most funds gladly make.
- Bridging with Bayesian Updating
The Kelly formula requires —your estimate of the event probability. Where does come from? It is supplied directly by the posterior probability from Bayesian updating. The two paradigms fit together naturally: Bayes estimates the probability; Kelly sizes the position.
