GithubHelp home page GithubHelp logo

yoanyomba123 / altfolio-live Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pastudan/altfolio-live

0.0 2.0 0.0 562 KB

๐Ÿ“ˆ๐ŸŒ• A React + WebSocket app that tracks a mixed portfolio of stocks and cryptocurrencies in realtime

Home Page: https://altfolio.live

License: MIT License

JavaScript 79.78% Shell 0.27% HTML 1.51% CSS 18.44%

altfolio-live's Introduction

Altfolio.Live

A react + websocket app to help track of a mixed portfolio of stocks and cryptocurrencies in realtime

image

Starting a Local Development Environment

First, install dependencies with yarn

UI (React + Webpack) Instructions

This app is built on top of create react app, so starting the front-end is as simple as running

yarn start

API Instructions

This app uses redis as it's sole data store, so you will need to have a local redis server running on port 6379

brew install redis

Once that's installed, you can run individual pieces of the API as needed.

Since the UI automatically tries to reconnect to the to the websocket API upon disconnection, I like running the pieces with a watcher like nodemon when developing.

API Pieces

  • node api/api.js will start the main API backend which hosts the websocket server for the UI clients. It listens for redis pub events and rebroadcasts them to all its connected end clients. This is required for seeing any stock / crypto data.

  • node api/crypto-worker.js will start the script that polls for updates from CoinMakretCap and pushes them to redis upon receiving new data.

  • node api/stock-worker.js will start the script that polls for updates from AlphaVantage and pushes them to redis upon receiving new data. It also starts a socket.io connection to IEX, which pushes live updates for most US based stocks.

  • node api/binance.js will open a websocket connection to Binance and receive price updates for a handful of cryptocurrencies.

  • node api/stock-historical-backfill.js will start a script that loads historical data (1-day and 7-day) for the default stocks. You'll only need to run this once upon initialization of data, or any time you haven't had the stock worker running for a while. Otherwise, the stock worker will log historical data as it runs.

NOTE: Running any of the stock scripts requires an API key from AlphaVantage. Once you register and receive your key, you should set it as the value to your environment variable STOCK_API_KEY for the scripts to function properly.

Starting All API Pieces

If you have PM2 installed, you can start all these scripts with pm2 start ecosystem.config.js.

Contributing

Feel free to open a pull request to add functionality

License

Altfolio is MIT licensed.

altfolio-live's People

Contributors

pastudan avatar

Watchers

 avatar  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.