Code Monkey home page Code Monkey logo

stock-nse-india's Introduction

NPM

National Stock Exchange - India (Unofficial)

npm NPM GitHub Release Date - Published_At GitHub top language

This package will help us to get equity/index details and historical data from National Stock Exchange of India.

Please refer Documentation here.

See the Examples here

Installation

Install using 'npm'

npm i stock-nse-india

Install using 'yarn'

yarn add stock-nse-india

Usage

import { NseIndia } from  "stock-nse-india";
const  nseIndia = new  NseIndia()
// To get all symbols from NSE
nseIndia.getAllStockSymbols().then(symbols  => {
console.log(symbols)
})

// To get equity details for specific symbol
nseIndia.getEquityDetails('IRCTC').then(details  => {
console.log(details)
})

// To get equity historical data for specific symbol
const range = {
    start: new Date("2010-01-01"),
    end: new Date("2021-03-20")
}
nseIndia.getEquityHistoricalData(symbol, range).then(data => {
    console.log(data)
})

API Methods

Common Methods

getAllStockSymbols

getData

getDataByEndpoint - Get data by NSE API endpoints. API Endpoints list

Equity Methods

getEquityCorporateInfo

getEquityDetails

getEquityHistoricalData

getEquityIntradayData

getEquitySeries

getEquityTradeInfo

Index Methods

getEquityStockIndices

getIndexIntradayData

getIndexHistoricalData

Helper Methods

getGainersAndLosersByIndex

getMostActiveEquities

Run locally

Clone the repo locally using below command

git clone https://github.com/hi-imcodeman/stock-nse-india.git

Goto 'stock-nse-india' folder

cd stock-nse-india

Then install packages using 'npm' or 'yarn'

npm install

or

yarn

Start the application using 'npm' or 'yarn'

npm start

or

yarn start

Then open the URL http://localhost:3000 in browser.

For API service documentation please hit http://localhoast:3000/api-docs

CLI

We can use this package in CLI.

Install for CLI

npm i -g stock-nse-india

CLI Usage

To get CLI help

nseindia --help

To get market status

nseindia

To get the current equity details of the NSE symbol

nseindia equity IRCTC

To get the historical details of the NSE symbol

nseindia historical IRCTC

To get the details of the indices

nseindia index

To get the details of the specific index

nseindia index "NIFTY AUTO"

Docker

Build & Run in local

Build and run the docker instance in local machine.

docker build -t nseindia . && docker run --rm -d -p 3001:3001 nseindia:latest

Start a instance

docker run --rm -d -p 3001:3001 imcodeman/nseindia

Test the instance

Open the browser and hit http://localhoast:3001

For API service documentation please hit http://localhoast:3001/api-docs

Docker Hub link

https://hub.docker.com/r/imcodeman/nseindia

Testing

Run the below command for testing and coverage.

yarn test

Contributors

stock-nse-india's People

Contributors

asrafalih avatar dependabot[bot] avatar dibo237 avatar utpalsapre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stock-nse-india's Issues

Historical for NSE Indices

Acceptance criteria

  • Get index historical data
  • Add Test cases
  • Update documents
  • Add API for index historical
  • Update swagger api-doc

Data Fetch is not Working in Android

I am developing a App in React-native my code is run perfectly in IOS but not in Android

const nseIndia = new NseIndia();
const Fetch_Single_Symbol = async () => {
try {
const updatedStockDetails = [];

  for (let index = 0; index < watchList.length; index++) {
    const data = watchList[index];
    const details = await nseIndia.getEquityDetails(data);
    updatedStockDetails.push(details);
  }

  setStockDetails(updatedStockDetails);
} catch (error) {
  console.error("Error fetching equity details:", error);
}

};

Search by ISIN code

Sometime companies changes their name and hard to search for equity info by changed name.
I searched for the possibility of searching by ISIN but i couldn't find any, Is there any possibility that you aware of to search EQ info by ISIN number ?

Standardizing symbol input for endpoints

The symbol needs to be in capital case to get any valid results for the following endpoints:

1. /api/equity/series/:symbol
2. /api/equity/tradeInfo/:symbol
3. /api/equity/corporateInfo/:symbol
4. /api/equity/intraday/:symbol
5. /api/equity/historical/:symbol

Will be good if we convert the symbol path parameter value to standard capital case.

REIT historical data not available

No historical data is available for the various REIT - INDIGRID, PGIVIT, etc.

What is the source of historical data? Is it sourced from NSE authorised channel? Or stored in a 3rd party database? How is it updated?

Release readiness for v1.1.1

Changes required

  • Modify README for yarn start
  • Add description field in package.json
  • Add API methods to the README

No support for Angular

Unable to use the package in Angular. Also, I tried hitting the endpoints by running the project locally but there is no response.

[Feature Request] Can we handle download and handle csv file for historical data i got some nse links for csv

https://www.nseindia.com/api/historical/cm/equity?symbol=TATAMOTORS&series=[%22EQ%22]&from=17-03-2023&to=17-04-2023&csv=true

Above link downloads csv for perticular stock like tata motors and perticular time frame.

Problems : I tried to fetch but denies after some time.

My logic is to downlod -> read ->delete it will make fetching historical data more fast.. i guess

I really want to work on this logic with you please guide me..

/api/equity/historical/{symbol}

Hello Sir
/api/equity/historical/{symbol}
This api is not working, some time its work fine but suddenly stop working and return error.
image

Stock-nse-india not work on ubuntu

Hello,

I am using Ubuntu 22.04.2 LTS as the hosting for my API. The lib is just working well on my dev environment (window OS) but its not work on server which is running Ubuntu. Its simply just hanging forever but not reject or return any error. This is my function which using to retrieve the data of symbol.

const getSymbolDetail = async (req, res) => {
    try {
        var symbolCode = req.query.symbol;
	console.log(nseIndia);
        nseIndia.getEquityDetails(symbolCode).then(data => {
            res.status(200).json({
                message: responseMsg.success.getDataSuccess,
                data: data,
            });
        },
        (reason) => {
            console.log(reason)
        })
    } catch (error) {
        let errorMsg = error.message;
        if (typeof error?.response?.data?.error !== "undefined") {
            errorMsg = error.response.data.error;
        }
        errorMsg = responseMsg.error.getDataFailed;
        return res.status(403).json({
            error: errorMsg,
        });
    }
};

Do we have anyway to get the error or to solve this issue?

not working in heoku

I tired a simple app, working fine in my local setup, while trying to host from heroku not working

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.