aynse


Nameaynse JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA lean and modern python library to fetch data from NSE
upload_time2025-07-30 10:07:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
license*CMIT
keywords nse bhavcopy aynse
VCS
bugtrack_url
requirements requests click appdirs beautifulsoup4 brotli pandas
Travis-CI
coveralls test coverage No coveralls.
            # `aynse`

[![build status](https://github.com/sudotman/aynse/actions/workflows/run-tests.yml/badge.svg)](https://github.com/sudotman/aynse/actions/workflows/run-tests.yml)
[![PyPI version](https://badge.fury.io/py/aynse.svg)](https://badge.fury.io/py/aynse)
[![license: CMIT](https://img.shields.io/badge/license-*CMIT-black.svg)](https://opensource.org/licenses/MIT)
[![misc badge](https://img.shields.io/badge/ayn-nse-black)](https://en.wikipedia.org/wiki/Ayn_Rand)

`aynse` is a lean, modern python library for fetching data from the national stock exchange (NSE) of india. it is a fork of the unmaintained `jugaad-data` library, aiming to provide a robust and regularly updated tool for financial data analysis. 

## features

-   **historical data:** fetch historical stock and index data.
-   **derivatives data:** download futures and options data.
-   **bhavcopy:** download daily bhavcopy reports for equity, f&o, and indices.
-   **live market data:** get real-time stock quotes.
-   **holiday information:** retrieve a list of trading holidays for a given year.
-   **command-line interface:** a simple cli for quick data downloads.
-   **pandas integration:** returns data as pandas dataframes for easy analysis.

## etymology / musings
aynse is a portmanteau of "ayn" from miss ayn rand and "nse" from national stock exchange. ayn rand was a russian-american writer and philosopher known for her philosophy of objectivism, which emphasizes individualism and rational self-interest and among other things, she was a strong advocate for laissez-faire capitalism. the name serves as a fun ironical reminder of the library's purpose: to provide a tool for individuals to access and analyze financial data independently, without relying on large institutions or complex systems. in a cruel twist of fate, this open source library wouldn't be encouraged under ayn rand's philosophy, as she discouraged altruism and believed in the pursuit of one's own happiness as the highest moral purpose. and as the final act of irony, we gather to use this library to analyze financial markets while generating zero (and possibly, negative) intrinsic value for humans or human kind as a whole - this is capitalism.


## installation

you can install `aynse` directly from PyPI:

```sh
pip install aynse
```

## usage

here are a few examples of how to use `aynse` to fetch data.

### get historical stock data

retrieve historical data for a stock as a pandas dataframe.

```python
from datetime import date
import pandas as pd
from aynse.nse import stock_df

# set pandas display options to view all columns
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)

# fetch data for reliance from january 1, 2024, to january 31, 2024
df = stock_df(symbol="RELIANCE",
        from_date=date(2024, 1, 1),
        to_date=date(2024, 1, 31))

print(df.head())
```

### download daily bhavcopy

download the daily bhavcopy for a specific date to a local directory.

```python
from datetime import date
from aynse.nse import bhavcopy_save

# download equity bhavcopy for july 26, 2024, into the "tmp" directory
bhavcopy_save(date(2024, 7, 26), "tmp")
```

### get live stock quote

fetch live price information for a stock.

```python
from aynse.nse import NSELive

n = NSELive()
quote = n.stock_quote("INFY")
print(quote['priceInfo'])
```

### get trading holidays

get the list of trading holidays for a specific year.

```python
from aynse.holidays import holidays

# get trading holidays for the year 2024
trading_holidays = holidays(2024)
print(trading_holidays)
```

## command-line interface

`aynse` also comes with a simple command-line tool for quick downloads.

**download today's bhavcopy:**

```sh
aynse bhavcopy -d /path/to/your/directory
```

**download bhavcopy for a specific date range:**

```sh
aynse bhavcopy -d /path/to/your/directory -f 2024-01-01 -t 2024-01-31
```

**download historical stock data:**

```sh
aynse stock --symbol RELIANCE -f 2024-01-01 -t 2024-01-31 -o reliance_data.csv
```

## contributing

contributions are welcome! if you find a bug or have a feature request, please open an issue on the [github repository](https://github.com/a-y-n/aynse/issues).

## license

this project has a (custom) MIT* license but extends limitations. if you're a agency/corporate with >2 employees alongside of you, you cannot wrap this project or use it without prior written permission from me. if you're an individual, you can use it freely for personal projects. this project is not intended for commercial use without prior permission. if caught using this project in violation of the license, it may result in automated reporting and/or legal action. please see the [license file](LICENSE) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aynse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "nse, bhavcopy, aynse",
    "author": null,
    "author_email": "satyam-kashyap <satyamsudo@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a6/3c/60d1ac93b1fa15b25346e99c0731d63eb8ed7b1cd109b39e98e96ab613b5/aynse-1.0.0.tar.gz",
    "platform": null,
    "description": "# `aynse`\n\n[![build status](https://github.com/sudotman/aynse/actions/workflows/run-tests.yml/badge.svg)](https://github.com/sudotman/aynse/actions/workflows/run-tests.yml)\n[![PyPI version](https://badge.fury.io/py/aynse.svg)](https://badge.fury.io/py/aynse)\n[![license: CMIT](https://img.shields.io/badge/license-*CMIT-black.svg)](https://opensource.org/licenses/MIT)\n[![misc badge](https://img.shields.io/badge/ayn-nse-black)](https://en.wikipedia.org/wiki/Ayn_Rand)\n\n`aynse` is a lean, modern python library for fetching data from the national stock exchange (NSE) of india. it is a fork of the unmaintained `jugaad-data` library, aiming to provide a robust and regularly updated tool for financial data analysis. \n\n## features\n\n-   **historical data:** fetch historical stock and index data.\n-   **derivatives data:** download futures and options data.\n-   **bhavcopy:** download daily bhavcopy reports for equity, f&o, and indices.\n-   **live market data:** get real-time stock quotes.\n-   **holiday information:** retrieve a list of trading holidays for a given year.\n-   **command-line interface:** a simple cli for quick data downloads.\n-   **pandas integration:** returns data as pandas dataframes for easy analysis.\n\n## etymology / musings\naynse is a portmanteau of \"ayn\" from miss ayn rand and \"nse\" from national stock exchange. ayn rand was a russian-american writer and philosopher known for her philosophy of objectivism, which emphasizes individualism and rational self-interest and among other things, she was a strong advocate for laissez-faire capitalism. the name serves as a fun ironical reminder of the library's purpose: to provide a tool for individuals to access and analyze financial data independently, without relying on large institutions or complex systems. in a cruel twist of fate, this open source library wouldn't be encouraged under ayn rand's philosophy, as she discouraged altruism and believed in the pursuit of one's own happiness as the highest moral purpose. and as the final act of irony, we gather to use this library to analyze financial markets while generating zero (and possibly, negative) intrinsic value for humans or human kind as a whole - this is capitalism.\n\n\n## installation\n\nyou can install `aynse` directly from PyPI:\n\n```sh\npip install aynse\n```\n\n## usage\n\nhere are a few examples of how to use `aynse` to fetch data.\n\n### get historical stock data\n\nretrieve historical data for a stock as a pandas dataframe.\n\n```python\nfrom datetime import date\nimport pandas as pd\nfrom aynse.nse import stock_df\n\n# set pandas display options to view all columns\npd.set_option('display.max_rows', None)\npd.set_option('display.max_columns', None)\npd.set_option('display.width', None)\n\n# fetch data for reliance from january 1, 2024, to january 31, 2024\ndf = stock_df(symbol=\"RELIANCE\",\n        from_date=date(2024, 1, 1),\n        to_date=date(2024, 1, 31))\n\nprint(df.head())\n```\n\n### download daily bhavcopy\n\ndownload the daily bhavcopy for a specific date to a local directory.\n\n```python\nfrom datetime import date\nfrom aynse.nse import bhavcopy_save\n\n# download equity bhavcopy for july 26, 2024, into the \"tmp\" directory\nbhavcopy_save(date(2024, 7, 26), \"tmp\")\n```\n\n### get live stock quote\n\nfetch live price information for a stock.\n\n```python\nfrom aynse.nse import NSELive\n\nn = NSELive()\nquote = n.stock_quote(\"INFY\")\nprint(quote['priceInfo'])\n```\n\n### get trading holidays\n\nget the list of trading holidays for a specific year.\n\n```python\nfrom aynse.holidays import holidays\n\n# get trading holidays for the year 2024\ntrading_holidays = holidays(2024)\nprint(trading_holidays)\n```\n\n## command-line interface\n\n`aynse` also comes with a simple command-line tool for quick downloads.\n\n**download today's bhavcopy:**\n\n```sh\naynse bhavcopy -d /path/to/your/directory\n```\n\n**download bhavcopy for a specific date range:**\n\n```sh\naynse bhavcopy -d /path/to/your/directory -f 2024-01-01 -t 2024-01-31\n```\n\n**download historical stock data:**\n\n```sh\naynse stock --symbol RELIANCE -f 2024-01-01 -t 2024-01-31 -o reliance_data.csv\n```\n\n## contributing\n\ncontributions are welcome! if you find a bug or have a feature request, please open an issue on the [github repository](https://github.com/a-y-n/aynse/issues).\n\n## license\n\nthis project has a (custom) MIT* license but extends limitations. if you're a agency/corporate with >2 employees alongside of you, you cannot wrap this project or use it without prior written permission from me. if you're an individual, you can use it freely for personal projects. this project is not intended for commercial use without prior permission. if caught using this project in violation of the license, it may result in automated reporting and/or legal action. please see the [license file](LICENSE) for more details.\n",
    "bugtrack_url": null,
    "license": "*CMIT",
    "summary": "A lean and modern python library to fetch data from NSE",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://satyamkashyap.com/aynse",
        "Homepage": "https://satyamkashyap.com/aynse",
        "Issues": "https://github.com/sudotman/aynse/issues",
        "Repository": "https://github.com/sudotman/aynse"
    },
    "split_keywords": [
        "nse",
        " bhavcopy",
        " aynse"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "72f953746950f66948738de8deb98f157749f53b090cd9d7a48ee4414f23b6aa",
                "md5": "ab5cf0908712f32ebe567690539f64ac",
                "sha256": "bee093367badbfafcc861c44440022dd746658602b2f0b2e014d1b402b73e0ce"
            },
            "downloads": -1,
            "filename": "aynse-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab5cf0908712f32ebe567690539f64ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 23091,
            "upload_time": "2025-07-30T10:07:01",
            "upload_time_iso_8601": "2025-07-30T10:07:01.080414Z",
            "url": "https://files.pythonhosted.org/packages/72/f9/53746950f66948738de8deb98f157749f53b090cd9d7a48ee4414f23b6aa/aynse-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a63c60d1ac93b1fa15b25346e99c0731d63eb8ed7b1cd109b39e98e96ab613b5",
                "md5": "9fb95aa4cf4ce76376f2e3f459705036",
                "sha256": "abc3cececcf601544ebd91f4de8d0a76b68d2a5346643bf1ede80a2735074670"
            },
            "downloads": -1,
            "filename": "aynse-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9fb95aa4cf4ce76376f2e3f459705036",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 27976,
            "upload_time": "2025-07-30T10:07:01",
            "upload_time_iso_8601": "2025-07-30T10:07:01.969444Z",
            "url": "https://files.pythonhosted.org/packages/a6/3c/60d1ac93b1fa15b25346e99c0731d63eb8ed7b1cd109b39e98e96ab613b5/aynse-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 10:07:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sudotman",
    "github_project": "aynse",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "click",
            "specs": [
                [
                    ">=",
                    "7.1.2"
                ]
            ]
        },
        {
            "name": "appdirs",
            "specs": [
                [
                    ">=",
                    "1.4.4"
                ]
            ]
        },
        {
            "name": "beautifulsoup4",
            "specs": [
                [
                    ">=",
                    "4.9.3"
                ]
            ]
        },
        {
            "name": "brotli",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        }
    ],
    "lcname": "aynse"
}
        
Elapsed time: 1.26836s