alpacahq / alpaca-ts

A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.
ISC License
156 stars 42 forks source link

Add Functionality to Close AlpacaStream? #94

Closed tclare closed 2 years ago

tclare commented 2 years ago

Hi there @117! 👋 firstly: fantastic job with this. I've started with Alpaca recently and being able to integrate with Typescript is a lifesaver 🙂 great work!

In building out a strategy for my specific use case, I have recently started thinking about integrating the stream feature. For cleanup purposes, I, as a user of this package would like control over when to close the underlying Websocket, so that I can control when to exit the calling process. Am I missing somewhere this is already built in? Or how would you feel about incorporating a feature like this? Something like AlpacaStream.close()?

Would be happy to take point on this also! Thanks for reading 🚀

117 commented 2 years ago

Yea maybe expose the entire connection instead, like .getConnection() and close from there. Offers a bit more freedom.

tclare commented 2 years ago

Sure thing, and yes good call. Will make a PR today or tomorrow!