Can't update securities on TSX in CDN funds
David Hampton
hampton@employees.org
06 Jan 2003 23:38:51 -0800
--=-641aVdmcGBxwiMVwDIgx
Content-Type: multipart/mixed; boundary="=-DdoEAynNXVSf32GcPpPl"
--=-DdoEAynNXVSf32GcPpPl
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
On Mon, 2003-01-06 at 23:23, David Hampton wrote:
> That's a Finance::Quote bug. It's telling gnucash that the stock is
> denominated in USD. Is there a consistent prefix/suffix that Yahoo uses
> on Canadian stock names? If so, I can build you a patch for F::Q so it
> will correctly tell gnucash that the stock is in CAD.
Yahoo uses ".TO" to indicate that a stock is on the Toronto Exchange.
Apply the following patch to your installed version of Finance::Quote
and gnucash will start getting quotes in Canadian Dollars.
David
--=-DdoEAynNXVSf32GcPpPl
Content-Disposition: attachment; filename=finance_quote
Content-Type: text/x-patch; name=finance_quote; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Index: Finance/Quote/Yahoo/USA.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/finance-quote/finance-quote/lib/Finance/Quote/Yahoo/USA.=
pm,v
retrieving revision 1.14
diff -u -r1.14 USA.pm
--- Finance/Quote/Yahoo/USA.pm 26 Jun 2001 05:25:06 -0000 1.14
+++ Finance/Quote/Yahoo/USA.pm 7 Jan 2003 07:33:39 -0000
@@ -117,8 +117,14 @@
# Yahoo indexes all start with a hat, so don't
# tag them with a currency.
if ($info{$symbol,"success"} and $symbol !~ /^\^/) {
- $info{$symbol,"currency"} =3D "USD";
$info{$symbol,"method"} =3D "yahoo";
+ if ($symbol =3D~ /\.TO$/i) {
+ # Prices from Toronto are in Canadian
+ # Dollars (CAD).
+ $info{$symbol,"currency"} =3D "CAD";
+ } else {
+ $info{$symbol,"currency"} =3D "USD";
+ }
}
}
return %info if wantarray;
--=-DdoEAynNXVSf32GcPpPl--
--=-641aVdmcGBxwiMVwDIgx
Content-Type: application/DEFANGED-9; name="signature_asc.DEFANGED-9"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQA+GoQLlSwHWMdNRQQRAlKQAKCmGy45s7cUv3X14gd7OoCSnfk78QCgpdQ0
J41cKwpKiOPQDiUxmUDtCww=
=qlFq
-----END PGP SIGNATURE-----
--=-641aVdmcGBxwiMVwDIgx--