finfetch 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.
finfetch-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Karanveer Singh
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,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: finfetch
3
+ Version: 0.1.0
4
+ Summary: Free financial data for Indian stocks — no API key needed.
5
+ Author: Karanveer Singh
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/karanveersingh/finfetch
8
+ Project-URL: Issues, https://github.com/karanveersingh/finfetch/issues
9
+ Keywords: finance,stocks,india,nse,bse,scraper,screener,pandas
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Financial and Insurance Industry
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Office/Business :: Financial :: Investment
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: requests>=2.28
25
+ Requires-Dist: beautifulsoup4>=4.11
26
+ Requires-Dist: lxml>=4.9
27
+ Requires-Dist: pandas>=1.5
28
+ Requires-Dist: yfinance>=0.2.30
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0; extra == "dev"
31
+ Requires-Dist: build; extra == "dev"
32
+ Requires-Dist: ruff; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # finfetch
36
+
37
+ Free financial data for Indian stocks. No API key needed.
38
+
39
+ `finfetch` scrapes publicly available data from Screener.in, Trendlyne, MoneyControl, and Yahoo Finance, returning clean **pandas DataFrames** with normalised column names and proper datetime indices.
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install finfetch
45
+ ```
46
+
47
+ Or install from source:
48
+
49
+ ```bash
50
+ git clone https://github.com/karanveersingh/finfetch.git
51
+ cd finfetch
52
+ pip install -e .
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ```python
58
+ import finfetch as ff
59
+
60
+ # Create a ticker object
61
+ stock = ff.Ticker("RELIANCE")
62
+
63
+ # Current price
64
+ stock.price # → 2845.50
65
+
66
+ # Company info (dict)
67
+ stock.info # → {"symbol": "RELIANCE", "name": "Reliance Industries", "pe_ratio": 25.4, ...}
68
+
69
+ # Price history (DataFrame)
70
+ stock.history(period="1y")
71
+ # open high low close volume
72
+ # 2024-01-02 2502.00 2535.00 2490.00 2520.00 8234567
73
+ # 2024-01-03 2525.00 2560.00 2510.00 2545.00 7654321
74
+ # ...
75
+
76
+ # Annual income statement
77
+ stock.financials
78
+ # revenue cogs gross_profit operating_profit net_profit eps
79
+ # 2024-03-31 612000.0 ... ... ... 60500.0 89.4
80
+ # 2023-03-31 593500.0 ... ... ... 55100.0 81.5
81
+ # ...
82
+
83
+ # Other statements
84
+ stock.balance_sheet
85
+ stock.cashflow
86
+ stock.ratios
87
+ stock.quarterly_financials
88
+ stock.shareholding
89
+ ```
90
+
91
+ ## Multiple Tickers
92
+
93
+ ```python
94
+ tickers = ff.Tickers("RELIANCE TCS INFY")
95
+ tickers["RELIANCE"].price
96
+ tickers["TCS"].financials
97
+
98
+ # Price history for all
99
+ histories = tickers.history(period="6m")
100
+ ```
101
+
102
+ ## Convenience Functions
103
+
104
+ ```python
105
+ # Quick price lookup
106
+ ff.get_price("RELIANCE") # → 2845.50
107
+
108
+ # Search for tickers
109
+ ff.search("Reliance")
110
+ # [{"symbol": "RELIANCE", "name": "reliance industries", "score": 0.85}, ...]
111
+ ```
112
+
113
+ ## Features
114
+
115
+ - **Lazy loading** — data is only fetched when you access a property
116
+ - **Built-in caching** — results cached for 5 minutes (configurable)
117
+ - **Multi-source fallback** — tries Screener.in → Trendlyne → MoneyControl → Yahoo Finance
118
+ - **Retry with backoff** — handles rate limits and transient errors
119
+ - **Clean output** — snake_case columns, DatetimeIndex, NaN for missing values
120
+ - **No API keys** — pure web scraping of publicly available data
121
+
122
+ ## Configuration
123
+
124
+ ### Cache TTL
125
+
126
+ ```python
127
+ stock = ff.Ticker("RELIANCE", cache_ttl=600) # cache for 10 minutes
128
+ stock.clear_cache() # manually invalidate
129
+ ```
130
+
131
+ ### Consolidated vs Standalone
132
+
133
+ ```python
134
+ stock = ff.Ticker("RELIANCE", consolidated=False) # standalone statements
135
+ ```
136
+
137
+ ### Screener.in Login (optional)
138
+
139
+ Set environment variables for extended Screener.in data:
140
+
141
+ ```bash
142
+ export SCREENER_EMAIL="your@email.com"
143
+ export SCREENER_PASSWORD="yourpassword"
144
+ ```
145
+
146
+ ## Data Sources
147
+
148
+ | Source | Sections | Auth Required |
149
+ |---|---|---|
150
+ | Screener.in | All financials, ratios, shareholding | Optional (login gives more history) |
151
+ | Trendlyne | Income, balance sheet, cash flow, ratios | No |
152
+ | MoneyControl | Income, balance sheet, cash flow, ratios | No |
153
+ | Yahoo Finance | Income, balance sheet, cash flow, price | No |
154
+
155
+ Sources are tried in the order listed above. If one fails, the next is tried automatically.
156
+
157
+ ## Output Format
158
+
159
+ All financial DataFrames follow a consistent format:
160
+
161
+ - **Index**: `DatetimeIndex` (fiscal period end dates)
162
+ - **Columns**: `snake_case` field names (e.g., `revenue`, `net_profit`, `operating_profit`)
163
+ - **Values**: `float64` in Crores (INR) for monetary fields
164
+ - **Missing data**: `NaN` (never empty strings)
165
+
166
+ ## Error Handling
167
+
168
+ ```python
169
+ from finfetch import TickerNotFoundError, DataUnavailableError
170
+
171
+ try:
172
+ stock = ff.Ticker("INVALID")
173
+ data = stock.financials
174
+ except DataUnavailableError as e:
175
+ print(f"No data: {e}")
176
+ ```
177
+
178
+ ## Building from Source
179
+
180
+ ```bash
181
+ pip install build
182
+ python -m build
183
+ # Output: dist/finfetch-0.1.0-py3-none-any.whl
184
+ ```
185
+
186
+ ## License
187
+
188
+ MIT
@@ -0,0 +1,154 @@
1
+ # finfetch
2
+
3
+ Free financial data for Indian stocks. No API key needed.
4
+
5
+ `finfetch` scrapes publicly available data from Screener.in, Trendlyne, MoneyControl, and Yahoo Finance, returning clean **pandas DataFrames** with normalised column names and proper datetime indices.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install finfetch
11
+ ```
12
+
13
+ Or install from source:
14
+
15
+ ```bash
16
+ git clone https://github.com/karanveersingh/finfetch.git
17
+ cd finfetch
18
+ pip install -e .
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ```python
24
+ import finfetch as ff
25
+
26
+ # Create a ticker object
27
+ stock = ff.Ticker("RELIANCE")
28
+
29
+ # Current price
30
+ stock.price # → 2845.50
31
+
32
+ # Company info (dict)
33
+ stock.info # → {"symbol": "RELIANCE", "name": "Reliance Industries", "pe_ratio": 25.4, ...}
34
+
35
+ # Price history (DataFrame)
36
+ stock.history(period="1y")
37
+ # open high low close volume
38
+ # 2024-01-02 2502.00 2535.00 2490.00 2520.00 8234567
39
+ # 2024-01-03 2525.00 2560.00 2510.00 2545.00 7654321
40
+ # ...
41
+
42
+ # Annual income statement
43
+ stock.financials
44
+ # revenue cogs gross_profit operating_profit net_profit eps
45
+ # 2024-03-31 612000.0 ... ... ... 60500.0 89.4
46
+ # 2023-03-31 593500.0 ... ... ... 55100.0 81.5
47
+ # ...
48
+
49
+ # Other statements
50
+ stock.balance_sheet
51
+ stock.cashflow
52
+ stock.ratios
53
+ stock.quarterly_financials
54
+ stock.shareholding
55
+ ```
56
+
57
+ ## Multiple Tickers
58
+
59
+ ```python
60
+ tickers = ff.Tickers("RELIANCE TCS INFY")
61
+ tickers["RELIANCE"].price
62
+ tickers["TCS"].financials
63
+
64
+ # Price history for all
65
+ histories = tickers.history(period="6m")
66
+ ```
67
+
68
+ ## Convenience Functions
69
+
70
+ ```python
71
+ # Quick price lookup
72
+ ff.get_price("RELIANCE") # → 2845.50
73
+
74
+ # Search for tickers
75
+ ff.search("Reliance")
76
+ # [{"symbol": "RELIANCE", "name": "reliance industries", "score": 0.85}, ...]
77
+ ```
78
+
79
+ ## Features
80
+
81
+ - **Lazy loading** — data is only fetched when you access a property
82
+ - **Built-in caching** — results cached for 5 minutes (configurable)
83
+ - **Multi-source fallback** — tries Screener.in → Trendlyne → MoneyControl → Yahoo Finance
84
+ - **Retry with backoff** — handles rate limits and transient errors
85
+ - **Clean output** — snake_case columns, DatetimeIndex, NaN for missing values
86
+ - **No API keys** — pure web scraping of publicly available data
87
+
88
+ ## Configuration
89
+
90
+ ### Cache TTL
91
+
92
+ ```python
93
+ stock = ff.Ticker("RELIANCE", cache_ttl=600) # cache for 10 minutes
94
+ stock.clear_cache() # manually invalidate
95
+ ```
96
+
97
+ ### Consolidated vs Standalone
98
+
99
+ ```python
100
+ stock = ff.Ticker("RELIANCE", consolidated=False) # standalone statements
101
+ ```
102
+
103
+ ### Screener.in Login (optional)
104
+
105
+ Set environment variables for extended Screener.in data:
106
+
107
+ ```bash
108
+ export SCREENER_EMAIL="your@email.com"
109
+ export SCREENER_PASSWORD="yourpassword"
110
+ ```
111
+
112
+ ## Data Sources
113
+
114
+ | Source | Sections | Auth Required |
115
+ |---|---|---|
116
+ | Screener.in | All financials, ratios, shareholding | Optional (login gives more history) |
117
+ | Trendlyne | Income, balance sheet, cash flow, ratios | No |
118
+ | MoneyControl | Income, balance sheet, cash flow, ratios | No |
119
+ | Yahoo Finance | Income, balance sheet, cash flow, price | No |
120
+
121
+ Sources are tried in the order listed above. If one fails, the next is tried automatically.
122
+
123
+ ## Output Format
124
+
125
+ All financial DataFrames follow a consistent format:
126
+
127
+ - **Index**: `DatetimeIndex` (fiscal period end dates)
128
+ - **Columns**: `snake_case` field names (e.g., `revenue`, `net_profit`, `operating_profit`)
129
+ - **Values**: `float64` in Crores (INR) for monetary fields
130
+ - **Missing data**: `NaN` (never empty strings)
131
+
132
+ ## Error Handling
133
+
134
+ ```python
135
+ from finfetch import TickerNotFoundError, DataUnavailableError
136
+
137
+ try:
138
+ stock = ff.Ticker("INVALID")
139
+ data = stock.financials
140
+ except DataUnavailableError as e:
141
+ print(f"No data: {e}")
142
+ ```
143
+
144
+ ## Building from Source
145
+
146
+ ```bash
147
+ pip install build
148
+ python -m build
149
+ # Output: dist/finfetch-0.1.0-py3-none-any.whl
150
+ ```
151
+
152
+ ## License
153
+
154
+ MIT
@@ -0,0 +1,25 @@
1
+ """finfetch — Free financial data for Indian stocks. No API key needed."""
2
+
3
+ from .core import Ticker, Tickers, get_price
4
+ from .models import search
5
+ from .exceptions import (
6
+ DataUnavailableError,
7
+ FinFetchError,
8
+ RateLimitError,
9
+ ScrapingError,
10
+ TickerNotFoundError,
11
+ )
12
+
13
+ __version__ = "0.1.0"
14
+ __all__ = [
15
+ "Ticker",
16
+ "Tickers",
17
+ "get_price",
18
+ "search",
19
+ # exceptions
20
+ "FinFetchError",
21
+ "TickerNotFoundError",
22
+ "DataUnavailableError",
23
+ "RateLimitError",
24
+ "ScrapingError",
25
+ ]