This guide explains the equations actually used in WeatherPred. Examples are illustrations, not trading recommendations. Where a model relies on an assumption, that assumption is part of the explanation. The system has not established a profitable strategy or a validated probability of reaching a bankroll target.

Start with contracts and fees, then the forecast distributions, then execution and validation. A probability is a belief about an outcome; an executable price is what an order can actually pay or receive. Every trade calculation needs both. The final worked example connects these steps. The project brief also defines the main modeling and trading terms.

1. Contracts, prices and profit

Let Y{0,1}Y\in\{0,1\} be a YES contract's final payout, p=P(Y=1)p=P(Y=1) its estimated probability, aa the purchase ask and FF the entry fee for one contract. The cost is c=a+Fc=a+F. Holding to settlement gives

Π=Yc,E[Π]=pc.\Pi=Y-c,\qquad E[\Pi]=p-c.

If a later sale receives bid bb' and costs exit fee FF', profit is instead

Πexit=bFaF.\Pi_{\rm exit}=b'-F'-a-F.

These are different strategies. The second can profit from a price movement without waiting for the event to resolve. Both lose money if the spread and fees exceed the available edge.

YES and NO payouts sum to one, but their executable prices do not have to sum to one because bid and ask differ. If bY,aYb_Y,a_Y are YES quotes, the complementary NO ask is 1bY1-b_Y and the NO bid is 1aY1-a_Y. The midpoint m=(bY+aY)/2m=(b_Y+a_Y)/2 is used as a benchmark probability or signal, not a fill price.

Implementation: books.py, quote_screen.py.

2. Fees, precision and a worked trade

The implemented quadratic taker fee model is

Fmodel(q,a)=0.07Mqa(1a),F_{\rm model}(q,a)=0.07\,M\,q\,a(1-a),

where qq is quantity and MM is the applicable fee multiplier. For a maker, the coefficient is either zero or 0.0175, depending on the verified schedule. The code first rounds trade fees upward to six decimal places, aligns cash changes to the supported balance precision, and carries rounding amounts across partial fills with the documented rebate treatment. A separate accumulator belongs to each order. Historical experiments explicitly state their assumed schedule; a current fee formula is not evidence of past fees.

For a single contract on a cent-balance account, buying at $0.40 costs $0.42: the model fee is $0.0168, which yields a two-cent debit after alignment. Selling at $0.60 receives $0.58 after its separate fee. Profit is $0.16, not $0.20. At 0.0001-dollar balance precision the analogous isolated cash changes are −$0.4168 and +$0.5832, giving $0.1664. Partial fills must follow the accumulator, not independently rounded copies of a whole-order fee.

Implementation: fees.py. Primary specification: Kalshi fee rounding.

3. Basket consistency

For KK mutually exclusive, exhaustive brackets, exactly one YES wins:

j=1KYj=1,j=1K(1Yj)=K1.\sum_{j=1}^K Y_j=1,\qquad \sum_{j=1}^K(1-Y_j)=K-1.

Buying one of each YES has conditional net surplus 1jcj1-\sum_j c_j; buying one of each NO has surplus (K1)jcjNO(K-1)-\sum_j c_j^{NO}. For uncertain coverage, the scanner evaluates numeric predicates across boundary points and uses the minimum possible aggregate payout rather than assuming the partition is correct. Integer and continuous settlement domains are checked separately.

Positive displayed surplus would still be conditional: prices can move while the legs are filled, and multi-leg execution is not atomic.

Implementation: contracts.py, basket.py.

4. Probability calibration from market prices

Market-only logistic calibration transforms a quoted probability mm using

z=α+βlogm1m,p^=11+ez.z=\alpha+\beta\log\frac{m}{1-m},\qquad \hat p=\frac{1}{1+e^{-z}}.

Probabilities are clipped to [106,1106][10^{-6},1-10^{-6}] when taking logarithms. The fit minimizes weighted binary negative log likelihood plus a slope penalty:

L=iwi{log(1+ezi)yizi}+λ2β2,λ=1.L=\sum_i w_i\{\log(1+e^{z_i})-y_i z_i\} +\frac{\lambda}{2}\beta^2,\qquad \lambda=1.

The intercept shifts the overall probability level; the slope changes how extreme the probabilities are. This regularizer shrinks the slope toward zero; it differs from the market-centered regularizer in the combination model below. Fits use chronological earlier outcomes, not a random split of contracts.

Implementation: calibration.py.

5. Turning temperature forecasts into bracket probabilities

Let TT denote the temperature before reporting-rounding, with Gaussian distribution TN(μ,σ2)T\sim\mathcal N(\mu,\sigma^2), and let Φ\Phi be the standard-normal cumulative distribution function: the probability mass below a given standardized value. Here μ\mu is the mean and σ\sigma the standard deviation, which describes spread. For an inclusive integer bracket LTpublishedUL\leq T_{\rm published} \leq U, the model's rounding-cell approximation gives

P(LTpublishedU)=Φ ⁣(U+0.5μσ)Φ ⁣(L0.5μσ).P(L\leq T_{\rm published}\leq U)= \Phi\!\left(\frac{U+0.5-\mu}{\sigma}\right)- \Phi\!\left(\frac{L-0.5-\mu}{\sigma}\right).

Thus an integer 77–78°F bracket corresponds to the latent interval [76.5,78.5)[76.5,78.5). Strict greater/less predicates use the corresponding first/last allowed integer. Upper-tail subtraction uses survival functions where possible to avoid numerical cancellation.

Hourly index contracts have a different 0.01°F lattice. A strict threshold kk uses latent boundary (100k+0.5)/100(\lfloor100k\rfloor+0.5)/100. This is a modeling discretization, not permission to substitute one contract's rounding rules for another's.

Implementation: daily_forecasts.py, forecasts.py.

6. Bias correction and empirical errors

For a base forecast fif_i and observed label TiT_i, residuals are ei=Tifie_i=T_i-f_i. The daily model uses weighted bias and variance

eˉw=iwieiW,W=iwi,\bar e_w=\frac{\sum_i w_i e_i}{W},\quad W=\sum_i w_i,

sw2=iwi(eieˉw)2Wiwi2/W.s_w^2=\frac{\sum_i w_i(e_i-\bar e_w)^2} {W-\sum_i w_i^2/W}.

The corrected mean is μ=f+eˉw\mu=f+\bar e_w. Daily Gaussian spread is floored at 0.5°F. Station models estimate these quantities by station; the global version pools stations. Training day weights prevent a day with more station rows from automatically receiving more influence.

The daily empirical model uses samples f+eif+e_i. Its bracket probability adds one unit of Gaussian smoothing mass:

P^(B)=iwi1{f+eiB}+PGaussian(B)W+1.\hat P(B)=\frac{\sum_i w_i\mathbf1\{f+e_i\in B\} +P_{\rm Gaussian}(B)}{W+1}.

The hourly empirical exceedance model instead uses Jeffreys smoothing:

p^=#{f+eiboundary}+0.5n+1.\hat p=\frac{\#\{f+e_i\geq\text{boundary}\}+0.5}{n+1}.

Hourly Gaussian errors use the ordinary sample mean and standard deviation, with a 0.05°F spread floor. Empirical and Gaussian models are alternatives; the implementation does not pretend their uncertainty assumptions are identical.

Implementation: daily_forecasts.py, forecasts.py.

7. Daily mean and spread regression

The regression combines the daily grid maximum gig_i, the native extrema proxy xix_i, the native spread sis_i and station indicators IikI_{ik}:

μi=gi+kθkIik+θd(xigi),\mu_i=g_i+\sum_k\theta_k I_{ik}+\theta_d(x_i-g_i),

vi=σi2=0.25+exp(γ0)+exp(γ1)si2.v_i=\sigma_i^2=0.25+\exp(\gamma_0)+\exp(\gamma_1)s_i^2.

The exponentials keep variance positive; the 0.25 term is a 0.5°F standard- deviation floor. The fit minimizes Gaussian negative log likelihood with an L2 penalty on mean coefficients:

L=12iwi[log(2πvi)+(Tiμi)2vi]+12θ22.L=\frac12\sum_i w_i\left[\log(2\pi v_i)+ \frac{(T_i-\mu_i)^2}{v_i}\right]+\frac12\|\theta\|_2^2.

An analytic gradient is supplied to L-BFGS-B and checked against numerical derivatives in tests. The model's 18-hour extrema proxy is retained as a feature; it is not relabeled as the contract's 24-hour daily maximum.

Implementation: daily_forecasts.py.

8. Hourly persistence, trend and information timing

Persistence uses the latest eligible value: fpersist=Tlastf_{\rm persist}=T_{\rm last}. The trend model fits a least-squares slope to recent points:

β^=i(titˉ)(TiTˉ)i(titˉ)2,ftrend=Tlast+β^(ttargettlast).\hat\beta=\frac{\sum_i(t_i-\bar t)(T_i-\bar T)} {\sum_i(t_i-\bar t)^2},\qquad f_{\rm trend}=T_{\rm last}+\hat\beta(t_{\rm target}-t_{\rm last}).

Time is measured in minutes in this calculation. Residual distributions turn these point forecasts into probabilities. Five- and ten-minute input limits test freshness; they do not give permission to use later-received records.

For every decision tt, a forward feature must satisfy treceivedtt_{\rm received}\leq t. Model initialization, valid time, object modification time, document issue time and our receipt time are separate fields. Retrospective object/document timestamps support explicitly limited historical assumptions, not an assertion of independently observed historical public access.

Implementation: forecasts.py, freshness.py, updated_forecasts.py.

9. Logarithmic forecast combination

For a complete event, let qjq_j be normalized market probabilities and pjp_j weather probabilities. The combined probability is

rj=qjβmax(pj,106)γkqkβmax(pk,106)γ,0β,γ3.r_j=\frac{q_j^{\beta}\max(p_j,10^{-6})^{\gamma}} {\sum_k q_k^{\beta}\max(p_k,10^{-6})^{\gamma}}, \qquad 0\leq\beta,\gamma\leq3.

The sum is one by construction. Parameters minimize categorical negative log likelihood with penalty 12[(β1)2+γ2]\tfrac12[(\beta-1)^2+\gamma^2], favoring the original market distribution (β,γ)=(1,0)(\beta,\gamma)=(1,0). Softmax and log-sum-exp provide numerically stable evaluation. A zero fitted weather weight is a meaningful result, not a failed optimization to hide.

Earlier-month weather fits produce the forecasts used to train the combination stage. This prevents the second stage from learning from artificially good in-sample predictions of its first stage.

Implementation: forecast_pool.py.

10. Momentum, reversal, favorites and longshots

Let the current midpoint be mtm_t and the earlier midpoint be mthm_{t-h}. Define the price move Δh=mtmth\Delta_h=m_t-m_{t-h}. For threshold τ\tau:

Momentum/reversal select the largest absolute eligible move; favorite/longshot rules select the highest midpoint satisfying the threshold. Ticker ordering breaks ties. At most one contract is selected per event and policy. Signal functions reject outcome and future-quote fields.

The entry limit is fixed at the signal-side ask plus scenario slippage, capped at $0.99. At the exact later entry hour, the later ask plus slippage must still fit the limit. Exits use the scheduled later bid less slippage and an exit fee, or the preregistered settlement fallback if there is no valid exit quote. Only endpoint prices are used; candle highs/lows are not assumed tradable.

Implementation: trading_research.py.

11. Preliminary observation bounds and error allowance

Let HtH_t be a preliminary daily high and d{0,1,2}d\in\{0,1,2\} a fixed safety margin. The candidate lower bound on the final high is HtdH_t-d. An inclusive bracket with upper boundary U<HtdU<H_t-d, or a strict-less contract with threshold UHtdU\leq H_t-d, cannot win if the bound holds.

It sometimes does not hold. Training counts a day as a failure when any station's preliminary bound exceeds its final exchange value. For kk failed days in nn observed training days, the one-sided 95% Clopper–Pearson upper failure rate is

u=BetaQuantile(0.95;k+1,nk),p^NO,lower=1u.u=\operatorname{BetaQuantile}(0.95;k+1,n-k),\qquad \hat p_{NO,\rm lower}=1-u.

If every day fails, the lower probability is zero. At least 100 training days are required. With zero failures, the lower probability simplifies to 0.051/n0.05^{1/n}; for n=180n=180 it is approximately 0.983495. Zero observed failures therefore does not imply certainty.

This interval assumes a binomial sampling model; serial weather dependence and conditioning on unusually cheap contracts can invalidate interpreting it as a universal trade-level confidence bound. It is an exploratory conservative feature. A two-degree preliminary/final discrepancy in validation demonstrates the practical issue. No margins were changed after viewing that result.

Implementation: intraday_bounds.py.

12. Taker depth and maker queue mechanics

For a taker with RR contracts remaining, displayed quantity ss_\ell at level \ell and retained-depth fraction ρ\rho, the next hypothetical fill is

q=min{R,100ρs/100},q_\ell=\min\{R,\lfloor100\rho s_\ell\rfloor/100\},

provided the worsened purchase price does not exceed the earlier limit. The simulator walks levels, applies fees to actual partial quantities and cancels the remainder. It obtains the book only after the registered arrival delay, rather than selecting a convenient old snapshot.

For a maker, let AA be queue volume ahead, vv qualifying opposite-side trade volume strictly through the quote, RR remaining quantity and η=0.25\eta=0.25:

A=max(Av,0),e=max(vA,0),qfill=min{R,100ηe/100}.A'=\max(A-v,0),\quad e=\max(v-A,0),\quad q_{\rm fill}=\min\{R,\lfloor100\eta e\rfloor/100\}.

Only deduplicated, eligible, non-block trades count. Touches and cancellations do not advance this queue model. It is deliberately conservative, but is still a model of hypothetical execution rather than actual exchange queue priority. Post-fill quotes at 0/30/60/300 seconds diagnose adverse selection: the risk that getting filled is itself associated with a subsequent unfavorable move.

Implementation: paper.py, execution diagnostics.

13. Fractional Kelly sizing and cash limits

Spend fraction ff of bankroll on a binary contract with total unit cost cc and win probability pp. On a win, bankroll is multiplied by 1+f(1c)/c1+f(1-c)/c; on a loss it is multiplied by 1f1-f. Expected log growth is

g(f)=plog(1+f1cc)+(1p)log(1f).g(f)=p\log\left(1+f\frac{1-c}{c}\right)+(1-p)\log(1-f).

Setting its derivative to zero gives the full-Kelly cost allocation

f=pc1c.f^*=\frac{p-c}{1-c}.

The paper experiment uses quarter Kelly after subtracting a fixed three percentage points from the relevant side's model probability:

p=p0.03,fpaper=0.25max(0,pc1c).p'=p-0.03,\qquad f_{\rm paper}=0.25\max\left(0,\frac{p'-c}{1-c}\right).

That haircut is a heuristic, not a confidence interval. The dollar budget is then bounded by available unreserved cash, Kelly allocation, remaining 5% event exposure and remaining 10% Miami-cluster exposure. The global 25% limit is looser than the single-cluster limit in this experiment. Whole intended quantity is budget/reserved unit cost\lfloor\text{budget}/\text{reserved unit cost}\rfloor; actual partial fills can have hundredth-contract precision.

For illustration, if p=0.65p'=0.65 and total cost c=0.55c=0.55, quarter Kelly allocates about 5.56%; the 5% event cap limits a $100 account to $5 before quantity rounding. This is only useful if the probability estimate is trustworthy.

In the original E009 cohort, position cash is not recycled before exit or settlement. The separate E016 cohort also returns cash through a same-contract offset, as explained below. Open positions use provisional liquidating bid marks without exit fees; closed but unfinalized positions are carried at cost. Consequently reported interim equity and drawdown are limited measures, not a validated liquidation or ruin-risk distribution.

Implementation: paper runner, paper.py.

14. Scores and trading performance

Binary probability forecasts use Brier score and log loss:

Brier=1Ni(p^iyi)2,\operatorname{Brier}=\frac1N\sum_i(\hat p_i-y_i)^2,

LogLoss=1Ni[yilogp^i+(1yi)log(1p^i)].\operatorname{LogLoss}=-\frac1N\sum_i [y_i\log\hat p_i+(1-y_i)\log(1-\hat p_i)].

For continuous distributions, CRPS measures both location and spread:

CRPS(F,y)=EXy12EXX,\operatorname{CRPS}(F,y)=E|X-y|-\tfrac12E|X-X'|,

where X,XX,X' are independent draws from the forecast distribution. Gaussian CRPS has a closed form; the empirical version uses sorted samples to avoid an n×nn\times n pairwise matrix. Coverage measures how often a nominal prediction interval contains the outcome. Better coverage alone need not improve trading.

Trading research tracks net profit, cash, locked capital and daily log growth gd=log(Bd/Bd1)g_d=\log(B_d/B_{d-1}). Realized drawdown is

Dmax=maxd(1BdmaxsdBs).D_{\max}=\max_d\left(1-\frac{B_d}{\max_{s\leq d}B_s}\right).

E013's BdB_d carries unresolved positions at cost. Its drawdown is therefore realized-only and can understate economic drawdown. No Sharpe ratio or target- hit probability is presented as validated performance.

Implementation: calibration.py, forecasts.py, autoresearch runner.

15. Chronological selection and multiple experiments

Contracts from the same weather event are dependent. The research aggregates within events/days and resamples whole day blocks, preserving cross-city and cross-strategy dependence. E013 uses 10,000 shared circular seven-day bootstrap samples over all 1,728 policy/scenario combinations.

For candidate jj, let gˉj\bar g_j be mean daily log growth, gˉj(b)\bar g_j^{*(b)} its mean in bootstrap sample bb, and sjs_j the standard deviation of those bootstrap means. The centered maximum statistic is

M(b)=maxjgˉj(b)gˉjsj.M^{*(b)}=\max_j\frac{\bar g_j^{*(b)}-\bar g_j}{s_j}.

The observed statistic Tj=gˉj/sjT_j=\bar g_j/s_j is compared with this maximum distribution, with finite-sample p-value

pj=1+#{b:M(b)Tj}B+1.p_j=\frac{1+\#\{b:M^{*(b)}\geq T_j\}}{B+1}.

Zero-variance candidates receive p-value one. This is an approximate familywise development diagnostic, relying on bootstrap assumptions; it does not replace final holdout or forward evidence. Earlier experiments separately use Holm's step-down adjustment for their declared families.

The monthly selector uses only returns released before the month starts. It ranks candidates by gˉ2SE\bar g-2\,SE, where SESE is estimated from nonoverlapping seven-day training block sums, requires 30 traded days and positive stressed training growth, and selects cash if none qualify. The two-SE criterion is a selection heuristic, not a corrected confidence bound. Evaluating its subsequent months exposes the cost of choosing strategies from earlier noisy results.

January–June 2025 is training and July–September is repeatedly examined development validation. October–December remains sealed. The global promotion protocol additionally requires substantial untouched and prospective samples, cost/depth stress, parameter robustness and source audits. Tests of code correctness are not evidence that those statistical gates have been met.

Implementation: autoresearch runner, validation protocol.

16. Reproducibility and hash-chain evidence

Each response body has digest Di=SHA256(bodyi)D_i=\operatorname{SHA256}(\text{body}_i). The archive record hash commits to its kind, key, actual availability timestamp, metadata, body digest and previous record hash:

Hi=SHA256(canonicalJSON(kind,key,ti,metadata,Di,Hi1)).H_i=\operatorname{SHA256}(\operatorname{canonicalJSON} (\text{kind},\text{key},t_i,\text{metadata},D_i,H_{i-1})).

SQLite triggers reject record updates/deletes. Replays check the chain and reconstruct selected outputs from original sources. This detects accidental modification; it is not an independently notarized timestamp or protection against an operator rewriting the whole archive. Published evidence identifies the snapshot and local source records; the large raw archive is not bundled in the Git repository.

Implementation: archive.py, raw-quote audit.

17. Paired maker inventory and payout bounds

The later E015 experiment adds an explicit inventory calculation. If a contract has YES quantity qYq_Y, NO quantity qNq_N and total acquisition cost CC, its terminal profit under normal binary settlement is

Π(Y)=qYY+qN(1Y)C.\Pi(Y)=q_Y Y+q_N(1-Y)-C.

Thus the minimum and maximum payouts on already filled positions are min(qY,qN)\min(q_Y,q_N) and max(qY,qN)\max(q_Y,q_N). Within one account, cash KK already includes acquisition costs. Summing over its contracts jj, bounds relative to initial capital W0W_0 are

Πmin=K+jmin(qY,j,qN,j)W0,\Pi_{\min}=K+\sum_j\min(q_{Y,j},q_{N,j})-W_0,

Πmax=K+jmax(qY,j,qN,j)W0.\Pi_{\max}=K+\sum_j\max(q_{Y,j},q_{N,j})-W_0.

These bounds exclude future fills from outstanding orders and assume normal binary settlement. Related contracts may make the individual extremes impossible to reach together, so the bounds can be loose. They are not an expected return. E015 holds the matched cash until settlement as a capital stress assumption; E016 corrects same-contract cash return below. Averaging each leg's cost allows a decomposition into matched-pair profit and unmatched cost at risk, but only their combined result is portfolio profit.

For the inventory-skew benchmark, let I=qYqNI=q_Y-q_N and d=clip(0.01I,0.03,0.03)d=\operatorname{clip}(0.01I,-0.03,0.03). If current own-side bids are bY,bNb_Y,b_N, candidate buy quotes before valid-tick rounding are

pY=min(bY+0.01d,1bN0.01),p_Y=\min(b_Y+0.01-d,1-b_N-0.01),

pN=min(bN+0.01+d,1bY0.01).p_N=\min(b_N+0.01+d,1-b_Y-0.01).

The quotes must leave at least one cent per matched pair after current maker fees. A larger YES inventory lowers the YES bid and raises the NO bid, encouraging rebalancing. The shift is a fixed benchmark inspired by inventory-sensitive market-making literature, not a fitted optimal-control solution or a fair-value estimate. E015 keeps one-contract quotes under the same cash/exposure checks.

Implementation: market_making.py.

18. Same-contract netting and realized round trips

Kalshi offsets opposite positions in the same contract. If both sides have filled, let m=min(qY,qN)m=\min(q_Y,q_N). The cash and quantities become

K=K+m,K'=K+m,

qY=qYm,qN=qNm.q_Y'=q_Y-m,\qquad q_N'=q_N-m.

With each side's total acquisition cost denoted by CY,CNC_Y,C_N, average allocated cost and realized profit of the matched part are

Cm=mCYqY+mCNqN,C_m=\frac{m C_Y}{q_Y}+\frac{m C_N}{q_N},

Πm=mCm.\Pi_m=m-C_m.

This is applied only when both quantities are positive. Matched costs are removed from the remaining positions. A losing offset produces negative realized profit; it is not discarded. Unmatched positions still have outcome risk.

For the same fills, netting does not improve the eventual economic result:

K+min(qY,qN)=K+min(qY,qN),K+\min(q_Y,q_N)=K'+\min(q_Y',q_N'),

and the analogous equality holds for the maximum payout. It moves cash earlier, which may allow new orders. Those extra opportunities need their own future execution evidence; an accounting replay cannot fabricate them.

E016 performs a fill and its offset in a single immutable journal update. Its same-contract rule does not assume optional collateral return across different contracts. Earlier E015 results remain an overcollateralized stress comparator.

Implementation: netted_paper.py, identical-fill replay and future cohort.

19. Worked example: forecast to an order decision

This numerical illustration joins the methods above. It is not an observed trade or a claim that the assumed forecast probabilities are calibrated.

Suppose an earlier fitted weather model gives a final temperature mean of 78°F and standard deviation of 2°F. Consider a contract for a reported integer high of 77–78°F. Under the rounding-cell model,

p=Φ(0.25)Φ(0.75)0.372079.p=\Phi(0.25)-\Phi(-0.75)\approx0.372079.

The model assigns about 37.21% probability to YES. An ask of 30¢ is below that probability, but the gap is not the net edge. For one contract under the illustrated cent-balance taker schedule, the model fee is 0.07(0.30)(0.70)=0.01470.07(0.30)(0.70)=0.0147 dollars, and the isolated cash debit rounds to 32¢.

Step Calculation Meaning
Cost 30¢ ask + 2¢ rounded fee = 32¢ Cash spent if that isolated fill occurs.
Expected settlement profit 37.21¢ − 32¢ = about 5.21¢ An average under the assumed model, not a certain payout.
Probability haircut 37.21% − 3 percentage points = 34.21% The paper rule's fixed allowance for model uncertainty.
Adjusted edge 34.21¢ − 32¢ = about 2.21¢ Still conditional on the model and the fill.
Quarter-Kelly allocation 0.25 × (0.342079 − 0.32) / (1 − 0.32) ≈ 0.00812 About 0.81% of bankroll, or 81¢ for a $100 account, before further limits.

The system then applies available-cash and exposure limits, rounds the intended quantity and fixes the order limit. A later eligible book must support the purchase. If the ask moves above the limit or there is no eligible depth, the unfilled quantity is cancelled. Multiple partial fills use the fee accumulator, so their fees are not computed by simply multiplying this isolated example.

Even if the one-contract purchase fills at 30¢ with a 2¢ fee, its realized settlement result is either +68¢ or −32¢. The expected 5.21¢ is neither of those outcomes. Validation asks whether many independent future decisions support the probability and execution assumptions behind that expectation.

For a maker, there is another distinction. Buying one YES for 42¢ and one NO for 55¢ would lock in 3¢ before any applicable fees if both fill. Receiving only the YES fill leaves 42¢ at risk. The paired-maker experiments track that unmatched risk and the queue evidence required for each side separately.

20. Conditional hourly regression and Student t errors

E018 predicts the remaining temperature change rather than assuming all hours share one residual distribution. For the known target's Miami local hour hh, define θ=2πh/24\theta=2\pi h/24. Features contain the trend forecast minus persistence, plus sin(kθ),cos(kθ)\sin(k\theta),\cos(k\theta) for k=1k=1 or k=1,2k=1,2. The second pair permits a more flexible daily shape. Target time is known at the decision and is not a future observation.

Let ri=Tifpersist,ir_i=T_i-f_{{\rm persist},i}. Training-only means and standard deviations standardize each feature into a row of ZZ. Weights in diagonal matrix WW give each training day equal total influence and are normalized to sum to the number of rows. With weighted mean residual rˉ\bar r, the ridge solution is

A=ZTWZ+λI,A=Z^T WZ+\lambda I,

b=ZTW(rrˉ1),β^=A1b.b=Z^T W(r-\bar r\mathbf1),\qquad\hat\beta=A^{-1}b.

The forecast mean is

μ=fpersist+rˉ+zTβ^.\mu=f_{\rm persist}+\bar r+z^T\hat\beta.

The intercept is unpenalized. The registered penalties are λ{1,10,100}\lambda\in\{1,10,100\}; larger penalties shrink the fitted trend and daily-pattern effects more strongly. Parameters are fitted separately for 30-, 15- and 5-minute horizons.

The error distribution is either Gaussian or a Student t with fixed five degrees of freedom. For the latter,

T=μ+sU,Ut5,T=\mu+sU,\qquad U\sim t_5,

P(T>k)=SFt5 ⁣(bkμs),P(T>k)=\operatorname{SF}_{t_5}\!\left(\frac{b_k-\mu}{s}\right),

where bkb_k is the earlier 0.01°F rounding-cell boundary and SF is the survival function, the probability above a threshold. The t distribution has heavier tails. Its scale ss is not its standard deviation: the latter is s5/3s\sqrt{5/3}. The scale is chosen by minimizing negative log density, with a 0.05°F floor and a 20°F upper search bound for the t case.

There are twelve candidates. Expanding August fits predict the following two days; the candidate with the lowest equal-day average negative log density is selected. This is a probability-density score, distinct from the binary log loss of a YES contract. The mean is then refitted on all twelve August days, and its scale is calibrated using the selected candidate's earlier-fold errors. Those same eight days were used for selection, so their apparent improvement is not an unbiased estimate of future performance. The frozen forward cohort uses new receipts, orders and outcomes to test the result.

Implementation: conditional_forecasts.py, forward runner, model replay.

21. Conditional rain-calendar pairs and unequal fills

Let AA indicate Saturday rain and BB indicate Sunday rain, each taking value zero or one. Under identical normal source and reporting conventions, the weekend indicator is

W=max(A,B)=A+BAB.W=\max(A,B)=A+B-AB.

If Saturday has officially finalized dry and the source still confirms that value, A=0A=0 implies W=BW=B. One Sunday YES plus one weekend NO then pays

B+(1W)=1.B+(1-W)=1.

Let the executable costs including fees be cDc_D and cWc_W. A fully matched one-contract pair has conditional settlement profit

π=1cDcW.\pi=1-c_D-c_W.

At the exploratory 16:30 UTC snapshot, NYC's asks were 0.100.10 for daily YES and 0.810.81 for weekend NO. The fee accumulator produces a total cost of 0.92710.9271, leaving 0.07290.0729 conditional surplus. With quarter depth and two cents extra slippage per leg, total cost is 0.96730.9673 and the surplus is 0.03270.0327. Neither calculation proves that later orders can fill at those prices.

If the two actual fills are unequal, let qD,qWq_D,q_W be their quantities and CC their combined cash cost, including fees. Then

Π(B)=qDB+qW(1B)C,\Pi(B)=q_DB+q_W(1-B)-C,

minBΠ=min(qD,qW)C,maxBΠ=max(qD,qW)C.\min_B\Pi=\min(q_D,q_W)-C,\qquad \max_B\Pi=\max(q_D,q_W)-C.

For example, if only 0.50 daily YES fills at 11 cents and the weekend leg fails, its actual fee-inclusive cash cost is 0.05850.0585. Possible profit is between −$0.0585 and +$0.4415, despite a positive matched-pair price screen. The missing leg is never inserted retrospectively. Different contracts also do not release matched cash through the same-contract netting mechanism.

Source consistency is another condition. If the relation breaks and both held sides lose, the payoff is zero and profit is C-C. For a hypothetical complete one-contract pair with normal payout one and failure payout zero, an assumed failure probability rr would give

E[Π]=1rC.E[\Pi]=1-r-C.

The project has not estimated rr reliably. Two observed weekends cannot establish a rare-failure rate, and exchange review can affect settlement. E019 therefore reports the source-break loss separately. Its fixed one-cent source allowance is a stress deduction, not a measured probability or confidence bound. It requires two cents additional conditional surplus after that deduction, reserves at most 5% of equity per pair and retains the existing aggregate exposure caps.

Implementation: rain_relations.py, prospective pair runner.

22. Position capacity, early exit and geometric growth

E020 measures the cost of increasing a matched rain-pair position. Let C(q)C(q) include both legs' ask depth, slippage and accumulated entry fees for quantity qq. When both legs have enough displayed size, conditional surplus is

S(q)=qC(q).S(q)=q-C(q).

The diagnostic chooses the largest surplus among quantities 1–100 subject to C(q)KC(q)\le K and S(q)/q0.03S(q)/q\ge0.03, where KK is an illustrative cash-cost cap. Costs need not increase linearly: the next contracts may be offered at worse prices. This calculation is a quote screen, not a fill or a recommendation to increase E019's registered limits. Under quarter depth and two cents additional slippage per leg, the September 6 snapshot supports six pairs for $5.8108, leaving $0.1892 conditional surplus. A larger cap does not improve that row.

Selling early requires a separate calculation. If eligible bid slices for the held positions have prices bjb_j and quantities uju_j, then

Vexit=jbjujFsell,Πexit=VexitCentry.V_{\rm exit}=\sum_j b_ju_j-F_{\rm sell},\qquad \Pi_{\rm exit}=V_{\rm exit}-C_{\rm entry}.

The implementation also applies the exit slippage and depth scenario. It reports profit only for a fully quoted exit; quantities without bids remain unfilled. At the observed full-depth bids, the fastest E019 account could receive $2.4384 after exit fees against its $4.5887 cost: a $2.1503 loss if those sales execute. Its conditional $5 normal settlement payout cannot be used as immediate cash.

Now let BB be initial bankroll, with 0<C<q0<C<q and C<BC<B. Suppose the pair pays qq normally and zero on source failure. For an assumed failure probability rr,

E[Π]=(1r)qC,E[\Pi]=(1-r)q-C,

g(r)=(1r)log(B+qCB)+rlog(BCB).g(r)=(1-r)\log\left(\frac{B+q-C}{B}\right) +r\log\left(\frac{B-C}{B}\right).

The second expression is expected logarithmic growth. It penalizes losses more strongly as they consume the bankroll. Define a=log((B+qC)/B)a=\log((B+q-C)/B) and b=log((BC)/B)b=\log((B-C)/B). The break-even failure assumptions are

rarithmetic=1C/q,rgeometric=aab.r_{\rm arithmetic}=1-C/q,\qquad r_{\rm geometric}=\frac{a}{a-b}.

They are sensitivity thresholds, not estimates of the actual failure frequency. For example, B=100,q=100,C=90,r=0.08B=100,q=100,C=90,r=0.08 gives expected profit of 22, but negative expected log growth. Positive average dollars alone can conceal poor compounding. No source-failure estimate or reliable bankroll-target probability is available from the single current weekend.

Implementation: capital and exit functions, execution study.

23. Transformer quantiles and supervised adaptation

E021 uses a pretrained Chronos-2-small transformer through its official library. The project implements data alignment, adaptation and evaluation; it does not claim to have invented or reimplemented the pretrained architecture. A sequence of 512 minute values produces forecasts for the next 40 minutes. Missing values remain masked. The model's median forecast is used for the temperature-error comparison, while its quantiles describe possible outcomes.

A quantile QτQ_\tau is a value below which the model assigns probability τ\tau. For error u=yQτu=y-Q_\tau, the pinball loss is

ρτ(u)=max(τu,(τ1)u).\rho_\tau(u)=\max(\tau u,(\tau-1)u).

Underprediction receives weight τ\tau, and overprediction receives weight 1τ1-\tau. At τ=0.5\tau=0.5, this equals half the absolute error. For nn forecasts and mm quantile levels, the reported score in Fahrenheit is

Lreport=1nmi=1nj=1mρτj(yiQi,τj).L_{\rm report}=\frac{1}{nm}\sum_{i=1}^{n}\sum_{j=1}^{m} \rho_{\tau_j}(y_i-Q_{i,\tau_j}).

The library's training loss uses its internally normalized targets, twice the pinball loss, masks missing targets and known future covariates, averages over the output horizon, sums across quantile levels and averages over the batch. Consequently, its training-log loss is not numerically interchangeable with the evaluation score above. E021 trains all model parameters for 100 AdamW optimizer steps with batch size eight and initial learning rate 10510^{-5}, which follows the library's linear schedule. There is no validation-based checkpoint selection. The short pilot is supervised learning, not RL.

The point-forecast comparisons are

RMSE=1ni(y^iyi)2,MAE=1niy^iyi.\operatorname{RMSE}=\sqrt{\frac1n\sum_i(\hat y_i-y_i)^2},\qquad \operatorname{MAE}=\frac1n\sum_i|\hat y_i-y_i|.

Across the 93 reused development forecasts, fine-tuned RMSE is 0.8010°F versus 0.7504°F for persistence. At the five-minute horizon it is 0.4512°F versus 0.5375°F. These 31 hourly targets span eight days and overlap the earlier model comparison. Neither the lower subgroup error nor an unadjusted resampling interval establishes independent skill after selecting among models/horizons.

Dropout randomly masks model activations during training. The initial evaluation accidentally retained that mode and failed saved-checkpoint replay. Explicit evaluation mode removes that randomness. The corrected scores use the same saved weights and reproduce exactly; no training retry occurred.

For a binary event with true probability qq, expected Brier loss satisfies

E[(pY)2]=q(1p)2+(1q)p2,pE[(pY)2]=2(pq).E[(p-Y)^2]=q(1-p)^2+(1-q)p^2,\qquad \frac{\partial}{\partial p}E[(p-Y)^2]=2(p-q).

This explains why direct supervised probability learning already has a useful optimization target. RL can instead address sequential actions such as posting, cancelling or reducing an order. A proposed execution objective is expected change in log wealth after fees, fills and final inventory outcomes. It remains unimplemented and would require a reliable simulator and new validation days.

Implementation and sources: model study, probe.

24. Consecutive-day states and contract implications

The weekly heat contracts depend on consecutive hot days, not the mean of the whole week. For day dd, let ndn_d be its number of eligible hourly observations and TdhT_{dh} their temperatures. Under the exact contract rounding rule, define

qd=1{nd18,round(1ndhTdh)>90}.q_d=\mathbf1\left\{n_d\ge18,\quad \operatorname{round}\left(\frac{1}{n_d}\sum_hT_{dh}\right)>90\right\}.

The streak ending on a day follows sd=qd(sd1+1)s_d=q_d(s_{d-1}+1) with initial s0=0s_0=0. The longest streak is L=maxdsdL=\max_d s_d, so a contract for at least kk consecutive days pays 1{Lk}\mathbf1\{L\ge k\}. Enumerating unresolved days as both zero and one bounds the possible final result. Earlier source revisions can still change the completed-day inputs; observed data is not an unconditional payout guarantee.

Similarly, a monthly rainfall total is R=At+RremainingR=A_t+R_{\rm remaining}, where AtA_t is accumulated reported rain. When additional amounts are nonnegative and past reports remain valid, At>kA_t>k implies a strictly-greater-than-kk threshold has already been exceeded. Equality alone does not suffice.

More generally, if event AA implies event BB under compatible source rules,

1¬A+1B1.\mathbf1_{\neg A}+\mathbf1_B\ge1.

Examples include a higher rainfall threshold implying a lower one, or major hurricanes being included in a compatible hurricane count. Buying NO(A) and YES(B) has a conditional minimum payout of one dollar per matched pair. Profit still requires both fills and total cost below that payout. The new 541-relation screen finds no positive quoted floor after fees; theoretical relationships do not guarantee a discounted purchase.

Implementation and precise source gates: expanded market study.

25. Integer bankroll sizing and selection before trading

Let CtC_t be available cash, RtR_t cancellable order reservations and PtP_t the purchase principal of held positions. The simulation's bookkeeping equity is

Et=Ct+Rt+Pt.E_t=C_t+R_t+P_t.

Entry fees are expensed immediately. This cost-based value is not a liquidation price. A deliberately conservative alternative assigns zero to every held contract, giving Et0=Ct+RtE_t^{0}=C_t+R_t. Neither convention estimates the missing historical bid prices.

For an order limit aa and a predeclared risk fraction ff, the integer quantity is

qt=max{qZ0:qa+F(q,a)min(Ct,fEt,Levent,Lcluster,Ltotal)}.q_t=\max\left\{q\in\mathbb Z_{\ge0}: qa+F(q,a)\le \min(C_t,fE_t,L_{\rm event},L_{\rm cluster},L_{\rm total})\right\}.

Here each LL is its remaining permitted exposure after held positions and pending orders. The full limit-price debit is reserved before observing the later entry price or depth. Actual fills can reduce quantity, never increase the previously decided quantity. The conditional candle study additionally assumes a fixed 100-contract capacity ceiling; that ceiling is not observed liquidity.

For cent prices and cent account precision, its historical fee assumption is

F(q,a)=100cqa(1a)100,c=0.07.F(q,a)=\frac{\lceil100\,cqa(1-a)\rceil}{100},\qquad c=0.07.

The implementation also handles subcent prices by rounding the aggregate debit against the account, after the model fee is rounded to six decimals. Fees for one qq-contract order generally differ from qq separately rounded one-contract orders. Sale fees are charged again; settlement payouts have no assumed fee. Historical applicability of this fee schedule remains unverified.

Strategy choice uses earlier daily log returns gdj=log(Ed,j/Ed1,j)g_{dj}=\log(E_{d,j}/E_{d-1,j}). Every candidate uses the same dates. A circular seven-day bootstrap resamples all cities and candidates together, preserving their shared weather days. If sjs_j is the bootstrap standard error, compute

Mb=maxjgˉbjgˉjsj,Lj=gˉjQ0.95(M)sj.M_b=\max_j\frac{\bar g_{bj}^{*}-\bar g_j}{s_j},\qquad L_j=\bar g_j-Q_{0.95}(M)\,s_j.

The selector ranks positive LjL_j values from the earlier period, subject to stressed profit, release-day and unresolved-cash gates. Zero-variance candidates cannot establish a positive bound. A 20% decline from the running peak of cost-based equity stops new orders and cancels pending reservations; already held positions continue to their release events. This stop cannot guarantee a 20% liquidation-loss bound when positions overlap or market bids are missing.

This is a within-batch development calculation. It does not erase prior searches, replace the untouched holdout or establish forward profitability. The maximizer within a finite earlier-data search is not an omniscient optimal trading strategy.

Implementation: bankroll account, shared bootstrap, E023 specification.

26. Station residual regression and forecast calibration

E022 predicts an individual station's temperature one, three or six hours after the decision. A 15-minute assumed publication lag limits the final context hour:

tend=tdecision15 minutes1 hour×1 hour. t_{\mathrm{end}}= \left\lfloor\frac{t_{\mathrm{decision}}-15\text{ minutes}}{1\text{ hour}}\right\rfloor \times1\text{ hour}.

At an exact hourly decision this makes the required neural forecast steps two, four and seven. It does not backdate the actual September receipt. A case needs at least 120 finite observations in 168 context hours and a last input no more than two hours old; missing observations remain missing.

The simple regression predicts the residual from the last eligible temperature ylast,iy_{\mathrm{last},i}. Its feature vector includes temperature changes over one, three and 24 hours, the previous day's target-hour value, local-clock harmonics, input age, missing-data indicators and station indicators. Weighted training means and scales produce standardized features ziz_i. The fit solves

minb,βiwi[(yiylast,i)bziβ]2+λβ22,λ{1,10,100}. \min_{b,\beta}\sum_iw_i \left[(y_i-y_{\mathrm{last},i})-b-z_i^\top\beta\right]^2 +\lambda\|\beta\|_2^2, \qquad\lambda\in\{1,10,100\}.

The intercept is unpenalized. Weights are proportional to 1/nd1/n_d, where ndn_d is the number of training cases on day dd, and normalized to sum to the number of cases. Thus each training day has the same total weight. The three penalties are separate registered candidates, all retained in the result table.

For each model, forecast horizon hh and quantile level τ\tau, the separate earlier calibration panel provides an additive correction:

δh,τ=Qτ({yiq^i,τ:iCh}),q~i=sortτ(q^i+δh). \delta_{h,\tau}=Q_\tau\left( \{y_i-\widehat q_{i,\tau}:i\in\mathcal C_h\}\right), \qquad \widetilde{\boldsymbol q}_i= \operatorname{sort}_{\tau}\left( \widehat{\boldsymbol q}_i+\boldsymbol\delta_h\right).

Here QτQ_\tau is the linearly interpolated empirical quantile. Sorting makes the corrected quantiles nondecreasing. Baselines begin with their point forecast repeated at each quantile level; neural candidates supply their own quantiles. Calibration uses July 6–19 only. This empirical correction does not guarantee future or trade-conditional coverage under changing weather conditions.

The primary development score uses raw point forecasts or neural medians, before that quantile correction:

MAE=1Dd=1D1ndidyiy^i,RMSE=1Dd=1D1ndid(yiy^i)2. \operatorname{MAE}=\frac1D\sum_{d=1}^D \frac1{n_d}\sum_{i\in d}|y_i-\widehat y_i|, \qquad \operatorname{RMSE}=\sqrt{\frac1D\sum_{d=1}^D \frac1{n_d}\sum_{i\in d}(y_i-\widehat y_i)^2}.

The same day weighting applies to calibrated quantile loss, coverage and width. There are 6,599 cases but only 28 development UTC days. The fitted transformer has MAE 1.8872°F versus 2.1501°F for the strongest ridge candidate:

11.88720755182.1500931022=12.23%. 1-\frac{1.8872075518}{2.1500931022}=12.23\%.

Its gain over the pretrained checkpoint is only 1.05%. Neither percentage is a trading return or an independent validation result. See the complete study and all eight candidates.

27. Fixed physical and transformer combinations

This forecast experiment asks whether operational physical guidance and learned station patterns supply complementary information. Let nin_i be the original NBH temperature forecast for case ii, cic_i the saved pretrained transformer's point forecast, and qi,τq_{i,\tau} its raw quantile at level τ\tau. Three fixed neural weights define three distinct candidates:

w{0.25,0.50,0.75},y^i(w)=(1w)ni+wci,q^i,τ(w)=(1w)ni+wqi,τ. w\in\{0.25,0.50,0.75\},\qquad \widehat y_i^{(w)}=(1-w)n_i+wc_i,\qquad \widehat q_{i,\tau}^{(w)}=(1-w)n_i+wq_{i,\tau}.

This averages corresponding quantiles. It does not assume a normal distribution for NBH's reported temperature spread, and it is not a mixture of the two forecast distribution functions. The additive calibration and monotonic rearrangement in Section 26 are then estimated separately for each candidate using only July 6–19. No blending weight is fitted or selected from the July 20–August 16 development scores.

Each combination is compared with NBH, pretrained Chronos, adapted Chronos and ridge-100: twelve paired mean-error contrasts. Shared seven-day blocks preserve the same sampled days across all contrasts; a maximum standardized statistic gives a simultaneous descriptive interval. All candidates, missing cases, negative contrasts and interval-width changes must remain visible. Design 124922 precedes the first NBH error score. Implementation registration 129863 acknowledges that the NBH benchmark was known by then; the weights and comparison family remain unchanged. Report 131549 retains all three combinations on the full original case grid. Their mean absolute errors are 1.6608°F, 1.6023°F and 1.6866°F in increasing neural-weight order, versus 1.8345°F for NBH. All twelve descriptive intervals are below zero. The 50/50 candidate has the lowest observed error among these three; it is not selected as a production strategy. These are retrospective station forecasts, not settlement probabilities or validated trading returns. Design, all results.

28. Learning trading returns through a common historical simulator

E032 compares two statistical targets using the same fifteen quote/calendar features, monthly training cutoffs and execution rules. Its feature vector contains market log-odds, spread, one-hour and three-hour price changes, the sum and fraction of currently observable panel quotes, bracket rank, seasonal sine/cosine and six city indicators. Only contracts open at the decision can affect another contract's panel features. Missing quotes are recorded; their prices are never invented.

For an individual binary contract, the probability model starts from market log-odds and learns a correction:

pi=σ ⁣(logit(mi)+β0+ziβ),σ(a)=11+ea. p_i=\sigma\!\left(\operatorname{logit}(m_i)+\beta_0+z_i^\top\beta\right), \qquad \sigma(a)=\frac{1}{1+e^{-a}}.

Here mim_i is the decision-time midpoint and ziz_i contains features centered and scaled using training data only. The midpoint is a feature, not a fill price. Minimize weighted binary log loss plus 12β22\frac12\|\beta\|_2^2; the intercept is not penalized. Weights give each day equal total weight, then divide it equally across events and eligible contracts. The two outcomes of one contract are complements; fitted probabilities across different brackets are not forced to sum to one.

The second model learns net dollars from attempting one contract, separately for YES and NO. Under the fixed execution scenario its target is:

Ri,s={0,a later observed quote rejects the original limit,Yi,sC(Pi,sentry,1),the modeled entry fills and settlement is released. R_{i,s}= \begin{cases} 0,&\text{a later observed quote rejects the original limit},\\ Y_{i,s}-C(P^{\mathrm{entry}}_{i,s},1), &\text{the modeled entry fills and settlement is released}. \end{cases}

C(p,q)C(p,q) is the exact aggregate purchase debit, including the assumed quadratic fee and account rounding from earlier sections. A missing entry quote or unreleased settlement is an unknown target, not zero. Each side's ridge regression minimizes weighted squared error plus a fixed coefficient penalty of one. Unknown labels have zero weight and an explicit mask. Return estimates are raw linear predictions, not calibrated profit guarantees. The account sizes whole contracts and recalculates aggregate fees; it does not multiply rounded single-contract fees by quantity.

The probability model's order score is predicted payout minus the maximum single-contract debit at the original limit. The return model's score already includes its modeled costs. For example, a YES probability of .70 and a decision ask of .60 imply a .61 limit and a .63 one-contract debit under the assumed .07 fee coefficient. The predicted edge is .07. If the later ask plus slippage exceeds .61, the order does not fill.

Both models require a score above .03, select at most one side/contract per event, and reserve at most 1% of current cost-basis equity per order, subject to cash and correlated-exposure caps. This score threshold is fixed, not a confidence bound or an optimized parameter.

Models refit on March 1 through August 1, 2026. Training decisions stop five days before each fit, and every training label must independently be released strictly before that fit. Each head needs at least 45 distinct training days. A failed fit remains a failed candidate. Each month's predictions enter the archive before the next month's training accesses newly released outcomes.

All candidates share one continuous account per scenario, starting with 200 dollars; monthly refits never reset money or release pending positions. The costed scenario enters at the exact next hourly endpoint plus .01; the stress scenario uses two hours plus .02. Both retain the original .01 limit allowance. Missing endpoints never trigger a search for a better fill.

Shared one-, seven- and fourteen-day block resamples compare the entire candidate/cost family. Incomplete campaigns cannot pass the research gate. These are reused-development diagnostics on conditional historical execution. Actual September receipts remain recorded separately from assumed historical times. An account requiring contemporaneous verified receipts must stay in cash. No annual-optimality or future-profit claim follows.

Executable campaign, fixed first batch, statistical families.

Further reading used in the project