Skip to content
CAI
Software that uses CAICheck a score

StefanBelo/BetfairAiTrading

52.7

Adequate · 3 October 2026

7.5k

lines of production code

Python

with F#, C#, JavaScript, TypeScript

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a multi-language framework for automated sports betting and market analysis, primarily focused on Betfair data. It provides tools for technical analysis of betting markets, automated trading strategies for football, tennis, and horse racing, and AI-driven agent integration for decision-making. The codebase includes data providers, visualization dashboards, and educational examples across C\#, F\#, and Python to support these workflows.

How it got here

2025 — AI agent and market analysis expansion

19 changes.

The project underwent a major restructuring to support AI-driven trading workflows, introducing C\# and Python AI agents for automated betting strategies alongside comprehensive market analysis tools. New technical analysis capabilities were added in C\#, F\#, and Python, while specific trading bots for football, tennis, and horse racing were implemented to automate market entry and position management. The codebase was modernized with .NET 10 support, new React-based data visualization interfaces, and expanded documentation optimized for AI ingestion.

2026 — Educational examples and tooling expansion

5 changes.

This period focused on expanding the project's educational resources and developer tooling by adding multi-language strategy examples, interactive Jupyter notebooks, and Docker deployment configurations for TuskBot. It also introduced utilities for documentation maintenance, LLM integration testing, and static data provisioning to support the Bfexplorer platform.

Features

Added Docker configuration and documentation for TuskBot

Users can now deploy the TuskBot service using the provided Docker Compose setup. The change introduces a compose.yaml file that defines the TuskBot service using the ghcr.io/sandevgo/tuskbot:latest image, along with a persistent volume for data storage. Supporting Windows batch scripts (configure.cmd and run.cmd) and a documentation file (Doc.txt) have also been added to facilitate installation and execution.

docker · high confidence

Added trainer data provider and CSV export

A new F\# script (TrainersData.fsx) has been added to fetch trainer information from the horseracing API and export it as a CSV file (Data/Trainers.csv). This provides a static dataset of trainers and their postcodes for use by other components.

src/DataProviders · high confidence

Introduce Betfair Market Analyzer with technical analysis and reporting

Added a new C\# application in src/BetfairMarketAnalyzer that performs technical analysis on Betfair betting market data using the Skender.Stock.Indicators library. The tool calculates indicators such as RSI, MACD, Bollinger Bands, and moving averages, while also detecting support/resistance levels, volume spikes, and market flow (backing vs. laying pressure). It generates comprehensive markdown reports with trading strategy recommendations (e.g., scalping, back-to-lay) and risk assessments, and includes example code in src/Examples to demonstrate usage with sample market data.

src/BetfairMarketAnalyzer, src/Examples · high confidence

Introduce Python implementation of Betfair Market Analyzer

Added a new Python-based Betfair Market Analyzer that replicates the functionality of the existing C\# version. The application performs comprehensive technical analysis on betting market data using TA-Lib (with a pandas/numpy fallback) to calculate indicators like RSI, MACD, and Bollinger Bands, and generates detailed markdown reports including trading recommendations and risk assessments.

src/BetfairMarketAnalyzerPython · high confidence

Introduces F\# implementation of Betfair Market Analyzer

Adds a new F\# version of the Betfair Market Analyzer that provides technical analysis for betting markets using the Skender.Stock.Indicators library. This implementation includes models for market and selection data, services for calculating technical indicators (RSI, SMA, EMA, MACD, Bollinger Bands) and analyzing market flow, and a report generator that outputs comprehensive markdown analysis reports with trading recommendations.

src/BetfairMarketAnalyzerFSharp · high confidence

New 'Hello Betfair' educational strategy examples in C\#, F\#, and Visual Basic

Added a new 'Hello Betfair' folder containing educational examples that implement a simple trading strategy across three languages (C\#, F\#, and Visual Basic). The strategy automatically places a back bet on the first favorite market selection with a price between 2.5 and 3.0, using configurable parameters with those defaults. The F\# implementation also includes a custom DSL (Domain Specific Language) for defining trigger logic. These files serve as reference implementations for the bfexplorer app platform.

src/HelloBetfair · high confidence

New Betfair trading chart examples added

Added two new HTML examples in the examples/html directory: BetfairPriceChart.html, which displays static market data and price movement charts using Plotly, and BetfairTradingChartDynamic.html, which extends this with a user interface for inputting custom JSON data to dynamically render trading charts.

examples/html · high confidence

New Bfexplorer Studio example notebooks for API, bots, and AI charts

The examples/BfexplorerStudio directory now includes a set of F\# script files (.fsx) and corresponding Verso notebook files (.verso) that serve as interactive getting-started guides. These examples demonstrate how to use the Betfair API to retrieve market data, implement custom strategy bots and triggers within the Bfexplorer environment, and visualize AI-driven selection analysis using Plotly.NET charts.

examples/BfexplorerStudio · high confidence

New Bfexplorer scripting examples and documentation

Added a collection of F\# script examples and documentation to the Bfexplorer location, demonstrating how to interact with the platform's console and services. These include scripts for opening markets, calculating and displaying selection probabilities, generating interactive Plotly charts for price history, and reading/writing data to spreadsheets via bot triggers. The set also includes utility scripts for inspecting the IBfexplorerConsole interface and markdown documentation outlining implementation steps for charting features.

src/Bfexplorer · high confidence

New C\# AI agent for automated Betfair betting strategies

Added a new C\# application (src/AiAgentCSharp) that connects AI language models (via Azure AI Inference and Microsoft.Extensions.AI) to the BfexplorerApp MCP server to automate betting strategies. The agent retrieves active Betfair market data, performs Expected Value (EV) analysis on horse racing form, and executes 'Bet' or 'Lay' strategies based on conservative criteria. It supports multiple AI providers (GitHub Models, DeepSeek, AI Hub Mix, local proxies) and uses user secrets for API key configuration.

src/AiAgentCSharp · high confidence

New Market Data Browser web application for Betfair markets

A new React-based web application has been added to view and analyze Betfair market data, featuring a sidebar for market selection with search and filtering, and a main area that switches between tabular and chart views based on the selected data context. The app integrates with the backend API to fetch market lists, active market status, and specific market details, while supporting multiple data contexts such as Timeform ratings, Racing Post data, and OLBG tips displayed via AG-Grid tables, as well as price history visualized using TradingView's Lightweight Charts. State management is handled by Zustand, and the UI is styled with the Inspinia theme, providing a responsive layout for desktop and mobile devices.

src/MarketDataBrowser · high confidence

New documentation maintenance scripts and LLM testing utilities

Added helper scripts to improve documentation organization and LLM integration: \scripts/maintain\_docs\_metadata.py\ automatically manages YAML frontmatter for markdown files (extracting titles, types, and tags for Obsidian), and \scripts/ingest\_docs.py\ flattens documentation into a single context file for LLMs. Additionally, new F\# scripts in \src/Strategies/LLM/\ (\ExecuteYourTest.fsx\, \GetDataContextForMarket.fsx\, \RacingTvProvider.fsx\) provide utilities for testing Bfexplorer service interactions, including login, market data retrieval, and race card data fetching via the RacingTvProvider.

scripts, src/Strategies/LLM · high confidence

New horse racing analysis and data export tools

This change introduces a new F\# application suite within the RacingStatto module to analyze horse racing results and export data for machine learning. It includes a data export tool that fetches race results from a local API and writes them to a CSV file (MlData.csv) with specific columns like ranks and odds. Additionally, it provides an analysis engine that evaluates betting strategies using both manually defined rules and automatically derived rules based on historical winners, calculating metrics such as profit and ROI.

src/RacingStatto · high confidence

New horse racing bot to close positions on rank drops or favorite odds thresholds

A new automated trading strategy, CloseByPositionDifferenceBotTrigger, has been added for Horse Racing WIN markets. The bot monitors the favoritism rank of selections and automatically closes open bet positions when a selection's rank drops by a configurable number of positions (default 2) or when the favorite's odds fall below a specified threshold. It includes configurable settings for the position difference, minimal favorite odds, and optional logging of position changes.

src/Strategies/HorseRacing · high confidence

New script to open football markets based on score difference

A new F\# script, OpenMyFootballMarketsByScore.fsx, has been added to the Football strategies folder. This script connects to the Betfair API via the BeloSoft Bfexplorer service to retrieve active football matches and opens specific markets for matches where the score difference is greater than zero. It utilizes the FootballScoreProvider to fetch live data and filters matches before invoking the OpenMyMarkets function, providing a new automated way to target football markets based on current game states.

src/Strategies/Football · high confidence

New strategy configurations for Football, Tennis, and Horse Racing

Added new JSON configuration files in the data/Strategies directory to define execution parameters for specific sports strategies. These include Football match time criteria and market opening by score, Tennis data export and market opening by score, and Horse Racing bookmakers odds and race distance triggers. Each file maps specific BetEvents (such as 'Football - In-Play Now' or 'Horse Racing - GB and IE') to corresponding scripts or bot strategies, establishing how and when these automated actions should be triggered.

data/Strategies · high confidence

New tennis-specific trading scripts for market selection and spreadsheet tracking

Two new F\# scripts are added to the Tennis strategy folder. OpenMyTennisMarketsByScore.fsx provides a script that identifies active tennis matches in the second set with a 1-0 or 0-1 score and automatically opens markets for those matches. TennisDataToSpreadsheet.fsx introduces a bot trigger that updates a DevExpress spreadsheet with real-time tennis match scores (points and set scores) and current back/lay prices for match odds markets.

src/Strategies/Tennis · high confidence

Repository restructured for AI-driven trading workflows and documentation

The repository has been reorganized to support AI agent integration and automated trading strategies. A new solution file (BetfairAiTrading.slnx) defines the project structure, including C\# AI agents, F\# strategy bots, and data analysis tools. Documentation has been significantly expanded and restructured, with a new index (README.md) and a flattened context file (docs\_context.txt) designed for AI ingestion. Configuration files for the Reasonix AI agent and .NET SDK 10.0.401 have been added, while the legacy Visual Studio solution file was removed.

(repo-wide) · high confidence

Removals

Removal of F\# console application scaffold

The default F\# console application entry point (Program.fs) and its associated build artifacts have been removed from the src/App directory. This eliminates the 'Hello from F\#' output and the net9.0 project configuration for this specific location, effectively stripping out the initial scaffolding code.

src/App · high confidence

Behavioural changes

1 commit (0 fixes) modifying data

A change to existing behaviour in data — 1 commit, 1 file.

data · low confidence · unverified

4 commits (0 fixes) modifying data/BetEvents

A change to existing behaviour in data/BetEvents — 4 commits, 5 files.

data/BetEvents · medium confidence · unverified

BfexplorerApp agent session history now includes token usage and reasoning metrics

The BfexplorerApp agent's session history files now record detailed AI model usage data, including token counts (input, output, total) and reasoning tokens. This metadata is captured in the session history JSON, allowing users to track model consumption and reasoning overhead for each interaction.

src/AiAgentPython · high confidence

Test coverage

Added horse racing market test fixtures

Added seven new JSON test data files in the \data/TestData\ directory to support testing of horse racing market analysis features. These fixtures include \MarketSelectionsCandleStickData\ (files 1–6) containing OHLCV candlestick series, VWAP, and back/lay ratios for specific selections, as well as \MarketSelectionsPriceHistoryData\ with granular time-price-volume history, and \RacingTvDataForHorses\ providing detailed horse profiles, form, and performance statistics.

data/TestData · high confidence

Dependencies

New AI agent, market analysis, and browser tools with updated dependencies

This update introduces several new project scaffolds and dependency configurations across the codebase. The \AiAgentCSharp\ project is added targeting .NET 10.0 with packages for Azure AI Inference, OpenAI, and Model Context Protocol, while the \AiAgentPython\ project is introduced with a dependency on \fast-agent\. Betfair market analysis capabilities are expanded with new F\# (\BetfairMarketAnalyzerFSharp\) and Python (\BetfairMarketAnalyzerPython\) projects using libraries like \Skender.Stock.Indicators\, \pandas\, and \plotly\. The \MarketDataBrowser\ React application is added with \ag-grid\ and \lightweight-charts\ for data visualization. Additionally, the original \App\ project has been renamed to \BetfairMarketAnalyzer\ and migrated from .NET 9.0 to .NET 8.0, and \RacingStatto\ F\# tools are updated to target .NET 10.0.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 56 → 53 (-3.3)
  • Rubric changed (rubric-2026.09.15 → rubric-2026.10.1) — scores are not directly comparable.

Lenses

  • Code Health 86 → 87 (+0.9)
  • Architecture 97 → 97 (+0.7)
  • Maturity 83 → 81 (-2.5)
  • Readiness 26 → 20 (-6.1)
  • Security 80 → 79 (-0.8)

Resolved (6)

  • Documentation: no installation or build instructions (docs/Research/README.md)
  • High CVE: [GHSA redacted] (src/MarketDataBrowser/package-lock.json)
  • High CVE: [GHSA redacted] (src/MarketDataBrowser/package-lock.json)
  • redundant comment (src/AiAgentCSharp/Program.cs)
  • redundant comment (src/AiAgentCSharp/Program.cs)
  • redundant comment (src/AiAgentCSharp/Program.cs)

New (10)

  • Documentation: no architecture or design documentation (docs/Strategies/Basketball/README.md)
  • Duplicated block (11 lines × 2) (src/RacingStatto/FSharp/AnalyzeResults/QuipuOperations.fs)
  • Duplicated block (11–12 lines × 3) (src/RacingStatto/FSharp/AnalyzeResults/QuipuOperations.fs)
  • Duplicated block (15 lines × 2) (src/RacingStatto/FSharp/AnalyzeResults/RulesOperations.fs)
  • Duplicated block (18 lines × 2) (src/BetfairMarketAnalyzer/Models/BetfairModels.cs)
  • Duplicated block (56 lines × 2) (src/RacingStatto/FSharp/AnalyzeResults/Models.fs)
  • High CVE: [GHSA redacted] (src/MarketDataBrowser/package-lock.json)
  • High CVE: [GHSA redacted] (src/MarketDataBrowser/package-lock.json)
  • High CVE: [GHSA redacted] (src/MarketDataBrowser/package-lock.json)
  • XML-doc coverage: BetfairMarketAnalyzer (src/BetfairMarketAnalyzer/BetfairMarketAnalyzer.csproj)

Changes since last survey

  • 3 commits — 3 feature/other, 0 fixes

By area

  • data/TheUkBettingForum — 2 commits
  • docs/Ideas — 1 commit

Notable commits

  • change: TheUkBettingForum
  • change: TheUkBettingForum
  • change: TrainersData

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

StefanBelo/BetfairAiTrading was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 3 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 4949708117e583bf6e1a5d8a2d7b91e9794a3066 — the exact code this score is about.
  • Scored under rubric-2026.10.1 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-4f4226d619ea.