hello world.
I'd like to know if it's possible to get stock info for only one company, for example:
I have a content type with companies like Google, Apple, Microsoft, Yahoo etc.
The content type has some fields with information on the company and the Ticker Symbol (stock, whatever)
my question is: Can I display somehow the price info of a company, let's say Google (GOOG) in a field on the content page?
somehow like this: the module gets the ticker from the field_ticker (Ticker Symbol) and displays the information for that ticker/company on the company page (so, for google it displays the info only for GOOG, for yahoo it displays the info only for YHOO. etc)
so it looks like this
Help is very much appreciated!

Comments

beanluc’s picture

Does the Views module provide stock data from this module?

If so, you could use the "Insert View" input filter to populate the node field.

Or, maybe you could use "Views Attach", which might make it easier to use arguments based on node field values (ticker symbol = argument).

Views Attach wouldn't store the data (price) in the node's field (and neither would Insert View), but you don't want to do that anyway, or else you'd have a new node revision every hour while the market's open.

frankie_2304’s picture

good ideea but i don't think views provides stock data from this module, i'll take a look.
Thank you!

kbahey’s picture

Title: More of an Ideea then a Issue » Quotes for a single company
Status: Active » Postponed (maintainer needs more info)

See the stock api module and the README that comes with it. You can call a function to get the quote for a single symbol.

frankie_2304’s picture

FIXED
i did this by modifying the code in stock module like this:

function stock_get_user_quotes() {
  global $user;
  $alias = drupal_get_path_alias($_GET['q']); 
  return db_result(db_query("SELECT symbol FROM {stockapi} WHERE symbol = \"%s\" LIMIT 1", arg(2, $alias))); 
}

and it works.
i have the url like this www.mysite.com/companies/stock/companyticker (using Pathauto)
Thank you for your comments