You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ability to implement any different order that isn't a market order will require a bit of refactoring of the backend. The best way to go about implementing this would be to incorporate WebSockets so that you can stream and update the stock data in real time in order to implement code that fires when stock prices reach the specified threshold..
Here are 2 potential solutions for implementing WebSockets in Flask backend:
After implementing WebSockets, AlpacaAPI has support for wss streams that you can then use to regularly update the stock data from the market. Here is their documentation for implementing WebSockets for stock data. https://docs.alpaca.markets/docs/real-time-stock-pricing-data
Considerations and Pitfalls:
The intent of limit orders is that a user can walk away after placing the order with the peace of mind that if the stock price ever hits that specified limit (within a specified time frame, 24 hours, 30 days, 90 days, etc.), the trade will always go through. Due to the nature of our application's hosting via Render, we will need to specify somewhere for the user to see exactly what time frame our app is live and display that time frame as being the only option for when limit orders will execute.
As Alpaca APIs free tier only offers up to 30 symbols being subscribed to via WebSockets, we'll need to be a little creative in how we implement the logic for this. Luckily, as this is just a portfolio project and it's unlikely that we will truly need more than 30 symbols, we can most likely start and breakoff connections depending on whether or not there is a limit order slated for that symbol.
The text was updated successfully, but these errors were encountered:
Context and Resources
The ability to implement any different order that isn't a market order will require a bit of refactoring of the backend. The best way to go about implementing this would be to incorporate WebSockets so that you can stream and update the stock data in real time in order to implement code that fires when stock prices reach the specified threshold..
Here are 2 potential solutions for implementing WebSockets in Flask backend:
https://flask-socketio.readthedocs.io/en/latest/ < My recommendation as the docs are more robust and the github is updated much more recently
https://github.com/kennethreitz/flask-sockets
After implementing WebSockets, AlpacaAPI has support for wss streams that you can then use to regularly update the stock data from the market. Here is their documentation for implementing WebSockets for stock data. https://docs.alpaca.markets/docs/real-time-stock-pricing-data
Considerations and Pitfalls:
The intent of limit orders is that a user can walk away after placing the order with the peace of mind that if the stock price ever hits that specified limit (within a specified time frame, 24 hours, 30 days, 90 days, etc.), the trade will always go through. Due to the nature of our application's hosting via Render, we will need to specify somewhere for the user to see exactly what time frame our app is live and display that time frame as being the only option for when limit orders will execute.
As Alpaca APIs free tier only offers up to 30 symbols being subscribed to via WebSockets, we'll need to be a little creative in how we implement the logic for this. Luckily, as this is just a portfolio project and it's unlikely that we will truly need more than 30 symbols, we can most likely start and breakoff connections depending on whether or not there is a limit order slated for that symbol.
The text was updated successfully, but these errors were encountered: