Yahoo Stock Quote (AJAX module version) |
| Written by kksou | ||||||||||
| Saturday, 06 September 2008 | ||||||||||
This module allows you to display stock quotes from Yahoo Finance in a module position. The stock quotes are obtained in "real-time" direct from Yahoo Finance. Note: as stated in the Yahoo Finance page, these quotes are delayed (for up to 15 to 20 minutes.), except where indicated otherwise. The latest version now allows you to display the time in your local time, e.g. Hong Kong's Hang Seng Index in Hong Kong time. Please refer to here for details. Live DemoThere are three demos available:
Note: I've turned off the automatic refresh in these demo so that the Yahoo Finance's server is not overloaded too much when too many users are trying out the demo all at the same time. Unique Features
Latest Version v1.6.8 (for Joomla 1.6), v1.7.8 (for Joomla 1.7) and v2.5.8 (for Joomla 2.5) Special thanks to Gruz! He ported the original Joomla 1.5 version to Joomla 2.5 and asked me to share this with the rest. How to useYou can display a single quote: e.g. Or you can display multiple quotes all at once: e.g. If you have entered "
You can turn on or off any of these fields. For example, you can choose to display only some of the fields:
And you can choose to display the symbols by row or by column. This is useful, for example, if you wish to display the stock quotes in the left or right module position.
The stock quote from Yahoo Finance are always displayed in ET time. Global Time OffsetYou can set a global time offset in the parameters page. All displayed time will be offset by this amount. Please refer to here for more details. Local Time OffsetTo do a local time offset, enter the following in search field: ^HSI(+13) The
Half-hour offsetFor half-hour offset, use the following: ^HSI(+17:30) ^HSI(+12:45) You can add some additional characters behind the time offset to indicate the time zone, e.g. ^HSI(+13HK)
Note that there is now "HK" appended behind the time. Note that the program WILL NOT automatically find out the difference between HK and ET time. You have to manually specify how many hours to add or subtract from the ET time. You can have multiple offsets for different symbols, e.g. YHOO,^HSI(+13HK),^N225(+14JP)
Automatic RefreshOf course, the module supports automatic refresh without any reloading of pages. If your browser supports AJAX, the stock quotes will be refreshed once every 5 seconds. You can set this interval to be longer. But the minimal is 5 seconds. (Of course, technically you can even refresh at a rate of once every one milliseconds. However, if you do so, I think Yahoo will soon come after you for absuing their servers. That's why I set the fastest refresh rate to be 5 seconds.) To turn off automatic refresh, set the interval to be 0. Note that the automatic refresh will only work if your browser supports javascript and AJAX. If it doesn't, then the stock quotes will only be displayed when you first click the submit button. The stock quotes will not be updated or refreshed subsequently. You need to manually click the submit button again to get the latest stock quotes from Yahoo Finance. Intraday Graph - direct links to Yahoo FinanceIf you click on any of the intraday thumbnail, it will bring you direct to the full graph at Yahoo Finance site:
Support for non-javascript browserThe module will also work for non-javascript browser and browsers which do not allow javascript. For these browsers, since AJAX cannot run, there will be reloading of the page when the submit button is clicked. The same result will appear for both the AJAX and non-AJAX mode. Including this module in Content Item or ArticleSince this is a standard Joomla module, you can easily include this module into a content item or article with the use of {mosloadposition} (for Joomla 1.0.x) or {loadposition} (for Joomla 1.5.x). You can take a look at the demo here.
Be a SponsorIf you find this module useful, Secure Payments by PayPal. DownloadThe Yahoo Stock Quote module is FREE to use (even on commercial websites) as long as the Powered by JoomlaGadgets links remain intact and visible. Joomla 1.0.x: mod_yahoostockquote_v1.0.8.zip
Joomla 1.5.x: mod_yahoostockquote_v1.5.8.zip Joomla 1.6.x: mod_yahoostockquote_v1.6.8.zip Joomla 1.7.x: mod_yahoostockquote_v1.7.8.zip Joomla 2.5.x: mod_yahoostockquote_v2.5.8.zip How to install
That's it! You're now ready to use the Yahoo Stock Quote right inside your Joomla website! ParametersYou can set the following in the Parameters page:
Use the default method fread() first. If it doesn't work, then try file_get_contents(), and then the cURL library.
I've used the same method as that used in the ordering of modules/plugins in the Joomla admin page. You select and position a field by inputting an integer number 1, 2, 3, etc. A field with 0 will not be displayed. Note that the number need not be sequential, for example, you can also input 1, 10, 20, 30, 40, 100, 210, 300, etc. Styling the Module using CSSThe entire formatting of the stock quotes is done using CSS. If you do not like the default look and feel of the stock data, you can edit the following CSS file:
Note that in the stylesheet In case you need even more control, below are listed some additional styles you can use. Just add these new styles to the file
div.yahoostock input.inputbox {
font-family: Verdana;
font-size: 12pt;
font-style: italic;
}
div.yahoostock input.button {
font-family: Verdana;
font-size: 10pt;
}
div.yahoostock {
background: #33FF66;
}
History
Thanks to Karen who informed about the "Division by zero" error when the previous trade value is zero. This sometimes occurs when Yahoo Finance reset these values a few hours before the market opens. Have fixed the code so that there will not be any "Division by zero" error. This is in response to Achdw's request to be able to display local time for the Yahoo stock quotes, for example, to display Hong Kong's Hang Seng Index in Hong Kong time The latest version now supports this. Please refer to here for details. Bug fix: you can now specify the fields to be displayed again. Thanks to Elie for highlighting the bug. Bug fix: v1.5.6 fixed line 297 $row is redundant. Thanks to Andrew to provide me with the list of additional yahoo stock quote APIs. The new version now allows you to display a lot more financial info such as P/E ratio, Earnings per share (EPS), market cap, etc. The new version also incorporates some of the feature requests from users: This is in response to Redback's request to have time offset in half hours e.g. South Australian time is +9.30 GMT. Please refer to here for details. |
||||||||||
| < Prev | Next > |
|---|















. Use this if the width of your module is large enough. If you are using the module in the left or right module position, use the default progress image: 
Comments
//.. chittah chattah
I?ve a problem using your module
I installed it successfully and I?m using it inside Article (using {loadposition })
Module appears on the webpage but for some reason it doesn?t display companies? info or charts
http://diamond-class.eu/index.php/diamond-related-companies-stock
I?m using Joomla 2.5
Let me know if you?ve require more info
RSS feed for comments to this post