This project demonstrates a fully autonomous prediction market powered by three cooperating agents that provide liquidity, trade, resolve outcomes, and settle value using onchain USDC.
The system runs continuously without human intervention and includes an LLM-driven trading agent that adapts to real-time market conditions.
Each round follows a fully autonomous lifecycle:
- A Maker agent provides liquidity.
- A Trader agent monitors BTC price movement and uses an LLM-based decision engine.
- A Resolver agent settles the outcome using external price data.
- The winning side is automatically redeemed.
- USDC flows back into the system for the next round.
This creates a continuous, agent-native economic loop.
Responsibilities:
- Mints YES and NO shares.
- Provides sell-side liquidity.
- Maintains balanced inventory.
- Reposts liquidity when inventory is consumed.
Goal:
Maintain a functional prediction market for other agents.
Responsibilities:
- Monitors BTC price in real time.
- Tracks short-term volatility.
- Evaluates time remaining in the round.
- Sends market state to a large language model (LLM).
- Executes YES, NO, or HOLD decisions on-chain.
Strategy:
- Record BTC opening price at round start.
- Track live BTC price every few seconds.
- Calculate short-term volatility.
- Determine if price movement is significant.
- Send market data to the LLM.
- Execute the LLM’s decision on-chain.
Example LLM input:
BTC open: 64210
BTC now: 64262
Move: +52
Volatility: 18
Time left: 280s
YES price: 0.74
NO price: 0.26
LLM output:
YES
Goal:
Take adaptive, AI-driven directional positions using real-time data and LLM reasoning.
Responsibilities:
- Detects round end.
- Fetches BTC open and close prices.
- Resolves the market outcome.
- Automatically redeems winnings.
Goal:
Ensure correct settlement and value distribution.
The system forms a continuous agent economy:
Maker → provides liquidity Trader → takes LLM-driven positions Resolver → settles outcome Trader/Maker → receive USDC Cycle repeats
All value is settled in USDC.
Core contract:
src/BTC15AutoMarket.sol
Features:
- 15-minute BTC direction rounds
- YES / NO share minting
- Onchain orderbook
- Autonomous resolution
- USDC settlement
agents/
maker_agent.py
trader_agent.py
resolver_agent.py
run_all.sh
src/
BTC15AutoMarket.sol
script/
BTC15Deploy.s.sol
.env.example
README.md
foundry.toml
Python:
pip install web3 python-dotenv requests
Optional (for contract deployment):
curl -L https://foundry.paradigm.xyz | bash
foundryup
Copy the example file:
cp .env.example .env
Fill in:
RPC=<RPC URL>
MARKET=<DEPLOYED MARKET ADDRESS>
USDC=<USDC TOKEN ADDRESS>
MAKER_KEY=<PRIVATE KEY>
TRADER_KEY=<PRIVATE KEY>
RESOLVER_KEY=<PRIVATE KEY>
GROQ_API_KEY=<LLM API KEY>
- Use testnet or disposable wallets only.
- Never use production private keys.
- The agents execute transactions automatically.
cd agents
./run_all.sh
Agents will:
- Detect new rounds
- Provide liquidity
- Trade using LLM decisions
- Resolve outcomes
- Redeem winnings
No manual interaction required.
- New round starts.
- Maker posts YES/NO liquidity.
- Trader detects BTC move.
- LLM decides YES, NO, or HOLD.
- Trader executes the decision.
- Round ends.
- Resolver resolves outcome.
- Winnings are redeemed automatically.
No human steps required.
Trader uses real-time volatility signals and an LLM to determine positions.
Agents:
- Provide liquidity
- Trade using LLM reasoning
- Settle value onchain
All value flows use USDC.