Git Product home page Git Product logo

hypergro_assignment's Introduction

Hypergro-Assessment: Stock Price Analysis Application

Prerequisites

Before running the application, ensure you have the following installed on your machine:

  • Node.js and npm
  • MongoDB server

Installing

  1. Clone the repository to your local machine:

    git clone https://github.com/tanmax22end/hypergro-assessment
  2. Install project dependencies:

    cd hypergro-assessment
    npm install
  3. Set up environment variables:

    Create a .env file in the root directory and provide the required environment variables:

    MONGODB_USERNAME=your-mongodb-username
    MONGODB_PASSWORD=your-mongodb-password
    
  4. Start the server:

    npm start

Server Refresh Functionality

Upon starting the server, the script performs the following actions to ensure the latest trading data is up-to-date:

  • Fetch Latest Trading Data:

    • The server fetches the latest trading data from the BSE (Bombay Stock Exchange) website.
    • The data is retrieved in the form of a ZIP file containing an Excel sheet.
  • Process and Update MongoDB:

    • The script processes the data from the Excel sheet and inserts it into the MongoDB database.
    • The MongoDB database is updated with the latest stock information.
  • Historical Data Update (Last 90 Days):

    • Additionally, a script was executed to fetch and insert the last 90 days' stock data into the MongoDB database.
    • The script iterates over the last 90 days, fetching data for each day and updating the database.

API Endpoints

  1. Get Top Stocks

    • Endpoint: /api/v1/getTopStocks
    • Method: GET
    • Description: Fetches the top 10 performing stocks based on percent gain.
    • Query Parameters: None
  2. Get Stocks by Name

    • Endpoint: /api/v1/stocks
    • Method: GET
    • Description: Fetches stocks by name. The name should be alphanumeric and between 2 to 20 characters.
    • Query Parameters:
      • name (string): Alphanumeric stock name (2 to 20 characters).
  3. Add Favorites

    • Endpoint: /api/v1/favorites
    • Method: POST
    • Description: Adds a stock to the user's favorites list.
    • Request Body:
      • userId (number): User ID (1 to 1 billion).
      • stockId (number): Stock ID (1 to 1 billion).
  4. Get User's Favorite Stocks

    • Endpoint: /api/v1/getfavorites
    • Method: GET
    • Description: Fetches the list of favorite stocks for a given user.
    • Query Parameters:
      • userId (number): User ID (1 to 1 billion).
  5. Delete User's Favorite Stock

    • Endpoint: /api/v1/deletefavorites
    • Method: DELETE
    • Description: Deletes a stock from the user's favorites list.
    • Query Parameters:
      • userId (number): User ID (1 to 1 billion).
      • stockId (number): Stock ID (1 to 1 billion).
  6. Stock Price History

    • Endpoint: /api/v1/stockPriceHistory
    • Method: GET
    • Description: Fetches the price history of a stock.
    • Query Parameters:
      • SC_CODE (number): Stock code (1 to 1 billion).

hypergro_assignment's People

Contributors

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