Autonomous on-chain trading agent for Solana prediction markets — LLM reasoning, quantitative signals, and atomic execution
Project description
Oracle3
Autonomous prediction market trading agent across Kalshi, Polymarket, and Solana.
Why this exists
Prediction markets price binary contracts at systematically biased levels — a true 50/50 contract typically trades around 0.57 (favorite-longshot bias, $\hat{\lambda} \approx 0.183$). Most trading bots ignore this distortion entirely. Oracle3 operationalizes a peer-reviewed pricing model, calibrated on 291,309 resolved contracts across six venues, to systematically harvest the bias through arbitrage detection and Kelly-sized model trades.
This system deploys the exact $\lambda$ estimates and covariate model from prediction-market-pricing (Yang, 2026) as its real-time pricing engine.
How oracle3 differs from existing prediction-market tools
| Oracle3 | polymarket-whales | prediction-market-maker | py-clob-client | |
|---|---|---|---|---|
| Pricing model | Wang Transform (calibrated MLE) | None | Bid-ask MM | None |
| Constraint-based arbitrage | 8 strategies | None | None | N/A |
| Multi-venue | Kalshi + Polymarket + Solana | Polymarket only | Polymarket only | Polymarket only |
| On-chain execution | Solana via DFlow + Jito | No | No | N/A (SDK) |
| Working paper | Yang (2026), SSRN | No | No | No |
| Tests | 633 | 0 | 0 | 50+ |
| License | Apache 2.0 | MIT | MIT | MIT |
Architecture
graph TD
A[Wang Transform Pricing Engine<br/>MLE coefficients from paper] --> B[Fair Value Estimator<br/>Model Greeks · Kelly Sizing]
B --> C[Strategy Layer]
C --> D[8 Constraint-Based Arbitrage]
C --> E[2 Model-Driven Strategies]
C --> F[LLM Agent Strategies]
D --> G[Trading Engine<br/>SpreadExecutor · Risk Manager · Position Tracker]
E --> G
F --> G
G --> H[Kalshi]
G --> I[Polymarket]
G --> J[Solana / DFlow]
Strategies
Constraint-based arbitrage — each exploits a violated probability axiom:
| Strategy | Invariant |
|---|---|
| Cross-Market | Same event, same price across exchanges |
| Exclusivity | $P(A) + P(B) \leq 1$ for mutually exclusive events |
| Implication | $P(A) \leq P(B)$ when A implies B |
| Conditional | $P(A \mid B) \in [L, U]$ within derived bounds |
| Event Sum | $\sum P(\text{outcome}_i) = 1$ within an event |
| Structural | $P(A) = \beta \cdot P(B) + \alpha$ from calibrated model |
Statistical arbitrage: cointegration spread (self-calibrating z-score), lead-lag (cross-correlation).
Model-driven: fair value divergence (Wang-model edge), premium decay (rides predictable premium lifecycle).
Pricing Engine
Deploys the Wang Transform from Yang (2026), calibrated on 291,309 contracts across 6 platforms:
$$p^{\text{mkt}} = \Phi\bigl(\Phi^{-1}(p^*) + \lambda\bigr), \quad \hat{\lambda} = 0.183 ; (p < 10^{-15})$$
- Hierarchical model: $\lambda_i = 0.259 - 0.072 \ln(1+V) + 0.143 \ln(1+D) - 0.477 |p-0.5|$
- Model Greeks: $\partial p / \partial \lambda$, Kelly fraction, edge decay rate
- Online calibrator: hybrid batch MLE + streaming EWMA with category shrinkage
- Correlation-aware risk: EWMA correlation matrix, effective exposure limits
Yang, Y. (2026). Pricing Prediction Markets: Risk Premiums, Incomplete Markets, and a Decomposition Framework. Working Paper, UIUC. [Replication package]
Quick Start
git clone https://github.com/YichengYang-Ethan/oracle3.git && cd oracle3
poetry install
oracle3 market list --exchange polymarket --limit 10
oracle3 dashboard --exchange solana --initial-capital 10000
See docs for full CLI reference.
Key Technical Choices
- Event-driven async engine with snapshot persistence and Unix socket control (pause/resume/killswitch)
- SpreadExecutor with automatic LIFO unwind on partial fills — no naked multi-leg positions
- Dual-layer risk: local position/drawdown/exposure limits + Solana
simulateTransactionpre-flight - On-chain audit trail via Solana Memo program; Jito bundle submission for MEV protection
- 633 tests, ruff, mypy, codespell CI on every push
Star History
Contributors
If oracle3 helps your research or trading, please ⭐ star the repo — it helps others find it.
License
Apache 2.0 — see LICENSE for details.
This software is for research and educational purposes. Trading involves financial risk.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oracle3-1.1.2.tar.gz.
File metadata
- Download URL: oracle3-1.1.2.tar.gz
- Upload date:
- Size: 332.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
246f7be584f95bc29eb680d933ef300b401c2292c189258fcca9d243b49ef153
|
|
| MD5 |
bf4c14d3dee026147b2f3a185b7111a6
|
|
| BLAKE2b-256 |
d77eb0bbe1a9ef6677bdb2b6de8eef833291f29379490a3aa0887b531bc2986a
|
Provenance
The following attestation bundles were made for oracle3-1.1.2.tar.gz:
Publisher:
pypi-publish.yml on YichengYang-Ethan/oracle3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oracle3-1.1.2.tar.gz -
Subject digest:
246f7be584f95bc29eb680d933ef300b401c2292c189258fcca9d243b49ef153 - Sigstore transparency entry: 1464675024
- Sigstore integration time:
-
Permalink:
YichengYang-Ethan/oracle3@86c2518a981e8c7d4738a54dd9eff1b1468bb527 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/YichengYang-Ethan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@86c2518a981e8c7d4738a54dd9eff1b1468bb527 -
Trigger Event:
release
-
Statement type:
File details
Details for the file oracle3-1.1.2-py3-none-any.whl.
File metadata
- Download URL: oracle3-1.1.2-py3-none-any.whl
- Upload date:
- Size: 407.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6806d76ba11ca4055430c51a86e0eb19cdad29399568a4d3ee8d6c0559a9309d
|
|
| MD5 |
5b17ab373b47204cbbd8e39913f97564
|
|
| BLAKE2b-256 |
50fc0adb8f36ec3eeb7f333f2ef0d075d207d1ac2c5dc7456fc9fdff28c0d451
|
Provenance
The following attestation bundles were made for oracle3-1.1.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on YichengYang-Ethan/oracle3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oracle3-1.1.2-py3-none-any.whl -
Subject digest:
6806d76ba11ca4055430c51a86e0eb19cdad29399568a4d3ee8d6c0559a9309d - Sigstore transparency entry: 1464675145
- Sigstore integration time:
-
Permalink:
YichengYang-Ethan/oracle3@86c2518a981e8c7d4738a54dd9eff1b1468bb527 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/YichengYang-Ethan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@86c2518a981e8c7d4738a54dd9eff1b1468bb527 -
Trigger Event:
release
-
Statement type: