Look at market fluctuations as your friend rather than your enemy; profit from folly rather than participate in it.

-Warren Buffet

With Bank of America (BAC), Wachovia (WB), Wells Fargo (WFC), and Washington Mutal (WM) all seeing drops even without our impending bailout it might be in good taste to keep a real time watch on these charts.

I’ve installed sparkline and did just a few of their test examples and then wrote a small little program to do the following. This can be achieved by mostly modifing the example in stock_chart2
stock-ticker BAC

stock-ticker WB

stock-ticker WFC

stock-ticker WM

stock-ticker AIG

Above as stated is bank of america, wachovia bank, wells fargo , washington mutal, and AIG just for fun. Each are a 4 year chart generated using sparkline. If you haven’t used sparkline it’s highly recommended. Google Analytics among many others use it.

SetDebugLevel(DEBUG_NONE);
$data = array_reverse($data);
$i = 0;
$min  = null;
$max  = null;
$last = null;
while (list(, $v) = each($data)) {
  $elements = explode(',', $v);
  $value    = @trim($elements[6]);

  if (ereg('^[0-9\.]+$', $value)) {

    $sparkline->SetData($i, $value);

    if (null == $max ||
        $value >= $max[1]) {
      $max = array($i, $value);
    }

    if (null == $min ||
        $value <= $min[1]) {
      $min = array($i, $value);
    }

    $last = array($i, $value);

    $i++;
  }
}
$sparkline->SetYMin(0);
$sparkline->SetPadding(2); // setpadding is additive
$sparkline->SetPadding(imagefontheight(FONT_2),
                       imagefontwidth(FONT_2) * strlen(" $last[1]"),
                       0, //imagefontheight(FONT_2),
                       0);
$sparkline->SetFeaturePoint($min[0],  $min[1],  'red',   5, $min[1],     TEXT_TOP,    FONT_2);
$sparkline->SetFeaturePoint($max[0],  $max[1],  'green', 5, $max[1],     TEXT_TOP,    FONT_2);
$sparkline->SetFeaturePoint($last[0], $last[1], 'blue',  5, " $last[1]", TEXT_RIGHT,  FONT_2);

if (isset($_GET['m']) &&
    $_GET['m'] == '0') {
  $sparkline->Render(200, 50);
} else {
  $sparkline->SetLineSize(3); // for renderresampled, linesize is on virtual image
  $sparkline->RenderResampled(200, 50);
}
$sparkline->DrawText(strtoupper($_GET['s']),
                     $sparkline->GetImageWidth() - (imagefontwidth(FONT_5) * strlen($_GET['s'])),
                     $sparkline->GetImageHeight() - imagefontheight(FONT_5),
                     'black',
                     FONT_5);

$sparkline->Output();

?>

This is originally adopted from the example in the sparkline package. You will need sparkline to reproduce the above examples.

The arts are an even better barometer of what is happening in our world than the stock market or the debates in congress.

-Hendrik Willem van Loon