Closed (outdated)
Project:
Stock API
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Jun 2010 at 01:46 UTC
Updated:
5 Feb 2018 at 00:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
flaviovs commentedI've just found the attached patch which is in use on my production site for many years. It takes a different approach: a new API
stockapi_fetch_many()allows one to fetch many symbol passing a array of symbols. Of course, it' s also backward compatible because it doesn't change the existing API. The function do just one HTTP request to the Yahoo! finance service to fetch all symbols, so it' s pretty efficient.The patch also change
stockapi_cron()to use the new API. One cron run, one Yahoo! request, no matter how many symbols you need to fetch.TODO: use
drupal_http_request()instead of using "fopen()" to to the HTTP request, as many users run with "allow_url_fopen" disabled.Comment #2
melissamwong commentedHello, can you explain how to apply this patch successfully? Thank-you for providing this.
Comment #3
flaviovs commentedhttp://drupal.org/patch/apply
Comment #4
melissamwong commentedThanks Flaviovs!!!!!
Comment #5
izmeez commentedCan anyone comment on their experience with these two patches? Thanks.
Comment #6
izmeez commentedI have applied the patch in comment #1. It applies with -p0
Is there anything more that is needed or is the module now doing fetch multiple as single request to yahoo?
Comment #7
fp commented@izmeez: have you tried it?
Comment #8
izmeez commentedYes. I applied the patch to the module and am using the module.
Everything looks fine and seems to be working. I just don't know if there is an easy way to tell if the patch is active and only a single call to yahoo is being made. Maybe the server logs will need to be examined?
Comment #9
fp commentedIs the code you are using to fetch the stocks making use of this new stockapi_fetch_many() function? If so, it should work (check the output) if not then, it won't! :)
Comment #10
izmeez commentedLooking at the code, it appears to be using the stockapi_fetch_many() function. The output of the stock module is correct. I just wasn't sure if there is someway to examine the calls to yahoo. I think I will have to look at server logs, unless there is another way. Maybe with devel module?
Comment #11
fp commentedYou can add something like this to the code:
This will allow you to see what is returned by the stockapi_fetch_many() function.
Comment #12
joseph.olstadPlease upgrade to 7.x-2.x
Comment #13
joseph.olstad