I turned off stock module and tried just using the API calls as stated in the readme just in a simple node with php filter as a test
$symbols = array('AAPL', 'GOOG', 'MSFT', 'SBUX');
$stocks = stockapi_fetch($symbols);
foreach ($stocks as $key => $stock) {
stockapi_save(_stockapi_to_object($stock));
}
When saving the node I received a number of errors:
Notice: Undefined offset: 22 in _stockapi_to_object() (line 164 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: short_ratio in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: one_yr_target_price in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: eps_est_current_yr in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: eps_est_next_year in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: eps_est_next_quarter in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: price_per_eps_est_current_year in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: price_per_eps_est_next_year in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: peg_ratio in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: book_value in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: price_per_book in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: price_per_sales in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: 50_day_moving_average in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: 200_day_moving_average in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Notice: Undefined index: price_paid in _stockapi_fix_floats() (line 262 of /modules/stockapi/stockapi.inc).
Im running on latest d7 dev, php 5.3.3 if that is of any help.
Comments
Comment #1
7wonders commentedIs no one else experiencing this error? I have tried this on a complete clean install on latest d7 and get the same errors.
Any ideas on whether this is related to php 5.3 or anything I can try to debug?
Comment #2
michael.k commentedI'm seeing the exact same errors. Also...
- Multiple iterations of errors when clicking on /admin/config/content/stock and depending on the type of quotes to retrieve in /admin/settings/stockapi.
- Current output on the /stockapi page is presumably not intended with no theme build
- Output does not reflect Yahoo Finance number's after clearing cache and running cron with a 15 min delay for the module. (Cross checked with Google Finance and Bloomberg.)
- Only the first stock in the Block default symbols field produces output.
- Switched from PHP 5.3.5 to 5.2.17 in MAMP with no difference.
Comment #3
waverate commentedSame errors.
Comment #4
ehask71 commentedI have had some issues with this module here is a patch to address:
1. stock info not saving
2. Issues (at least with me on php 5.2.11) with Stock Names with comma's messing up object. I added a helper function to parse cvs strings much like 5.3 str_getcsv()
3. stockapi_multiload() not working fixed the query
I need to patch the installer to make better use of the float fields i.e. float 15,2
Let me know what you guys think
Eric
Comment #5
waverate commentedPatch #4 fixed php notices in original post.
Patch was applied to 7.x-1.x-dev (2011-Sep-13 ).
Comment #6
onelittleant commentedI can confirm that the patch in #4 worked to resolve our issues with stock updates failing to save.
Comment #7
klidifia commentedConfirmed fixed.