Skip to content

steelthedev/exec-trade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exec Trade

Low-latency execution infrastructure for real-time crypto prediction markets.

Overview

Exec Trade is a real-time market engine designed to power short-duration prediction markets on crypto assets such as BTC, ETH, and SOL.

The system aggregates prices from multiple exchanges, generates executable strike ladders, signs market data cryptographically, and distributes live markets to clients over WebSockets.

The long-term vision is to combine:

  • Off-chain low-latency market generation
  • On-chain escrow and settlement using Solana
  • Deterministic execution and settlement

Current Architecture

Exchange Feeds
    │
    ▼
Aggregator
    │
    ▼
Market Engine
    │
    ├── Strike Generation
    ├── Probability Computation
    ├── Market Signing
    └── Redis Caching
    │
    ▼
WebSocket Distribution
    │
    ▼
Frontend Clients

Implemented Features

Multi-Exchange Market Data Aggregation

Live market data is consumed from:

  • Binance
  • Coinbase
  • Kraken
  • Bybit

The aggregator normalizes symbols and produces a unified market snapshot.

Example:

{
  "symbol": "BTC/USDT",
  "price": 76315.99,
  "provider_count": 2,
  "confidence": 0.2
}

Aggregated Market Snapshot

The aggregator maintains an in-memory view of the latest market state.

AggregatedSnapshot {
    markets: Vec<AggregatedMarket>
}

Strike Ladder Generation

The market engine generates strike ladders around the current spot price.

Example:

BTC Spot: 76315

76100
76200
76300
76400
76500

Asset-specific spacing is supported.

Example:

BTC → 100
ETH → 10
SOL → 1

Probability Engine

A basic probability model computes directional pricing for each strike.

Outputs:

UP Probability
DOWN Probability

Example:

Strike: 76400

UP   = 0.43
DOWN = 0.57

This model will be replaced later with more sophisticated market-making logic.


Live Market Generation

For every strike generated:

LiveMarket {
    quote_id,
    symbol,
    strike,
    up_price,
    down_price,
    expiry_ts,
    generated_at
}

Markets are regenerated continuously as new prices arrive.


Cryptographic Signing

All generated markets are signed using a Solana keypair.

This ensures:

  • Market authenticity
  • Execution integrity
  • Future on-chain verification

Signed market structure:

SignedLiveMarket {
    market,
    signature,
    signer
}

Redis Integration

Redis acts as the hot execution cache.

Current responsibilities:

Symbol Market Surface

markets:BTCUSDT
markets:ETHUSDT
markets:SOLUSDT

Stores active executable markets.

Quote Lookup

quote:<quote_id>

Stores individual signed markets.

TTL Support

Markets automatically expire and are regenerated continuously.


WebSocket Streaming

Signed live markets are streamed to frontend clients.

This enables:

  • Real-time updates
  • Live strike ladders
  • Dynamic probability changes
  • Low-latency market visualization

Project Structure

crates/

├── api/
│   ├── websocket endpoints
│   ├── http endpoints
│   └── application state
│
├── feeds/
│   ├── binance
│   ├── coinbase
│   ├── kraken
│   └── bybit
│
├── aggregator/
│   └── market aggregation logic
│
├── market-engine/
│   ├── strike generation
│   ├── probability engine
│   ├── live market generation
│   └── redis caching
│
├── signer/
│   └── cryptographic signing utilities
│
└── common/
    └── shared types

Redis

Start Redis:

docker compose up -d

Redis runs on:

localhost:6379

RedisInsight:

http://localhost:5540

Current Status

Completed:

  • Feed ingestion
  • Aggregation engine
  • Strike ladder generation
  • Probability generation
  • Market signing
  • Redis integration
  • WebSocket distribution
  • In-memory market cache

In Progress:

  • Frontend market terminal
  • Market visualization
  • Execution engine

Planned:

  • Position creation
  • Quote execution
  • Replay protection
  • Settlement engine
  • Solana PDA escrow accounts
  • On-chain settlement
  • User balances
  • Risk engine
  • Oracle validation
  • Multi-market support

Long-Term Vision

Exec Trade aims to become a low-latency execution layer for crypto prediction markets.

Market generation remains off-chain for speed while custody and settlement move on-chain through Solana programs and PDA-based escrow accounts.

This architecture combines:

  • Centralized exchange performance
  • Decentralized settlement guarantees
  • Real-time prediction market trading

License

Private - Internal Development

About

Exec Trade is a real-time market engine designed to power short-duration prediction markets on crypto assets such as BTC, ETH, and SOL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages