Skip to main content

Overview

Limitless is a decentralized prediction market platform with WebSocket support for real-time orderbook streaming.
FeatureStatus
REST APIFull Support
WebSocketOrderbook Streaming
AuthenticationEthereum Wallet

Configuration

Basic Setup

use pc_exchange_limitless::{Limitless, LimitlessConfig};

let config = LimitlessConfig::new();
let exchange = Limitless::new(config)?;

// Fetch public market data
let markets = exchange.fetch_markets(None).await?;

Authenticated Setup

use pc_exchange_limitless::{Limitless, LimitlessConfig};

let config = LimitlessConfig::new()
    .with_private_key("0x...");  // Your Ethereum private key

let exchange = Limitless::new(config)?;

Full Configuration

use pc_exchange_limitless::{Limitless, LimitlessConfig};

let config = LimitlessConfig::new()
    .with_private_key("0x...")
    .with_verbose(true);

let exchange = Limitless::new(config)?;

Environment Variables

export LIMITLESS_PRIVATE_KEY="0x..."

Examples

Fetch Markets

use pc_core::{Exchange, FetchMarketsParams};
use pc_exchange_limitless::{Limitless, LimitlessConfig};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let exchange = Limitless::new(LimitlessConfig::new())?;

    let markets = exchange
        .fetch_markets(Some(FetchMarketsParams {
            limit: Some(10),
            active_only: true,
        }))
        .await?;

    for market in markets {
        println!("─────────────────────────────────");
        println!("Question: {}", market.question);
        println!("Volume: ${:.0}", market.volume);

        for (outcome, price) in &market.prices {
            println!("  {}: {:.1}%", outcome, price * 100.0);
        }
    }

    Ok(())
}

Place an Order

use pc_core::{Exchange, OrderSide};
use std::collections::HashMap;

let config = LimitlessConfig::new()
    .with_private_key("0x...");
let exchange = Limitless::new(config)?;

let order = exchange
    .create_order(
        "market-id",
        "Yes",
        OrderSide::Buy,
        0.60,
        50.0,
        HashMap::new(),
    )
    .await?;

println!("Order: {} - {:?}", order.id, order.status);

WebSocket Streaming

Limitless supports real-time orderbook streaming:
use pc_core::OrderBookWebSocket;
use pc_exchange_limitless::LimitlessWebSocket;
use futures::StreamExt;

let mut ws = LimitlessWebSocket::new();

ws.connect().await?;
ws.subscribe("market-id").await?;

let mut stream = ws.orderbook_stream("market-id").await?;

while let Some(result) = stream.next().await {
    let orderbook = result?;

    if let (Some(bid), Some(ask)) = (orderbook.best_bid(), orderbook.best_ask()) {
        println!("Bid: {:.4} | Ask: {:.4}", bid, ask);
    }
}

ws.disconnect().await?;

Next Steps