BharatFinTrack 0.0.1__py3-none-any.whl

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,9 @@
1
+ from .nse_track import NSETrack
2
+
3
+
4
+ __all__ = [
5
+ 'NSETrack'
6
+ ]
7
+
8
+
9
+ __version__ = '0.0.1'
@@ -0,0 +1,186 @@
1
+ class NSETrack:
2
+
3
+ '''
4
+ Represents characteristics of NSE finance products.
5
+ '''
6
+
7
+
8
+ @property
9
+ def indices_category(self):
10
+
11
+ '''
12
+ Returns a list categories for NSE indices.
13
+ '''
14
+
15
+ output = [
16
+ 'broad',
17
+ 'sectoral',
18
+ 'thematic',
19
+ 'strategy'
20
+ ]
21
+
22
+ return output
23
+
24
+
25
+ def get_indices_by_category(self, category):
26
+
27
+ '''
28
+ Returns NSE indices for a specified category.
29
+
30
+ Parameters
31
+ ----------
32
+ category : str
33
+ The classification type of NSE indices.
34
+
35
+ Returns
36
+ -------
37
+ list
38
+ A list containing the names of indices for the specified category.
39
+ '''
40
+
41
+ indices = {}
42
+
43
+ # broad index
44
+ indices['broad'] = [
45
+ 'NIFTY 500',
46
+ 'NIFTY 50'
47
+ ]
48
+
49
+ # sectoral index
50
+ indices['sectoral'] = [
51
+ 'NIFTY IT',
52
+ 'NIFTY BANK'
53
+ ]
54
+
55
+ # thematic index
56
+ indices['thematic'] = [
57
+ 'NIFTY EV & NEW AGE AUTOMOTIVE',
58
+ 'NIFTY INDIA DEFENCE'
59
+ ]
60
+
61
+ # strategy index
62
+ indices['strategy'] = [
63
+ 'NIFTY ALPHA 50',
64
+ 'NIFTY MIDCAP150 MOMENTUM 50'
65
+ ]
66
+
67
+ if category in self.indices_category:
68
+ pass
69
+ else:
70
+ raise Exception(f'Invadid category: {category}')
71
+
72
+ return indices[category]
73
+
74
+
75
+ @property
76
+ def downloadable_indices(self):
77
+
78
+ '''
79
+ Returns a list of all indices names.
80
+ '''
81
+
82
+ output = [
83
+ index for category in self.indices_category for index in self.get_indices_by_category(category)
84
+ ]
85
+
86
+ return output
87
+
88
+
89
+ def is_valid_index(self, index):
90
+
91
+ '''
92
+ Checks whether a specified NSE index name is valid.
93
+
94
+ Parameters
95
+ ----------
96
+ index : str
97
+ The name of the NSE index.
98
+
99
+ Returns
100
+ -------
101
+ bool
102
+ True if the index name is valid, False.
103
+ '''
104
+
105
+ return index in self.downloadable_indices
106
+
107
+
108
+ @property
109
+ def indices_base_date(self):
110
+
111
+ '''
112
+ Returns a dictionary where keys are indices
113
+ and values are their corresponding base dates.
114
+ '''
115
+
116
+ default_date = '01-Apr-2005'
117
+
118
+ start_date = {}
119
+
120
+ start_date['01-Jan-1995'] = ['NIFTY 500']
121
+ start_date['03-Nov-1995'] = ['NIFTY 50']
122
+ start_date['01-Jan-1996'] = ['NIFTY IT']
123
+ start_date['01-Jan-2000'] = ['NIFTY BANK']
124
+ start_date['31-Dec-2003'] = ['NIFTY ALPHA']
125
+ start_date['02-Apr-2018'] = [
126
+ 'NIFTY EV & NEW AGE AUTOMOTIVE'
127
+ 'NIFTY INDIA DEFENCE'
128
+ ]
129
+
130
+ date_dict = {v: key for key, value in start_date.items() for v in value}
131
+
132
+ output = dict(
133
+ map(lambda x: (x, date_dict.get(x, default_date)), self.downloadable_indices)
134
+ )
135
+
136
+ return output
137
+
138
+
139
+ def get_index_base_date(self, index):
140
+
141
+ '''
142
+ Returns the base date for a specified NSE index.
143
+
144
+ Parameters
145
+ ----------
146
+ index : str
147
+ The name of the NSE index.
148
+
149
+ Returns
150
+ -------
151
+ str
152
+ The base date of the index in 'DD-MMM-YYYY' format.
153
+ '''
154
+
155
+ if self.is_valid_index(index):
156
+ pass
157
+ else:
158
+ raise Exception(f'Invalid index: {index}')
159
+
160
+ return self.indices_base_date[index]
161
+
162
+
163
+ def get_index_base_value(self, index):
164
+
165
+ '''
166
+ Returns the base value for a specified NSE index.
167
+
168
+ Parameters
169
+ ----------
170
+ index : str
171
+ The name of the NSE index.
172
+
173
+ Returns
174
+ -------
175
+ float
176
+ The base value of the index.
177
+ '''
178
+
179
+ if self.is_valid_index(index):
180
+ pass
181
+ else:
182
+ raise Exception(f'Invalid index: {index}')
183
+
184
+ base_value = {'NIFTY IT': 100.0}
185
+
186
+ return base_value.get(index, 1000.0)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Debasish Pal
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,83 @@
1
+ Metadata-Version: 2.1
2
+ Name: BharatFinTrack
3
+ Version: 0.0.1
4
+ Summary: Downloading and analyzing financial data, including indices, stocks, and mutual funds, from India, that is, Bharat.
5
+ Author-email: Debasish Pal <bestdebasish@gmail.com>
6
+ Project-URL: Homepage, https://github.com/debpal/BharatFinTrack
7
+ Project-URL: Documentation, https://bharatfintrack.readthedocs.io/en/latest/
8
+ Keywords: nse index,nse total return index,data download,data analysis
9
+ Classifier: Development Status :: 1 - Planning
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Intended Audience :: Education
14
+ Classifier: Topic :: Office/Business :: Financial
15
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
16
+ Requires-Python: >=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE.txt
19
+
20
+ # BharatFinTrack
21
+
22
+ ## Analysis Toolkit
23
+
24
+ | Feature | Badge|
25
+ | --- | --- |
26
+ | Documemt | [![Documentation Status](https://readthedocs.org/projects/bharatfintrack/badge/?version=latest)](https://bharatfintrack.readthedocs.io/en/latest/?badge=latest) |
27
+
28
+
29
+ ## What is BharatFinTrack?
30
+ BharatFinTrack is a Python package designed to simplify the process of downloading and analyzing financial data from India, that is Bharat. The current features of the package include:
31
+
32
+ - **NSE Indices**
33
+ - Access to characteristics of indices.
34
+ - Download of historical daily Total Return Index (TRI) values.
35
+
36
+
37
+ ## Easy Installation
38
+
39
+ To install, use pip:
40
+
41
+ ```bash
42
+ pip install BharatFinTrack
43
+ ```
44
+
45
+ ## Quickstart
46
+ A brief example of how to start:
47
+
48
+ ```python
49
+ >>> import BharatFinTrack
50
+ >>> nse_track = BharatFinTrack.NSETrack()
51
+ >>> nse_track.indices_category
52
+ ['broad', 'sectoral', 'thematic', 'strategy']
53
+
54
+ # get the list of downloadable indices
55
+ >>> nse_track.downloadable_indices
56
+ ['NIFTY 500',
57
+ 'NIFTY 50',
58
+ 'NIFTY IT',
59
+ 'NIFTY BANK',
60
+ ...]
61
+
62
+ # get the dictionary of indices base date
63
+ >>> nse_track.indices_base_date
64
+ {'NIFTY 500': '01-Jan-1995',
65
+ 'NIFTY 50': '03-Nov-1995',
66
+ 'NIFTY IT': '01-Jan-1996',
67
+ 'NIFTY BANK': '01-Jan-2000',
68
+ ...}
69
+ ```
70
+
71
+
72
+ ## Documentation
73
+ For detailed information, see the [documentation](https://bharatfintrack.readthedocs.io/en/latest/).
74
+
75
+
76
+ ## Development status
77
+
78
+ The project is in the conceptualization and planning phases.
79
+
80
+
81
+ ## License
82
+
83
+ The package is released under the MIT License.
@@ -0,0 +1,7 @@
1
+ BharatFinTrack/__init__.py,sha256=ztHT709JQ48koDCF_Wa0s4MqvwLLmPRk1IzbIlMbZ7w,94
2
+ BharatFinTrack/nse_track.py,sha256=C8apYEbqQXlCHDT2_SBH0RMHP_mIEkQERvIZWejUn7g,4454
3
+ BharatFinTrack-0.0.1.dist-info/LICENSE.txt,sha256=KHtq3IB8A7uqL5aoINWYplXVYU-YpAlUo9Ugt8_roFU,1090
4
+ BharatFinTrack-0.0.1.dist-info/METADATA,sha256=c0bX7zNNX5GAiez9WCi0nRbqAqP_8NeaQnaRb79KjJA,2455
5
+ BharatFinTrack-0.0.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
6
+ BharatFinTrack-0.0.1.dist-info/top_level.txt,sha256=y5g9pTqy4I9foo3PDKM5fQod6TI2PxD4evTU-VS1T-0,15
7
+ BharatFinTrack-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (74.1.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ BharatFinTrack