Verified Price Feeds

Perfect for StarkEx integrations and applications requiring cryptographic verification of price data

Overview

If you are building on StarkEx or need a robust verification mechanism for price data, this endpoint provides real-time feeds with cryptographic signatures to ensure data integrity and provenance.

Connection

1

Open WebSocket Connection

Connect to our WebSocket endpoint on your preferred environment:

wscat -c wss://ws.devnet.pragma.build/node/v1/data/subscribe
2

Subscribe to Asset Pairs

Send a subscription message to start receiving updates every 500 milliseconds.

Subscription Management

Subscribing to Pairs

{
  "msg_type": "subscribe",
  "pairs": ["BTC/USD", "ETH/USD:MARK"]
}

The response includes all pairs you are currently subscribed to, including any previous subscriptions not mentioned in your latest request.

Unsubscribing from Pairs

{
  "msg_type": "unsubscribe",
  "pairs": ["BTC/USD"]
}

Price Types

Median price from spot markets across supported exchanges.

Format Example: BTC/USD

By default, subscriptions are for index prices. Subscribing to a pair without specifying the type will subscribe to the index price.

Data Format

{
  "global_asset_id": "0x12345",
  "median_price": "10000000000000001",
  "signature": "0x154786876ae878",
  "signed_prices": [
    {
      "oracle_asset_id": "0x12345000000000ABCDEF",
      "oracle_price": "1000000000000000000",
      "signing_key": "0x1234567890ABCDEF",
      "timestamp": "1234567",
      "signature": "0x1234567890ABCDEF"
    },
    {
      "oracle_asset_id": "0x12345000000000FEDCBA",
      "oracle_price": "1000000000000000002",
      "signing_key": "0xFEDCBA0987654321",
      "timestamp": "1234567",
      "signature": "0x1234567890ABCDEF"
    }
  ]
}

Field Reference

FieldDescription
global_asset_idUnique identifier for the asset encoded using the pair name
median_priceThe median price of the asset
signatureSignature of the median price by the Pragma oracle
signed_pricesArray of the prices used to compute the median price
oracle_asset_idUnique identifier encoded using the pair and publisher names
oracle_pricePrice provided by the oracle
signing_keyKey used by the oracle to sign the price
timestampTime when the price was recorded
signatureSignature of the price by our publisher

All numeric values are returned as strings to preserve precision, especially for assets with very small or very large prices.

Integration Examples

We’ve created a ready-to-use example with a terminal UI for testing this endpoint:

# Clone the repository
git clone https://github.com/astraly-labs/pragma-node

# Run the example
cargo run --example starkex

Comparison with Lightspeed

Starkex

  • ✓ Includes cryptographic signatures
  • ✓ Verifiable price data
  • ✓ Individual publisher prices
  • ✓ Ideal for StarkEx integration
  • ⚠️ Slightly larger payload size

Lightspeed

  • ✓ Minimal payload size
  • ✓ Optimized for performance
  • ✓ Lower latency
  • ✓ Ideal for trading applications
  • ❌ No verification metadata

Choose Starkex when data provenance and verification are required, and Lightspeed when raw performance is your primary concern.