Giter VIP home page Giter VIP logo

stock-market-india's Introduction

stock-market-india

A npm package which fetches data from Bombay & National Stock Exchange and provides an API to access it.

National Stock Exchange (NSE) API

 {
  'NIFTY 50': 'nifty',
  'NIFTY NEXT 50': 'juniorNifty',
  'NIFTY MIDCAP 50': 'niftyMidcap50',
  'NIFTY AUTO': 'cnxAuto',
  'NIFTY BANK': 'bankNifty',
  'NIFTY ENERGY': 'cnxEnergy',
  'NIFTY FIN SERVICE': 'cnxFinance',
  'NIFTY FMCG': 'cnxFMCG',
  'NIFTY IT': 'cnxit',
  'NIFTY MEDIA': 'cnxMedia',
  'NIFTY METAL': 'cnxMetal',
  'NIFTY PHARMA': 'cnxPharma',
  'NIFTY PSU BANK': 'cnxPSU',
  'NIFTY REALTY': 'cnxRealty',
  'NIFTY PVT BANK': 'niftyPvtBank',
  'NIFTY COMMODITIES': 'cnxCommodities',
  'NIFTY CONSUMPTION': 'cnxConsumption',
  'NIFTY CPSE': 'cpse',
  'NIFTY INFRA': 'cnxInfra',
  'NIFTY MNC': 'cnxMNC',
  'NIFTY GROWSECT 15': 'ni15',
  'NIFTY PSE': 'cnxPSE',
  'NIFTY SERV SECTOR': 'cnxService',
  'NIFTY100 LIQ 15': 'nseliquid',
  'NIFTY MID LIQ 15': 'niftyMidcapLiq15',
  'NIFTY DIV OPPS 50': 'cnxDividendOppt',
  'NIFTY50 VALUE 20': 'nv20',
  'NIFTY QUALITY 30': 'niftyQuality30',
  'NIFTY50 EQL WGT': 'nifty50EqualWeight',
  'NIFTY100 EQL WGT': 'nifty100EqualWeight',
  'NIFTY100 LOWVOL30': 'nifty100LowVolatility30',
  'NIFTY ALPHA 50': 'niftyAlpha50',


  'INDIA VIX': '-',
  'NIFTY 100': '-',
  'NIFTY 500': '-',
  'NIFTY MIDCAP 100': '-',
  'NIFTY GS 11 15YR': '-',
  'NIFTY50 PR 1X INV': '-',
  'NIFTY GS COMPSITE': '-',
  'NIFTY GS 15YRPLUS': '-',
  'NIFTY50 PR 2X LEV': '-',
  'NIFTY50 TR 1X INV': '-',
  'NIFTY 200': '-',
  'NIFTY GS 4 8YR': '-',
  'NIFTY GS 8 13YR': '-',
  'NIFTY50 TR 2X LEV': '-',
  'NIFTY50 DIV POINT': '-',
  'NIFTY SMLCAP 100': '-',
  'NIFTY GS 10YR': '-',
  'NIFTY GS 10YR CLN': '-',
};
  • companyName
[ ACC, ADANIENT, ADANIPORTS, ADANIPOWER, AJANTPHARM, ALBK, AMARAJABAT, AMBUJACEM, APOLLOHOSP, APOLLOTYRE, ARVIND, ASHOKLEY, ASIANPAINT, AUROPHARMA, AXISBANK, BAJAJ-AUTO, BAJFINANCE, BAJAJFINSV, BALKRISIND, BANKBARODA, BANKINDIA, BATAINDIA, BEML, BERGEPAINT, BEL, BHARATFIN, BHARATFORG, BPCL, BHARTIARTL, INFRATEL, BHEL, BIOCON, BOSCHLTD, BRITANNIA, CADILAHC, CANFINHOME, CANBK, CAPF, CASTROLIND, CEATLTD, CENTURYTEX, CESC, CGPOWER, CHENNPETRO, CHOLAFIN, CIPLA, COALINDIA, COLPAL, CONCOR, CUMMINSIND, DABUR, DCBBANK, DHFL, DISHTV, DIVISLAB, DLF, DRREDDY, EICHERMOT, ENGINERSIN, EQUITAS, ESCORTS, EXIDEIND, FEDERALBNK, GAIL, GLENMARK, GMRINFRA, GODFRYPHLP, GODREJCP, GODREJIND, GRASIM, GSFC, HAVELLS, HCLTECH, HDFCBANK, HDFC, HEROMOTOCO, HEXAWARE, HINDALCO, HINDPETRO, HINDUNILVR, HINDZINC, ICICIBANK, ICICIPRULI, IDBI, IDEA, IDFCBANK, IDFC, IFCI, IBULHSGFIN, INDIANB, IOC, IGL, INDUSINDBK, INFIBEAM, INFY, INDIGO, IRB, ITC, JISLJALEQS, JPASSOCIAT, JETAIRWAYS, JINDALSTEL, JSWSTEEL, JUBLFOOD, JUSTDIAL, KAJARIACER, KTKBANK, KSCL, KOTAKBANK, KPIT, L&TFH, LT, LICHSGFIN, LUPIN, M&MFIN, MGL, M&M, MANAPPURAM, MRPL, MARICO, MARUTI, MFSL, MINDTREE, MOTHERSUMI, MRF, MCX, MUTHOOTFIN, NATIONALUM, NBCC, NCC, NESTLEIND, NHPC, NIITTECH, NMDC, NTPC, ONGC, OIL, OFSS, ORIENTBANK, PAGEIND, PCJEWELLER, PETRONET, PIDILITIND, PEL, PFC, POWERGRID, PTC, PNB, PVR, RAYMOND, RBLBANK, RELCAPITAL, RCOM, RELIANCE, RELINFRA, RPOWER, REPCOHOME, RECLTD, SHREECEM, SRTRANSFIN, SIEMENS, SREINFRA, SRF, SBIN, SAIL, STAR, SUNPHARMA, SUNTV, SUZLON, SYNDIBANK, TATACHEM, TATACOMM, TCS, TATAELXSI, TATAGLOBAL, TATAMTRDVR, TATAMOTORS, TATAPOWER, TATASTEEL, TECHM, INDIACEM, RAMCOCEM, SOUTHBANK, TITAN, TORNTPHARM, TORNTPOWER, TV18BRDCST, TVSMOTOR, UJJIVAN, ULTRACEMCO, UNIONBANK, UBL, MCDOWELL-N, UPL, VEDL, VGUARD, VOLTAS, WIPRO, WOCKPHARMA, YESBANK, ZEEL ]
  • time
var time = [1, 5, 15, 30, 60, 'week', 'month', 'year'] minutes

Bombay Stock Exchange (BSE) API

symbolKey is different from symbol or securityCode, this value is present in response of getIndices method in 'key' property

valid symbols for Index Futures and Options are ["BANKNIFTY","FTSE100","NIFTY","NIFTYINFRA","NIFTYIT","NIFTYMID50","NIFTYPSE"]

  • companyKey

You can check the company key values using:

https://github.com/maanavshah/stock-market-india/bse/constant/names.js
  • time
var time = [1, 5, 15, 30, 60, 'week', 'month', 'year'] minutes

INSTALLATION

Let's get step by step here.

Identify the location for your application.

First identify the location for your application. Let's take it as /home/user/your_app. The path doesn’t matter, so feel free to locate the directory wherever it is best for you.

Installing Node.js

Here is where we will set up Node.js and Express. Node.js is a framework and Express provides a web server. The webserver we need does not need to do anything fancy. The only feature that the webserver needs are the ability to provide static files.

To get started download and install Node.JS: nodejs.org

Install Express

Express is a package that executes within Node.js. To install express, in the Command Prompt navigate to your directory for the application which is /home/user/your_app.

Now let's install Express as a package for Node.js. At the command prompt type “npm install express”. That installed Express and should have created a directory called “node_modules”.

Start Express Web Server in Node.js

In the terminal confirm you are at the /home/user/your_app directory and execute the following command.

node app.js 3000

Now the webserver should be running on port 3000 and you should be able to access the APIs.

IMPORTANT

API Calls will fail when made from browser due to 'OPTIONS' request sent by browsers before making an API call and Have few 'insecure' headers set which fails when changed from browser.

We Get all the indices of NSE (work around to make the call either on your server or in your app).

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/maanavshah/stock-market-india. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct. I give credits to https://github.com/kaushiknishchay/indian-stock-exchange, using which it was possible for me to create the library.

License

The content of this repository is licensed under MIT LICENSE.

stock-market-india's People

Contributors

cksharma11 avatar dependabot[bot] avatar maanavshah avatar mihirharshe avatar mr-radium avatar nahdus avatar vikash-sharma-php avatar winstardeveloper 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  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  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

stock-market-india's Issues

Not working as a deployment

Hello @maanavshah first of all, this is an awesome package. Great job on this.

I tried installing this on AWS and Heroku, but it times out on both these cases. Any idea why and how can we proceed in resolving this? I would like to collaborate and take this further.

unable to run nodejs server

I have Nodjs, express and axios intsalled but i get this error message:
[Server running on port 3000
/home/samar/Desktop/Jarvis2/NSE_nodejs_API/stock-market-india/node_modules/axios/lib/core/createError.js:16
var error = new Error(message);
^

Error: Request failed with status code 403
at createError (/home/samar/Desktop/Jarvis2/NSE_nodejs_API/stock-market-india/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/samar/Desktop/Jarvis2/NSE_nodejs_API/stock-market-india/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/home/samar/Desktop/Jarvis2/NSE_nodejs_API/stock-market-india/node_modules/axios/lib/adapters/http.js:260:11)](url)

Timeout issue

I have deployed this code in heroku & gcloud but the api is not working. Iam getting timeout error for all apis. Any solution?

all end points are dead

Could you kindly update the repository with the latest website changes for both NSE and BSE, or alternatively, mark this repository as archived?

How to use with okHttp

I just want to know that ur are web scrapping the content or getting data from any api as do not found any organization api mention in ur code.

Query about the project code functionality

Hi All,

I had few questions about this project like,

  1. does these API provide real time information?
  2. is it paid or free service?
  3. is there anything which needs to be taken care of in case it provides real time data and we need latest information?
    @maanavshah @winstarDeveloper @MrRadium please let know if you guys have any clue on this as I am a beginner in this.

thanks in advance :p

API being 2 minutes late on results

The project is very good but currently, I'm having an issue with the API from the NSE branch (I haven't tried the BSE branch still). It looks like that the results shown by the API are 2 minutes late. For example, if I do an API call at 15:00 it shows the last updated time to be 14:58. The market closes and opens 2 minutes delay from the actual time.

I just want to know if that is a problem with the API or it is just a mistake by me, if yes then is there a way I could fix it?

BSE related market apis are outdated, getting 404

BSE market related apis like getgainers, getcompanyquote are not valid, it is giving 404 error

 _currentUrl: 'https://www.bseindia.com/stock-share-price/SiteCache/EQHeaderData.aspx?text=500112',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      referer: [Array],
      'user-agent': [Array],
      host: [Array]
    }
  },
  response: {
    status: 404,

NSE New Website

Hi All,

With the update on the NSE Website non of the functions are working.

I would appreciate any help.

F&O data

Can you please give the example API to get F&O data?

some APIs are not working

Hi Maanav shah,

some of the APIs are not working. is it because of out of market hours? I will try to access these APIs in market hours and will update you, meanwhile, you can give your thoughts.

For eg -

Get the top 10 gainers of NSE
Format: JSON
http://localhost:3000/nse/get_gainers

Get the stock market status (open/closed)
Format: JSON
http://localhost:3000/get_market_status

Get the information of all the companies in a single NSE index
Format: JSON
http://localhost:3000/nse/get_index_stocks?symbol=nifty

API URL Not Working from Server

Do you know who maintains the API URLs? If I deploy on localhost, the API's are working, but if I deploy on a server, calls fail (timeout)

Adding Docker Support and enable access via browser

So, this seems like a really useful project for a lot of people, but not everyone might be comfortable in setting up the entire thing up from scratch.

Do you think I / we could dockerize the application and then also push it to Docker Hub so that deploying the application becomes a one step process?

Also, we could try and see if CORS would make it possible to you it from the browser, so that all OPTIONS requests are easily accepted by the backend when a request is sent from the browser?

This would allow people to create interesting dashboards using your project as the backend.

Chart data API is not working

Hey @maanavshah the chart data api is working it keeps loading. So can you fix it for me or tell me how I can get api so I can fix. If my work is done I also give you money. Please help me! I am working on very big project.

Not working in production serevers like vercel , digital oceans and aws cloud

i see you are passing custom headers to request from local but this settings are not working for production servers

var options = {
    headers: {
      'X-Requested-With': 'XMLHttpRequest',
      'Referer': 'https://www.nseindia.com/ChartApp/install/charts/mainpage.jsp',
      Host: 'www.nseindia.com'
    },
    transformResponse: searchTransformer(false)
  };

i applied .catch section for this to know what went wrong but request is not rejecting and catching the error

 NSEAPI.searchStocks(req.query.keyword)
    .then(function (response) {
      console.log("search response",response.data)
      res.json(response.data);
    }).catch((errr)=>{
      console.log(errr)
    });

How to run the project?

Hi ,

I have a small request for you, can you please tell me the steps for run this project? It will be very big help for me to learn.

Thank You.

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.