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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mftool
3
- Version: 3.1
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
@@ -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.1'
24
+ __VERSION__='3.2'
25
25
  from .mftool import Mftool
@@ -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 = self.get_52_week_high_low(response['data'])
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
- 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]}
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mftool
3
- Version: 3.1
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
@@ -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.1",
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