Skip to main content

API Reference

Integrate Oyrade market data and trading execution into your application.

Oyrade provides a robust HTTP REST API for data retrieval and a WebSocket interface for real-time market updates.


Authentication

Most market data is public (GET requests). However, placing orders or viewing private position data requires a signed wallet message.

Headers required for private endpoints:

Authorization: Bearer <signed_message>
X-Wallet-Address: <your_solana_pubkey>

REST Endpoints

1. Market Data

Retrieve information about active, resolved, or upcoming markets.

List Markets

GET /v1/markets

Fetches a paginated list of markets.

Parameters:

  • category: Filter by crypto, sports, politics.
  • status: active or resolved.
  • limit: Default 50.
// Response
{
"markets": [
{
"id": "CAM...xyz",
"question": "Will Bitcoin break $100k in 2026?",
"yesPrice": 0.32,
"volume24h": 450000
}
]
}

Get Market Details

GET /v1/markets/:id

Returns full metadata for a specific market, including the oracle resolution source and token mint addresses.


2. Trading Operations

Get Execution Quote

POST /v1/quotes

Get the estimated impact and return for a trade before executing it.

Body:

{
"marketId": "CAM...xyz",
"side": "yes",
"amount": 100 // USDC
}

Response:

{
"sharesExpected": 156.25,
"avgPrice": 0.64,
"priceImpact": 0.50, // %
"fee": 0.02
}

WebSocket Stream

Connect to our WebSocket logic to receive real-time order book and price updates.

Endpoint: wss://ws.oyrade.io

Subscribe to a Market

Send this JSON message immediately after connection:

{
"type": "subscribe",
"channel": "market_updates",
"ids": ["CAM...xyz"]
}

Event: Price Update

You will receive push events whenever a trade occurs that shifts the odds.

{
"type": "price_update",
"marketId": "CAM...xyz",
"timestamp": 1709845200,
"data": {
"yes": 0.33,
"no": 0.67
}
}

Rate Limits

ScopeLimit
Public IP100 requests / minute
Authenticated1,000 requests / minute
WebSocket50 messages / second

Need higher limits?
Contact our team on Discord for an API Key.