mftool 3.1__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.
- {mftool-3.1 → mftool-3.2}/PKG-INFO +1 -1
- {mftool-3.1 → mftool-3.2}/mftool/__init__.py +1 -1
- {mftool-3.1 → mftool-3.2}/mftool/mftool.py +4 -10
- {mftool-3.1 → mftool-3.2}/mftool/utils.py +9 -0
- {mftool-3.1 → mftool-3.2}/mftool.egg-info/PKG-INFO +1 -1
- {mftool-3.1 → mftool-3.2}/setup.py +1 -1
- {mftool-3.1 → mftool-3.2}/README.md +0 -0
- {mftool-3.1 → mftool-3.2}/mftool/const.json +0 -0
- {mftool-3.1 → mftool-3.2}/mftool.egg-info/SOURCES.txt +0 -0
- {mftool-3.1 → mftool-3.2}/mftool.egg-info/dependency_links.txt +0 -0
- {mftool-3.1 → mftool-3.2}/mftool.egg-info/requires.txt +0 -0
- {mftool-3.1 → mftool-3.2}/mftool.egg-info/top_level.txt +0 -0
- {mftool-3.1 → mftool-3.2}/setup.cfg +0 -0
|
@@ -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, get_52_week_friday
|
|
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,7 +182,7 @@ 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 =
|
|
185
|
+
result = get_52_week_high_low(response['data'])
|
|
186
186
|
scheme_info['52_week_high'] = result['52_week_high']
|
|
187
187
|
scheme_info['52_week_low'] = result['52_week_low']
|
|
188
188
|
if response['data']:
|
|
@@ -193,13 +193,7 @@ class Mftool:
|
|
|
193
193
|
else:
|
|
194
194
|
return None
|
|
195
195
|
|
|
196
|
-
|
|
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]}
|
|
196
|
+
|
|
203
197
|
|
|
204
198
|
def calculate_balance_units_value(self, code, balance_units, as_json=False):
|
|
205
199
|
"""
|
|
@@ -509,4 +503,4 @@ class Mftool:
|
|
|
509
503
|
plt.title("Compare mutual funds")
|
|
510
504
|
plt.xlabel("Date")
|
|
511
505
|
plt.ylabel("NAV")
|
|
512
|
-
plt.show()
|
|
506
|
+
plt.show()
|
|
@@ -26,6 +26,15 @@ def get_52_week_friday():
|
|
|
26
26
|
return (date.today() - timedelta(weeks=52)).strftime("%d-%m-%Y")
|
|
27
27
|
|
|
28
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
|
+
|
|
29
38
|
def render_response(data, as_json=False, as_Dataframe=False):
|
|
30
39
|
if as_json is True:
|
|
31
40
|
return json.dumps(data)
|
|
@@ -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="3.
|
|
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",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|