Connecting
Connecting to the WebSocket API
Connecting to the SFOX websocket feed gives you access to real-time market data from all supported exchanges.
Environment
Endpoint
Production
wss://ws.sfox.com
Sandbox
Contact Support
NodeJS
Python
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.sfox.com/ws');
// don't forget to subscribe (see below)
ws.on('message', function(data) {
// Do something with data
console.log(data);
});
import asyncio
import websockets
async def main(uri):
async with websockets.connect(uri) as ws:
# don't forget to subscribe (see below)
async for msg in ws:
print(msg)
asyncio.run(main("wss://ws.sfox.com/ws"))
Copy link