Drupal Stock module

Sponsored Links

Drupal Stock module

I 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

  • All spam and irrelevant comments will be deleted.
  • Comments posted here will take some time to appear on the site. Do not post your comment again if you do not see it. Just be patient and it will be published.
  • Note that what you post here will be publicly available on the web and will be indexed in search engines.
  • We reserve the right to unpublish any comments without stating the reasons for that.
  • All postings are subject to our Terms of use
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.

More information about formatting options