Skip to content

Repository files navigation

Ivry - Bloomberg Terminal for Prediction Markets

A Bloomberg Terminal-style platform for prediction markets, creating financial derivatives on top of existing prediction market contracts from Kalshi, Polymarket, and Manifold.

Vision

Ivry creates synthetic financial assets from prediction markets:

  • ** Index Products**: Combined baskets of related contracts (e.g., Election Index, Crypto Index)
  • ** Volatility Options**: Hedge against prediction market volatility
  • ** Single Contracts**: Individual prediction market positions
  • ** Basket Products**: Diversified portfolios across themes

Users can search, discover, and trade these financial instruments through a professional trading terminal interface.

Monorepo Structure

arbitrader-1/
├── src/arbitrader/      # Python backend
│   ├── clients/         # API clients for Kalshi, Polymarket, Manifold
│   ├── flows/           # Prefect workflows for data collection
│   ├── models/          # Data models
│   ├── services/        # Embeddings, Qdrant (vector DB), Clustering
│   └── api/             # FastAPI layer (coming soon)
├── frontend/            # Next.js Terminal UI (Dark Mode)
│   ├── app/             # Pages and routes
│   ├── components/      # Terminal-style React components
│   └── lib/             # Types and data models
└── README.md

Setup

  1. Install dependencies:
pip install -e .
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your API keys if needed

For Qdrant Cloud:

  • Set QDRANT_URL to your cluster URL (e.g., https://xxx.qdrant.io)
  • Set QDRANT_API_KEY to your API key
  • Leave QDRANT_HOST and QDRANT_PORT empty

For local Qdrant:

  • Set QDRANT_HOST=localhost and QDRANT_PORT=6333
  • Leave QDRANT_URL and QDRANT_API_KEY empty
  1. Start Qdrant (if using local instance):
docker run -p 6333:6333 qdrant/qdrant

Running the Flow

Running directly:

python run_flow.py

Using Prefect CLI (Prefect 3.x):

# Deploy the flow
prefect deploy src/arbitrader/flows/market_events.py:process_market_events --name market-events

# Run the deployment
prefect deployment run process_market_events/market-events

Using Prefect Flow Server (for development):

python deploy.py

This will start a flow server that you can trigger via the Prefect UI or API.

Backend Project Structure

  • src/arbitrader/ - Main Python package
    • clients/ - API clients for Kalshi, Polymarket, and Manifold
    • flows/ - Prefect workflow definitions
    • models/ - Data models
    • services/ - Embedding, Qdrant, and Clustering services
    • config.py - Configuration settings

Frontend

The Next.js frontend is in the frontend/ directory. See frontend/README.md for details.

cd frontend
npm install
npm run dev  # Runs on http://localhost:3000

Features

  • Fetches events from Kalshi and Manifold APIs
  • Generates embeddings using MiniLM-L6-V2 model
  • Stores events and embeddings in Qdrant vector database
  • Uses Prefect for workflow orchestration with retries and error handling

Manifold API

Manifold API works without authentication for public data. Optional API key can be added to .env if needed.


SETUP:

BACKEND: python -m venv .venv .venv\Scripts\activate pip install uv pip install google-genai uv sync

proceed with post setup

FRONTEND: cd frontend npm install

POST SETUP

RUN BACKEND: .venv\Scripts\activate uvicorn src.arbitrader.api.server:app --reload --host 0.0.0.0 --port 8000

RUN FRONTEND: cd frontend npm run dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages