Stock Quote Sidebar

Update:  Now hosted at http://wordpress.org/extend/plugins/stock-quote-sidebar/ – please rate the plugin there if you like it!  This page will still be updated, and comments are welcome here.

Important Note:  Yahoo no longer provides the Dow Jones Industrial Average in downloadable format, due to restrictions imposed by Dow Jones.  Therefore, you will not be able to include ^DJI or INDU in your quotes list.  There is currently no workaround.

This is a WordPress plugin that allows you to put a list of stock quotes in your sidebar (or anywhere you want, really). This should be considered beta software, although I’ve been using it without problems for a while, as you can see in my sidebar. I have a different plugin that allows inline stock quote tooltips – check that out here.

Usage:
Unzip into your WordPress plugins directory, which should result in a directory called sqsidebar. Enable the StockQuoteSB plugin in the Admin page. Configure the plugin under WordPress Options, Stock Quote Sidebar.

Then, wherever you want the quotes to appear, put in code like the following, depending on what quotes you want:
<?php get_stock_quote(); ?>

You can also override the symbols configured in WordPress options by explicitly calling get_stock_quote with the symbols as parameters:

<?php get_stock_quote("NOVL,PFE,INTC"); ?>

The options allow you to specify the following:

  • Yahoo URLs to use for quotes and charts
  • Chart range (1 day, 5 day, etc)
  • Date and time format
  • Number of randomly selected quotes to display
  • Whether to display the symbol or the company name

A chart is displayed in a tooltip when you mouse-over the day’s change.

As of version 1.2, cURL is used to download quote data.  Accordingly, cURL must be available and enabled in your PHP environment.

Version 1.3 fixes the issue caused by Yahoo changing the URL for stock data downloads. Existing users will need to download version 1.3 or later, and change the URLs in the plugin’s options to NOT include the “http://” portion. For example, enter finance.yahoo.com and NOT http://finance.yahoo.com

Versions 1.4 and later use a different plugin directory, due to the way the SVN downloads work from WordPress.org.

This plugin has been tested with WordPress 1.5 and later.
Please leave feedback or let me know of any problems below.

This is free software, but donations are accepted in the sidebar.

Download here

Change Log

Share

200 Responses to “Stock Quote Sidebar”


  • Dow Jones Industrial Average (INDU) no longer displays.

    It used to show the quote DJIA, stock chart, etc. Now it just says “INDU” and chart not available.

    I noticed the same error on this very same page, using your example of the plugin.

    Anyone know how to fix this? (I know the author of the plugin will probably never see this, but just in case…)

    Anyone? Bueller?

  • I have the same problem, DJIA not available, any solution ?

  • Well, DJIA seems to be working again.

  • Hi, this is an amazing mod. I like it very much and use it with great pleasure! But I was wondering is’i it forbidden to use Yahoo quotes and charts on your site without Yahoo’s permission?

    Thanks!

  • Installed the add-on. Tried both using the sidebar widget and the text widget w/the supplied php code. Tried setting the stocks to quote as an option and also in the in-line code. Quotes never appear. (Currently using as in-line php code in a text box widget.)

    Must be something simple, but so far, I haven’t stumbled across any combination that will work.

  • I should add, the code I am using is:

  • Sorry, code stripped out. Image that there are open/closed brackets in the below:
    ?php get_stock_quote(“AINV, BPT, BBEP, CIM, CYS, EEP, HTS, LINE”); ?

  • Hi,

    Thanks for this nice, simple, minimalistic plug-in. I am a WordPress web developer using your widget on my client’s site listed above. I wonder if you are aware that as of this week, the date displayed below the stock quotes is “1970-01-01″ instead of the current date. (That’s what happens when my Mac reboots and gets confused about the date.) Last week, it correctly displayed the current date. My client who I’m developing the site for is disturbed about the incorrect date … can this be fixed? Thanks much, Tad Hanna

  • Unfortunately, I suffer from the same issue that others say.

    The plugin won’t query ^DJI properly instead, giving me INDU
    However, the ^DJI link is still correct. You can even see it in your sidebar. Is there a fix for this? DJIA does not work either.

    Best-
    Connor

  • I added ^DJI

    I’ll wait until you fix it to use that. I’m guessing, you will release a new version. Hopefully, I’ll get a notice in wordpress dashboard that their is an update available.

    Thanks!
    Newager

  • Seems like it stopped working and then began again. I’m guessing it a yahoo.com issue and not the plugin.

  • Regarding the DJIA not displaying:

    Dow Jones has prohibited sites like Yahoo from distributing CSV/XML quotes of the index. There is no fix and no workaround, unfortunately. If you look at the Yahoo quote page for INDU or ^DJI, you’ll see that the “download data” link is missing under the Toolbox section compared to other symbols/indexes, like ^GSPC. Because my plugin relies on the CSV data, there is no way to provide DJI unless they change their policy.

    Thanks,

    Andy

  • Dear,

    Why is change of NASDAQ always 0,00 and +0.00%?
    Is that something with my site or?

    Thanks in advance.
    BR

  • Love the Stock Quote Sidebar, but I’m having a problem. For he last week it’s been showing the same stats and appears to be stuck on 11-25-2011. I’ve tried deactivating, changing some of the settings and saving, checking the WP date in settings, and nothing is working It’s still showing data for 11-25-2011. Any ideas? Thank you!

  • Hi again. I fixed the problem by removing the Dow which, as I could see from earlier comments, Yahoo no longer allows SQS or anyone to use. Thank you!

  • Hey, great plugin. Is it possible to integrate Foreign Exchange rates into this?

  • Hi and thanks for the plug in. I am using “Display widgets” to control my side bar content but this plug-in’s option do not display on your plug-in’s options. Is there a quick fix for this?

  • Dear Andy,

    the stock quotes can be used only once in the sidebar.

    I work with the WordPress 3.2.1 and when I put it in my sidebar than is the widget out of my widget options. But i won´t to put in more sidebar positions.

    Have you the solution?

  • Hey Andy,

    I have my problem already solve.

    Thanks

  • any way to make it scroll horizontally across the screen?

  • Receiving ERROR message Stock quote information cannot be displayed. The error message comes and goes? Is there a fix for this?

  • For some reason I can’t get the CSS to work right. Can you help me with this? Site is test.officingtoday.com

  • Just what i’m looking for :)thanks

  • Please for the love of god make this usable via shortcode so I can just stick it in a widget…

    I’d stick it in the code but I actually prefer a more powerful WordPress, not a static one… I need things DYNAMIC!! I need pages that look DIFFERENT!! — I use Gantry and I want to stick this in a sidebar widget that doesn’t display on every page… but… you can’t put raw PHP code in a sidebar widget… best you can do is use WordPress shortcode

  • Anyone having issues dragging the plugin into a sidebar and the mouse-over “graphs” do not display properly? They’re totally distorted on my localhost site.

  • Howdy,

    I noticed your stock chart is centered in your right sidebar…any clue to how I can mine centered in my far right sidebar in Atahualpa theme? Any help would be appreciated.

  • OK, I answered my own question. To center this widget in a sidebar we first need to download PHP Code Widget which is similar to the Text insert widget, however it accepts PHP coding along with html.

    Thus, after adding your stocks to the list, add the following code to the PHP Code Widget and drop it into your side bar:

    and wa-la, you’ve got it Toyota!

  • Here is the code again. I was unable to use the actual coding here…so you will need to add arrow brackets on each center with the end slash on the final one, and add the arrow brackets around the php coding:

    center ?php get_stock_quote(); ? /center

  • The Code works and centers the table but it also moves the ticker symbols to center instead of left justified. Any thoughts?

  • Hi there.

    This sounds like a handy plugin. Ideally for me, I would like to use a tool like this in the body of my posts. Is there a way to accomodate that with this code? Or is it hard coded to be a widget only?

    Many thanks

  • how can I extract only the top 5?

  • I wanted to show the quotes in one of my posts. I went to edit the post and added the following quote.

    ?php get_stock_quote(“AINV, BPT, BBEP, CIM, CYS, EEP, HTS, LINE”); ?

    But, the quotes are never getting showed under the post.

    Please help me fix the issue.

  • Hi Andrew!

    How to add up / down images stock?

  • How can I add a class to the link? I have a class built to send an alert to site visitors when clicking an outbound link (you are leaving our site warning). I simply need to add a class to the link that is built. Which line controls the outbound link?

  • Nevermind… got it. Built a class – added to link class.

    Thanks

  • Hey there just wanted to give you a quick heads up and let you know a
    few of the images aren’t loading properly. I’m not sure why but I think its
    a linking issue. I’ve tried it in two different browsers and both show the same results.

  • Hello!

    We have noticed that the data has stopped updating as of July 5th. DO you know if this is just Yahoo being dumb or is your plug-in needing a look at? Thanks!

    Mike

  • this tool is so nice… but I just can’t seem to discover why my tooltip chart size displays so small, much smaller than expected settings. Is there a way to increase or vary the size? Any tips would be very much appreciated.

  • Hi, just a head’s up, I’m getting a wpdb::prepare() error thrown when calling this plugin. See Nacin’s post about the issue here: http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

  • Angelique, I just upgraded to the latest and I’m not seeing that error in the debug. Can you give me some specifics about where/when you are seeing this error?

    Thanks,

    Andy

  • widget is too small,,,any bigger one?

  • it looks nice,,i wonder if wordpress has home page.
    i can put it on

Leave a Reply