Localizing the Stock Quotes

When you are using the YFaPi library you may wonder How do I get the trade timestamps returned in my own Time Zone? If so you are in luck as Yahoo Finance has localize their site for different countries and as such we can query the appropriate localization to get your timestamps.

To enable localization you simply need to set the local property.

$api->local = YahooFinance_Location::SINGAPORE;

The YahooFinance_Location class contains constants for the different localizations support by Yahoo Finance. For easy reference I have included the full list below.

Country URL Prefix
Argentina ar
Australia au
Brazil br
Canada ca
France fr
Germany de
Hong Kong hk
India in
Ireland uk
Italy it
Korea kr
New Zealand au
Singapore sg
Spain es
United Kingdom uk

Comments & Questions

  1. I just checked again today if the localized data were back, and it doesn’t seem to.

    I’m still not sure if it’s a bug or a volontary move from Yahoo!, in order to cut their expenses.

    1. It appears Yahoo has removed the localized data permanently for Stock Quotes. All urls now redirect to the US link.

  2. Since yesterday the API doesn’t seem to work with appropriate localization.

    Wonder if Yahoo changed something in their API.

    1. Jean:

      Thanks for bringing this to my attention. It appears that Yahoo has decided to no longer offer localized version of the data. Currently they are redirecting all localized requests to the default download.finance.yahoo.com/d/quotes.csv url.

Add Your Comment