-
Notifications
You must be signed in to change notification settings - Fork 8
/
test.php
35 lines (31 loc) · 1.39 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?
require_once('YahooFinance.php');
$arr = array("STEM","COOL","RENN","DRYS","KCG","GOOG","NVDA","RAD","T","A",'AA','LUV','SWHC','C','F','SINA','BAC');
//abbreviation change speedtest
$iterations = 125000;
$start = microtime(true);
for($i = 0; $i != $iterations; $i++)
YahooFinance::toAbbrev('ChangeFromFiftyDayMovingAverage');
$end = microtime(true);
echo "\n".'Time to execute '.$iterations.' abbreviation calls: '.($end-$start).' seconds'."\n\t".'('.(1000*($end-$start))/$iterations.' milliseconds per call)'."\n";
//current price retrieval
$iterations = 5;
$mtime = 0;
for($i = 0; $i != $iterations; $i++) {
$start = microtime(true);
YahooFinance::retrieveCurrentPrice($arr);
$end = microtime(true);
echo "\n".'Time to retrieve '.count($arr).' stock prices : '.($end-$start).' seconds'."\n\t".'('.(1000*($end-$start))/count($arr).' milliseconds per stock)';
$mtime += $end-$start;
}
echo "\n\n".'Time to execute '.$iterations.' stock price retrieval pulls : '.$mtime.' seconds'."\n\t".'('.$mtime/$iterations.' seconds per pull)'."\n";
$mtime=0;
for($i = 0; $i != 5; $i++){
$start = microtime(true);
YahooFinance::retrieveEarningsDate('rad');
$end = microtime(true);
echo "\nTime to retrieve earnings date: ".(1000*($end-$start)).' milliseconds taken';
$mtime += $end-$start;
}
echo "\n\n".'Time to retrieve 5 earnings dates : '.($mtime).' seconds ('.($mtime/5).' seconds per pull'."\n";
?>