How to get real-time Mutual Funds Information using Python?
Last Updated :
08 Mar, 2024
In this article, we are going to write Python scripts to real-time Mutual Funds Information. Today Mutual Funds is a very popular term among investors, so let’s do some help for them. Mftool Modules will help to collect real-time data from AFM(Association of Mutual Funds).
Features of Mftool:
- Get last update quotes from Mutual Fund using scheme codes.
- Get all the register Schemes available in AMF
- Get Net Asset Value (NAV) track record
- Get all the list of Schemes with there Scheme codes.
Note: This module is able to collect data from The Association of Mutual Funds in India.
Before starting we need to install this module:
Run this module into your terminal.
pip install mftool
Let’s Understand these modules Step-by-step:
Step 1: import module and create an object for Mftool.
Python3
from mftool import Mftool
obj = Mftool()
|
Step 2: Getting a Scheme Quote with get_scheme_quote() methods.
Python3
data = obj.get_scheme_quote( '119551' )
print (data)
|
Output:
Step 3: Get Scheme Details with specific Scheme code using get_scheme_details() methods.
Python3
obj.get_scheme_details( "119551" )
|
Output:
Step 4: Get Scheme Historical NAV’s data using get_scheme_historical_nav() methods.
Python3
data = mf.get_scheme_historical_nav( "119551" )
print (data)
|
Output:
Note: This data is in the Dictionary form.
Now we can manipulate this data with our own needs.
Output:
'Aditya Birla Sun Life Mutual Fund'
List of the Historical NAV data.
Output:
[{'date': '25-09-2020', 'nav': '156.32930'},
{'date': '24-09-2020', 'nav': '156.37000'},
{'date': '23-09-2020', 'nav': '156.40260'},
{'date': '22-09-2020', 'nav': '156.34590'},
{'date': '21-09-2020', 'nav': '156.29950'},
{'date': '18-09-2020', 'nav': '156.20390'},
{'date': '17-09-2020', 'nav': '156.16490'},
{'date': '16-09-2020', 'nav': '156.11460'},
{'date': '15-09-2020', 'nav': '156.00040'},
{'date': '14-09-2020', 'nav': '156.12840'},
{'date': '11-09-2020', 'nav': '156.11520'},
....
Step 5: List of Mutual Funds Scheme Codes & Names with get_scheme_codes() method.
Python3
data = obj.get_scheme_codes()
print (data)
|
Output:
Step 6: Get daily performance of equity schemes with get_open_ended_equity_scheme_performance() module.
Python3
data = obj.get_open_ended_equity_scheme_performance( True )
print (data)
|
Output:
{"Large Cap": [{"scheme_name": "Aditya Birla Sun Life Frontline Equity",
"benchmark": "NIFTY 50 Total Return Index",
"latest NAV- Regular": "210.1600",
"latest NAV- Direct": "224.8700",
"1-Year Return(%)- Regular": "-4.65",
"1-Year Return(%)- Direct": "-4.02",
"3-Year Return(%)- Regular": "0.21",
"3-Year Return(%)- Direct": "1.03",
"5-Year Return(%)- Regular": "5.97",
"5-Year Return(%)- Direct": "6.93"},
.........
Step 7: Get daily performance of debt schemes with get_open_ended_debt_scheme_performance() module.
Python3
value = obj.get_open_ended_debt_scheme_performance( True )
print (value)
|
Output:
{"Long Duration": [{"scheme_name": "ICICI Prudential Long Term Bond Fund",
"benchmark": "NIFTY Long Duration Debt Total Return Index",
"latest NAV- Regular": "70.0523",
"latest NAV- Direct": "74.6568",
"1-Year Return(%)- Regular": "11.13",
"1-Year Return(%)- Direct": "11.68",
"3-Year Return(%)- Regular": "8.52",
............
Step 7: All AMC profiles with get_all_amc_profiles() module.
Python3
data = obj.get_all_amc_profiles( True )
print (data)
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...