Skip to content

YichengYang-Ethan/oracle3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Oracle3

Oracle3

Autonomous On-Chain Trading Agent for Prediction Markets

Tests Lint Type Check Python Solana License Release

A fully autonomous agent that reads on-chain data, exploits structural mispricings across prediction markets, signs Solana transactions, and manages risk end-to-end — no human in the loop.


Oracle3 Live Dashboard
Live trading dashboard — real-time equity curve, execution pipeline, 8 on-chain agent capabilities

What's New

Date Update
2026-03-09 v1.0.0 released — 8 arbitrage strategies, market relation graph, SpreadExecutor, engine control
2026-03-04 Live trading dashboard with real-time equity curve and 8 on-chain feature cards
2026-02-28 Initial release — trading engine, multi-exchange support, AI agent strategies

Key Features

  • 8 arbitrage strategies — 6 constraint-based (cross-market, exclusivity, implication, conditional, event-sum, structural) + 2 statistical (cointegration spread, lead-lag) with formal mathematical invariants
  • Multi-exchange — Solana/DFlow, Polymarket, Kalshi with cross-platform arbitrage
  • AI + Quant hybrid — LLM agent strategies (OpenAI Agents SDK + LiteLLM) alongside adaptive quantitative strategies
  • On-chain execution — native Solana tx signing, Jito MEV protection, flash loan arbitrage, atomic multi-leg trades
  • Safe multi-leg — SpreadExecutor with automatic LIFO unwind on partial fills; no naked positions
  • Market relation graph — persistent knowledge graph with quantitative validation (cointegration, ADF, hedge ratio)
  • Dual-layer risk — local limits + Solana simulateTransaction pre-flight check
  • On-chain audit trail — every trade logged via Memo program + agent reputation scoring (0–100)
  • Engine control — Unix socket runtime control (pause/resume/killswitch) without process restart
  • Live dashboard — web UI with equity curve, 8 feature cards, execution pipeline + terminal TUI

Architecture

                    ┌───────────────────────────────────────────────┐
                    │              Oracle3 CLI                      │
                    │   paper │ live │ blinks │ monitor │ control   │
                    └───────────────────┬───────────────────────────┘
                                        │
          ┌─────────────────────────────┼─────────────────────────────┐
          │                             │                             │
 ┌────────▼────────┐         ┌──────────▼──────────┐       ┌─────────▼─────────┐
 │  Agent Strategy │         │   Quant Strategy    │       │ Arbitrage Suite   │
 │  (LLM + Tools)  │         │  (Momentum/MR/MM)   │       │ (8 strategies)    │
 └────────┬────────┘         └──────────┬──────────┘       └─────────┬─────────┘
          └─────────────────────────────┼─────────────────────────────┘
                                        │
                    ┌───────────────────▼───────────────────────────┐
                    │             Trading Engine                    │
                    │  Event Loop • Risk Manager • Position Tracker │
                    │  SpreadExecutor • Control Server • Registry   │
                    └───────────────────┬───────────────────────────┘
                                        │
          ┌─────────────────────────────┼─────────────────────────────┐
          │                             │                             │
 ┌────────▼────────┐         ┌──────────▼──────────┐       ┌─────────▼─────────┐
 │  Solana / DFlow │         │    Polymarket       │       │      Kalshi       │
 │  SPL Tokens     │         │    CLOB API         │       │    REST API       │
 └────────┬────────┘         └─────────────────────┘       └───────────────────┘
          │
 ┌────────▼────────┐
 │  Solana Blinks  │  ← Shareable trade URLs
 │  On-Chain Logs  │  ← Memo program audit trail
 │  Jito Bundles   │  ← MEV protection
 └─────────────────┘

Arbitrage Strategies

Constraint-Based

Strategy Invariant Entry Signal
Cross-Market Arb Same event, same price Price gap across DFlow/Polymarket/Kalshi exceeds fees
Exclusivity Arb P(A) + P(B) ≤ 1 Mutually exclusive event prices sum > 1
Implication Arb P(A) ≤ P(B) Implied event priced higher than parent
Conditional Arb P(A|B) ∈ [L, U] Conditional probability bounds violated
Event Sum Arb Σ P(outcome) = 1 Outcome prices don't sum to 1
Structural Arb P(A) = β·P(B) + α Price deviates from calibrated model

Statistical

Strategy Method Edge Source
Cointegration Spread Self-calibrating z-score bands Mean-reverting spread between cointegrated markets
Lead-Lag Rolling cross-correlation Follower market lags leader's price movements

Every strategy uses a position state machine, fee-aware edge calculation, cooldown windows, and fill-guarded transitions. See Architecture docs for details.

Quick Start

git clone https://github.com/YichengYang-Ethan/oracle3.git
cd oracle3
poetry install
# Browse markets
oracle3 market list --exchange solana --limit 10

# Paper trading with live dashboard
oracle3 dashboard --exchange solana \
  --strategy-ref oracle3.strategy.contrib.adaptive_onchain_strategy:AdaptiveOnChainStrategy \
  --initial-capital 10000

# Run the interactive demo
./demo.sh

Open http://localhost:3000/live for the live dashboard. See Quick Start Guide for more commands.

Why Oracle3?

Feature Oracle3 Polymarket/agents freqtrade
Prediction markets 3 exchanges Polymarket only Crypto spot/futures
Constraint arbitrage 8 strategies with formal invariants None None
On-chain atomic execution Solana native Off-chain Off-chain
LLM agent + quant hybrid OpenAI Agents SDK + LiteLLM RAG pipeline FreqAI (ML)
Multi-leg auto-unwind SpreadExecutor (LIFO) None None
MEV protection Jito Bundles N/A N/A
On-chain audit trail Solana Memo program None None

Motivation

On-chain autonomous agents represent the next evolution of crypto infrastructure. Oracle3 is a reference architecture for unifying LLM reasoning, quantitative signals, constraint-based arbitrage, and on-chain primitives into a single autonomous system. Prediction markets are the sharpest testbed — discrete outcomes, transparent order books, and probability axioms that create mathematically guaranteed arbitrage when prices misbehave.

Solana Polymarket Kalshi OpenAI Jito

Community

Discussions Issues

Discussions · Issues · Contributing · Security · Docs

Contributors

License

Apache 2.0 — see LICENSE for details.


This software is for research and educational purposes. Trading on prediction markets involves financial risk.