/**
  * @param \SimpleXMLElement $row
  *
  * @return bool
  */
 private function update(\SimpleXMLElement $row)
 {
     $return = true;
     $type = AbstractCall::getXmlAttr($row);
     // buy
     /** @var Price $price */
     $price = Price::findOne(['typeID' => $type['id'], 'type' => Price::TYPE_BUY]);
     if (!$price) {
         $price = new Price();
         $price->typeID = $type['id'];
         $price->type = Price::TYPE_BUY;
     }
     $price->volume = (string) $row->buy->volume;
     $price->average = (string) $row->buy->avg;
     $price->min = (string) $row->buy->min;
     $price->max = (string) $row->buy->max;
     $price->stdDev = (string) $row->buy->stddev;
     $price->median = (string) $row->buy->median;
     $price->percentile = (string) $row->buy->percentile;
     $return = $price->save() && $return;
     // sell
     /** @var Price $price */
     $price = Price::findOne(['typeID' => $type['id'], 'type' => Price::TYPE_SELL]);
     if (!$price) {
         $price = new Price();
         $price->typeID = $type['id'];
         $price->type = Price::TYPE_SELL;
     }
     $price->volume = (string) $row->sell->volume;
     $price->average = (string) $row->sell->avg;
     $price->min = (string) $row->sell->min;
     $price->max = (string) $row->sell->max;
     $price->stdDev = (string) $row->sell->stddev;
     $price->median = (string) $row->sell->median;
     $price->percentile = (string) $row->sell->percentile;
     $return = $price->save() && $return;
     return $return;
 }
 /**
  * @return null|Price
  */
 public function getPriceSell()
 {
     return Price::findOne(['typeID' => $this->typeID, 'type' => Price::TYPE_SELL]);
 }