Expirace\n \nStrike | ";
foreach($expirations as $date) {
echo "".strftime("%d. %m. %Y", $date)." | "; } echo "
---|---|
%.2f | \n", $strike); foreach($expirations as $expiration) { echo "";
$first = 1;
$firstGain = 0;
foreach($tspots as $tspot) {
$price1 = BlackScholes($wtype, $spot, $strike, getT($now, $expiration), $rfrate, $vol) * $ratio * $curc;
$price2 = BlackScholes($wtype, doubleval($tspot), $strike, getT($tdated, $expiration), $rfrate, $vol) * $ratio * $curc;
// echo "price1=$price1, wtype=$wtype, spot=$spot, strike=$strike, T=".getT($now, $expiration).", rfrate=$rfrate, vol=$vol \n"; // echo "price2=$price2, wtype=$wtype, spot=$stpot, strike=$strike, T=".getT($tdated, $expiration).", rfrate=$rfrate, vol=$vol \n"; if ($price1 == 0) $price1 = 0.001; $gainp = doubleval($price2-$price1)/$price1*100; if ($first) { $firstGain = $gainp; $first = 0; $rrrf = " "; $rrr = 0; } else { $rrr = $firstGain / -$gainp; $rrrf = " %.2f"; } printf(" P%.2f N%.2fZisk %s%.2f%%$rrrf \n", $price2, $price1, ($gainp>=0)?"+":"" ,$gainp, $rrr); } echo " | \n";
}
$rowNo = 1 - $rowNo;
echo "