The Claude Quant PlaybookDownload ebookDownload ebook

Uniform distribution

beginnerDistributions5 of 11

Every value between a and b is equally likely. The chance of landing in a window is just the window's width as a share of the whole range.

Build a trading system with Claude.Download ebook

01The formula

the density: height of the curve at x
the lowest and highest possible values
the ends of the window you ask about, inside [a, b]
the random value, such as the time an order arrives

02See it move

03Where it is used

04Why traders use it

It is the starting point for simulation: every random number generator produces uniform draws first. It also shows the basic idea of a density: probability is area.

05Worked example

An order arrives at a random moment between 0.0 and 10.0 seconds. The chance it lands between 2.0 and 5.0 seconds is 30.0%. The density is 0.100, the mean 5.00 and the standard deviation 2.89.

06How it is built

  1. A flat density over must have total area 1, so its height is .
  2. The chance of a window is its area: width times height .
  3. By symmetry the mean is the midpoint .
  4. Integrating over the range gives the variance .

07The common mistake

Reading the density as a probability. When is less than 1 the density is above 1; only areas under it are probabilities.

08In Python and LaTeX

from scipy.stats import uniform
a, b = 0, 10
X = uniform(loc=a, scale=b - a)
print(X.cdf(5) - X.cdf(2), X.mean(), round(X.std(), 4))
f(x) = \frac{1}{b - a} \ \text{for } a \le x \le b, \qquad P(c < X < d) = \frac{d - c}{b - a}

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.