Giter VIP home page Giter VIP logo

redis-stack-stocks's Introduction

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.

redis-stack-stocks's People

Contributors

ajeetraina avatar wjohnsto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.