market-data-feed 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- market_data_feed-0.1.0/LICENSE +21 -0
- market_data_feed-0.1.0/PKG-INFO +58 -0
- market_data_feed-0.1.0/README.md +23 -0
- market_data_feed-0.1.0/customdata/__init__.py +7 -0
- market_data_feed-0.1.0/customdata/api.py +107 -0
- market_data_feed-0.1.0/customdata/drive_client.py +97 -0
- market_data_feed-0.1.0/market_data_feed.egg-info/PKG-INFO +58 -0
- market_data_feed-0.1.0/market_data_feed.egg-info/SOURCES.txt +36 -0
- market_data_feed-0.1.0/market_data_feed.egg-info/dependency_links.txt +1 -0
- market_data_feed-0.1.0/market_data_feed.egg-info/requires.txt +26 -0
- market_data_feed-0.1.0/market_data_feed.egg-info/top_level.txt +4 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/__init__.py +36 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/bse.py +340 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/cli.py +85 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/dataframe.py +61 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/fetcher.py +350 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/py.typed +0 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/registry.py +282 -0
- market_data_feed-0.1.0/packages/bse-data/src/bsedata/session.py +130 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/__init__.py +40 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/cli.py +91 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/dataframe.py +60 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/fetcher.py +305 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/mcx.py +231 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/py.typed +0 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/registry.py +147 -0
- market_data_feed-0.1.0/packages/mcx-data/src/mcxdata/session.py +96 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/__init__.py +30 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/calendar.py +145 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/cli.py +116 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/dataframe.py +78 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/fetcher.py +277 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/niftyindices.py +341 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/nse.py +401 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/py.typed +0 -0
- market_data_feed-0.1.0/packages/nse-data/src/nsedata/registry.py +1205 -0
- market_data_feed-0.1.0/pyproject.toml +42 -0
- market_data_feed-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lumiq.ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: market-data-feed
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Indian market data: NSE, BSE, MCX + custom 1-minute OHLCV
|
|
5
|
+
Author-email: Praglitch <your-email@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Praglitch/market-data-feed
|
|
8
|
+
Project-URL: Repository, https://github.com/Praglitch/market-data-feed
|
|
9
|
+
Project-URL: BugTracker, https://github.com/Praglitch/market-data-feed/issues
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: pandas>=2.0.0
|
|
14
|
+
Requires-Dist: requests>=2.31.0
|
|
15
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
16
|
+
Requires-Dist: curl-cffi>=0.7.0
|
|
17
|
+
Requires-Dist: google-api-python-client>=2.100.0
|
|
18
|
+
Requires-Dist: google-auth-oauthlib>=1.0.0
|
|
19
|
+
Requires-Dist: google-auth-httplib2>=0.1.0
|
|
20
|
+
Provides-Extra: s3
|
|
21
|
+
Requires-Dist: boto3>=1.28.0; extra == "s3"
|
|
22
|
+
Provides-Extra: polars
|
|
23
|
+
Requires-Dist: polars>=0.20.0; extra == "polars"
|
|
24
|
+
Provides-Extra: cloudflare
|
|
25
|
+
Requires-Dist: cloudscraper>=1.2.71; extra == "cloudflare"
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: boto3>=1.28.0; extra == "all"
|
|
28
|
+
Requires-Dist: polars>=0.20.0; extra == "all"
|
|
29
|
+
Requires-Dist: cloudscraper>=1.2.71; extra == "all"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="docs/assets/nse.jpg" alt="NSE India" height="80"/>
|
|
38
|
+
|
|
39
|
+
<img src="docs/assets/BSE_logo.png" alt="BSE India" height="80"/>
|
|
40
|
+
|
|
41
|
+
<img src="docs/assets/mcx.png" alt="MCX India" height="80"/>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<h1 align="center">market-data-feed</h1>
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<strong>Unified Indian Market Data + Custom 1‑Minute OHLCV</strong><br/>
|
|
48
|
+
NSE · BSE · MCX · Proprietary High‑Frequency Data
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<a href="https://pypi.org/project/market-data-feed/"><img src="https://img.shields.io/pypi/v/market-data-feed" alt="PyPI version"/></a>
|
|
53
|
+
<a href="https://pypi.org/project/market-data-feed/"><img src="https://img.shields.io/pypi/pyversions/market-data-feed" alt="Python 3.9+"/></a>
|
|
54
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT License"/></a>
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install market-data-feed
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/nse.jpg" alt="NSE India" height="80"/>
|
|
3
|
+
|
|
4
|
+
<img src="docs/assets/BSE_logo.png" alt="BSE India" height="80"/>
|
|
5
|
+
|
|
6
|
+
<img src="docs/assets/mcx.png" alt="MCX India" height="80"/>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<h1 align="center">market-data-feed</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>Unified Indian Market Data + Custom 1‑Minute OHLCV</strong><br/>
|
|
13
|
+
NSE · BSE · MCX · Proprietary High‑Frequency Data
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://pypi.org/project/market-data-feed/"><img src="https://img.shields.io/pypi/v/market-data-feed" alt="PyPI version"/></a>
|
|
18
|
+
<a href="https://pypi.org/project/market-data-feed/"><img src="https://img.shields.io/pypi/pyversions/market-data-feed" alt="Python 3.9+"/></a>
|
|
19
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT License"/></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install market-data-feed
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from .drive_client import (
|
|
3
|
+
authenticate,
|
|
4
|
+
get_root_folder_id,
|
|
5
|
+
get_subfolder_id,
|
|
6
|
+
list_files_in_folder,
|
|
7
|
+
download_file_as_df,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
_FOLDER_CACHE = {}
|
|
11
|
+
_DRIVE_SERVICE = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_service():
|
|
15
|
+
global _DRIVE_SERVICE
|
|
16
|
+
if _DRIVE_SERVICE is None:
|
|
17
|
+
_DRIVE_SERVICE = authenticate()
|
|
18
|
+
return _DRIVE_SERVICE
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _get_folder_id(folder_name):
|
|
22
|
+
if folder_name not in _FOLDER_CACHE:
|
|
23
|
+
service = _get_service()
|
|
24
|
+
root_id = get_root_folder_id(service)
|
|
25
|
+
if not root_id:
|
|
26
|
+
raise Exception("Root folder 'indian-market-data' not found on Drive.")
|
|
27
|
+
sub_id = get_subfolder_id(service, folder_name, root_id)
|
|
28
|
+
if not sub_id:
|
|
29
|
+
raise Exception(f"Subfolder '{folder_name}' not found on Drive.")
|
|
30
|
+
_FOLDER_CACHE[folder_name] = sub_id
|
|
31
|
+
return _FOLDER_CACHE[folder_name]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _fetch_csv(folder_name, file_name, start=None, end=None):
|
|
35
|
+
service = _get_service()
|
|
36
|
+
folder_id = _get_folder_id(folder_name)
|
|
37
|
+
|
|
38
|
+
files = list_files_in_folder(service, folder_id)
|
|
39
|
+
file_id = None
|
|
40
|
+
for f in files:
|
|
41
|
+
if f["name"] == file_name:
|
|
42
|
+
file_id = f["id"]
|
|
43
|
+
break
|
|
44
|
+
|
|
45
|
+
if not file_id:
|
|
46
|
+
raise FileNotFoundError(f"{file_name} not found in {folder_name}")
|
|
47
|
+
|
|
48
|
+
df = download_file_as_df(service, file_id)
|
|
49
|
+
df["timestamp"] = pd.to_datetime(df["timestamp"])
|
|
50
|
+
|
|
51
|
+
if start:
|
|
52
|
+
df = df[df["timestamp"] >= pd.to_datetime(start)]
|
|
53
|
+
if end:
|
|
54
|
+
df = df[df["timestamp"] <= pd.to_datetime(end)]
|
|
55
|
+
|
|
56
|
+
return df
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def get_scrip(symbol, index="nifty50", start=None, end=None):
|
|
60
|
+
folder_map = {
|
|
61
|
+
"nifty50": "nifty50_scrips",
|
|
62
|
+
"nifty500": "nifty500_scrips",
|
|
63
|
+
}
|
|
64
|
+
if index not in folder_map:
|
|
65
|
+
raise ValueError("index must be 'nifty50' or 'nifty500'")
|
|
66
|
+
|
|
67
|
+
folder_name = folder_map[index]
|
|
68
|
+
file_name = f"{symbol.upper()}.csv"
|
|
69
|
+
return _fetch_csv(folder_name, file_name, start, end)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def get_index(index_type="nifty50", start=None, end=None):
|
|
73
|
+
folder_map = {
|
|
74
|
+
"nifty50": "nifty50_index",
|
|
75
|
+
"nifty500": "nifty500_index",
|
|
76
|
+
}
|
|
77
|
+
if index_type not in folder_map:
|
|
78
|
+
raise ValueError("index_type must be 'nifty50' or 'nifty500'")
|
|
79
|
+
|
|
80
|
+
folder_name = folder_map[index_type]
|
|
81
|
+
file_name = "NIFTY50_INDEX.csv" if index_type == "nifty50" else "NIFTY500_INDEX.csv"
|
|
82
|
+
return _fetch_csv(folder_name, file_name, start, end)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_all_scrips(index="nifty50", start=None, end=None):
|
|
86
|
+
folder_map = {
|
|
87
|
+
"nifty50": "nifty50_scrips",
|
|
88
|
+
"nifty500": "nifty500_scrips",
|
|
89
|
+
}
|
|
90
|
+
if index not in folder_map:
|
|
91
|
+
raise ValueError("index must be 'nifty50' or 'nifty500'")
|
|
92
|
+
|
|
93
|
+
service = _get_service()
|
|
94
|
+
folder_id = _get_folder_id(folder_map[index])
|
|
95
|
+
files = list_files_in_folder(service, folder_id)
|
|
96
|
+
|
|
97
|
+
result = {}
|
|
98
|
+
for f in files:
|
|
99
|
+
symbol = f["name"].replace(".csv", "")
|
|
100
|
+
try:
|
|
101
|
+
df = _fetch_csv(folder_map[index], f["name"], start, end)
|
|
102
|
+
result[symbol] = df
|
|
103
|
+
print(f"✅ {symbol}: {len(df)} rows")
|
|
104
|
+
except Exception as e:
|
|
105
|
+
print(f"❌ {symbol}: {e}")
|
|
106
|
+
|
|
107
|
+
return result
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pickle
|
|
3
|
+
import io
|
|
4
|
+
import pandas as pd
|
|
5
|
+
from google_auth_oauthlib.flow import InstalledAppFlow
|
|
6
|
+
from google.auth.transport.requests import Request
|
|
7
|
+
from googleapiclient.discovery import build
|
|
8
|
+
from googleapiclient.http import MediaIoBaseDownload, MediaFileUpload
|
|
9
|
+
|
|
10
|
+
SCOPES = ["https://www.googleapis.com/auth/drive.file"]
|
|
11
|
+
CLIENT_SECRET_FILE = "credentials/oauth_client.json"
|
|
12
|
+
TOKEN_PICKLE = "credentials/token.pickle"
|
|
13
|
+
ROOT_FOLDER_NAME = "indian-market-data"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def authenticate():
|
|
17
|
+
creds = None
|
|
18
|
+
if os.path.exists(TOKEN_PICKLE):
|
|
19
|
+
with open(TOKEN_PICKLE, "rb") as token:
|
|
20
|
+
creds = pickle.load(token)
|
|
21
|
+
if not creds or not creds.valid:
|
|
22
|
+
if creds and creds.expired and creds.refresh_token:
|
|
23
|
+
creds.refresh(Request())
|
|
24
|
+
else:
|
|
25
|
+
flow = InstalledAppFlow.from_client_secrets_file(CLIENT_SECRET_FILE, SCOPES)
|
|
26
|
+
creds = flow.run_local_server(port=0)
|
|
27
|
+
with open(TOKEN_PICKLE, "wb") as token:
|
|
28
|
+
pickle.dump(creds, token)
|
|
29
|
+
return build("drive", "v3", credentials=creds)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def get_folder_id(service, folder_name, parent_id=None):
|
|
33
|
+
query = f"name='{folder_name}' and mimeType='application/vnd.google-apps.folder' and trashed=false"
|
|
34
|
+
if parent_id:
|
|
35
|
+
query += f" and '{parent_id}' in parents"
|
|
36
|
+
results = service.files().list(q=query, fields="files(id, name)").execute()
|
|
37
|
+
folders = results.get("files", [])
|
|
38
|
+
return folders[0]["id"] if folders else None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_root_folder_id(service):
|
|
42
|
+
return get_folder_id(service, ROOT_FOLDER_NAME)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_subfolder_id(service, folder_name, parent_id):
|
|
46
|
+
return get_folder_id(service, folder_name, parent_id)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def list_files_in_folder(service, folder_id):
|
|
50
|
+
query = f"'{folder_id}' in parents and trashed=false and mimeType='text/csv'"
|
|
51
|
+
results = service.files().list(q=query, fields="files(id, name)").execute()
|
|
52
|
+
return results.get("files", [])
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def download_file_as_df(service, file_id):
|
|
56
|
+
request = service.files().get_media(fileId=file_id)
|
|
57
|
+
file_bytes = io.BytesIO()
|
|
58
|
+
downloader = MediaIoBaseDownload(file_bytes, request)
|
|
59
|
+
done = False
|
|
60
|
+
while not done:
|
|
61
|
+
status, done = downloader.next_chunk()
|
|
62
|
+
file_bytes.seek(0)
|
|
63
|
+
return pd.read_csv(file_bytes)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def upload_df_as_csv(service, df, folder_id, file_name):
|
|
67
|
+
"""
|
|
68
|
+
Upload DataFrame as CSV, deleting any existing file first.
|
|
69
|
+
Verifies upload by checking row count.
|
|
70
|
+
"""
|
|
71
|
+
temp_path = f"/tmp/{file_name}"
|
|
72
|
+
df.to_csv(temp_path, index=False)
|
|
73
|
+
|
|
74
|
+
# Check if file exists and delete it
|
|
75
|
+
query = f"name='{file_name}' and '{folder_id}' in parents and trashed=false"
|
|
76
|
+
results = service.files().list(q=query, fields="files(id, name)").execute()
|
|
77
|
+
files = results.get("files", [])
|
|
78
|
+
if files:
|
|
79
|
+
file_id = files[0]["id"]
|
|
80
|
+
service.files().delete(fileId=file_id).execute()
|
|
81
|
+
print(f"🗑️ Deleted old {file_name}")
|
|
82
|
+
|
|
83
|
+
# Upload new file
|
|
84
|
+
media = MediaFileUpload(temp_path, mimetype="text/csv", resumable=True)
|
|
85
|
+
file_metadata = {"name": file_name, "parents": [folder_id]}
|
|
86
|
+
new_file = service.files().create(body=file_metadata, media_body=media, fields="id").execute()
|
|
87
|
+
print(f"✅ Uploaded new {file_name} (ID: {new_file['id']})")
|
|
88
|
+
|
|
89
|
+
os.remove(temp_path)
|
|
90
|
+
|
|
91
|
+
# Verification: download and compare row count
|
|
92
|
+
verify_df = download_file_as_df(service, new_file['id'])
|
|
93
|
+
if len(verify_df) != len(df):
|
|
94
|
+
print(f"⚠️ Verification failed: expected {len(df)} rows, got {len(verify_df)} rows")
|
|
95
|
+
else:
|
|
96
|
+
print(f"✅ Verification passed: {len(verify_df)} rows")
|
|
97
|
+
return new_file['id']
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: market-data-feed
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Indian market data: NSE, BSE, MCX + custom 1-minute OHLCV
|
|
5
|
+
Author-email: Praglitch <your-email@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Praglitch/market-data-feed
|
|
8
|
+
Project-URL: Repository, https://github.com/Praglitch/market-data-feed
|
|
9
|
+
Project-URL: BugTracker, https://github.com/Praglitch/market-data-feed/issues
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: pandas>=2.0.0
|
|
14
|
+
Requires-Dist: requests>=2.31.0
|
|
15
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
16
|
+
Requires-Dist: curl-cffi>=0.7.0
|
|
17
|
+
Requires-Dist: google-api-python-client>=2.100.0
|
|
18
|
+
Requires-Dist: google-auth-oauthlib>=1.0.0
|
|
19
|
+
Requires-Dist: google-auth-httplib2>=0.1.0
|
|
20
|
+
Provides-Extra: s3
|
|
21
|
+
Requires-Dist: boto3>=1.28.0; extra == "s3"
|
|
22
|
+
Provides-Extra: polars
|
|
23
|
+
Requires-Dist: polars>=0.20.0; extra == "polars"
|
|
24
|
+
Provides-Extra: cloudflare
|
|
25
|
+
Requires-Dist: cloudscraper>=1.2.71; extra == "cloudflare"
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: boto3>=1.28.0; extra == "all"
|
|
28
|
+
Requires-Dist: polars>=0.20.0; extra == "all"
|
|
29
|
+
Requires-Dist: cloudscraper>=1.2.71; extra == "all"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="docs/assets/nse.jpg" alt="NSE India" height="80"/>
|
|
38
|
+
|
|
39
|
+
<img src="docs/assets/BSE_logo.png" alt="BSE India" height="80"/>
|
|
40
|
+
|
|
41
|
+
<img src="docs/assets/mcx.png" alt="MCX India" height="80"/>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<h1 align="center">market-data-feed</h1>
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<strong>Unified Indian Market Data + Custom 1‑Minute OHLCV</strong><br/>
|
|
48
|
+
NSE · BSE · MCX · Proprietary High‑Frequency Data
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<a href="https://pypi.org/project/market-data-feed/"><img src="https://img.shields.io/pypi/v/market-data-feed" alt="PyPI version"/></a>
|
|
53
|
+
<a href="https://pypi.org/project/market-data-feed/"><img src="https://img.shields.io/pypi/pyversions/market-data-feed" alt="Python 3.9+"/></a>
|
|
54
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT License"/></a>
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install market-data-feed
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
customdata/__init__.py
|
|
5
|
+
customdata/api.py
|
|
6
|
+
customdata/drive_client.py
|
|
7
|
+
market_data_feed.egg-info/PKG-INFO
|
|
8
|
+
market_data_feed.egg-info/SOURCES.txt
|
|
9
|
+
market_data_feed.egg-info/dependency_links.txt
|
|
10
|
+
market_data_feed.egg-info/requires.txt
|
|
11
|
+
market_data_feed.egg-info/top_level.txt
|
|
12
|
+
packages/bse-data/src/bsedata/__init__.py
|
|
13
|
+
packages/bse-data/src/bsedata/bse.py
|
|
14
|
+
packages/bse-data/src/bsedata/cli.py
|
|
15
|
+
packages/bse-data/src/bsedata/dataframe.py
|
|
16
|
+
packages/bse-data/src/bsedata/fetcher.py
|
|
17
|
+
packages/bse-data/src/bsedata/py.typed
|
|
18
|
+
packages/bse-data/src/bsedata/registry.py
|
|
19
|
+
packages/bse-data/src/bsedata/session.py
|
|
20
|
+
packages/mcx-data/src/mcxdata/__init__.py
|
|
21
|
+
packages/mcx-data/src/mcxdata/cli.py
|
|
22
|
+
packages/mcx-data/src/mcxdata/dataframe.py
|
|
23
|
+
packages/mcx-data/src/mcxdata/fetcher.py
|
|
24
|
+
packages/mcx-data/src/mcxdata/mcx.py
|
|
25
|
+
packages/mcx-data/src/mcxdata/py.typed
|
|
26
|
+
packages/mcx-data/src/mcxdata/registry.py
|
|
27
|
+
packages/mcx-data/src/mcxdata/session.py
|
|
28
|
+
packages/nse-data/src/nsedata/__init__.py
|
|
29
|
+
packages/nse-data/src/nsedata/calendar.py
|
|
30
|
+
packages/nse-data/src/nsedata/cli.py
|
|
31
|
+
packages/nse-data/src/nsedata/dataframe.py
|
|
32
|
+
packages/nse-data/src/nsedata/fetcher.py
|
|
33
|
+
packages/nse-data/src/nsedata/niftyindices.py
|
|
34
|
+
packages/nse-data/src/nsedata/nse.py
|
|
35
|
+
packages/nse-data/src/nsedata/py.typed
|
|
36
|
+
packages/nse-data/src/nsedata/registry.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
pandas>=2.0.0
|
|
2
|
+
requests>=2.31.0
|
|
3
|
+
openpyxl>=3.1.0
|
|
4
|
+
curl-cffi>=0.7.0
|
|
5
|
+
google-api-python-client>=2.100.0
|
|
6
|
+
google-auth-oauthlib>=1.0.0
|
|
7
|
+
google-auth-httplib2>=0.1.0
|
|
8
|
+
|
|
9
|
+
[all]
|
|
10
|
+
boto3>=1.28.0
|
|
11
|
+
polars>=0.20.0
|
|
12
|
+
cloudscraper>=1.2.71
|
|
13
|
+
|
|
14
|
+
[cloudflare]
|
|
15
|
+
cloudscraper>=1.2.71
|
|
16
|
+
|
|
17
|
+
[dev]
|
|
18
|
+
pytest
|
|
19
|
+
pytest-cov
|
|
20
|
+
ruff
|
|
21
|
+
|
|
22
|
+
[polars]
|
|
23
|
+
polars>=0.20.0
|
|
24
|
+
|
|
25
|
+
[s3]
|
|
26
|
+
boto3>=1.28.0
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
bse-data — Download BSE India market data as pandas DataFrames.
|
|
3
|
+
|
|
4
|
+
BSE (Bombay Stock Exchange) is India's oldest stock exchange.
|
|
5
|
+
This library provides historical and live data for all BSE indices
|
|
6
|
+
including SENSEX, BSE500, BANKEX and 50+ more.
|
|
7
|
+
|
|
8
|
+
Quick Start:
|
|
9
|
+
from bsedata import bse
|
|
10
|
+
|
|
11
|
+
# Historical SENSEX OHLC
|
|
12
|
+
df = bse.get_index("SENSEX", "2026-01-01", "2026-05-22")
|
|
13
|
+
|
|
14
|
+
# Historical BSE500
|
|
15
|
+
df = bse.get_index("BSE500", "2026-01-01", "2026-05-22")
|
|
16
|
+
|
|
17
|
+
# All indices for one date (single call)
|
|
18
|
+
df = bse.get_all_indices("2026-05-22")
|
|
19
|
+
|
|
20
|
+
# Live SENSEX quote
|
|
21
|
+
df = bse.get_live_sensex()
|
|
22
|
+
|
|
23
|
+
# Download to S3 (Lambda with IAM role)
|
|
24
|
+
bse.download_index("SENSEX", "2026-01-01", "2026-05-22",
|
|
25
|
+
s3_bucket="my-bucket", s3_prefix="raw/bse/")
|
|
26
|
+
|
|
27
|
+
# List all 50+ supported indices
|
|
28
|
+
bse.list_indices()
|
|
29
|
+
bse.list_indices(category="Sectoral")
|
|
30
|
+
|
|
31
|
+
See: https://NikhilSuthar.github.io/indian-market-data
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
__version__ = "1.1.1"
|
|
35
|
+
|
|
36
|
+
from bsedata import bse
|