Hello,
ok, I tried everything I could find and it is not working. There are multiple wss URLs out there and I tried them all. The one below is the one I ended up with that seems to give me some sort of response. I’m just trying to get market trade data in real-time for US stocks.
I am able to connect to many WebSockets to get data, but this one, I have no idea why it is not sending me any message after I send a listen command.
I connect to **wss://data.alpaca.markets/stream**
and send it this payload:
{‘action’: ‘authenticate’, ‘data’ : { ‘key_id’: MY_API_KEY, ‘secret_key’: MY_API_KEY_SECRET } }
I get this response:
message { target: WebSocket, isTrusted: true, data: "{\"stream\":\"authorization\",\"data\":{\"action\":\"authenticate\",\"status\":\"authorized\"}}", origin: "wss://data.alpaca.markets", lastEventId: "", ports: Restricted, srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, … }
So I am connected and authenticated.
Then I send it this command:
{ 'action': 'listen', 'data': { 'streams': [ 'T.AMC', 'Q.AMC' ] } }
I get this response:
message { target: WebSocket, isTrusted: true, data: "{\"stream\":\"listening\",\"data\":{\"streams\":[\"T.AMC\",\"Q.AMC\",\"AM.AMC\"]}}", origin: "wss://data.alpaca.markets", lastEventId: "", ports: Restricted, srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, … }
Then, it is complete radio silence. I do not get the expected trades streaming data.