This project demonstrates how you can use the multi-model capabilities of Redis to create a real-time stock watchlist application.

Overview

Introduction

redis-stack-stocks

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
  • RedisTimeSeries
  • RedisBloom
  • RedisJSON
  • RediSearch

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
  2. 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+
  2. pip

Environment Variables

Create a .env file in the root directory of the project and set the following environment variables:

APCA_API_KEY_ID=<your-api-key>
APCA_API_SECRET_KEY=<your-api-secret>
REDIS_URL=<redis-url>
REDIS_OM_URL=<redis-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 for free, and you can even get $200 in credits towards a paid subscription by using code TIGER200.

You might also like...

A simple Node.js APIBAN client for downloading banned IPs and inserting them into a redis set

apiban-redis A simple Node.js APIBAN client for downloading banned IPs and inserting them into a redis set. Installation This utility can be run as a

Apr 5, 2022

Serve read-only Redis data over a HTTP API with auth

Redis data exposer This was created for Cliptok and not intended for use outside of it. Use at your own peril. This application will serve an API that

May 28, 2022

Full type-safe Redis PubSub with Zod

redis-pubsub Full type-safe Redis PubSub system with async iterators Features Type-safety with Zod Out-of-the-box support for Date/Map/Set/BigInt seri

Dec 21, 2022

🪦 Redis Key Value store backed by IPFS

🪦 Redis Key Value store backed by IPFS

🪦 RipDB 🪦 A snappy, decentralized JSON store perfect for fast moving web3 builders. Redis + IPFS = RIP = 😍 Install With a Package Manager (browser

Dec 13, 2022

An open-source link shortener built with Vercel Edge Functions and Upstash Redis.

Dub An open-source link shortener built with Vercel Edge Functions and Upstash Redis. Introduction · Deploy Your Own · Contributing Introduction Dub i

Jan 5, 2023

Out of the box modern User Interface, so you can see and manage your Workhorse jobs in realtime

Out of the box modern User Interface, so you can see and manage your Workhorse jobs in realtime

WORKHORSE UI Out of the box modern User Interface, so you can see and manage your Workhorse jobs in realtime. Start local Run npm i Copy and name prox

Apr 15, 2022

Nanoservices in no time with seamless TypeScript support.

Nanoservices in no time with seamless TypeScript support.

Nanolith Nanoservices in no time with seamless TypeScript support. Table of Contents About Defining a set of tasks Creating multiple sets of definitio

Dec 28, 2022

Use Cloudflare Workers Cron Triggers to keep your Hetzner Cloud Firewall allowing the latest list of Cloudflare IPs, or any other lists!

Hetzner Cloud Firewall automation with Cloudflare Workers Heavily inspired by xopez/Hetzner-Cloud-Firewall-API-examples, this repository holds a Cloud

Dec 17, 2022

slash-create with Cloudflare Workers template

/create with Cloudflare Workers A slash-create template, using Cloudflare Workers. Getting Started Cloning the repo You can either use degit to locall

Jan 3, 2023
Owner
Redis Developer
Redis Developer Community
Redis Developer
Kue is a priority job queue backed by redis, built for node.js.

Kue Kue is no longer maintained Please see e.g. Bull as an alternative. Thank you! Kue is a priority job queue backed by redis, built for node.js. PRO

Automattic 9.4k Dec 20, 2022
A simple, fast, robust job/task queue for Node.js, backed by Redis.

A simple, fast, robust job/task queue for Node.js, backed by Redis. Simple: ~1000 LOC, and minimal dependencies. Fast: maximizes throughput by minimiz

Bee Queue 3.1k Jan 5, 2023
Redis Simple Message Queue

Redis Simple Message Queue A lightweight message queue for Node.js that requires no dedicated queue server. Just a Redis server. tl;dr: If you run a R

Patrick Liess 1.6k Dec 27, 2022
BullMQ - Premium Message Queue for NodeJS based on Redis

The fastest, most reliable, Redis-based distributed queue for Node. Carefully written for rock solid stability and atomicity. Read the documentation F

Taskforce.sh Inc. 3.1k Dec 30, 2022
Nodejs Background jobs using redis.

node-resque: The best background jobs in node. Distributed delayed jobs in nodejs. Resque is a background job system backed by Redis (version 2.6.0 an

Actionhero 1.2k Jan 3, 2023
A simple high-performance Redis message queue for Node.js.

RedisSMQ - Yet another simple Redis message queue A simple high-performance Redis message queue for Node.js. For more details about RedisSMQ design se

null 501 Dec 30, 2022
Redis-backed task queue engine with advanced task control and eventual consistency

idoit Redis-backed task queue engine with advanced task control and eventual consistency. Task grouping, chaining, iterators for huge ranges. Postpone

Nodeca 65 Dec 15, 2022
A fast, robust and extensible distributed task/job queue for Node.js, powered by Redis.

Conveyor MQ A fast, robust and extensible distributed task/job queue for Node.js, powered by Redis. Introduction Conveyor MQ is a general purpose, dis

Conveyor MQ 45 Dec 15, 2022
egg.js(jwt) + mysql(sequelize) + redis + docker + docker-compose + nginx + vue + element-ui 全栈获取省市区数据(统计局数据)【工具】项目,实现在docker环境中一键部署

Egg-spider Preview 线上预览地址 (https://ronaldoxzb.com/) admin admin Project description [后端]egg.js(jwt) + mysql(sequelize) + redis + docker + docker-compo

null 11 Sep 29, 2022
Serverless URL Shortener made with Next.js + Redis.

linki: a place for your links linki is a url shortener made with next.js and redis! built with simplicity in mind, it's all in one page. deploy your o

Jack Reiker 12 Sep 15, 2022