alpacahq / alpaca-trade-api-js

Node.js library for Alpaca Trade API.
https://www.npmjs.com/package/@alpacahq/alpaca-trade-api
Apache License 2.0
519 stars 136 forks source link

Websocket events not firing #185

Open SyntaxisCS opened 2 years ago

SyntaxisCS commented 2 years ago

I am able to successfully connect to a WebSocket and subscribe to multiple tickers in the quotes and trades category and I set up the onStockQuote and trade events but they are not firing. There is a serious lack of documentation regarding websockets and configuring the Alpaca client. There is no mention of verbose, the exchanges array, feed and what strings it accepts, and also many of the functions listed on the documentation being entirely out of date and not working anymore. I have a client who needs a bot that requires this API and working with this API and sifting through it's documentation is a massive headache as following the examples in the sdk's files not on the documentation actually works less than my code. The example code doesn't even manage to connect to the websocket or subscribe to the quotes and trades.

Any help would be greatly appreciated. If you need any of my code just let me know.

majorsauce commented 2 years ago

@SyntaxisCS can you elaborate on what piece of information you exactly require ?

Even though I would agree that the documentation is far from complete (That´s also the case with the documentation on the Alpaca website itself), the example code of this project works fine for me.

This might sound a little dumb but you never know: At what time did you test your websocket connection ? I personally ran into the same problem a few times until I realized that the market is actually closed so there won´t be any trades.

If that´s not the case then your code would help a lot to reproduce.