https://github.com/redis-developer/redis-stack-stocks
This project demonstrates how you can use the multi-model capabilities of Redis to create a real-time stock watchlist application.
https://github.com/redis-developer/redis-stack-stocks
Last synced: 7 months ago
JSON representation
This project demonstrates how you can use the multi-model capabilities of Redis to create a real-time stock watchlist application.
- Host: GitHub
- URL: https://github.com/redis-developer/redis-stack-stocks
- Owner: redis-developer
- Created: 2022-03-18T01:07:58.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-30T21:41:35.000Z (over 2 years ago)
- Last Synced: 2025-04-12T03:53:01.604Z (11 months ago)
- Language: TypeScript
- Size: 5.64 MB
- Stars: 72
- Watchers: 6
- Forks: 26
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction

This project demonstrates how you can use Redis Stack to create a real-time stock watchlist application. It uses several different features of Redis:
- Sets
- Pub/Sub
- Hashes
-Redis Time Series
- RedisBloom
- Redis JSON
- Redis Search
# Usage with Docker
## Requirements
1. Install Docker
Set the following environment variables in a .env file in the root directory of the project:
1. `APCA_API_KEY_ID`: Your Alpaca API Key found on the Alpaca dashboard
1. `APCA_API_SECRET_KEY`: Your Alpaca API Secret found on the Alpaca dashboard
## Installation
```
$ docker-compose --env-file ./.env up -d
```
After the containers are up and running (for the first time), go into the `data` directory and run:
```
$ pip install -r requirements.txt
$ python main.py
```
# Usage Locally
## Requirements
1. python 3.6+
1. pip
## Environment Variables
Create a `.env` file in the root directory of the project and set the following environment variables:
```
APCA_API_KEY_ID=
APCA_API_SECRET_KEY=
REDIS_URL=
REDIS_OM_URL=
```
Create a `.env` file in the `ui` directory of the project and set the following envionrment variables:
```
NEXT_PUBLIC_API_URL=http://localhost:8000/api/1.0
NEXT_PUBLIC_WS_URL=ws://localhost:8000
```
## Installation
From the root directory, run the following commands:
```
$ python -m venv ./.venv
```
### Stream Service
Run the following commands in the `stream` directory:
```
$ pip install -r requirements.txt
$ python main.py
```
### API Service
Run the following commands in the `api` directory:
```
$ pip install -r requirements.txt
$ uvicorn main:app
```
### Web Service
Run the following commands in the `web` directory:
```
$ npm install
$ npm run dev
```
# Known Issues
1. There is a known issue with the Alpaca websocket API thread safety. You will find a workaround in the alpaca.py file.
# Managed Hosting
Redis offers [managed hosting for Redis Stack](https://redis.info/3tyWUYJ) for free, and you can even get $200 in credits towards a paid subscription by using code TIGER200.