mftool 2.8__tar.gz → 2.9__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.
- {mftool-2.8 → mftool-2.9}/PKG-INFO +2 -2
- {mftool-2.8 → mftool-2.9}/README.md +1 -1
- {mftool-2.8 → mftool-2.9}/mftool/__init__.py +2 -2
- {mftool-2.8 → mftool-2.9}/mftool/mftool.py +43 -12
- {mftool-2.8 → mftool-2.9}/mftool.egg-info/PKG-INFO +2 -2
- {mftool-2.8 → mftool-2.9}/setup.py +1 -1
- {mftool-2.8 → mftool-2.9}/mftool/const.json +0 -0
- {mftool-2.8 → mftool-2.9}/mftool/utils.py +0 -0
- {mftool-2.8 → mftool-2.9}/mftool.egg-info/SOURCES.txt +0 -0
- {mftool-2.8 → mftool-2.9}/mftool.egg-info/dependency_links.txt +0 -0
- {mftool-2.8 → mftool-2.9}/mftool.egg-info/requires.txt +0 -0
- {mftool-2.8 → mftool-2.9}/mftool.egg-info/top_level.txt +0 -0
- {mftool-2.8 → mftool-2.9}/setup.cfg +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mftool
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9
|
|
4
4
|
Summary: Library for getting real time Mutual funds info
|
|
5
5
|
Home-page: https://github.com/NayakwadiS/mftool
|
|
6
6
|
Author: SujitN
|
|
7
7
|
Author-email: nayakwadi_sujit@rediffmail.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Description: mftool is a library
|
|
9
|
+
Description: mftool is a library getting publicly available Mutual Funds data in India. It can be used in various types of projects which requires getting live quotes for a given mutual fund scheme or build large data sets for further data analytics.
|
|
10
10
|
|
|
11
11
|
Features
|
|
12
12
|
=============
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
mftool is a library
|
|
1
|
+
mftool is a library getting publicly available Mutual Funds data in India. It can be used in various types of projects which requires getting live quotes for a given mutual fund scheme or build large data sets for further data analytics.
|
|
2
2
|
|
|
3
3
|
Features
|
|
4
4
|
=============
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
The MIT License (MIT)
|
|
3
3
|
|
|
4
|
-
Copyright (c)
|
|
4
|
+
Copyright (c) 2025 Sujit Nayakwadi
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
SOFTWARE.
|
|
23
23
|
"""
|
|
24
|
-
__VERSION__='2.
|
|
24
|
+
__VERSION__='2.9'
|
|
25
25
|
from .mftool import Mftool
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
The MIT License (MIT)
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Sujit Nayakwadi
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
|
@@ -24,7 +24,9 @@ from bs4 import BeautifulSoup
|
|
|
24
24
|
import yfinance as yf
|
|
25
25
|
import datetime
|
|
26
26
|
from deprecated import deprecated
|
|
27
|
+
from matplotlib import pyplot as plt
|
|
27
28
|
from .utils import Utilities, is_holiday, get_today, get_friday, render_response
|
|
29
|
+
import pandas as pd
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
class Mftool:
|
|
@@ -236,23 +238,23 @@ class Mftool:
|
|
|
236
238
|
else:
|
|
237
239
|
return None
|
|
238
240
|
|
|
239
|
-
@deprecated(version='2.
|
|
241
|
+
@deprecated(version='2.8',
|
|
240
242
|
reason="This function will be in deprecated from next release, use mf.history() to get data")
|
|
241
|
-
def get_scheme_historical_nav_year(self, code, year, as_json=False):
|
|
243
|
+
def get_scheme_historical_nav_year(self, code, year, as_json=False, as_dataframe=False):
|
|
242
244
|
"""
|
|
243
245
|
gets the scheme historical data of given year for a given scheme code
|
|
244
246
|
:param code: scheme-code
|
|
245
247
|
:param year: year
|
|
246
248
|
:param as_json: default false
|
|
249
|
+
:param as_dataframe: default false
|
|
247
250
|
:return: dict or None
|
|
248
251
|
:raises: HTTPError, URLError
|
|
249
252
|
"""
|
|
250
253
|
code = str(code)
|
|
251
254
|
if self.is_valid_code(code):
|
|
252
|
-
scheme_info = {}
|
|
253
255
|
data = []
|
|
254
|
-
url = self._get_scheme_url + code
|
|
255
|
-
response = self._session.get(url).json()
|
|
256
|
+
# url = self._get_scheme_url + code
|
|
257
|
+
# response = self._session.get(url).json()
|
|
256
258
|
nav = self.get_scheme_historical_nav(code)
|
|
257
259
|
scheme_info = self.get_scheme_details(code)
|
|
258
260
|
for dat in nav['data']:
|
|
@@ -264,30 +266,31 @@ class Mftool:
|
|
|
264
266
|
data.append({'Error': 'For Year '+str(year)+' Data is NOT available'})
|
|
265
267
|
|
|
266
268
|
scheme_info.update(data=data)
|
|
267
|
-
return render_response(scheme_info, as_json)
|
|
269
|
+
return render_response(scheme_info, as_json, as_dataframe)
|
|
268
270
|
else:
|
|
269
271
|
return None
|
|
270
272
|
|
|
271
273
|
@deprecated(version='2.7',
|
|
272
274
|
reason="This function will be in deprecated from next release, use mf.history() to get data")
|
|
273
|
-
def get_scheme_historical_nav_for_dates(self, code, start_date, end_date, as_json=False):
|
|
275
|
+
def get_scheme_historical_nav_for_dates(self, code, start_date, end_date, as_json=False, as_dataframe=False):
|
|
274
276
|
"""
|
|
275
277
|
gets the scheme historical data between start_date and end_date for a given scheme code
|
|
276
278
|
:param start_date: string '%Y-%m-%d'
|
|
277
279
|
:param end_date: string '%Y-%m-%d'
|
|
278
280
|
:param code: scheme code
|
|
279
281
|
:param as_json: default false
|
|
282
|
+
:param as_dataframe: default false
|
|
280
283
|
:return: dict or None
|
|
281
284
|
:raises: HTTPError, URLError
|
|
282
285
|
"""
|
|
283
286
|
code = str(code)
|
|
284
287
|
if self.is_valid_code(code):
|
|
285
|
-
scheme_info = {}
|
|
288
|
+
# scheme_info = {}
|
|
286
289
|
data = []
|
|
287
290
|
start_date = datetime.datetime.strptime(start_date, '%d-%m-%Y').date()
|
|
288
291
|
end_date = datetime.datetime.strptime(end_date, '%d-%m-%Y').date()
|
|
289
|
-
url = self._get_scheme_url + code
|
|
290
|
-
response = self._session.get(url).json()
|
|
292
|
+
# url = self._get_scheme_url + code
|
|
293
|
+
# response = self._session.get(url).json()
|
|
291
294
|
nav = self.get_scheme_historical_nav(code)
|
|
292
295
|
scheme_info = self.get_scheme_details(code)
|
|
293
296
|
for dat in nav['data']:
|
|
@@ -299,7 +302,7 @@ class Mftool:
|
|
|
299
302
|
data.append({'Data is NOT available for selected range'})
|
|
300
303
|
|
|
301
304
|
scheme_info.update(data=data)
|
|
302
|
-
return render_response(scheme_info, as_json)
|
|
305
|
+
return render_response(scheme_info, as_json, as_dataframe)
|
|
303
306
|
else:
|
|
304
307
|
return None
|
|
305
308
|
|
|
@@ -510,3 +513,31 @@ class Mftool:
|
|
|
510
513
|
mf = yf.Ticker(code)
|
|
511
514
|
response = mf.info
|
|
512
515
|
return render_response(response, as_json)
|
|
516
|
+
|
|
517
|
+
def compare_trend(self, codes, start_date, end_date):
|
|
518
|
+
"""
|
|
519
|
+
plot and Compare trend of mutual funds
|
|
520
|
+
:param start_date: string '%Y-%m-%d'
|
|
521
|
+
:param end_date: string '%Y-%m-%d'
|
|
522
|
+
:param code: scheme code
|
|
523
|
+
:param as_json: default false
|
|
524
|
+
:param as_dataframe: default false
|
|
525
|
+
:return: dict or None
|
|
526
|
+
:raises: HTTPError, URLError
|
|
527
|
+
"""
|
|
528
|
+
all_mf = pd.DataFrame()
|
|
529
|
+
for code in codes:
|
|
530
|
+
mf_data = self.get_scheme_historical_nav_for_dates(code, start_date, end_date, as_dataframe=True)
|
|
531
|
+
mf_data = mf_data.drop(columns=['dayChange'])
|
|
532
|
+
mf_name = self.get_scheme_details(code)['scheme_name']
|
|
533
|
+
mf_data[mf_name] = mf_data['nav'].astype(float)
|
|
534
|
+
mf_data['date'] = mf_data.index
|
|
535
|
+
all_mf[mf_name] = mf_data[mf_name]
|
|
536
|
+
all_mf['date'] = mf_data['date']
|
|
537
|
+
|
|
538
|
+
all_mf = all_mf[::-1]
|
|
539
|
+
all_mf.plot(x='date')
|
|
540
|
+
plt.title("Compare mutual funds")
|
|
541
|
+
plt.xlabel("Date")
|
|
542
|
+
plt.ylabel("NAV")
|
|
543
|
+
plt.show()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mftool
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9
|
|
4
4
|
Summary: Library for getting real time Mutual funds info
|
|
5
5
|
Home-page: https://github.com/NayakwadiS/mftool
|
|
6
6
|
Author: SujitN
|
|
7
7
|
Author-email: nayakwadi_sujit@rediffmail.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Description: mftool is a library
|
|
9
|
+
Description: mftool is a library getting publicly available Mutual Funds data in India. It can be used in various types of projects which requires getting live quotes for a given mutual fund scheme or build large data sets for further data analytics.
|
|
10
10
|
|
|
11
11
|
Features
|
|
12
12
|
=============
|
|
@@ -7,7 +7,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="mftool",
|
|
10
|
-
version="2.
|
|
10
|
+
version="2.9",
|
|
11
11
|
author="SujitN",
|
|
12
12
|
author_email="nayakwadi_sujit@rediffmail.com",
|
|
13
13
|
description="Library for getting real time Mutual funds info",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|