Skip Menu |

This queue is for tickets about the Finance-Quote CPAN distribution.

Report information
The Basics
Id: 94484
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Finance-Quote

People
Owner: eco [...] ecocode.net
Requestors: vinayshastry [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.28
Fixed in: 1.28



Subject: IndiaMutual.pm: fixes + ISIN support
The current IndiaMutual.pm implementation is broken because of changed source URL, and file format. Attached patch fixes that, and also adds support for ISIN. Closed ended funds are also supported now (as the source adds them). This patch should override #89109 #83862 .
Subject: IndiaMutual.pm.patch
--- IndiaMutual.pm.orig 2014-03-16 23:08:20.000000000 +0530 +++ IndiaMutual.pm 2014-04-06 23:28:22.227579302 +0530 @@ -18,10 +18,9 @@ # URLs of where to obtain information. -#$AMFI_MAIN_URL = ("http://localhost/"); $AMFI_MAIN_URL = ("http://www.amfiindia.com/"); -$AMFI_URL = ("${AMFI_MAIN_URL}NavReport.aspx?type=0"); -#$AMFI_URL = ("${AMFI_MAIN_URL}spages/NAV0.txt"); #This page seems to do the job also. Keep for reference +$AMFI_URL = ("http://portal.amfiindia.com/NAVReport.aspx?type=0"); +#$AMFI_URL = ("http://portal.amfiindia.com/spages/NAV0.txt"); #This page seems to do the job also. Keep for reference # amfinavlist.txt is a cache-file. keep it until updated on the website since this is a 1meg file. my $cachedir = $ENV{TMPDIR} // $ENV{TEMP} // '/tmp/'; @@ -70,13 +69,19 @@ open NAV, $AMFI_NAV_LIST or die "Unexpected error in opening file: $!\n"; - # Scheme Code;Scheme Name;Net Asset Value;Repurchase Price;Sale Price;Date + #Scheme Code;ISIN Div Payout/ ISIN Growth;ISIN Div Reinvestment;Scheme Name;Net Asset Value;Repurchase Price;Sale Price;Date while (<NAV>) { next if !/\;/; chomp; s/\r//; - my ($symbol, @data) = split /\s*\;\s*/; - $allquotes{$symbol} = \@data; + my ($symbol1, $symbol2, $symbol3, @data) = split /\s*\;\s*/; + $allquotes{$symbol1} = \@data; + if ($symbol2 ne "-") { + $allquotes{$symbol2} = \@data; + } + if ($symbol3 ne "-") { + $allquotes{$symbol3} = \@data; + } } close(NAV); @@ -89,11 +94,11 @@ my $data = $allquotes{$symbol}; if ($data) { - $fundquote{$symbol, "name"} = $data->[4]; - $fundquote{$symbol, "nav"} = $data->[5]; - $fundquote{$symbol, "rprice"} = $data->[6]; - $fundquote{$symbol, "sprice"} = $data->[7]; - $quoter->store_date(\%fundquote, $symbol, {eurodate => $data->[8]}); + $fundquote{$symbol, "name"} = $data->[0]; + $fundquote{$symbol, "nav"} = $data->[1]; + $fundquote{$symbol, "rprice"} = $data->[2]; + $fundquote{$symbol, "sprice"} = $data->[3]; + $quoter->store_date(\%fundquote, $symbol, {eurodate => $data->[4]}); $fundquote{$symbol, "success"} = 1; } else { $fundquote{$symbol, "success"} = 0; @@ -131,13 +136,11 @@ if the source of prices is irrelevant, and "amfiindia" if you specifically want to use information downloaded from amfiindia.com. -=head1 AMFIINDIA-CODE +=head1 AMFIINDIA-CODE/ISIN -In India a mutual fund does not have a unique global symbol identifier. - -This module uses an id that represents the mutual fund on an id used by -amfiindia.com. You can the fund is from the AMFI web site -http://amfiindia.com/downloadnavopen.asp. +In India, not all funds have an ISIN. However, they do have a scheme code. +You can use those if you can't find the ISIN. See AMFI site for details. +http://www.amfiindia.com/nav-history-download =head1 LABELS RETURNED @@ -148,15 +151,13 @@ =head1 NOTES -amfiindia.com provides a link to download a text file containing all the +AMFI provides a link to download a text file containing all the NAVs. This file is mirrored in a local file /tmp/amfinavlist.txt. The local mirror serves only as a cache and can be safely removed. -Currently NAVs of Open-Ended funds are supported. - =head1 SEE ALSO -AMFI india website - http://amfiindia.com/ +AMFI india website - http://www.amfiindia.com/ Finance::Quote
Hi, I applied the patch. The test file still fails 40 out of 50 tests. Any ideas why ? best -- Erik
Subject: Re: [rt.cpan.org #94484] IndiaMutual.pm: fixes + ISIN support
Date: Tue, 8 Apr 2014 10:06:49 +0530
To: bug-Finance-Quote [...] rt.cpan.org
From: Vinay Shastry <vinayshastry [...] gmail.com>
Hi, On 7 April 2014 11:10, Erik Colson via RT <bug-Finance-Quote@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=94484 > > > Hi, > > I applied the patch. The test file still fails 40 out of 50 tests. Any ideas why ? > > best > -- > Erik
That's strange. All 50 passed here (output attached). Also, it'd be best to replace a few fund codes with ISINs in t/indiamutual.t. Patch attached. (Tests with the new values were successful too.) -- Vinay S Shastry

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

On Tue Apr 08 00:37:24 2014, vinayshastry@gmail.com wrote: Show quoted text
> That's strange. All 50 passed here (output attached). > > Also, it'd be best to replace a few fund codes with ISINs in > t/indiamutual.t. Patch attached. (Tests with the new values were > successful too.)
Hi, Tried again today and now all tests pass... maybe I was offline as my connection seems to be unstable now... Anyway, patches applied and release 1.29 on the way to CPAN. Thanks ! -- Erik