mftool 3.0__tar.gz → 3.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mftool
3
- Version: 3.0
3
+ Version: 3.2
4
4
  Summary: Library for getting real time Mutual funds info
5
5
  Home-page: https://github.com/NayakwadiS/mftool
6
6
  Author: SujitN
@@ -1,7 +1,7 @@
1
1
  """
2
2
  The MIT License (MIT)
3
3
 
4
- Copyright (c) 2025 Sujit Nayakwadi
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.0'
24
+ __VERSION__='3.2'
25
25
  from .mftool import Mftool
@@ -1,6 +1,6 @@
1
1
  """
2
2
  The MIT License (MIT)
3
- Copyright (c) 2025 Sujit Nayakwadi
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, get_52_week_high_low
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 = 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,8 @@ class Mftool:
190
193
  else:
191
194
  return None
192
195
 
196
+
197
+
193
198
  def calculate_balance_units_value(self, code, balance_units, as_json=False):
194
199
  """
195
200
  gets the market value of your balance units for a given scheme code
@@ -367,7 +372,7 @@ class Mftool:
367
372
  return render_response(fund_performance, as_json)
368
373
 
369
374
  @deprecated(version='3.1',
370
- reason="This function will be in deprecated from next release")
375
+ reason="This function will be in deprecated from next release, use mf.history() to get data")
371
376
  def get_all_amc_profiles(self, as_json=True):
372
377
  """
373
378
  gets profiles for all Fund houses
@@ -498,4 +503,4 @@ class Mftool:
498
503
  plt.title("Compare mutual funds")
499
504
  plt.xlabel("Date")
500
505
  plt.ylabel("NAV")
501
- plt.show()
506
+ plt.show()
@@ -22,6 +22,19 @@ 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
+
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
+
25
38
  def render_response(data, as_json=False, as_Dataframe=False):
26
39
  if as_json is True:
27
40
  return json.dumps(data)
@@ -40,4 +53,4 @@ class Utilities:
40
53
  def __init__(self):
41
54
  self._filepath = str(os.path.dirname(os.path.abspath(__file__))) + '/const.json'
42
55
  with open(self._filepath, 'r') as f:
43
- self.values = json.load(f)
56
+ self.values = json.load(f)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mftool
3
- Version: 3.0
3
+ Version: 3.2
4
4
  Summary: Library for getting real time Mutual funds info
5
5
  Home-page: https://github.com/NayakwadiS/mftool
6
6
  Author: SujitN
@@ -4,3 +4,4 @@ httpx
4
4
  pandas
5
5
  yfinance
6
6
  matplotlib
7
+ deprecated
@@ -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.0",
10
+ version="3.2",
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