wss://api.doppapp.com/v1/public/ws/get_order_book?currency={currency}&instrument_name={instrument_name}
currency
instrument_name
{ "instrument_id": "0x06ab5246259e470647b5b2a471acca3889fc89667cebd10b9d440cafbee65d40", "strike_price": 67000.0, "base_currency": "BTC", "expiration_date": 1721980800, "side": "CALL", "mark_price": 0.04285714285714286, "best_bid_price": 0, "best_bid_amount": 0, "best_ask_price": 0, "best_ask_amount": 0, "bids_prices": [], "bids_amounts": [], "asks_prices": [], "asks_amounts": [], "bid_iv": 0, "ask_iv": 0, "greeks": { "delta": 0, "gamma": 0, "vega": 0, "theta": 0, "rho": 0 } }
import websockets import asyncio import json async def main(): currency = "BTC" instrument_name = "BTC-26JUL24-67000-C" uri = f"wss://api.doppapp.com/v1/public/ws/get_order_book?currency={currency}&instrument_name={instrument_name}" async with websockets.connect(uri) as websocket: print("Connected to WebSocket") while True: try: message = await websocket.recv() data = json.loads(message) print(f"Received update: {data}") except websockets.exceptions.ConnectionClosed: print("WebSocket connection closed") break asyncio.get_event_loop().run_until_complete(main())
pip install websockets
main.py
python main.py