Giter Site home page Giter Site logo

d4n-a / stock-watchlist Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.89 MB

Showcase Stock Watchlist: A real-time, scalable platform allowing users to effortlessly monitor, add, and manage their favorite stocks

Makefile 5.56% Dockerfile 1.07% HTML 0.92% CSS 4.20% JavaScript 21.91% Python 66.35%

stock-watchlist's Introduction

Product Engineering Case Study Overview

Welcome to the Albert product engineering case study. The project is a stock watchlist service and client application that allows users to view their favorite stock prices.

Functional Requirements:

  • Users should be able to search for stocks by name or ticker and add them to a watchlist.
  • Users should be able to remove a stock from their watchlist.
  • Users should be able to see the current price of the stocks in their watchlist.
  • Prices should update every 5 seconds.
  • The service should be designed to support millions of users each with their own watchlist.
  • User data should be persisted in a database and re-used when the app is restarted.
  • The focus for this case study is on the service architecture and communication between the service and client application.
  • The client application must support user login and a single screen that contains a search bar, list of stocks and current prices, but it does not need to be a polished UI.

Project Overview

The project consists of a Django REST backend service and a React client application.

Design Considerations

  1. Scalability: Asynchronous job queue, Celery, is used to offload the fetching of stock data from the 3rd party API. The job schedule is made by Celery Beat.
  2. Caching: All stock-related data - the stock models itself and the list of available tickers are cached in Redis on each update. This reduces DB load and makes service more responsive.
  3. Real-time Updates: WebSockets are used to push real-time (every 5 seconds) updates to the client. Websockets are made by the one-by-ticker method. The idea behind it is that the system anticipates a large and diverse user base, each with unique stock interests.
  4. Database Design: Watchlist’s are made as simple as User-to-Stock relation

Сonstraints

  1. User Management This project has no Authentication or User Management. Login is supported by the “Username” header, filled by username from LocalStorage, so this also breaks CORS. For a production-grade solution, Django JWT would be used.
  2. SSL This project has no SSL support and uses plain HTTP and WS, which is insufficient.
  3. Public /api/stock/{ticker} The stock model is assumed to be publicly accessible.

Getting started

When running the project for the first time, please run the following commands:

  • make build - build the image
  • make up-db - run DB service
  • make load - load dumped DB
  • make up - run all services
  • make open-app will open the React app in your browser.

Later only make up and make open-app could be used.

There are two users with usernames user1 and user2 are currently available.

Additional commands, such as migrate, createusers and test can be found in Makefile.

Demo

stock-watchlist's People

Contributors

d4n-a avatar

Watchers

 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.