I am trying to stream data by using an Alpaca paper trading account on a Windows 10 terminal, but instead of streaming data it returns empty. Does anybody know what I am doing wrong?
note: I have installed wscat by typing npm install -g wscat
and i have also downloaded node.js
First I type:
wscat -c wss://paper-api.alpaca.markets/stream
The terminal respondes with:
Connected (press CTRL+C to quit)
I then follow up with:
{"action": "authenticate","data": {"key_id": "my_key_id", "secret_key": "my_secret_key"}}
The terminal responds with:
{"stream":"authorization","data":{"action":"authenticate","status":"authorized"}}
Finally I type:
{"action": "listen", "data": {"streams": ["T.SPY"]}}
The terminal responds with:
{"stream":"listening","data":{"streams":[]}}
I want it to reply with streaming data.
The reason it didn't work for me was because I was using a paper trading account instead of a live trading account. If you want to stream on a paper trading account follow these steps:
Firstly download node.js
on the internet.
After you have downloaded node.js
open up your terminal and type:
npm install -g wscat
When wscat
has been installed type:
wscat -c wss://stream.data.alpaca.markets/v2/iex
The terminal will respond with:
[{"T":"success","msg":"connected"}]
Then you type:
{"action": "auth", "key": "your_key", "secret": "your_secret_key"}
The terminal will respond with:
[{"T":"success","msg":"authenticated"}]
Lastly you type:
{"action":"subscribe","quotes":["SPY"]}
Now you should be getting streamed data from a paper trading account on your terminal.