예제 #1
0
 public function calculatePeriod()
 {
     $curDate = $this->getCurDate();
     $last1Year = $this->getModifyDate('-1 year');
     $last3Year = $this->getModifyDate('-3 year');
     $actualTwr = new Actual();
     // NET
     $model = new PortfolioTwrPeriodModel();
     $model->setNetMtd($actualTwr->rule(new PortfolioActualNetRule($this->getKey(), Util::firstDayOf('month', $curDate), $curDate)));
     $model->setNetQtd($actualTwr->rule(new PortfolioActualNetRule($this->getKey(), Util::firstDayOf('quarter', $curDate), $curDate)));
     $model->setNetYtd($actualTwr->rule(new PortfolioActualNetRule($this->getKey(), Util::firstDayOf('year', $curDate), $curDate)));
     $model->setNetYr1($actualTwr->rule(new PortfolioActualNetRule($this->getKey(), $last1Year, $curDate)));
     $model->setNetYr3($actualTwr->rule(new PortfolioActualNetRule($this->getKey(), $last3Year, $curDate)));
     $model->setNetSinceInception($actualTwr->rule(new PortfolioActualNetRule($this->getKey())));
     // GROSS
     $model->setGrossMtd($actualTwr->rule(new PortfolioActualGrossRule($this->getKey(), Util::firstDayOf('month', $curDate), $curDate)));
     $model->setGrossQtd($actualTwr->rule(new PortfolioActualGrossRule($this->getKey(), Util::firstDayOf('quarter', $curDate), $curDate)));
     $model->setGrossYtd($actualTwr->rule(new PortfolioActualGrossRule($this->getKey(), Util::firstDayOf('year', $curDate), $curDate)));
     $model->setGrossYr1($actualTwr->rule(new PortfolioActualGrossRule($this->getKey(), $last1Year, $curDate)));
     $model->setGrossYr3($actualTwr->rule(new PortfolioActualGrossRule($this->getKey(), $last3Year, $curDate)));
     $model->setGrossSinceInception($actualTwr->rule(new PortfolioActualGrossRule($this->getKey())));
     $model->setClientId($this->getKey());
     // Save portfolio period
     return $this->periodRepo->save($model);
 }
예제 #2
0
 /**
  * @param SystemClientAccountModel $account
  */
 public function calculatePeriod(SystemClientAccountModel $account)
 {
     $curDate = $this->getCurDate();
     $last1Year = $this->getModifyDate('-1 year');
     $last3Year = $this->getModifyDate('-3 year');
     $actualTwr = new Actual();
     // NET
     $model = new AccountTwrPeriodModel();
     $model->setNetMtd($actualTwr->rule(new AccountActualNetRule($account->getAccountNumber(), Util::firstDayOf('month', $curDate), $curDate)));
     $model->setNetQtd($actualTwr->rule(new AccountActualNetRule($account->getAccountNumber(), Util::firstDayOf('quarter', $curDate), $curDate)));
     $model->setNetYtd($actualTwr->rule(new AccountActualNetRule($account->getAccountNumber(), Util::firstDayOf('year', $curDate), $curDate)));
     $model->setNetYr1($actualTwr->rule(new AccountActualNetRule($account->getAccountNumber(), $last1Year, $curDate)));
     $model->setNetYr3($actualTwr->rule(new AccountActualNetRule($account->getAccountNumber(), $last3Year, $curDate)));
     $model->setNetSinceInception($actualTwr->rule(new AccountActualNetRule($account->getAccountNumber(), $account->getPerformanceInceptionAsDateTime())));
     // GROSS
     $model->setGrossMtd($actualTwr->rule(new AccountActualGrossRule($account->getAccountNumber(), Util::firstDayOf('month', $curDate), $curDate)));
     $model->setGrossQtd($actualTwr->rule(new AccountActualGrossRule($account->getAccountNumber(), Util::firstDayOf('quarter', $curDate), $curDate)));
     $model->setGrossYtd($actualTwr->rule(new AccountActualGrossRule($account->getAccountNumber(), Util::firstDayOf('year', $curDate), $curDate)));
     $model->setGrossYr1($actualTwr->rule(new AccountActualGrossRule($account->getAccountNumber(), $last1Year, $curDate)));
     $model->setGrossYr3($actualTwr->rule(new AccountActualGrossRule($account->getAccountNumber(), $last3Year, $curDate)));
     $model->setGrossSinceInception($actualTwr->rule(new AccountActualGrossRule($account->getAccountNumber(), $account->getPerformanceInceptionAsDateTime())));
     $model->setAccountNumber($account->getAccountNumber());
     // Save
     $this->periodRepo->save($model);
 }