drishti-sdk 0.2.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.
@@ -0,0 +1,14 @@
1
+ .DS_Store
2
+ *.pyc
3
+ __pycache__/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ .venv/
8
+ venv/
9
+ python/.venv/
10
+ python/build/
11
+ python/dist/
12
+ python/*.egg-info/
13
+ js/node_modules/
14
+ js/dist/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Market-Stack
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,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: drishti-sdk
3
+ Version: 0.2.0
4
+ Summary: Python client for the Alpha API (/v1)
5
+ Author: Market-Stack
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: alpha-api,http-client,python,sdk
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Internet :: WWW/HTTP
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: httpx<1,>=0.27.0
21
+ Requires-Dist: pydantic<3,>=2.0
22
+ Requires-Dist: websockets<16,>=12.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
25
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Drishti SDK (Python)
29
+
30
+ Official Python SDK for the Manasija Alpha API (`/v1`).
31
+
32
+ This SDK provides:
33
+ - A synchronous HTTP client with named-argument endpoint helpers
34
+ - A low-level request interface for advanced/custom usage
35
+ - A WebSocket client for real-time streams (`/v1/ws`)
36
+
37
+ ## Requirements
38
+
39
+ - Python `3.10+`
40
+ - A valid Alpha API key
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install drishti-sdk
46
+ ```
47
+
48
+
49
+ ## Quick Start
50
+
51
+ ```python
52
+ from market_stack_sdk import DrishtiClient
53
+
54
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
55
+ news = client.get_news(
56
+ symbols=["RELIANCE", "TCS"],
57
+ limit=10,
58
+ )
59
+ print(len(news["data"]))
60
+ ```
61
+
62
+ All requests automatically include `X-API-Key` using the provided `api_key`.
63
+
64
+ ## HTTP Usage
65
+
66
+ ```python
67
+ from market_stack_sdk import DrishtiClient
68
+
69
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
70
+ announcements = client.get_announcements(
71
+ symbols=["RELIANCE"],
72
+ categories=["Corporate Action"],
73
+ detailed=True,
74
+ limit=20,
75
+ )
76
+
77
+ earnings = client.get_earnings_detail(
78
+ symbol="MEDIASSIST",
79
+ quarter="q4_26",
80
+ detailed=True,
81
+ )
82
+
83
+ transcript = client.get_concalls_transcript(
84
+ symbol="TCS",
85
+ quarter="q4_26",
86
+ )
87
+
88
+ alerts = client.get_alerts(
89
+ symbols=["INFY"],
90
+ important=True,
91
+ limit=25,
92
+ )
93
+ ```
94
+
95
+ ## Error Handling
96
+
97
+ ```python
98
+ from market_stack_sdk import MarketStackApiError, DrishtiClient
99
+
100
+ try:
101
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
102
+ client.get_account()
103
+ except MarketStackApiError as exc:
104
+ print(exc.status_code)
105
+ print(exc.body)
106
+ raise
107
+ ```
108
+
109
+ ## WebSocket Usage (`/v1/ws`)
110
+
111
+ ```python
112
+ import asyncio
113
+ from market_stack_sdk import DrishtiClient, SubscribeOptions
114
+
115
+
116
+ async def main() -> None:
117
+ client = DrishtiClient(api_key="YOUR_API_KEY")
118
+ async with client.websocket() as ws:
119
+ await ws.subscribe(
120
+ SubscribeOptions(
121
+ product="announcements",
122
+ symbols=["RELIANCE"],
123
+ detailed=False,
124
+ )
125
+ )
126
+ async for event in ws.events():
127
+ if event.kind == "subscribed":
128
+ print("ready", event.product, event.tier)
129
+ elif event.kind == "data":
130
+ print(event.channel, event.data)
131
+
132
+
133
+ asyncio.run(main())
134
+ ```
135
+
136
+ Reconnect/callback style:
137
+
138
+ ```python
139
+ async with client.websocket(
140
+ auto_reconnect=True,
141
+ reconnect_initial_delay=1.0,
142
+ reconnect_max_delay=30.0,
143
+ on_reconnect_attempt=lambda attempt, delay, reason: print(attempt, delay, reason),
144
+ on_data=lambda event: print(event.data) if event.kind == "data" else None,
145
+ ) as ws:
146
+ await ws.subscribe("alerts", symbols=["RELIANCE"])
147
+ await ws.run()
148
+ ```
149
+
150
+ ## Batch Jobs
151
+
152
+ ```python
153
+ from market_stack_sdk import DrishtiClient
154
+
155
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
156
+ with open("batch.jsonl", "rb") as f:
157
+ file_bytes = f.read()
158
+
159
+ job = client.post_batch_jobs_file(
160
+ file_name="batch.jsonl",
161
+ file_bytes=file_bytes,
162
+ display_name="Quarterly run",
163
+ )
164
+
165
+ status = client.get_batch_jobs_job_id(job_id=job["id"])
166
+ ```
167
+
168
+ ## API Surface
169
+
170
+ ### REST helper methods
171
+
172
+ - `get_news`
173
+ - `get_symbols_metadata`
174
+ - `get_announcements_categories`
175
+ - `get_announcements`
176
+ - `get_announcements_attachments`
177
+ - `post_daily_summary`
178
+ - `get_earnings`
179
+ - `get_earnings_detail`
180
+ - `get_earnings_attachments`
181
+ - `get_concalls`
182
+ - `get_concalls_detail`
183
+ - `get_concalls_transcript`
184
+ - `post_concalls_transcripts`
185
+ - `get_alerts`
186
+ - `get_account`
187
+ - `get_account_limits`
188
+ - `get_account_usage`
189
+ - `get_account_ledger`
190
+ - `post_batch_jobs`
191
+ - `post_batch_jobs_file`
192
+ - `get_batch_jobs`
193
+ - `get_batch_jobs_job_id`
194
+ - `delete_batch_jobs_job_id`
195
+ - `get_batch_jobs_job_id_results`
196
+ - `websocket`
197
+
198
+ ### Low-level HTTP methods
199
+
200
+ - `request`
201
+ - `get`
202
+ - `post`
203
+ - `put`
204
+ - `patch`
205
+ - `delete`
206
+ - `request_v1`
207
+
208
+ ## Development
209
+
210
+ ```bash
211
+ pip install -e .[dev]
212
+ ```
@@ -0,0 +1,185 @@
1
+ # Drishti SDK (Python)
2
+
3
+ Official Python SDK for the Manasija Alpha API (`/v1`).
4
+
5
+ This SDK provides:
6
+ - A synchronous HTTP client with named-argument endpoint helpers
7
+ - A low-level request interface for advanced/custom usage
8
+ - A WebSocket client for real-time streams (`/v1/ws`)
9
+
10
+ ## Requirements
11
+
12
+ - Python `3.10+`
13
+ - A valid Alpha API key
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install drishti-sdk
19
+ ```
20
+
21
+
22
+ ## Quick Start
23
+
24
+ ```python
25
+ from market_stack_sdk import DrishtiClient
26
+
27
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
28
+ news = client.get_news(
29
+ symbols=["RELIANCE", "TCS"],
30
+ limit=10,
31
+ )
32
+ print(len(news["data"]))
33
+ ```
34
+
35
+ All requests automatically include `X-API-Key` using the provided `api_key`.
36
+
37
+ ## HTTP Usage
38
+
39
+ ```python
40
+ from market_stack_sdk import DrishtiClient
41
+
42
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
43
+ announcements = client.get_announcements(
44
+ symbols=["RELIANCE"],
45
+ categories=["Corporate Action"],
46
+ detailed=True,
47
+ limit=20,
48
+ )
49
+
50
+ earnings = client.get_earnings_detail(
51
+ symbol="MEDIASSIST",
52
+ quarter="q4_26",
53
+ detailed=True,
54
+ )
55
+
56
+ transcript = client.get_concalls_transcript(
57
+ symbol="TCS",
58
+ quarter="q4_26",
59
+ )
60
+
61
+ alerts = client.get_alerts(
62
+ symbols=["INFY"],
63
+ important=True,
64
+ limit=25,
65
+ )
66
+ ```
67
+
68
+ ## Error Handling
69
+
70
+ ```python
71
+ from market_stack_sdk import MarketStackApiError, DrishtiClient
72
+
73
+ try:
74
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
75
+ client.get_account()
76
+ except MarketStackApiError as exc:
77
+ print(exc.status_code)
78
+ print(exc.body)
79
+ raise
80
+ ```
81
+
82
+ ## WebSocket Usage (`/v1/ws`)
83
+
84
+ ```python
85
+ import asyncio
86
+ from market_stack_sdk import DrishtiClient, SubscribeOptions
87
+
88
+
89
+ async def main() -> None:
90
+ client = DrishtiClient(api_key="YOUR_API_KEY")
91
+ async with client.websocket() as ws:
92
+ await ws.subscribe(
93
+ SubscribeOptions(
94
+ product="announcements",
95
+ symbols=["RELIANCE"],
96
+ detailed=False,
97
+ )
98
+ )
99
+ async for event in ws.events():
100
+ if event.kind == "subscribed":
101
+ print("ready", event.product, event.tier)
102
+ elif event.kind == "data":
103
+ print(event.channel, event.data)
104
+
105
+
106
+ asyncio.run(main())
107
+ ```
108
+
109
+ Reconnect/callback style:
110
+
111
+ ```python
112
+ async with client.websocket(
113
+ auto_reconnect=True,
114
+ reconnect_initial_delay=1.0,
115
+ reconnect_max_delay=30.0,
116
+ on_reconnect_attempt=lambda attempt, delay, reason: print(attempt, delay, reason),
117
+ on_data=lambda event: print(event.data) if event.kind == "data" else None,
118
+ ) as ws:
119
+ await ws.subscribe("alerts", symbols=["RELIANCE"])
120
+ await ws.run()
121
+ ```
122
+
123
+ ## Batch Jobs
124
+
125
+ ```python
126
+ from market_stack_sdk import DrishtiClient
127
+
128
+ with DrishtiClient(api_key="YOUR_API_KEY") as client:
129
+ with open("batch.jsonl", "rb") as f:
130
+ file_bytes = f.read()
131
+
132
+ job = client.post_batch_jobs_file(
133
+ file_name="batch.jsonl",
134
+ file_bytes=file_bytes,
135
+ display_name="Quarterly run",
136
+ )
137
+
138
+ status = client.get_batch_jobs_job_id(job_id=job["id"])
139
+ ```
140
+
141
+ ## API Surface
142
+
143
+ ### REST helper methods
144
+
145
+ - `get_news`
146
+ - `get_symbols_metadata`
147
+ - `get_announcements_categories`
148
+ - `get_announcements`
149
+ - `get_announcements_attachments`
150
+ - `post_daily_summary`
151
+ - `get_earnings`
152
+ - `get_earnings_detail`
153
+ - `get_earnings_attachments`
154
+ - `get_concalls`
155
+ - `get_concalls_detail`
156
+ - `get_concalls_transcript`
157
+ - `post_concalls_transcripts`
158
+ - `get_alerts`
159
+ - `get_account`
160
+ - `get_account_limits`
161
+ - `get_account_usage`
162
+ - `get_account_ledger`
163
+ - `post_batch_jobs`
164
+ - `post_batch_jobs_file`
165
+ - `get_batch_jobs`
166
+ - `get_batch_jobs_job_id`
167
+ - `delete_batch_jobs_job_id`
168
+ - `get_batch_jobs_job_id_results`
169
+ - `websocket`
170
+
171
+ ### Low-level HTTP methods
172
+
173
+ - `request`
174
+ - `get`
175
+ - `post`
176
+ - `put`
177
+ - `patch`
178
+ - `delete`
179
+ - `request_v1`
180
+
181
+ ## Development
182
+
183
+ ```bash
184
+ pip install -e .[dev]
185
+ ```
@@ -0,0 +1,75 @@
1
+ from market_stack_sdk.client import DEFAULT_BASE_URL, DrishtiClient
2
+ from market_stack_sdk.exceptions import MarketStackApiError, MarketStackWebSocketError
3
+ from market_stack_sdk.params import (
4
+ AccountLedgerQueryParams,
5
+ AlertsQueryParams,
6
+ AnnouncementsListQueryParams,
7
+ AnnouncementsQueryParams,
8
+ BatchJobsListQueryParams,
9
+ ConcallsQueryParams,
10
+ DailySummaryPortfolioItem,
11
+ DailySummaryRequest,
12
+ DocumentIdsQueryParams,
13
+ EarningsQueryParams,
14
+ FeedQueryParams,
15
+ NewsQueryParams,
16
+ SymbolMetadataQueryParams,
17
+ SymbolQuarterDetailQueryParams,
18
+ SymbolQuarterQueryParams,
19
+ BatchJobIdParams,
20
+ coerce_query_params,
21
+ )
22
+ from market_stack_sdk import types as response_types
23
+ from market_stack_sdk.websocket import (
24
+ ALPHA_WS_PRODUCTS,
25
+ AlphaWebSocketClientSessionOptions,
26
+ AlphaWebSocketProduct,
27
+ AlphaWebSocketSession,
28
+ DataEvent,
29
+ ErrorEvent,
30
+ RawEvent,
31
+ SubscribeOptions,
32
+ SubscribedEvent,
33
+ WebSocketEvent,
34
+ build_websocket_url,
35
+ parse_websocket_message,
36
+ stream_product,
37
+ )
38
+
39
+ __all__ = [
40
+ "DEFAULT_BASE_URL",
41
+ "ALPHA_WS_PRODUCTS",
42
+ "AccountLedgerQueryParams",
43
+ "AlertsQueryParams",
44
+ "AlphaWebSocketClientSessionOptions",
45
+ "AlphaWebSocketProduct",
46
+ "AlphaWebSocketSession",
47
+ "AnnouncementsListQueryParams",
48
+ "AnnouncementsQueryParams",
49
+ "BatchJobsListQueryParams",
50
+ "ConcallsQueryParams",
51
+ "DailySummaryPortfolioItem",
52
+ "DailySummaryRequest",
53
+ "DataEvent",
54
+ "DocumentIdsQueryParams",
55
+ "EarningsQueryParams",
56
+ "ErrorEvent",
57
+ "FeedQueryParams",
58
+ "DrishtiClient",
59
+ "MarketStackApiError",
60
+ "MarketStackWebSocketError",
61
+ "NewsQueryParams",
62
+ "RawEvent",
63
+ "SubscribeOptions",
64
+ "SubscribedEvent",
65
+ "SymbolMetadataQueryParams",
66
+ "SymbolQuarterDetailQueryParams",
67
+ "SymbolQuarterQueryParams",
68
+ "BatchJobIdParams",
69
+ "WebSocketEvent",
70
+ "build_websocket_url",
71
+ "coerce_query_params",
72
+ "parse_websocket_message",
73
+ "response_types",
74
+ "stream_product",
75
+ ]