Git Product home page Git Product logo

wallstreet's Introduction

Wallstreet

Abstract

  • This project is micro-service based web application that simulates a stock market, complete with companies, listings, stock exhcange, news engine and market analytics.>
  • Users can interact with the market, by buying, selling and trading shares. Much like the real world, user activity drives the market, deciding the direction of the stocks.
  • The application is written with a node.js backend to leverage JavaScript's asynchronous by default execution to handle a large number of concurrent users.
  • The entire application is divided into 4 distinct packages, which are further divided into distinct services. The services are all run as individual processes while in deployment.
  • Every service maintains its own database and is solely responsible for change in its own state.
  • However services within the same package have read-only access to each other's database
  • A high level over view of the architecture is given below

1. Gateway API

- All user interaction is handled by the gateway. Users can either login or register, after which they are authenticated by the gateway.
- All subsequent requests are also handled by the gateway which redirects the requests to relevant service

2. User Package

Profile Service
- This is the service that manages users profile, including personal details, available assets, etc.
- This service is also responsible for updating user profiles regularly

Trade Service
- It basically provides a trading terminal for the user to buy/sell stocks
- This service will also verify whether a user has enough cash to make a buy bid/enough stocks to make a sell bid
- It publishes all bids to a comon message queue
- This service also allows user to cancel bids

3. Market Package

Transaction Service
- This service executes different kinds of bid logic, such as limits, stop losses, options, etc.
- It maintains a database of all bids made by the user, comparing all bids and executing the best ones
- All executed bids, here on referred to as transactions, are published to a message queues

Pricing Service
- Thise service runs periodically in the backgroud to decide the price of all company stocks
- Prices are decided on the basis of executed bids, demand/supply of a particular stock and overall volume of trade
- All update prices are published to message queues

Rollback service
- Bids that are still sale after a given period of time are automatically cancelled
- Locked cash/Locked shares are also freed

4. Analytics Package

- Offer analytics on user level, company level, and arket level based on user activity of all users

5. Inter Service / Pub-Sub Communication

Communication between services is carried out throgh two means, either REST API endpoints or message queues using kafka, with a publisher subscriber model
- Queue has 4 topics, bids made, bids cancelled, bids executed, bids rolled back
- The first two are published by Trade service and subscribed by transactions service and analytics service
- The other two are published by transaction service and subscribed by pricing, analytics, and profile service

wallstreet's People

Contributors

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