Пример #1
0
 /**
  * @param SystemClientAccountModel $account
  * @param SecurityModel $security
  * @param array $data
  * @return mixed
  */
 public function process(SystemClientAccountModel $account, SecurityModel $security, array $data)
 {
     $model = new LotModel();
     $model->setSymbol($data['symbol']);
     $model->setTransactionCode($data['transaction_code']);
     $model->setInitialLotId(null);
     $model->setQuantity($data['qty']);
     $model->setStatus(WealthbotLot::LOT_INITIAL);
     $model->setDate($data['tx_date']);
     $model->setWasClosed(false);
     $model->setAmount($data['net_amount']);
     $model->setCostBasis($data['gross_amount']);
     $model->setRealizedGain(null);
     $model->setSecurityId($security->getId());
     $model->setClientSystemAccountId($account->getId());
     $model->setWasRebalancerDiff(false);
     $class = Factory::make($model->isBuy() ? 'Buy' : 'Sell');
     // Create new lot
     return $class->create($model);
 }