mftool 3.0__tar.gz → 3.1__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-3.0 → mftool-3.1}/PKG-INFO +1 -1
- {mftool-3.0 → mftool-3.1}/mftool/__init__.py +2 -2
- {mftool-3.0 → mftool-3.1}/mftool/mftool.py +14 -3
- {mftool-3.0 → mftool-3.1}/mftool/utils.py +5 -1
- {mftool-3.0 → mftool-3.1}/mftool.egg-info/PKG-INFO +1 -1
- {mftool-3.0 → mftool-3.1}/mftool.egg-info/requires.txt +1 -0
- {mftool-3.0 → mftool-3.1}/setup.py +2 -2
- {mftool-3.0 → mftool-3.1}/README.md +0 -0
- {mftool-3.0 → mftool-3.1}/mftool/const.json +0 -0
- {mftool-3.0 → mftool-3.1}/mftool.egg-info/SOURCES.txt +0 -0
- {mftool-3.0 → mftool-3.1}/mftool.egg-info/dependency_links.txt +0 -0
- {mftool-3.0 → mftool-3.1}/mftool.egg-info/top_level.txt +0 -0
- {mftool-3.0 → mftool-3.1}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
The MIT License (MIT)
|
|
3
3
|
|
|
4
|
-
Copyright (c)
|
|
4
|
+
Copyright (c) 2026 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__='3.
|
|
24
|
+
__VERSION__='3.1'
|
|
25
25
|
from .mftool import Mftool
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
The MIT License (MIT)
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 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
|
|
@@ -25,7 +25,7 @@ import yfinance as yf
|
|
|
25
25
|
import datetime
|
|
26
26
|
from deprecated import deprecated
|
|
27
27
|
from matplotlib import pyplot as plt
|
|
28
|
-
from .utils import Utilities, is_holiday, get_today, get_friday, render_response
|
|
28
|
+
from .utils import Utilities, is_holiday, get_today, get_friday, render_response, get_52_week_friday
|
|
29
29
|
import pandas as pd
|
|
30
30
|
|
|
31
31
|
|
|
@@ -182,6 +182,9 @@ class Mftool:
|
|
|
182
182
|
scheme_info['scheme_code'] = scheme_data['scheme_code']
|
|
183
183
|
scheme_info['scheme_name'] = scheme_data['scheme_name']
|
|
184
184
|
scheme_info['scheme_start_date'] = response['data'][int(len(response['data']) - 1)]
|
|
185
|
+
result = self.get_52_week_high_low(response['data'])
|
|
186
|
+
scheme_info['52_week_high'] = result['52_week_high']
|
|
187
|
+
scheme_info['52_week_low'] = result['52_week_low']
|
|
185
188
|
if response['data']:
|
|
186
189
|
scheme_info['data'] = response['data']
|
|
187
190
|
else:
|
|
@@ -190,6 +193,14 @@ class Mftool:
|
|
|
190
193
|
else:
|
|
191
194
|
return None
|
|
192
195
|
|
|
196
|
+
def get_52_week_high_low(self, data):
|
|
197
|
+
friday = pd.to_datetime(get_52_week_friday())
|
|
198
|
+
df = pd.DataFrame.from_records(data)
|
|
199
|
+
df['date'] = pd.to_datetime(df['date'], dayfirst=True)
|
|
200
|
+
df_high = df[df['date'] >= friday].sort_values(by='nav', ascending=False).head(1)
|
|
201
|
+
df_low = df[df['date'] >= friday].sort_values(by='nav', ascending=True).head(1)
|
|
202
|
+
return {"52_week_high": df_high['nav'].values[0], "52_week_low": df_low['nav'].values[0]}
|
|
203
|
+
|
|
193
204
|
def calculate_balance_units_value(self, code, balance_units, as_json=False):
|
|
194
205
|
"""
|
|
195
206
|
gets the market value of your balance units for a given scheme code
|
|
@@ -367,7 +378,7 @@ class Mftool:
|
|
|
367
378
|
return render_response(fund_performance, as_json)
|
|
368
379
|
|
|
369
380
|
@deprecated(version='3.1',
|
|
370
|
-
reason="This function will be in deprecated from next release")
|
|
381
|
+
reason="This function will be in deprecated from next release, use mf.history() to get data")
|
|
371
382
|
def get_all_amc_profiles(self, as_json=True):
|
|
372
383
|
"""
|
|
373
384
|
gets profiles for all Fund houses
|
|
@@ -22,6 +22,10 @@ def get_today():
|
|
|
22
22
|
return (date.today() - timedelta(days=1)).strftime("%d-%b-%Y")
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def get_52_week_friday():
|
|
26
|
+
return (date.today() - timedelta(weeks=52)).strftime("%d-%m-%Y")
|
|
27
|
+
|
|
28
|
+
|
|
25
29
|
def render_response(data, as_json=False, as_Dataframe=False):
|
|
26
30
|
if as_json is True:
|
|
27
31
|
return json.dumps(data)
|
|
@@ -40,4 +44,4 @@ class Utilities:
|
|
|
40
44
|
def __init__(self):
|
|
41
45
|
self._filepath = str(os.path.dirname(os.path.abspath(__file__))) + '/const.json'
|
|
42
46
|
with open(self._filepath, 'r') as f:
|
|
43
|
-
self.values = json.load(f)
|
|
47
|
+
self.values = json.load(f)
|
|
@@ -7,13 +7,13 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="mftool",
|
|
10
|
-
version="3.
|
|
10
|
+
version="3.1",
|
|
11
11
|
author="SujitN",
|
|
12
12
|
author_email="nayakwadi_sujit@rediffmail.com",
|
|
13
13
|
description="Library for getting real time Mutual funds info",
|
|
14
14
|
license="MIT",
|
|
15
15
|
keywords="amfi, quote, mutual-funds, funds, bse, nse, market, stock, stocks",
|
|
16
|
-
install_requires=['requests', 'bs4', 'httpx', 'pandas', 'yfinance', 'matplotlib'],
|
|
16
|
+
install_requires=['requests', 'bs4', 'httpx', 'pandas', 'yfinance', 'matplotlib','deprecated'],
|
|
17
17
|
url="https://github.com/NayakwadiS/mftool",
|
|
18
18
|
packages=find_packages(),
|
|
19
19
|
long_description=long_description,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|