Coder Social home page Coder Social logo

stock-manager's Introduction

Stock Tracker API

The appication is a stock management API. It can be used to track a user's holdings, create new securities, create buy and sell transaction, revert transactions, update transactions, calculate average price and average returns.

High Level Architecture

architectureDiagram

User

  • User schema contains information about the user like his userName, mobile, funds he has to buy shares etc.

Holdings

  • Represent a user's holdings of a particular share. It contains information about the number of shares of a particular stock held by the user, the average price, the total returns from that share etc.
  • In case we add a new buy or sell transaction, then we take the values present in holding object, like averagePrice, and shareCount for calculating their new values, but if we update or delete a transaction, the holdings of a user are recreated from the history of transactions.

Transactions

  • Stores all the trades that are done by the user, a trade can be of 2 types BUY or SELL.
  • Each transaction contains details like the number of shares that were exchanged, the price at which they were shared.
  • A transaction can be created, deleted and updated, given the fact that it upholds the consistency of the system, in cases of conflicts if problems like double spending occurs and the transaction deletion/updation is terminated and the user is shown correcponding error.

Security

  • Contains the different types of securities that are available to trade upon, they can be shares of a company like TCS, Wipro etc or some comodity like gold, grains etc.
  • Users can only trade in securities that are listed on the security schema.

Steps to setup

  • Clone the project
git clone https://github.com/AkshayCHD/stock-manager.git
  • change directory to the project
cd stock-manager
  • run
    npm install
  • create .env file with the following format
MONGOOSE_URL=<MONGODB_URI>
PORT=<PORT>
APP_SECRET=<APP_SECRET>
JWT_EXPIRES_IN=<JWT_EXPIRES_IN>
API_PREFIX=<API_PREFIX>
  • run
    npm start
  • Navigate to the url and port where the project was started, like localhost and 5521 and open api explorer

sdasdas

http://localhost:5521/api-docs
  • Hit the POST /user path that is open, to get the authorisation token, to authorise other apis.
  • To run application tests, create .env.test file in the root directory.
  • then run the command
npm run test

stock-manager's People

Contributors

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