Skip to main content

Coinjure

Agent-Native Trading System for Prediction Markets

Python 3.10+ PyPI version License Slack WeChat Blog Docs

Coinjure is an agent-native trading framework for prediction markets. It empowers LLM agents to drive the entire strategy lifecycle purely through CLI commands — autonomously discovering cross-market relations, building executable strategies, running large-scale backtests, and deploying to live execution.

Using Coinjure, LLM agents can discover over 100 backtest-positive strategies in a single hour — a capability validated by deploying to live trading and generating real profit on prediction market exchanges.

Demos

Installation

pip install coinjure

From source:

git clone https://github.com/ulab-uiuc/prediction-market-cli.git
cd prediction-market-cli
pip install poetry
poetry install

Quick Start

1) Discover — find markets and detect tradable relations

coinjure market discover -q "election" --exchange both --limit 20

Searches Polymarket and Kalshi, then auto-detects structural relations (exclusivity, complementary, implication) within each event. Discovered relations are persisted to ~/.coinjure/relations.json.

2) Backtest — validate strategies against historical data

coinjure engine backtest --all-relations

Each relation type auto-selects its matching strategy (see table above). Only relations with positive PnL advance to the next stage.

3) Paper trade — simulate live execution

coinjure engine paper-run --all-relations --detach

Deploys all backtest-passed strategies as independent background processes. Use coinjure engine monitor to attach a live TUI dashboard.

4) Live trade — execute with real funds

coinjure engine live-run --exchange polymarket --all-relations --detach

Requires exchange credentials (see Environment Variables).

5) Monitor and control

coinjure engine monitor         # live TUI across all engines
coinjure engine pause  --all    # pause all strategies
coinjure engine resume --all    # resume
coinjure engine killswitch --on # emergency halt

Coinjure Monitor

System Overview

The pipeline has four stages:

LLM Agent + market data
    → [1. Discovery]  — discover cross-market relations via CLI
    → [2. Backtest]   — validate each relation against historical data
    → [3. Execution]  — paper-trade or live-trade validated strategies
    → [4. Monitoring]  — human operator monitors and intervenes when needed

Core runtime components:

TradingEngine
  ├── DataSource          (Live / Historical / Hub)
  ├── Strategy            (Relation-based / LLM-powered / Custom)
  └── Trader              (PaperTrader / PolymarketTrader / KalshiTrader)
       ├── RiskManager    (Standard / Conservative / Aggressive)
       └── PositionManager

Each engine instance runs as an independent OS process, allowing hundreds of strategies to execute in parallel without shared-state contention. A ControlServer (Unix socket) provides per-instance pause/resume/status/stop, while the StrategyRegistry persists portfolio state across sessions.

Human-in-the-Loop Model

The operator is intentionally lightweight:

  • Use coinjure engine monitor for live TUI visibility across all running engines.
  • Use coinjure engine pause|resume|stop for intervention.
  • Use coinjure engine killswitch --on for emergency halt.
  • Use coinjure engine swap for hot-swapping strategy logic without restarting.

The operator should not need to manually place/cancel orders in normal operation.

CLI Reference

coinjure market — Market discovery and analysis

Command Description
market info Fetch detailed info for a market (by ID or slug)
market discover Multi-keyword search + auto structural relation discovery
market news Fetch news headlines (Google, RSS, TheNewsAPI)
market relations list List stored market relations (filter by type/status)
market relations add Create a relation between 2+ markets
market relations remove Remove a relation by ID

coinjure engine — Trading engine and portfolio management

Command Description
engine paper-run Start paper trading (single strategy or --all-relations batch)
engine live-run Start live trading with real funds
engine backtest Backtest relations against historical order book data
engine list Show all strategies in the portfolio registry
engine status Show engine status: positions, PnL, decisions, trades
engine pause Pause decision-making (--all for all instances)
engine resume Resume after pause
engine stop Graceful shutdown (--all for all instances)
engine swap Hot-swap strategy without restarting
engine retire Stop and mark as retired (--all for all instances)
engine promote Promote relation(s) from paper to deployed
engine monitor Attach live TUI dashboard to running engines
engine killswitch Toggle the global emergency kill-switch

Environment Variables

export POLYMARKET_PRIVATE_KEY="your_private_key"      # Polymarket live trading
export KALSHI_API_KEY_ID="your_kalshi_key_id"         # Kalshi live trading
export KALSHI_PRIVATE_KEY_PATH="/path/key.pem"        # Kalshi live trading

Citation

If you find Coinjure useful in your research or work, please cite:

@software{coinjure2026,
  title   = {Coinjure: An Agent-Native Trading System for Prediction Markets},
  author  = {Yu, Haofei and Yang, Yicheng and Liu, Yuxiang and You, Jiaxuan},
  year    = {2026},
  url     = {https://github.com/ulab-uiuc/prediction-market-cli},
  note    = {University of Illinois Urbana-Champaign}
}

License

MIT

Disclaimer

This software is for educational and research use. Live trading carries financial risk.

Metadata

Release files for coinjure 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coinjure 0.1.1
File Size Uploaded Provenance Actions
coinjure-0.1.1.tar.gz 174.6 kB Without provenance Details for coinjure-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coinjure 0.1.1
File Interpreter ABI Platform Actions
coinjure-0.1.1-py3-none-any.whl Python 3 none any Details for coinjure-0.1.1-py3-none-any.whl

Total release size: 390.7 kB

Release files / coinjure-0.1.1.tar.gz

Download URL coinjure-0.1.1.tar.gz
Size 174.6 kB
Tags Source
SHA-256 checksum
How to use checksums
515725234de39c27fb3b2a23944332b9b8c98b73640076ba4fc4ed7445008700
BLAKE2b-256 checksum
How to use checksums
537964b2205f5955761c8eb23aaa02c3e7d276cb7f71f216ad7b95009b7a54bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.10.16 Darwin/22.6.0

Release files / coinjure-0.1.1-py3-none-any.whl

Download URL coinjure-0.1.1-py3-none-any.whl
Size 216.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88c2af96473ac884f60432f3e0443235fd03f58fb2eac1788373ca16bba1923f
BLAKE2b-256 checksum
How to use checksums
20c5bd3afecd078b7fab37accae93b6917e76f2f5e0acd0b231fa34792ea7a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.10.16 Darwin/22.6.0

Security for coinjure 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page