Drupal Stock module
Sponsored Links
Drupal Stock module
Submitted by Khalid on Tue, 2005/02/01 - 11:15I wrote and contributed the stock module,which provides stock quotes from a web form, as well as a portfolio feature for registered site users, where they can save their favorite stock symbols. It uses Yahoo! Finance for getting the quotes.
»




Stock module
hello, thank you for creating such good stuff,
I have just installed it in my site - http://stock.hkbloggers.net/?q=stock
however, all of it shows 0 0 0 0, no data could be retrieved, do you know why???
Thank you,
Blacksnow
Re: Thank you for sharing Stock Module on Drupal.
Asalamolaykum,
Dear Brother,
Million thanks for sharing stock module on drupal. I am going to set my webiste shortly with this module.
may god bless you.
Salman from UK
allow_url_fopen
Check if your host is not allowing allow_url_fopen().
There can be other restrictions. See #218125 for more details.
--
Khalid Baheyeldin
Modified function
I was having the same problems about the values showing up as all zeros. I found that the problem was with the following function that is found in the current release of the stock module for Drupal. You can see the modifications that I made to it as a temporary fix for people having similar problems.
function test_process_data($data, $headers) {
$columns = array();
$i = 0;
foreach ($headers as $key => $value) {
$field = $data[$i++]; // <- This is where the problem was occuring
// Special handling for some fields
switch ($key) {
case 'symbol':
$columns[] = _add_full_quote($field);
break;
case 'name':
$columns[] = $field;
break;
case 'change_amt':
$columns[] = _right_align(_up_down_tick(_decimals($field)));
break;
case 'current_price':
case 'opening':
case 'high':
case 'low':
$columns[] = _right_align(_decimals($field));
break;
case 'volume':
$columns[] = _right_align($field);
break;
default:
$columns[] = $field;
break;
}
}
return $columns;
}
Post new comment