Claude, build me a horse racing betting system

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Claude, build me a horse racing betting system

4 days 3 hours ago - 4 days 3 hours ago
#916967
TL;DR at end.

I've been scraping South African horse racing data since 2012: runners and form (since 2009) as well as the odds from a number of betting operators, recording every movement at decreasing intervals as the race off approaches. My database is currently 8GB in size with 60,000 races and 720,000 runners.

Over the years I've had a number of attempts to build "The System". I'm a programmer by profession and was an early user of Machine Learning (ML) and have learnt a lot about statistics (mathematically). The goal of a system is not to predict winners, but to estimate each runner's chance of winning more accurately than the bookies do, and to leverage that difference against them. While I was able to get a small positive ROI (<5%), the systems were always fragile and not practical. I put it aside a few years ago but have kept the scrapers maintained and running.

With the current AI hype, I'm sure many people have had the (magical) thought: surely an AI could look at the data and predict the winner. Well, with today's release of the greatest AI model yet (according to Anthropic), I tasked Fable with analysing the data and building that system.

There was quite a lot of setup: I gave it access to all my source code dealing with the data (30+ projects) and an offline copy of the database. I provided as much context as I could and then gave it these simple goals:

- Develop a prediction engine that is able to provide, 10 minutes before race off, an instruction to place a bet
- There should be at least 1 bet placed every 16 races
- The losing streak must be < 10 bets
- The ROI should be the best you can achieve - this is extremely important
- The system should not be fragile (a missed opportunity must not destroy the ROI) 

It ran for 10 hours. Here is a technical summary (produced by Fable).

-- Fable summary

 What Fable built and ran in a 10-hour session (26 registered experiments, all forward-tested): 

Data foundation. A point-in-time snapshot pipeline over the 48.4M odds ticks: for every race, the state of the world at exactly T-minus-10-minutes (per-book win/place quotes with age, momentum anchors at T-30m/1h/3h/24h/48h, tote pools, quote-arrival intensity), extracted to Parquet in ~7 min for all 17 years, reconciled row-exactly against the DB, and cross-checked per race against an independent SQL as-of query. Leakage control is structural: one cutoff choke-point, post-race-computed columns banned by whitelist, and unit tests proving snapshots are byte-identical when post-cutoff data is appended.

Data audit before modelling (5 parallel agents): verified clock alignment across all sources and eras; discovered the books quote places mechanically as place = 1 + (win−1)·k/100 with a race-constant integer k (real divisors 5–10, not the folklore 4–5 — only one operator deviates per-runner); proved quoted odds are gross with 6% tax on the profit portion by checking 287 of my actual historical settled bets; calibrated per-book staleness limits from p95 inter-tick gaps; derived scratch timing from odds-disappearance (15-min activity window, 0.8% false-negative). 

Pattern search. Tax-aware baselines first (random bettor −14%, best-price favourite −5.3% — the honest hurdles). A calibration atlas over 247k runners found favourite-longshot bias but zero blindly-profitable cells. A joint logistic significance test on 240k rows confirmed three signals beyond the current price (60-min steam t=−6.8, tote-vs-fixed divergence t=+7.6, best-vs-consensus t=+6.1) and rejected two. Models: a LightGBM form model over 34 point-in-time features (chronological fold accumulator, alias-resolved identities), Benter-style logistic blending — including learning the hard way that blend weights must be fitted on out-of-sample fundamental predictions — and discounted-Harville (Lo/Bacon-Shone) top-J place probabilities with MLE-fitted λ and Platt calibration, bet via tax-net EV thresholds at best-of-4 prices. 

Evaluation discipline. Expanding-window walk-forward (6-month steps, 7-day embargo, 2016–2022 OOS only), block-bootstrap CIs, losing-streak Monte Carlo, a deflated-ROI noise floor charged against every experiment ever run, White's Reality Check, FDR-controlled residual subgroup mining, ablations, and a fragility battery (top-win removal, random bet dropout, single-book removal, second-best pricing, T-15/T-20 timing sensitivity). 

Result. Best config: +2.50% ROI over 1,198 OOS bets (hit 59%, max losing streak 6, bank never below start) — but the edge is top-price place outliers at one operator, decays ~0.6 ROI pts per minute of earlier decision (T-15 ≈ 0%), and is not yet statistically separable from search noise. The T-10 alerter is built with byte-identical live/offline feature code (9/9 decision parity) and the verdict now rests on shadow-mode running against the live scrapers — which measures the one thing 17 years of history can't: whether the prices are still there when you reach for them. 

(I've attached the results log it wrote as it worked, if you want more detail.) 

-- End Fable summary 

TL;DR 

Fable was able to achieve a small ROI (2.5%) in backtesting, but it's fragile (it depends on exact timing before a race — a few minutes' delay and it drops to zero). Fable wants to run a 12-week test on the live data to test whether it can maintain that ROI in a live environment. 

This outcome is disappointing for me; I've always held onto the hope that there's gold in the data. I won't be running the live tests as I've seen how they usually turn out when the premise is this fragile. Also, trying to turn this into an actual income would likely be more effort than I'm prepared to give. Back to work at the office tomorrow.

---
(edit: line breaks disappeared and presented a wall of text)
 
Last edit: 4 days 3 hours ago by Hermit.

Please Log in or Create an account to join the conversation.

  • Magi
  • Magi's Avatar
  • Platinum Member
  • Platinum Member
  • Posts: 9749
  • Thanks: 1408

Re: Claude, build me a horse racing betting system

3 days 11 hours ago
#916980
Brilliant Hermit ...... but as you say fairly unusable. At least in trading (stock market and crypto and commodities) one gets a much better return with less stress. But your initiative was fantastic.

Please Log in or Create an account to join the conversation.

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Re: Claude, build me a horse racing betting system

3 days 9 hours ago - 3 days 9 hours ago
#916994
I thought that, while everything is set up, I would test some more theories. Although this may be obvious to anyone who actually trains horses, I prompted Fable:

A horse, after a rest (no run for >= 3 months), will run poorly as the trainer is re-acclimatising the horse to the racetrack conditions, but the second (and third) run after a rest, the horse will show dramatically improved performance.
Is there any statistical evidence for this?

The answer to the hypothesis

EXP-0027 verdict: the pattern is real, but the market already prices it.

The hypothesized shape genuinely exists in the data (240,037 Tier A runner rows, 2016–2022, cluster-robust by race):

Test (market-blind) | β | t | Sign-stable | Result

1st run after ≥90d rest underperforms | −0.186 | −6.3 | yes | CONFIRMED
2nd run back improves vs 1st (the "bounce") | +0.133 | +3.4 | yes | CONFIRMED
2nd run back beats normal runners | −0.053 | −1.8 | yes | not confirmed
3rd run back beats normal runners | +0.051 | +1.6 | no | not confirmed

Two nuances against the literal hypothesis: the improvement is a recovery toward normal, not a dramatic overshoot (2nd-run-back horses are still slightly worse than reference), and the third run is simply back to baseline.

But once you control for the market price (ln + ln² of consensus), every coefficient collapses — rsl1 t = +0.3, rsl2 t = −1.3, bounce contrast t = −1.2. The descriptive table says it plainly: first-up horses win 8.0% of the time and the market prices them at 7.9%; even ≥365-day layoffs are priced within noise. The within-horse difference-in-differences confirms the same split: the raw bounce is strong (t = −7.9) with zero market-relative content (t = −1.2). So there is no exploitable edge — consistent with EXP-0015's finding that SA books price public form patterns efficiently. The full tables (severity bands, COVID-2020 layoff wave, attrition, supplementary 2009–2022) are in EXP-0027/report.md.

Given the market-conditional result there is no case for a model-integration follow-up; the angle is retired as a mispricing source.

-- End Fable Result

If anyone has any theories they'd like to test against the data, let me know and I'll try to test if there is statistical evidence to support them.

(edit: pasting text mangles it by removing formatting)
(edit2: editor does not support tables, try format)
 
Last edit: 3 days 9 hours ago by Hermit.

Please Log in or Create an account to join the conversation.

  • Magi
  • Magi's Avatar
  • Platinum Member
  • Platinum Member
  • Posts: 9749
  • Thanks: 1408

Re: Claude, build me a horse racing betting system

3 days 9 hours ago
#916997
One thing I would be interested in confirming is horses 'seasonal' form ....excluding western cape because here that is mostly due to underfoot conditions being very different between summer and winter.But fr instance in the UK often one sees 'last years winner of the race' repeating the dose next year despite indifferent form during the intervening 12 months.

I spent a lot of time hypothesising over circadian rhythms in equines ... but data was limited

Please Log in or Create an account to join the conversation.

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Re: Claude, build me a horse racing betting system

3 days 6 hours ago
#917003
One thing I would be interested in confirming is horses 'seasonal' form ....excluding western cape because here that is mostly due to underfoot conditions being very different between summer and winter.But fr instance in the UK often one sees 'last years winner of the race' repeating the dose next year despite indifferent form during the intervening 12 months.

I spent a lot of time hypothesising over circadian rhythms in equines ... but data was limited
 

Fable prompt:
Is there any statistical difference in the seasonal performance of horses?
Sub-group by province (geographical area).

--- Fable Results

E018 — Seasonal Performance × Province: results
Request: racing5-additional-experiments-2.md · Plan: racing5-additional-experiments-2_plan.md · Registered as EXP-0028 (registry N 27 → 28)

What was done

Recon. Four parallel scouts established: seasonality had never been tested anywhere in the project (the D1 miner's implemented lattice had prov but not month/season/going despite the plan spec); RaceCourses.cProvince exists and already flows through snapshot schema v4, with one data-quality trap (course 7 "Fairview Polytrack", 3,907 races, mislabeled GAU — physically Port Elizabeth, ECP); and the EXP-0027 template (Fit A/Fit B, cluster-robust SEs, hardcoded pre-registration, one registered run) was the governing pattern.

Plan. The hypothesis is unmeasurable as raw win rate — season and province are race-constant and every race has exactly one winner — so the plan pre-registered the two identifiable forms: H-horse (do horses repeat prior-years' same-season form beyond career form — within-race contrast β(oldSameSeasonRate) − β(oldOtherSeasonRate), old = ≥275.0d) and H-market (favorites-only A/E per season×province cell vs the pooled favorites' A/E, Δ_cell). An adversarial design review (3 independent reviewers) preceded freezing and caught two blockers: whole-cell A/E is degenerate (consensus ≈1 per race ⇒ A/E ≡ 1 + exclusion artifacts) → favorites-only redefinition; and Fit A needed the season/province/lnFieldSize nuisance block plus the 275d symmetric age floor to block field-size-cycle and form-drift artifacts. User resolved: both channels, one registered run; stop-and-report; 4 SH meteorological seasons.

Implementation. Non-vector FormFeatures season buckets in FormState.cs (FeatureCount untouched at 34 — frozen candidate bit-identical); CGM two-way (race, horse) cluster covariance + guarded contrast helper in LogisticRegression.cs; seeded race-day ratio bootstrap, BH-FDR, and normal-p in Statistics.cs; the whole pre-registered family hardcoded in AnalyzeSeasonalityCommand.cs (analyze seasonality). 52 new unit tests (season mapping incl. Dec→Summer wrap, 275.0 boundary, bucket splits, point-in-time, CGM identity vs three one-way fits, bootstrap determinism, B&H 1995 textbook example, Fairview override, favorite tie-break, EB shrink) — suite 90 → 142, all green.

Pre-run verification. A second adversarial review (plan-fidelity / statistical-wiring / edge-case hunters over the code vs the plan) ran BEFORE the registration was spent. It verified term-set alignment, leakage discipline, and the estimator plumbing, and caught 8 divergences — most materially: the drift label conflated S-fa with S-age (the plan keys it to S-age alone); the §4.3 "Fit C kills" rule was unimplemented and unquantified; and the non-PSD two-way fallback was resolved permissively where the pass rule reads strict. All were fixed and the resolutions recorded as pre-run amendments (g)–(m) in the plan's §8 review log. Rebuilt, 142/142 green, then ONE registered execution.

Bookkeeping. EXP-0028 registered (spec + report + metrics + index.jsonl); results.md session-2 table and retired-angles table updated; INDEX.md regenerated; plan stamped EXECUTED.

The answer to the hypothesis

No. Across 240,039 Tier A runner rows (22,682 races, 2016–2022), there is no statistical evidence of seasonal structure in horse performance, overall or in any province.

Test    Statistic    Result    Bar    Outcome
H-a — "winter horse" effect exists (market-blind)    contrast β(same−other), Fit A    +0.096, t = 1.4 (race & two-way)    |t| ≥ 3    fail
H-a-priced — …and is mispriced (market-controlled)    same contrast, Fit B    +0.119, t = 1.7    |t| ≥ 3    fail
H-p — effect differs by province    per-province contrast differences, Fit P    KZN −0.352 (t=−2.1, p=0.04); WCP/ECP/NCP ≈ 0    FDR q=0.10 ∧ |t| ≥ 3    all fail
H-m — market misprices season×province cells    favorites-only Δ_cell vs global, 20 cells    min p = 0.12 (NCP cells)    BH-FDR q=0.10    0/20

Nuances worth keeping:

The null is clean, not a power artifact. The H-a contrast is sign-stable across the two date-halves, sign-preserved under every named sensitivity (field-adjusted rates, bucket mean-log-age nuisances, EB shrink k=10, ex-COVID), and powered at 63.7k/49.1k informative rows per half. Nothing was confounded away; there is simply no seasonal signal.

The contrast design earned its keep. sameSeasonRate alone is t = 3.6 market-blind — a naive analysis would have "found" a winter-horse effect. But otherSeasonRate carries the same kind of information (old-subset rates add generic, non-seasonal residual information about ability), and the pre-registered contrast nets it to nil. This is exactly the artifact the design review predicted.

Provinces: the KZN contrast difference (−0.352, p=0.04 uncorrected) is the only whisper in the data, and it fails both the FDR gate and the |t| ≥ 3 bar; treat it as noise unless an independent pre-registration says otherwise. Small-province H-m cells (WCP/ECP/NCP, 9 of 20) are honestly underpowered at the ≥500-favorites/half floor (MDE 14–44%).

Data fact for the toolbox: favorites beat the overround-normalised consensus by 7.4% globally (A/E = 1.074) — the classic favorite–longshot bias, uniform enough across cells that no season×province deviation survives correction. It is not blindly bettable (best-book overround 7.7% + 6% tax; EXP-0005-8 already retired blind favorite backing).

Consistency with the project's running theme: EXP-0014/15 (form ≈ priced), EXP-0027 (rest bounce real but priced), and now EXP-0028 (seasonality absent even market-blind) — SA racing shows no public-information edge; only microstructure/timing edges have ever survived a market-conditional test here.

Angle retired. Any different seasonal binning (calendar months, racing-year quarters, carnival windows) or a travel/shipping angle is a new pre-registration per the plan's §9.

-- End Fable Results

And that's the end of my Fable token limit for now :(

 
The following user(s) said Thank You: Magi

Please Log in or Create an account to join the conversation.

  • Magi
  • Magi's Avatar
  • Platinum Member
  • Platinum Member
  • Posts: 9749
  • Thanks: 1408

Re: Claude, build me a horse racing betting system

3 days 5 hours ago
#917008
Very wordy chap is Fable ...... 

Please Log in or Create an account to join the conversation.

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Re: Claude, build me a horse racing betting system

3 days 4 hours ago
#917015
Very wordy chap is Fable ...... 
 

The more he talks, the more you pay ;)
 

Please Log in or Create an account to join the conversation.

  • Magi
  • Magi's Avatar
  • Platinum Member
  • Platinum Member
  • Posts: 9749
  • Thanks: 1408

Re: Claude, build me a horse racing betting system

3 days 3 hours ago
#917017
Tokens are expensive ...... I downloaded Deep Seek onto an external bootable drive....but have not yet got around to doing much with it.
Is a MUCH cheaper option.

Please Log in or Create an account to join the conversation.

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Re: Claude, build me a horse racing betting system

2 days 11 hours ago
#917052
This is a once-off experiment, just for fun. Disclaimer: don't take at face value anything an AI tells you.

Claude/Fable prompt:

Today (2026-07-04) is a big race meeting at the Greyville racecourse.
Using any knowledge you have gained, and any current Internet information you can find, create predictions of the first 5 finishers in each of today's races (all 12 of them), in order of most likely to win.
Do not just select the top favourites: try to come up with original reasoning for your selection.
Output your predictions to file durban_july_predictions.md. For each selection, explain why you selected it.

--- Fable results
Attached file: "durban_july_predictions.pdf".
-- End Fable results
 
 
The following user(s) said Thank You: Frodo, Magi

Please Log in or Create an account to join the conversation.

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Re: Claude, build me a horse racing betting system

1 day 12 hours ago
#917153
Prompt:
The results of the Durban July meeting are in and a fresh database has been restored.
Give an evaluation of how your predictions fared, where you went wrong and why and what you could do better next time.

--- Fable Output
Attached file: durban_july_predictions_outcome.pdf
--- End Fable Output

TL;DR (by Fable)

Honest bottom line

50% winners and 58% top-5 coverage is a solid public-forecast scorecard — headlined by an exact Durban
July exacta — but it is not evidence of edge: the six hits paid 2.2–8.8 (mostly market leaders), all six
misses paid 5.3+, and the one systematic recoverable failure (late steam) is precisely the already-known
T-10 signal. The exercise's real value is that it reproduced, on a single live card, the project's central
finding: the information that decides these races arrives in the last hour.

 
The following user(s) said Thank You: Pirhobeta

Please Log in or Create an account to join the conversation.

  • Hermit
  • Hermit's Avatar Topic Author
  • Junior Member
  • Junior Member
  • Posts: 57
  • Thanks: 14

Re: Claude, build me a horse racing betting system

8 hours 10 minutes ago
#917175
Collateral Form

It is theorised that by taking performance of horses against third-party common horses, a measure of how horses will perform against each other can be predicted.

Example:
Depth 0:
  Horse A and Horse B have run against each other previously.
  Direct relationship
Depth 1:
  Horse A has run against Horse C and Horse B  has run against Horse C (exclude races where A, B and C are all included).
  Relationship A <-> C <-> B
Depth 2:
  Horse A has run against Horse C, Horse C has run against Horse D
  Horse B has run against Horse E, Horse E has run against Horse D
  Relationship A <-> C <-> D <-> E <-> B
...

Task: determine if any information can be inferred by examining performance between horses through relationships.

--- Fable Results

The answer to the hypothesis

Yes — information can be inferred from opponent-graph relationships, and at depth 1 it is not fully priced. This is the first fundamental (non-microstructure) signal in the project to survive a market-conditional test. It still failed promotion into the betting strategy on the pre-registered streak guard.

Attached file: racing5-additional-experiments-3_results.md.txt (rename to .md then open with Edge/ Chrome (may need .md plugin) to view formatted)

--- End Fable Results

So, there is info there that the bookies haven't accounted for, but when this is built into "The System", the longest losing streak is 14 which exceed exceeds original instructions to keep it below 10. Further investigation is suggested to examine how actual "lengths behind" values affect the result rather than just a binary "A beat B".
 

Please Log in or Create an account to join the conversation.

  • Sealegs
  • Sealegs's Avatar
  • Premium Member
  • Premium Member
  • Posts: 319
  • Thanks: 70

Re: Claude, build me a horse racing betting system

7 hours 24 minutes ago - 7 hours 23 minutes ago
#917176
Fascinating.

Perhaps choose a particular racing centre & look for patterns within the training ranks. Pair this with your current model and there's a higher likelihood of success, given that you've now integrated the human intent factor into your system prediction!!!






 
Last edit: 7 hours 23 minutes ago by Sealegs. Reason: Hh

Please Log in or Create an account to join the conversation.

Time to create page: 0.142 seconds

Contact Details

Main Office (HQ)
PO Box 40390
Moreleta Park
Pretoria
0044
+27 (0) 82 785 4357
info@africanbettingclan.com

About A.B.C.

African Betting Clan is established for the upliftment of the sports punter, who enjoys a bet on horse racing, football and other sports, enabling them to voice their views and opinions on all aspects of the sport of their choice, free of charge.

Learn More

T's & C's

The views expressed on this website are not necessarily the views held by the proprietors of the site. Therefore African Betting Clan will not be responsible for any content posted. No persons under the age of 18 years are permitted to gamble. National Responsible Gambling Programme and its toll-free number (0800 006 008)