Giter Site home page Giter Site logo

bennythadikaran / nseindiaapi Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 2.0 842 KB

Unofficial Python Api for NSE India stock exchange

Home Page: https://pypi.org/project/nse/

License: GNU General Public License v3.0

Python 99.26% Dockerfile 0.74%
bhavcopy nse nse-stock-data nsescript stock-market-api stock-market-reports stock-news-api

nseindiaapi's Introduction

๐Ÿ’ฐ NseIndiaApi

An unofficial Python API for the NSE India stock exchange.

Python version: >= 3.8

If you โค๏ธ my work so far, please ๐ŸŒŸ this repo.

๐Ÿ‘ฝ Documentation

https://bennythadikaran.github.io/NseIndiaApi

Updates

v0.2.8: Add methods for listing upcoming, current and past IPOs. See Docs

๐Ÿ”ฅ Usage

Install with Pip

pip install -U nse

The class accepts a single argument download_folder, a str filepath, or a pathlib object. The folder stores cookie and any downloaded files.

Simple example

from nse import NSE
from pathlib import Path

# Working directory
DIR = Path(__file__).parent

nse = NSE(download_folder=DIR)

status = nse.status()

advDec = nse.advanceDecline()

nse.exit() # close requests session

Using with statement

with NSE(download_folder=DIR) as nse:
    status = nse.status()

    advDec = nse.advanceDecline()

Catching errors

from nse import NSE
from datetime import datetime

with NSE('./') as nse:
    try:
        bhavFile = nse.equityBhavcopy(date=datetime.now())
        dlvFile = nse.deliveryBhavcopy(date=datetime.now())
        raise RuntimeError('Some error')  # force an exception
    except RuntimeError as e:
        # continue execution or exit the script
        print(repr(e))

    # execution continues if handled without exit
    actions = nse.actions()

# NSE request session closed - continue processing

Samples folder

The src/samples folder contains sample outputs of various methods. The filenames match the method names. The output has been truncated in some places but demonstrates the overall structure of responses.

nseindiaapi's People

Contributors

bennythadikaran avatar

Stargazers

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

Watchers

 avatar

nseindiaapi's Issues

deliveryBhavcopy Encoding Error

Hi Benny,

Thanks for the Wonderful API. Observed the issue in deliveryBhavcopy.

Error

Download error. Try again later: ChunkedEncodingError(ProtocolError('Connection broken: IncompleteRead(271 bytes read, 138 more expected)', IncompleteRead(271 bytes read, 138 more expected)))

Kindly check it once please.

Thanks
Kmadhyan

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.