Market Creator is an autonomous service that uses news feeds and LLMs to create and manage prediction markets on Omen (Gnosis chain). It is an agent service built on the Open Autonomy framework.
Each cycle, the agent runs an ABCI FSM that goes through these phases:
- Deposit DAI — wrap xDAI into wxDAI for market funding.
- Collect proposed markets — decide how many new markets are needed per upcoming opening timestamp.
- Propose and approve markets — call the
propose-questionMech tool to generate candidate questions from current news, then push approved candidates to a market approval server. - Create markets on-chain — pull approved markets from the server and multisend:
- FPMM deployment via
FPMMDeterministicFactory - Liquidity funding
- Realitio question creation
- FPMM deployment via
- Recover funds from closed markets — via three dedicated sub-skills:
omen_fpmm_remove_liquidity_abci— remove LP from expired marketsomen_realitio_withdraw_bonds_abci— reclaim Realitio bondsomen_ct_redeem_tokens_abci— redeem winning conditional tokens
-
System requirements:
- Python
>=3.10, <3.15 - Tendermint
==0.34.19 - uv
- Docker Engine
- Docker Compose
- Python
Clone and install:
git clone https://github.com/valory-xyz/market-creator.git
-
Create development environment:
uv sync --all-groups source .venv/bin/activate -
Configure the Open Autonomy framework:
autonomy init --reset --author valory --remote --ipfs --ipfs-node "/dns/registry.autonolas.tech/tcp/443/https" -
Pull packages required to run the service:
autonomy packages sync --update-packages
You need a Gnosis keypair and a Safe address.
Create keys.json:
cat > keys.json << EOF
[
{
"address": "YOUR_AGENT_ADDRESS",
"private_key": "YOUR_AGENT_PRIVATE_KEY"
}
]
EOFFor the Safe, you can register the service on the OLAS Protocol ((canonical agent id 12) or set up your own Safe.
Set these environment variables (defaults in service.yaml):
# Chain
export GNOSIS_LEDGER_RPC=YOUR_RPC
export ALL_PARTICIPANTS='["YOUR_AGENT_ADDRESS"]'
export SAFE_CONTRACT_ADDRESS=YOUR_SAFE_ADDRESS
# News + LLM
export NEWSAPI_ENDPOINT=https://newsapi.org/v2
export NEWSAPI_API_KEY=YOUR_NEWSAPI_KEY
export OPENAI_API_KEY=YOUR_OPENAI_KEY
export SERPER_API_KEY=YOUR_SERPER_KEY
export SUBGRAPH_API_KEY=YOUR_THEGRAPH_KEY
# Market approval server (see below)
export MARKET_APPROVAL_SERVER_URL=http://127.0.0.1:5000
export MARKET_APPROVAL_SERVER_API_KEY=YOUR_SERVER_API_KEY
# Market generation tuning
export MARKETS_TO_APPROVE_PER_DAY=10
export APPROVE_MARKET_EVENT_DAYS_OFFSET=5
export MARKET_FEE=2.0
export INITIAL_FUNDS=1.0
export MARKET_TIMEOUT=1
export MIN_MARKET_PROPOSAL_INTERVAL_SECONDS=7200
export TOPICS='["business","science","technology","politics","finance","international"]'Key variables:
| Variable | Purpose |
|---|---|
ALL_PARTICIPANTS |
JSON list of agent addresses (single-agent setup: one entry) |
SAFE_CONTRACT_ADDRESS |
Multisig for the service |
NEWSAPI_API_KEY |
NewsAPI key for news ingestion |
OPENAI_API_KEY |
Key used by the propose-question Mech tool |
SERPER_API_KEY |
Google Serper key used by the tool for supplementary search |
SUBGRAPH_API_KEY |
The Graph API key (Omen/Realitio subgraphs) |
MARKET_APPROVAL_SERVER_URL |
Approval server endpoint (publicly reachable in production) |
MARKETS_TO_APPROVE_PER_DAY |
Target count of approved markets per opening timestamp |
APPROVE_MARKET_EVENT_DAYS_OFFSET |
How far in the future markets are opened (default 5 days) |
MARKET_FEE |
LP fee, percent |
INITIAL_FUNDS |
Initial liquidity in wxDAI |
MARKET_TIMEOUT |
Realitio challenge window, days |
TOPICS |
JSON list of news topics to draw from |
The service proposes markets to a separate approval server before creating them on-chain.
- Pick an API key and compute its SHA-256:
echo -n "your_api_key" | sha256sum
- Create
market_approval_server/server_config.json:{ "proposed_markets": {}, "approved_markets": {}, "rejected_markets": {}, "processed_markets": {}, "api_keys": { "YOUR_SHA256_HASH": "default_user" } } - Run the server (market_approval_server.py):
python market_approval_server/market_approval_server.py
- Explore endpoints at
http://localhost:5000/.
autonomy fetch --local --service valory/market_maker && cd market_maker
autonomy build-image
cp path/to/keys.json .
autonomy deploy build --n 1 -ltm
autonomy deploy run --build-dir abci_build/The repo provides a Make target that wraps aea-helpers run-agent:
pip install open-aea-helpers- Set up your
.envfile with required environment variables - Place your
ethereum_private_key.txtin the repo root - Run:
aea-helpers run-agent \
--name valory/market_maker \
--connection-keyTo run multiple agents on the same machine, add --free-ports.
aea-helpers run-service --name valory/market_maker --env-file .env-
Agent Setup
- You only need a signer key pair and agent address
- You can reuse existing trader agent credentials
- No need for full service registration
-
OpenAI Configuration
- Create an OpenAI account
- Generate an API key
- Fund account with minimum $5
- Add key to
.env
-
The Graph Integration
- Generate an API key from The Graph platform
- Set
SUBGRAPH_API_KEYin.env
-
Market Approval Server
- Generate a server API key
- Create its SHA-256 hash:
echo -n "your_api_key_here" | sha256sum
- Create a file
market_approval_server/server_config.jsonwith content of
{ "proposed_markets": {}, "approved_markets": {}, "rejected_markets": {}, "processed_markets": {}, "api_keys": { "7b97e2b52334e1da7a395ae53ebdbd42382fa77f4dac9017569579d58db42d08": "default_user" } }- Add hash to
market_approval_server/server_config.json - Configure server URL in
.env:MARKET_APPROVAL_SERVER_URL=http://host.docker.internal:5000
-
Blockchain Connection
- Create Tenderly account
- Generate virtual RPC endpoint
- Update
GNOSIS_LEDGER_RPCin.env
- Start market approval server (see section above)
- Launch market maker service
- Monitor service operation through logs
Note: Ensure all environment variables in .env are properly set before launching services.
This service depends on third-party AEA packages sourced from the following upstream repositories (all under valory-xyz on GitHub):
| Repository | What it provides |
|---|---|
| open-aea | AEA framework: protocols (contract_api, ledger_api, http, signing, etc.), connections, base contracts (gnosis_safe, multisend, service_registry) |
| open-autonomy | Core framework: abstract_round_abci, registration, transaction_settlement, reset_pause, termination |
| mech-interact | mech_interact_abci skill, mech/mech_mm/ierc1155 contracts |
| genai | GenAI-related packages (NVM contracts, subscription, etc.) |
| trader | realitio, realitio_proxy, conditional_tokens contracts |
These packages are synced from IPFS via autonomy packages sync --all and are not committed to the repository.
The market maker agent is configured to work with the Gnosis chain by default, if you want to use the agent with other chains you can figure out what contracts to use from here
You can explore the service.yaml file, which contains all the possible configuration variables for the service.
The Safe of the service holds the collateral token used to provide the initial liquidity to the markets created. By default the service uses WxDAI as collateral. This is configured through the environment variable COLLATERAL_TOKEN_CONTRACT, which points to the address of the collateral token to be used for market. The default is WxDAI.
Finally, if you are experienced with the Open Autonomy framework, you can also modify the internal business logic of the service yourself.