Watch your "basket" of stocks in real-time with data from Alpaca.
Basket is intended as a template; it provides a working example of a Phoenix Framework web server utilizing the following tools and patterns:
- Continuous Integration
- Phoenix Channels
- Phoenix LiveView
- Phoenix Presence
- Pow
- Search Autocomplete (in LiveView)
- WebSockex
Basket also serves as a reference for testing patterns:
Many thanks to the authors of these excellent libraries!
- Ensure Postgres is running. If using Docker,
docker start postgres
usually works well. - Run
mix setup
to install and set up dependencies - Start the development server with
make dev
- Now you can visit
localhost:4000
from your browser.
- Unauthenticated users will be redirected to the registration page as per Pow standards.
Sign up and verify your email (for a quick fix, populate the
email_verified_at
column in theUser
table) - Log in and watch your basket!
Basket uses HTTP and WebSocket connections to ingress stock data. The real-time updates are received over WebSocket and distributed through Phoenix Channels, one per stock ticker. Phoenix Presence is utilized to track ticker subscription lifecycles for all users in aggregate against the WebSocket client, sharing one client connection efficiently.