Ejemplo n.º 1
0
$dateStart = new \DateTime("2015-10-01");
$dateEnd = new \DateTime("2015-11-15");
$loan = new Loan($dateStart, $dateEnd);
$aParams = array('interest' => 3, 'maxAmount' => 1000);
$loan->addTranche("TrancheA", $aParams);
$aParams = array('interest' => 6, 'maxAmount' => 1000);
$loan->addTranche("TrancheB", $aParams);
//Investors
$aInvestors = array();
for ($i = 1; $i <= 4; $i++) {
    $aInvestors[$i] = new Investor(1000, $i);
}
//Stream option
$aInvestors[1]->addStream('Sms');
$aInvestors[2]->addStream('Sms');
$aInvestors[3]->addStream('eMail');
$aInvestors[4]->addStream('eMail');
//Investment
$loan->invest($aInvestors[1], new \DateTime("2015-10-03"), "TrancheA", 1000);
$loan->invest($aInvestors[2], new \DateTime("2015-10-04"), "TrancheA", 1);
$loan->invest($aInvestors[3], new \DateTime("2015-10-10"), "TrancheB", 500);
$loan->invest($aInvestors[4], new \DateTime("2015-10-25"), "TrancheB", 1100);
for ($i = 1; $i <= 4; $i++) {
    $aInvestors[$i]->printMsgs();
}
// End of month
$processingMonth = new \DateTime("2015-10-01");
$loan->getInterests($processingMonth);
for ($i = 1; $i <= 4; $i++) {
    $aInvestors[$i]->printMsgs();
}