I wrote a simple script to use with Conky for displaying stock quotes (or any thing you can have a symbol to refer to) and charts from Yahoo! Finance . I got to mention one thing, normally Google has good (just good, not great) support for developers to retrieve data from its products, but for financial information, it isnt so convenient to share with us. At least, the (nearly real-time) quotes part. Yahoo provides a CSV example and you can choose what data you want, just edit the link with options you need.

A sample result looked like:

http://farm5.static.flickr.com/4139/4901623509_9b30c6f7be_z.jpg

Lets take a look of this script, stock-conky.sh:

#!/bin/bash
# stock-conky.sh by livibetter 2010-08-17
# Usage: stock-conky.sh <chart_small|chart_large|header|quote> [ticker symbol] [x y]

case "$1" in
  chart_small)
    wget -q "http://ichart.finance.yahoo.com/t?s=$2&lang=en-US&region=US" -O "/tmp/yahoo.finance.$2.png"
    echo "\${image /tmp/yahoo.finance.$2.png -p $3,$4 -s 192x96 -f 60}"
    ;;
  chart_large)
    wget -q "http://ichart.finance.yahoo.com/b?s=$2&lang=en-US&region=US" -O "/tmp/yahoo.finance.$2.png"
    echo "\${image /tmp/yahoo.finance.$2.png -p $3,$4 -s 512x288 -f 60}"
    ;;
  header)
    echo 'Symbol      Last  Change             Open    High     Low     Volume       Date    Time'
    ;;
  quote)
    wget -q "http://download.finance.yahoo.com/d/quotes.csv?s=$2&f=sl1d1t1c1ohgvp2&e=.csv" -O - | awk -F "\"*,\"*" '{
ticker = substr(substr($1, 2, length($1) - 1), 1, 8);
printf("%-8s %7.2f ", ticker, $2);

if ($5 > 0)
  printf("${color green}")
else if ($5 < 0)
  printf("${color red}")
else
  printf("${color black}");

if ($5 == "N/A")
  printf("    ${color}N/A (   N/A) ")
else
  printf("%7.2f (%5.2f%%)$color ", $5, $10)

if ($6 == "N/A")
  printf("    N/A ")
else
  printf("%7.2f ", $6);

if ($7 == "N/A")
  printf("    N/A ")
else
  printf("%7.2f ", $7);

if ($8 == "N/A")
  printf("    N/A ")
else
  printf("%7.2f ", $8);

if ($9 == "N/A")
  printf("%10s ", "N/A")
else
  printf("%10d ", $9);

printf("%10s %7s", $3, $4);
printf("\n");
}'
    ;;
esac

It should be called like:

$ stock-conky.sh <chart_small|chart_large|header|quote> [ticker symbol] [x y]

First argument is the type, you can have chart_small for small chart (192x96), chart_large for larger chart (512x288), header for header title, and quote for the quotes. The second argument is the tickers symbol. Third and fourth arguments are the position of chart image in your Conky output. The ticker symbol maximal length is 8 characters, it should be enough. Change is rendered with color, its easy to read. I found that some field could be N/A, so it has to be dealt with or awk would give out 0.00, thats not the correct value.

This script downloads chart images to /tmp/yahoo.finance.<ticker symbol>.png, then it outputs Conky TEXT for being parsed. For quote, it uses awk to layout the quotes. For both types, you should run it using ${execpi 60 stock-conky.sh arguments...}. Parse and run with one minute interval, there is no need to run it more frequent. Here is a sample configuration:

# by livibetter 2010-08-17

TEXT
${voffset 288}${execpi 60 stock-conky.sh header}
${execpi 60 stock-conky.sh quote GOOG}
${execpi 60 stock-conky.sh quote YHOO}
${execpi 60 stock-conky.sh quote MSFT}
${execpi 60 stock-conky.sh quote CADUSD=X}
${execpi 60 stock-conky.sh chart_large GOOG 0 0}${execpi 60 stock-conky.sh chart_small YHOO 520 0}${execpi 60 stock-conky.sh chart_small MSFT 520 104}

The first voffset is to move the starting text below chart images, the chart images are pulled at the end of configuration because image in Conky is not being arranged as text is. You will need to tell Conky where you want to put this image. So, we just put those command at the end.

Hope this would help you keep an eye on your investments on your desktop!