public static function PHPExcel_Calculation_Financial::TBILLEQ in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php \PHPExcel_Calculation_Financial::TBILLEQ()
* TBILLEQ * * Returns the bond-equivalent yield for a Treasury bill. * *
Parameters
mixed settlement The Treasury bill's settlement date.: * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. * @param mixed maturity The Treasury bill's maturity date. * The maturity date is the date when the Treasury bill expires. * @param int discount The Treasury bill's discount rate. * @return float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Financial.php, line 1984
Class
- PHPExcel_Calculation_Financial
- PHPExcel_Calculation_Financial
Code
public static function TBILLEQ($settlement, $maturity, $discount) {
$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
$discount = PHPExcel_Calculation_Functions::flattenSingleValue($discount);
// Use TBILLPRICE for validation
$testValue = self::TBILLPRICE($settlement, $maturity, $discount);
if (is_string($testValue)) {
return $testValue;
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
return PHPExcel_Calculation_Functions::VALUE();
}
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
++$maturity;
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
}
else {
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement);
}
return 365 * $discount / (360 - $discount * $daysBetweenSettlementAndMaturity);
}