mftool 3.4__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.
- mftool/__init__.py +26 -0
- mftool/cache.py +233 -0
- mftool/const.json +20065 -0
- mftool/mftool.py +935 -0
- mftool/utils.py +56 -0
- mftool-3.4.dist-info/METADATA +69 -0
- mftool-3.4.dist-info/RECORD +10 -0
- mftool-3.4.dist-info/WHEEL +5 -0
- mftool-3.4.dist-info/licenses/LICENSE +22 -0
- mftool-3.4.dist-info/top_level.txt +1 -0
mftool/utils.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import json
|
|
4
|
+
import pandas as pd
|
|
5
|
+
from datetime import date, timedelta
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def is_holiday():
|
|
9
|
+
if date.today().strftime("%a") in ['Sat', 'Sun', 'Mon']:
|
|
10
|
+
return True
|
|
11
|
+
else:
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_friday():
|
|
16
|
+
days = {'Sat': 1, 'Sun': 2, 'Mon': 3}
|
|
17
|
+
diff = int(days[date.today().strftime("%a")])
|
|
18
|
+
return (date.today() - timedelta(days=diff)).strftime("%d-%b-%Y")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_today():
|
|
22
|
+
return (date.today() - timedelta(days=1)).strftime("%d-%b-%Y")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_52_week_friday():
|
|
26
|
+
return (date.today() - timedelta(weeks=52)).strftime("%d-%m-%Y")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_52_week_high_low(data):
|
|
30
|
+
friday = pd.to_datetime(get_52_week_friday(), dayfirst=True)
|
|
31
|
+
df = pd.DataFrame.from_records(data)
|
|
32
|
+
df['date'] = pd.to_datetime(df['date'], dayfirst=True)
|
|
33
|
+
df_high = df[df['date'] >= friday].sort_values(by='nav', ascending=False).head(1)
|
|
34
|
+
df_low = df[df['date'] >= friday].sort_values(by='nav', ascending=True).head(1)
|
|
35
|
+
return {"52_week_high": df_high['nav'].values[0], "52_week_low": df_low['nav'].values[0]}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def render_response(data, as_json=False, as_Dataframe=False):
|
|
39
|
+
if as_json is True:
|
|
40
|
+
return json.dumps(data)
|
|
41
|
+
# parameter 'as_Dataframe' only works with get_scheme_historical_nav()
|
|
42
|
+
elif as_Dataframe is True:
|
|
43
|
+
df = pd.DataFrame.from_records(data['data'])
|
|
44
|
+
df['dayChange'] = df['nav'].astype(float).diff(periods=-1)
|
|
45
|
+
df = df.set_index('date')
|
|
46
|
+
return df
|
|
47
|
+
else:
|
|
48
|
+
return data
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class Utilities:
|
|
52
|
+
|
|
53
|
+
def __init__(self):
|
|
54
|
+
self._filepath = str(os.path.dirname(os.path.abspath(__file__))) + '/const.json'
|
|
55
|
+
with open(self._filepath, 'r') as f:
|
|
56
|
+
self.values = json.load(f)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mftool
|
|
3
|
+
Version: 3.4
|
|
4
|
+
Summary: Library for getting real time Mutual funds info
|
|
5
|
+
Home-page: https://github.com/NayakwadiS/mftool
|
|
6
|
+
Author: SujitN
|
|
7
|
+
Author-email: nayakwadi_sujit@rediffmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: amfi,quote,mutual-funds,funds,bse,nse,market,stock,stocks
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: requests
|
|
13
|
+
Requires-Dist: bs4
|
|
14
|
+
Requires-Dist: httpx
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: yfinance
|
|
17
|
+
Requires-Dist: matplotlib
|
|
18
|
+
Requires-Dist: deprecated
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: keywords
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
<img src="https://raw.githubusercontent.com/NayakwadiS/mftool/master/docs/mftool.png" height="150">
|
|
31
|
+
|
|
32
|
+
Python library for getting Mutual Funds data in India
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
[](https://pypi.python.org/pypi/mftool)
|
|
36
|
+

|
|
37
|
+

|
|
38
|
+
[](https://mftool.readthedocs.io/en/latest/)
|
|
39
|
+
[](https://pepy.tech/project/mftool)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Introduction
|
|
43
|
+
============
|
|
44
|
+
mftool is a library for 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.
|
|
45
|
+
|
|
46
|
+
Features
|
|
47
|
+
=============
|
|
48
|
+
|
|
49
|
+
* Getting last updated quotes for Mutual fund scheme using scheme codes.
|
|
50
|
+
* Return data in Dataframe, json and dictionary formats.
|
|
51
|
+
* Getting quotes for all the schemes available with AMFI.
|
|
52
|
+
* Helper APIs to check whether a given Scheme code is correct.
|
|
53
|
+
* Getting all historical NAVs for a schemes.
|
|
54
|
+
* Getting list of all schemes with there Scheme codes.
|
|
55
|
+
* Get daily scheme performance.
|
|
56
|
+
* Support GenAI with mftool-mcp
|
|
57
|
+
|
|
58
|
+
<!---*[**Documentation**](https://61836947349d9.site123.me/)*--->
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
Related Projects -
|
|
62
|
+
|
|
63
|
+
1. Forecasting Indian Stocks *[NSE-Neuron](https://github.com/NayakwadiS/NSE-Neuron)*
|
|
64
|
+
2. Forecasting of Mutual Funds *[here](https://github.com/NayakwadiS/Forecasting_Mutual_Funds)*
|
|
65
|
+
3. Predict Cryptocurrency in Indian Rupees *[here](https://github.com/NayakwadiS/Predict_Cryptocurrency_INR)*
|
|
66
|
+
4. MCP server for GenAI apps *[mftool-mcp](https://github.com/NayakwadiS/mftool-mcp)*
|
|
67
|
+
|
|
68
|
+
<a href="https://www.buymeacoffee.com/nayakwadis" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="29" width="174">
|
|
69
|
+
</a>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
mftool/__init__.py,sha256=wanqQW-vJ6Og8pVx95kiEvPnxjRlTlxCkx8dmjhGnBc,1230
|
|
2
|
+
mftool/cache.py,sha256=fztiBFutQNa77E-9PR5TJA2YbnUMC947tu2HwEHelVc,7446
|
|
3
|
+
mftool/const.json,sha256=PKfjIyTFo6b-5MtGKeV9lbuBz4TGJKHKX5J-QNaTcg8,837596
|
|
4
|
+
mftool/mftool.py,sha256=CyAaGWbMyBqdXqfycODKeehWPSG_zmkWPG6_mDLY7zY,39721
|
|
5
|
+
mftool/utils.py,sha256=7Eq6JgG5YpPUxB1iOVEGV0tAvpJCq7z9RU8f5YAdm4E,1752
|
|
6
|
+
mftool-3.4.dist-info/licenses/LICENSE,sha256=KzHBpyPgmIV7GvRSszILUuSEvMIi59fPK4XYwzD1_Ko,1105
|
|
7
|
+
mftool-3.4.dist-info/METADATA,sha256=GD3vd9hmeyhXFSVXXeSNSP8VRX-VNm9pqXPe9Wn75-k,2830
|
|
8
|
+
mftool-3.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
9
|
+
mftool-3.4.dist-info/top_level.txt,sha256=8FzW_LK74bgNGKnMteTv2PcvI1whfXnby2Xq0HASU_k,7
|
|
10
|
+
mftool-3.4.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sujit Nayakwadi
|
|
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.
|
|
22
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mftool
|