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.

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 2.x.
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

110 Responses to “Stock Quote Sidebar”


  • Great plugin, just curious if any way to stop archiving sqsb…. files on my root dir?

    Getting overwhelmed with files but would like too keep the plugin active.

    Thanks

  • I’m getting error when running:

    Warning: tempnam();open_basedir restriction in effect. File() is not within the allowed path(s) …. on line 310

    Warning: curl_setopt(): supplied argument is not a valid File-Handle resource on line 313

    I am using Wordpress 2.05.

    Could this be that a tmp folder is required but has no permission?

  • is it possible to turn-off the pop-up chart when you roll over the change in value?

    also, any intention to expand this to international market and indexes?

  • Installed earlier version 1.1 and works now. Thanks Andy for the great plugins.

  • Works like a charm! I got ADM listed without any trouble. But how can I list the price of soybeans and corn on the Chicago Board of Trade?

  • Placed the Stock Quote Sidebar in a php code widget and works perfectly. I then adjusted size of sidebar on stylesheet to make it fit just right.

  • the sidebar works just fine with the widget too! just grab Widgetize anything and add the code it should be fine!

  • you should add formatting of tickers. example,

    BRK-A and BRK-B are in the thousands of dollars. Your tool is amazing and i love it. it would be nice to add this feature.

  • Hi,

    Your plugin is very helpful, thank you.

    I notice when you have many, many symbols (we have 50+), loading up all the charts graphics significantly slows down the page’s load time.

    I made the following changes to eliminate this problem, so that it pulls the charts on-demand. You don’t even see the difference, but the page loads much, much faster this way:

    in function get_stock_quote:


    if($change < 0) {
    echo "<td width='55' align='right'><a href='$chartclickurl' class='sqsbchart' onMouseover='popupChart(this, \"$charturl\");'><span class='chartPlaceHolder'></span><font color='red'>$change</font></a></td>";
    }
    else if($change > 0) {
    echo "<td width='55' align='right'><a href='$chartclickurl' class='sqsbchart' onMouseover='popupChart(this, \"$charturl\");'><span class='chartPlaceHolder'></span><font color='green'>$change</font></a></td>";
    }
    else {
    echo "<td width='55' align='right'><a href='$chartclickurl' class='sqsbchart' onMouseover='popupChart(this, \"$charturl\");'><span class='chartPlaceHolder'></span>$change</a></td>";
    }

    Then, in the sidebar before you call this function:


    function popupChart(obj, url) {
    placeHolder = $(obj).getElementsByClassName('chartPlaceHolder')[0];
    if (placeHolder.nodeName != "IMG") {
    placeHolder.replace("");
    }
    }

    As you can see it requires prototype, but it could easily be rewritten not to if you felt like it.

    Hope this is useful to someone.

  • I can’t get the above code to work. I’m using wp 2.2.1 and tried the code on a page and also a widget. It didn’t work. Nothing showed up. I activated plugin, configured a few valid stocks, put the code in, and nothing shows up. I must be doing something wrong as everyone else seems to be ok. Any suggestions? Thanks, Doug

  • Do you have any suggestions on how to get this working in Mediawiki (i.e. without using Wordpress)? Will try to do it but am not that experienced with PHP extensions. I just wondered if you have had any tips or previous experience with anyone doing this? Thanks.

  • oke, stockTT works well. But this plugin is a bit to difficult for me. I dont no where to put this code.

    if someone could copy paste a few lines of his script with this code within it..

    Thank you!

  • I’m getting an error related to CURL. What should I do ?
    Fatal error: Call to undefined function curl_init() in /var/www/nadertewelde.com/htdocs/wp-content/plugins/sqsidebar/stockquote.php on line 309

  • Looks like yahoo changed the url of their service only an hour after I installed your plugin. What are the odds? How do we get the plugin to work? No url I enter in the options seem to do the trick.

  • Well, I’ve been using it for a while, and then Yahoo! messed us all up.

    Hopefully we can all get this plug-in working again.

    Peace,
    Gene

  • I’ve been using this as well. I deleted the old version and uploaded the new one. I checked the options and all the old stocks still appear there. I tried to view the site but nothing is coming up. Are there any other upgrade instructions other than deactivate 1.2, upload a new 1.3, then activate again?

    Thanks

  • Awesome plugin. Works great with one exception. For some reason when I view my site in firefox the graphics get squished, in IE (7 at least) they look as expected. However the images on your site work as expected in FF. Is this a CSS issue?

  • I’ve downloaded the new plug-in but instead of having the chart appear when you roll over the number, it is actually just appearing on my site.

    How do I fix this? How do I get rid of the chart so that it only appears when you roll over the stock quote?

    Thanks.

  • man i am clueless. I uploaded into my plugin directory, modified the option a little bit. but i don’t see the table on the side bar.
    where do i exactly enter this
    “” much thanks.

  • opps php code didnt get posted.
    i meant to say enter this

    “php get_stock_quote();”

  • I keep getting this error. I don’t understand it worked before and I upgraded to 1.3.

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35 bytes) in /home/ovathar2/public_html/wordpress/wp-content/plugins/sqsidebar/stockquote.php on line 263

  • Hi, I got a weird one, but I’m not sure where to put the blame. So don’t take it personal, but I welcome assistance as my PHP skills are minimal and my Apache skills are even worse.

    I just updated to the newest RELEASE branch of cPanel 11, which includes something called Easy::Apache, a simple way to build the latest Apache 1.3, 2.0 or 2.2 release in just a few minutes.

    So,last night i upgraded from Apache 1.3.7 on my dedicated server to 2.2.6.

    I used the mods that my host (HostICan) said were correct, which means choosing a Basic configuration.

    After the update, some permissions were unaccountably changed, such a setup file for the MyBB message board system, which went from 777 to 644. The wp-content folder of my WordPress 2.3 installation was also changed, but I think I got this back to normal (and also reinstalled some plug-ins).

    However, with the WordPress installation, pages would stall at the sidebar, until I removed the code for SQSidebar in the sidebar theme file. Understand I’ve used your plug-in for months, and upgraded to the 1.3 version when it came out. Before the Apache upgrade, everything was fine.

    Despite reinstalling, and even doing a fresh WP installation, I cannot get your plug-in to run.

    Before and after the Apache upgrade, I was using PHP 5.2.4, so it seems that the Apache installation represents the only change that I can discern.

    So I ask you: What is going on here and how do I restore your plug-in to functionality?

    Apache experts are welcome to advise if there are further things I should do to avoid possible future problems.

    Peace,
    Gene Steinberg

  • I also upgraded to 1.3 and experienced a problem with the cURL function. The log file error message is:

    Call to undefined function curl_init() in /usr/local/apache2/htdocs/db/wp-content/plugins/sqsidebar/stockquote.php on line 321

    Am I correct that PHP has to have been compiled to include these functions?

  • Hello. I am very bad speak english. I have problem with your plugin. Please, tell me, why side bar not working? I am installing plugin in the directory my site, activated plugin in meta board, print php code in widget, but i dont see it :(
    Plugin is cool. But problem “unhappened” me :(
    Please write me solodin@list.ru (Russia)

  • Do u have any plan to have this plugin in
    Joomla??

  • Page is blank! wordpress 2.3.2

  • Anybody have this working in WP 2.3.3? I only get a list of info:

    “IDMI”,”IDM PHARMA INC”,2.40,”2/22/2008″,”4:00pm”,-0.21,2.66,2.70,2.34,928066 “XPRT”,”LECG CORPORATION”,9.28,”2/22/2008″,”4:00pm”
    .
    .
    .
    See this at http://trading.valuemanagementpartners.com
    near the end of the sidebar.

  • I just upgraded to WP 2.3.3 as well. I had been running SQSB .9 for the last year or more. .9 with 2.3.3 will break the WYSIWYG editor in WP. I have no idea why yet, but it causes RealTinyMCE to bomb out as “undefined”. So I am giving 1.3 a shot.

  • 1.3 is no worky either. I get an address stamp of 1969-12-31 16:00 where the stock quotes should be in the sidebar. That is all. I can tell it is trying to do something because the page hesitates as it loads. But then it fails and just leaves the timestamp. Huge bummer. I love this plugin.

  • Fixed. Missed this in the notes…

    “This will require users to remove the “http://” portion from the URLs in the plugin options.”

    Now if I can just get UDM to work within a text widget I would be totally dialed.

  • I’m using 2.3.3 and can’t get it to work:

    Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/stockmar:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/stockmar/public_html/wp-content/plugins/sqsidebar/stockquote.php on line 322

    Warning: curl_setopt(): supplied argument is not a valid File-Handle resource in /home/stockmar/public_html/wp-content/plugins/sqsidebar/stockquote.php on line 325

    Warning: fflush(): supplied argument is not a valid stream resource in /home/stockmar/public_html/wp-content/plugins/sqsidebar/stockquote.php on line 327

    Warning: fclose(): supplied argument is not a valid stream resource in /home/stockmar/public_html/wp-content/plugins/sqsidebar/stockquote.php on line 329

  • I am getting this error in the options page:

    Invalid argument supplied for foreach() in /home/myblog/public_html/wp-content/plugins/sqsidebar/stockquote.php on line 155

    Any ideas? Tanks in advance.

  • Man… too bad this plugin doesn’t work. It used to be great. using 2.3.2 and 2.3.3 and can’t even begin to get it to work. mainly cURL problems on a fresh install of 1.3… It is unfortunate when a plugin can’t be supported. but understandable I guess. I will miss it.

  • Ok. so my problem is that my server doesn’t have proper support.

    Since there hasn’t been an answer on here, I will try to explain. You have to have you PHP install compiled with support for cURL. If you don’t have that it won’t work. My dreamhost is already setup and everything works great for me. My local doesn’t, and it doesn’t work at all.

    Nice plugin. don’t know about 2.5, but works great on 2.3.3. thanks.

  • I’ve been using this plugin for a long time, but I’m finding that it’s been erratic since I went from WP 2.5 to 2.5.1.

    Now, we’re running into situations where there’s a 10-20 second delay when your plugin is enabled, as if it can’t retrieve the external online content.

    Is that an issue with Yahoo! — what?

    Anyone else?

    For now, I’ve disabled the plugin and the link in my sidebar till this clears out.

    Peace,
    Gene Steinberg

  • Just wanted to let you know that I reenabled this plugin, which seems to be running faster. But rendering times are still at least twice as slow.

    :(

    Peace,
    Gene

  • I recently installed with the latest WP. My host (pair) claims that cURL is configured as part of my php install. But nothing appears to happen.

    Do I need to do anything special other than install, activate and add the php code to the side bar?

  • hi. Thanks for plugin

    perfect.

    Regards

  • hi
    have have activate your stock market sidebar but i am getting the following error below. what am doin worng?

    error : cannot receive stock quote information

  • This is a great plugin and plan to use it shortly. How do you insert the Stock Quote Sidebar into a Wordpress page? Is there any way to include other stock information such as market capitalization? Is there any way to change the appearance to have the ticker, stock price, change, change percentage and 1 year chart in the same row and appear at the same time? Thanks.

  • As of yesterday I started seeing this message:

    error : cannot receive stock quote information

    Any idea on how I can fix this?

  • Never mind, it started working again.

  • I’m using both plugins and they work great. I’d like to customize the sidebar app and have a Yahoo! Finance search query that jumps into a new window/tab below the time/date. Any tips to pass along? Also, where did you insert the tag to draw the line in your chart you have here?

  • Hi Andy,
    cool widget. we would like to use it for our side, but we are not really sure if its legal because it is using the quotes from yahoo.

    could you give us feedback.
    thx

    greetings from hamburg,
    alex

  • what is the URL n ichart URL for yahoo finance India?

    the plugin is working fine for yahoo finance but not when I chance URLs to in.finance.yahoo.com and in.ichart.yahoo.com

    could you please reply soon

  • its working now :)

    BUT BUT BUT

    check your widget in your sidebar

    its displaying yesterday’s date….

    could you please correct that?

  • i want two copies of the widget on my blog. Is it possible?

  • i have two wordpress sites, the first with wp 2.6.1 and the plugin work perfect, but in the other with wordpress 2.8.3 it doesnt work:

    error : cannot receive stock quote information

    does the plugin work with wp 2.8.3?

Leave a Reply