Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developer.alterscope.org/llms.txt

Use this file to discover all available pages before exploring further.

pip install alterscope
import os
from alterscope import AlterscopeClient, freshness_status_of

client = AlterscopeClient(
    api_key=os.environ["ALTERSCOPE_API_KEY"],
    base_url="https://dev.alterscope.org",
)

oracle = client.oracles.classify(market_id="morpho-usdc-lending")
print("freshness", freshness_status_of(oracle))
import asyncio
import json
import os
import websockets

async def consume():
    headers = {"Authorization": f"Bearer {os.environ['ALTERSCOPE_API_KEY']}"}
    async with websockets.connect("wss://dev.alterscope.org/v2/events", additional_headers=headers) as ws:
        await ws.send(json.dumps({"action": "subscribe", "types": ["oracle.stale"]}))
        print(await ws.recv())

asyncio.run(consume())
import hashlib
import hmac

def verify(secret: bytes, body: bytes, header: str) -> bool:
    parts = dict(part.split("=", 1) for part in header.split(","))
    expected = hmac.new(secret, f"{parts['t']}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(parts["v1"], expected)
The Python client retries transient connection failures and 429 responses. Catch AuthenticationError, ForbiddenError, RateLimitError, and ServerError for explicit handling. Next: Pricing, Changelog, API Reference, Recipes.