Skip to main content

SuperSkin Architecture

Version: 3.0 Last Updated: January 2026 Status: Production Implementation


What This Document Covers

This is the authoritative architecture guide for SuperSkin, a suite of microservices that provide AI-powered trading tools for sports betting. It describes:

  1. What we are building (the 5 core services)
  2. How data flows through the system
  3. How SuperSkin connects to the Oracle Platform and Forsyt Data Machine
  4. Deployment and infrastructure details

The Three Pillars

SuperSkin sits at the intersection of three major systems:

SystemRepositoryWhat It Does
Oracle Platformsmartbets-protocol/oracle-platformAggregates real-time sports data from vendors (Oddspapi, Sportmonks, Roanuz, API-Tennis, Betfair)
Forsyt Data Machineforsyt-data-machine/Historical data warehouse with ML training infrastructure
SuperSkinThis monorepo6 microservices that consume data and provide trading intelligence

The 6 Core Services

These are the production services we are building and deploying:

#ServicePortStackPurpose
1Price Feed Aggregator3100TypeScript/ExpressAggregates odds from Oracle Platform and external APIs
2Cash Out Calculator3101TypeScript/ExpressCalculates fair cash-out values for open positions
3AI Value Detection3102Python/FastAPIDetects mispriced odds using Shin, Poisson, and ELO models
4AI Chat Assistant3103Python/FastAPIConversational assistant with RAG and function calling
5Trading Charts3104TypeScript/ExpressOHLC data aggregation for candlestick charts
6SuperSkin Platform3106TypeScript/ExpressUser context, watchlists, alerts, preferences

Supporting Services

ServicePortStackPurpose
ML Prediction Service3105Python/FastAPIServes ONNX models for match outcome prediction
ML Training PipelineN/APython/scikit-learnOffline training on Forsyt Data Machine

Infrastructure

ComponentPortPurpose
Redis6380Pub/Sub messaging, caching, price history
TimescaleDB5433Time-series storage for OHLC data
PostgreSQL (Main)5432Main database (via Forsyt Data Machine)
PostgreSQL (Platform)5434SuperSkin Platform database (watchlists, alerts, chat)

How Data Flows

The system has three distinct data flows:

1. Real-Time Match Data (Oracle → SuperSkin)

The Oracle Platform aggregates data from 5 vendor APIs and publishes updates every 60 seconds.

2. AI Analysis Pipeline (SuperSkin Internal)

When a user requests value bets, multiple services collaborate:

3. Historical Data Flow (Data Machine → ML)

Training happens offline using data from Forsyt Data Machine:


Service Architecture Details

1. Price Feed Aggregator (Port 3100)

Purpose: Aggregate real-time odds from Oracle Platform and external APIs into a unified price feed.

Technology Stack:

  • TypeScript / Express.js
  • Redis for caching and pub/sub
  • TimescaleDB for historical storage

Key Responsibilities:

  • Subscribe to Oracle Platform price updates via Redis
  • Normalize prices across bookmakers
  • Calculate fair value using Shin method
  • Publish unified prices to Redis channels

API Endpoints:

EndpointMethodDescription
/api/prices/:marketIdGETCurrent prices for a market
/api/prices/fair/:marketIdGETFair value calculation
/api/prices/history/:marketIdGETHistorical price data
/healthGETService health check

2. Cash Out Calculator (Port 3101)

Purpose: Calculate real-time cash-out values for open positions.

Technology Stack:

  • TypeScript / Express.js
  • Redis for price caching

Key Responsibilities:

  • Calculate cash-out value for any position
  • Support full, partial, and auto cash-out
  • Real-time quote generation with expiry
  • Integration with order execution

API Endpoints:

EndpointMethodDescription
/api/quote/:positionIdGETGet cash-out quote
/api/execute/:positionIdPOSTExecute cash-out
/api/auto-cashoutPOSTSet auto cash-out trigger
/healthGETService health check

Cash Out Formula:

For a BACK bet:

Cash Out Value = (Original Odds / Current Lay Price) × Stake
Profit Locked = Cash Out Value - Original Stake

For a LAY bet:

Cash Out Value = (Current Back Price / Original Odds) × Liability
Profit Locked = Original Liability - Cash Out Value

3. AI Value Detection (Port 3102)

Purpose: Identify betting opportunities where odds offer positive expected value using Shin, Poisson, and ELO models from Forsyt Data Machine.

Technology Stack:

  • Python / FastAPI
  • Algorithms from Forsyt Data Machine (Shin, Poisson, ELO)
  • Redis for caching
  • PostgreSQL for historical data

Key Responsibilities:

  • Calculate fair odds using Shin method (removes bookmaker margin)
  • Generate predictions using Poisson model (goal-based)
  • Maintain ELO ratings for teams
  • Compare market prices to fair odds
  • Calculate edge for each outcome

API Endpoints:

EndpointMethodDescription
/api/value/signalsGETCurrent value signals
/api/value/detectPOSTDetect value for specific match
/api/value/historyGETHistorical signal performance
/healthGETService health check

Value Detection Algorithm:


4. AI Chat Assistant (Port 3103)

Purpose: Natural language interface for betting assistance with native search, RAG, and function calling.

Technology Stack:

  • Python / FastAPI
  • Primary LLM: Grok/xAI (grok-4) with native X Search and Web Search
  • Fallback Providers: Groq (llama-3.3-70b), Ollama (local)
  • pgvector for embeddings (RAG)
  • Redis for conversation cache

Key Responsibilities:

  • Natural language query understanding
  • Native X Search for real-time sports news and sentiment
  • Native Web Search for live match information
  • Tool-based function calling for data retrieval
  • RAG over historical betting data
  • Integration with other SuperSkin services

API Endpoints:

EndpointMethodDescription
/api/chatPOSTSend chat message
/api/chat/streamPOSTStreaming chat response
/api/history/:sessionIdGETGet chat history
/healthGETService health check

LLM Provider Architecture:

Grok Native Search Capabilities:

ToolPurposeUse Case
X SearchSearch X (Twitter) in real-timeTeam news, injury updates, betting sentiment
Web SearchSearch the webLive scores, match previews, team news

Available Tools (Function Calling):

ToolDescription
get_market_pricesCurrent prices from Price Feed
get_value_signalsValue signals from AI Value Detection
get_team_historyHistorical team performance
get_head_to_headH2H stats between teams
calculate_cash_outCash out value from Cash Out Calculator

5. Trading Charts (Port 3104)

Purpose: OHLC data aggregation and real-time charting backend.

Technology Stack:

  • TypeScript / Express.js
  • Redis for real-time tick data
  • TimescaleDB for historical OHLC storage

Key Responsibilities:

  • Aggregate price ticks into OHLC candles
  • Store historical data in TimescaleDB
  • Serve OHLC data via REST API
  • Stream real-time updates via WebSocket

API Endpoints:

EndpointMethodDescription
/api/ohlc/:marketIdGETHistorical OHLC data
/api/ohlc/:marketId/latestGETLatest candle
/wsWebSocketReal-time tick stream
/healthGETService health check

ML Infrastructure

ML Prediction Service (Port 3105)

Purpose: Serve trained ML models for real-time match predictions.

Technology Stack:

  • Python / FastAPI
  • ONNX Runtime for inference
  • Redis for prediction caching

Model Ensemble:

ML Training Pipeline (Offline)

Purpose: Train models on historical data from Forsyt Data Machine.

Training Flow:


Integration with External Systems

Forsyt Data Machine

The Forsyt Data Machine is the data backbone providing:

ComponentPurpose
Data HarnessDownloads data from 10+ free sources
AlgorithmsShin, Poisson, ELO calculations
ML PipelineFeature engineering and model training

Oracle Platform (smartbets-protocol)

The Oracle Platform provides real-time sports data:

CapabilityDescription
Match SchedulingLive match data from Oddspapi
Price StreamingReal-time odds via WebSocket
Result SettlementMatch outcomes for settlement

Deployment Architecture

Docker Compose Stack

# docker-compose.yml overview
services:
# Infrastructure
redis: # Port 6380 - Cache & Pub/Sub
timescaledb: # Port 5433 - Time-series data

# Core Services (3100 range)
price-feed-aggregator: # Port 3100
cash-out-calculator: # Port 3101
ai-value-detection: # Port 3102
ai-chat-assistant: # Port 3103
trading-charts: # Port 3104

# ML Services
ml-prediction-service: # Port 3105

Environment Configuration

VariableServiceDescription
REDIS_URLAllRedis connection string
TIMESCALE_URLPrice Feed, ChartsTimescaleDB connection
DATABASE_URLAI ServicesPostgreSQL (Data Machine)
GROK_API_KEYAI ChatGrok/xAI primary LLM API key
GROQ_API_KEYAI ChatGroq fallback LLM API key

API Reference

Service Endpoints Summary

ServicePortEndpointMethodDescription
Price Feed3100/api/prices/:marketIdGETCurrent prices
Price Feed3100/api/prices/fair/:marketIdGETFair value calculation
Cash Out3101/api/quote/:positionIdGETCash out quote
Cash Out3101/api/execute/:positionIdPOSTExecute cash out
AI Value3102/api/value/signalsGETCurrent value signals
AI Value3102/api/value/detectPOSTDetect value for match
AI Chat3103/api/chatPOSTSend chat message
AI Chat3103/api/history/:sessionIdGETGet chat history
Trading Charts3104/api/charts/ohlc/:marketIdGETHistorical OHLC data
Trading Charts3104/api/watchlist/chartsGETOHLC data for watchlist items (auth required)
Trading Charts3104/api/watchlist/overlay/:selectionIdGETCheck if selection is in watchlist
Trading Charts3104/api/watchlist/selectionsGETGet all watchlist selection IDs (auth required)
Trading Charts3104/ws/chartsWebSocketReal-time tick stream
Trading Charts3104/ws/watchlistWebSocketWatchlist notifications (auth required)
ML Predict3105/predictPOSTGet match prediction

Security Considerations

API Security

LayerMechanism
AuthenticationJWT tokens from Backend API
Rate LimitingPer-IP and per-user limits
Input ValidationPydantic/Zod schemas
CORSWhitelist allowed origins

Data Security

ConcernMitigation
Chat PrivacyConversations deleted after 30 days
API KeysEnvironment variables, never in code
User DataMinimal collection, no training

Performance Targets

MetricTargetMeasurement
Price Update Latency<100msTime from source to frontend
Prediction Latency<200msTime for ML inference
Cash Out Quote<500msFull quote generation
Chat Response<3sFirst token streaming
Uptime99.9%Service availability

Current Status

ServiceStatusNotes
Price Feed Aggregator✅ ImplementedPort 3100
Cash Out Calculator✅ ImplementedPort 3101
AI Value Detection✅ ImplementedPort 3102
AI Chat Assistant✅ ImplementedPort 3103
Trading Charts✅ ImplementedPort 3104
ML Prediction Service✅ ImplementedPort 3105
ML Training Pipeline🔄 In ProgressTraining on Data Machine

RepositoryPurpose
smartbets-protocol/oracle-platformReal-time sports data aggregation
forsyt-data-machineHistorical data warehouse and ML training
gta-frontendReact frontend application