{"id":22956860,"url":"https://github.com/marketcalls/openchart","last_synced_at":"2025-07-18T20:32:24.718Z","repository":{"id":258739488,"uuid":"875511874","full_name":"marketcalls/openchart","owner":"marketcalls","description":"OpenChart is a Python library for downloading intraday and EOD (End of Day) historical data from the NSE (National Stock Exchange of India) and NFO (NSE Futures and Options) exchanges","archived":false,"fork":false,"pushed_at":"2024-10-20T11:07:39.000Z","size":22,"stargazers_count":31,"open_issues_count":5,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-08T07:53:13.313Z","etag":null,"topics":["historical-data","nseindia","pandas-dataframe","pythonlibrary","stock-market"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marketcalls.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-20T07:11:58.000Z","updated_at":"2025-07-05T18:12:53.000Z","dependencies_parsed_at":"2024-10-20T20:10:25.241Z","dependency_job_id":null,"html_url":"https://github.com/marketcalls/openchart","commit_stats":null,"previous_names":["marketcalls/openchart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marketcalls/openchart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenchart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenchart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenchart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenchart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marketcalls","download_url":"https://codeload.github.com/marketcalls/openchart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenchart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265828550,"owners_count":23835078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["historical-data","nseindia","pandas-dataframe","pythonlibrary","stock-market"],"created_at":"2024-12-14T17:12:17.447Z","updated_at":"2025-07-18T20:32:24.653Z","avatar_url":"https://github.com/marketcalls.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Download market data from NSEIndia's API\n\n\u003ctable border=1 cellpadding=10\u003e\u003ctr\u003e\u003ctd\u003e\n\n#### \\*\\*\\* IMPORTANT LEGAL DISCLAIMER \\*\\*\\*\n\n---\n\nopenchart is **not** affiliated, endorsed, or vetted by NSEIndia. It's\nan open-source tool that uses NseIndia's publicly available APIs, and is\nintended for research and educational purposes.\n\n\n# OpenChart\n\nOpenChart is a Python library for downloading intraday and EOD (End of Day) historical data from the NSE (National Stock Exchange of India) and NFO (NSE Futures and Options) exchanges.\n\n## Features\n\n- Download NSE and NFO master data.\n- Search for symbols in NSE and NFO exchanges.\n- Fetch historical data for equities and derivatives.\n- Supports various timeframes: `1m`, `3m`, `5m`, `10m`, `15m`, `30m`, `1h`, `1d`, `1w`, `1M`.\n\n## Installation\n\nYou can install the library directly from the GitHub repository:\n\n```bash\npip install openchart\n```\n\nor from the GitHub repository:\n\n```bash\npip install git+https://github.com/marketcalls/openchart.git\n```\n\n## Usage\n\n### Import the Library\n\n```python\nfrom openchart import NSEData\n```\n\n### Initialize the NSEData Class\n\n```python\nnse = NSEData()\n```\n\n### Download Master Data\n\nBefore fetching historical data or searching for symbols, download the master data:\n\n```python\nnse.download()\n```\n\n\n### Fetch Historical Data\n\nTo fetch historical data for a symbol, use the `historical` method. **Always specify `start` and `end` dates**. You can use `datetime` and `timedelta` to get data from 30 days back.\n\n#### Intraday Data\n\nFetch intraday data for **TCS** with a 5-minute interval, from 30 days ago until today:\n\n```python\nimport datetime\n\nend_date = datetime.datetime.now()\nstart_date = end_date - datetime.timedelta(days=30)\n\ndata = nse.historical(\n    symbol='TCS',\n    exchange='NSE',\n    start=start_date,\n    end=end_date,\n    interval='5m'\n)\nprint(data)\n```\n\n#### EOD Data\n\nFetch end-of-day data for **Nifty 50**, from 365 days ago until today:\n\n```python\nimport datetime\n\nend_date = datetime.datetime.now()\nstart_date = end_date - datetime.timedelta(days=365)\n\ndata = nse.historical(\n    symbol='Nifty 50',\n    exchange='NSE',\n    start=start_date,\n    end=end_date,\n    interval='1d'\n)\nprint(data)\n```\n\n#### NFO Data\n\nFetch historical data for a futures contract of 15min data, from 30 days ago until today:\n\n```python\nimport datetime\n\nend_date = datetime.datetime.now()\nstart_date = end_date - datetime.timedelta(days=30)\n\ndata = nse.historical(\n    symbol='BANKNIFTY24OCTFUT',\n    exchange='NFO',\n    start=start_date,\n    end=end_date,\n    interval='15m'\n)\nprint(data)\n```\n\n### Search for Symbols\n\n#### NSE Exchange\n\nSearch for symbols like **Nifty 50**, **TCS**, **RELIANCE** in the NSE exchange.\n\n```python\nsymbols = nse.search('RELIANCE', exchange='NSE')\nprint(symbols)\n```\n\n#### NFO Exchange\n\nSearch for symbols like **NIFTY24OCTFUT**, **BANKNIFTY24OCTFUT**, **NIFTY24N2124800CE**, **NIFTY24N2124800PE** in the NFO exchange.\n\n- **NIFTY24N2124800CE** corresponds to **NIFTY 21 Nov 2024 CE 24800.00**.\n- **NIFTY24N2124800PE** corresponds to **NIFTY 21 Nov 2024 PE 24800.00**.\n\n```python\nsymbols = nse.search('24OCTFUT', exchange='NFO')\nprint(symbols)\n```\n\nOutput\n```bash\n    ScripCode              Symbol                    Name Type\n0       35006   BANKNIFTY24OCTFUT   BANKNIFTY 30 Oct 2024    1\n1       35007  NIFTYNXT5024OCTFUT  NIFTYNXT50 25 Oct 2024    1\n2       35012    FINNIFTY24OCTFUT    FINNIFTY 29 Oct 2024    1\n3       35239  MIDCPNIFTY24OCTFUT  MIDCPNIFTY 28 Oct 2024    1\n4       35382       NIFTY24OCTFUT       NIFTY 31 Oct 2024    1\n..        ...                 ...                     ...  ...\n179     48598         UPL24OCTFUT         UPL 31 Oct 2024    3\n180     48601        VEDL24OCTFUT        VEDL 31 Oct 2024    3\n181     48602      VOLTAS24OCTFUT      VOLTAS 31 Oct 2024    3\n182     48603       WIPRO24OCTFUT       WIPRO 31 Oct 2024    3\n183     48604   ZYDUSLIFE24OCTFUT   ZYDUSLIFE 31 Oct 2024    3\n\n[184 rows x 4 columns]\n\n```\n\n#### Exact Match Search\n\nIf you want to perform an exact match search, you can set `exact_match=True`.\n\n```python\nsymbol_info = nse.search('BANKNIFTY24OCTFUT', exchange='NFO', exact_match=True)\nprint(symbol_info)\n```\n\n### Supported Timeframes\n\n```python\nprint(nse.timeframes())\n# Output: ['1m', '3m', '5m', '10m', '15m', '30m', '1h', '1d', '1w', '1M']\n```\n\n## Functions\n\n- `download()`: Downloads NSE and NFO master data.\n- `search(symbol, exchange, exact_match=False)`: Searches for symbols in the specified exchange (`'NSE'` or `'NFO'`).\n  - Returns a pandas DataFrame containing all matching symbols.\n- `symbolsearch(symbol, exchange)`: Searches for a symbol and returns the first match.\n  - Used internally by the `historical` method.\n- `historical(symbol, exchange, start, end, interval='1d')`: Fetches historical data for a symbol.\n  - Uses the `symbolsearch` method to find the symbol, which returns the first match.\n  - **Always specify `start` and `end` dates when fetching data**.\n- `timeframes()`: Returns a list of supported timeframes.\n\n## Notes\n\n- Ensure that you have a stable internet connection.\n- The `historical` method uses `symbolsearch`, which returns the first matching symbol. If multiple symbols match your query, consider using an exact symbol name or modifying the `historical` method to accept a symbol code directly.\n- **When fetching historical data, always specify `start` and `end` dates. You can use `datetime` and `timedelta` to calculate these dates.**\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## Contact\n\nFor any questions or support, please open an issue on the GitHub repository \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarketcalls%2Fopenchart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarketcalls%2Fopenchart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarketcalls%2Fopenchart/lists"}