Ai Analytix is an artificial intelligence, machine learning platform turning big data into information, then into actionable information.
Your one-stop destination for comprehensive company analysis, fundamental research, portfolio evaluation, screening tools and investor relations on over 1 100 African listed equities.
"; echo "
Error | "; echo "Error: NO record has been found, please enter a valid symbol | "; echo "
"; exit(); } if($jsonContent->$metadataKey != null) { $symbol=$jsonContent->$metadataKey->$symbolKey; //$symbol=strtoupper($symbol); $timestamp=$jsonContent->$metadataKey->$timeKey; } if($jsonContent->$timeSeriesKey != null) { $count=0; foreach($jsonContent->$timeSeriesKey as $key=>$value) { if($count==0) { $open=$value->$openKey; $close=$value->$closeKey; $vol=$value->$volKey; $high=$value->$highKey; $low=$value->$lowKey; $range=$low . "-" . $high; $count=$count+1; } else if($count==1) { $prevClose=$value->$closeKey; $count=$count+1; } else if($count==2) { break; } } } echo "
Stock Ticker Symbol | "; echo "" . $symbol . " | "; echo "|
Close | "; echo "" . $close . " | "; echo "|
Open | "; echo "" . $open . " | "; echo "Previous Close | "; echo "" . $prevClose . " | "; echo ""; echo "
Change | "; $change=$close-$prevClose; $change=number_format((float)$change, 2, '.', ''); if($change>=0) { echo "" . $change . " | "; } else { echo "" . $change . " | "; } echo "
Change Percent | "; $percentage=($change/$prevClose)*100; $percentage=round((float)$percentage, 2); if($change>=0) { echo "" . $percentage . "% | "; } else { echo "" . $percentage . "% | "; } echo "
Day's Range | "; echo "" . $range . " | "; echo "|
Volume | "; $vol=number_format($vol); echo "" . $vol . " | "; echo "|
Timestamp | "; date_default_timezone_set("America/New_York"); $fullDate=date_create($timestamp); $formattedDate=date_format($fullDate,"Y-m-d"); echo "" . $formattedDate . " | "; echo "Indicators | "; $spaces=" "; echo "Price" . $spaces . "SMA" . $spaces . "EMA" . $spaces . "STOCH" . $spaces . "RSI" . $spaces . "ADX" . $spaces . "CCI" . $spaces . "BBANDS" . $spaces . "MACD | "; echo ""; echo "
"; echo "
";
$volArray=[];
$dateArray=[];
$priceArray=[];
$today = new DateTime($formattedDate);
foreach($jsonContent->$timeSeriesKey as $key=>$value)
{
$date=new DateTime($key);
$diff=$today->diff($date);
if($diff->days>181)
{
break;
}
$dateArray[]="\"" . $date->format('m/d') . "\"";
$price=$value->$closeKey;
$price=round((float)$price, 2);
$priceArray[]=$price;
$vol=$value->$volKey;
$vol=$vol/1000000 ;
$volArray[]=$vol;
}
$revDateArray=array_reverse($dateArray);
$revVolArray=array_reverse($volArray);
$revPriceArray=array_reverse($priceArray);
$maxVol=max($volArray);
$minPrice=min($priceArray);
$dateCount=sizeof($revDateArray);
if(($dateCount-1)%5 !=0)
{
$ind=($dateCount-1)%5;
for($j=0;$j<$ind;$j++)
{
array_shift($revDateArray);
array_shift($revPriceArray);
array_shift($revVolArray);
}
}
?>
[porto_recent_posts items_desktop=”3″ cats=”13″]
Stay connected
Sign up for weekly tips, trends and investment opportunity in the African Market.