Locally runnable server with built-in data caching, providing both tick-level historical and consolidated real-time cryptocurrency market data via HTTP and WebSocket APIs
I am only able to stream data from coinbase. I'm unable to stream data from binance. I am using the following code to stream:
`import asyncio
import aiohttp
import json
import urllib.parse
stream_options = [
{
"exchange": "coinbase",
"symbols": ["BTC-USD"],
"dataTypes": data_types,
},
{
"exchange": "binance",
"symbols": ["BTCUSDT"],
"dataTypes": data_types,
},
]
options = urllib.parse.quote_plus(json.dumps(stream_options))
URL = f"ws://localhost:8001/ws-stream-normalized?options={options}"
# real-time normalized data for two exchanges via single connection
async with aiohttp.ClientSession() as session:
async with session.ws_connect(URL) as websocket:
print(websocket.closed)
async for msg in websocket:
print(msg.data)
asyncio.run(run())
`
I am getting the following error for bianance
tardis-dev:machine WebSocket /ws-stream-normalized binance WS connection error: Error: Unexpected server response: 451 at ClientRequest.<anonymous> (/home/ec2-user/.nvm/versions/node/v16.18.1/lib/node_modules/tardis-machine/node_modules/ws/lib/websocket.js:886:7) at ClientRequest.emit (node:events:513:28) at HTTPParser.parserOnIncomingClient (node:_http_client:693:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:534:22) at TLSSocket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) +596ms
I am only able to stream data from coinbase. I'm unable to stream data from binance. I am using the following code to stream: `import asyncio import aiohttp import json import urllib.parse
async def run(): data_types = ["trade"] #"trade" book_snapshot_25_0ms
asyncio.run(run()) `
I am getting the following error for bianance
tardis-dev:machine WebSocket /ws-stream-normalized binance WS connection error: Error: Unexpected server response: 451 at ClientRequest.<anonymous> (/home/ec2-user/.nvm/versions/node/v16.18.1/lib/node_modules/tardis-machine/node_modules/ws/lib/websocket.js:886:7) at ClientRequest.emit (node:events:513:28) at HTTPParser.parserOnIncomingClient (node:_http_client:693:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:534:22) at TLSSocket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) +596ms