private function calcVaria($CV){ $this->printLog("in calcVaria" .chr(10)); $retres = [ "impSm" => $this->maOrderPrice, "porSm" => self::$porIni['porSm'], "doit" => 0, "docntrl" => 1, "ordnewId" => '' ]; while(true){ $priceNow = $this->getPrice(); if ($priceNow > 0) { $statusTp = $this->getOrderStatusTp(); $statusSm = $this->getOrderStatusSl(); if($statusTp === 'done' or $statusSm === "done"){ $ext = 1; $retres["docntrl"] = 1; break; }else{ if($CV === 1){ //Compras //SI EL PRECIO ES>= PRECIO DE ENTRADA + 0,5% CAMBIA EL SL DE -0,5% A PRECIO DE ENTRADA (FILTRO PROTECCION DE SL) //CAMBIO A 1% EL 27/12/2023 $preOpe = number_format(round($this->maOrderPrice + (($this->maOrderPrice * 1) / 100),3), 3, '.', ','); if($priceNow >= $preOpe){ $statusLi = $this->getOrderStatusMa(); if($statusLi === 0){ $retres["docntrl"] = 1; }else{ $resp = $this->delOneOrder($this->slOrderId); if ($resp){ $this->slorder['stopPrice'] = $this->maOrderPrice; $this->slorder['clientOid'] = str_replace("SL", "SLC", $this->slorder['clientOid']); $respSl = $this->createSlOrder(); if($respSl){ $apiTelegram->sendAlertTelegram("Cambia precio de Sl en Compras a $this->maOrderPrice"); }else{ $apiTelegram->sendAlertTelegram("No es posible cambiar precio de Sl en Compras a $this->maOrderPrice"); } } } $retres["docntrl"] = 1; $ext = 1; $retres["porSm"] = 1.0; $retres["doit"] = 1; var_dump(" Comp.- statusLi:" . $statusLi . " preOpe:" . $preOpe . chr(10)); break; } }else{ //Ventas //SI EL PRECIO ES<= PRECIO DE ENTRADA - 0,5% CAMBIA EL SL DE +0,5% A PRECIO DE ENTRADA (FILTRO PROTECCION DE SL) //CAMBIO A 1% EL 27/12/2023 $preOpe = number_format(round($this->maOrderPrice - (($this->maOrderPrice * 1) / 100),3), 3, '.', ','); if($priceNow >= $preOpe){ $statusLi = $this->getOrderStatusMa(); if($statusLi === 0){ $retres["docntrl"] = 1; }else{ $resp = $this->delOneOrder($this->slOrderId); if ($resp){ $this->slorder['stopPrice'] = $this->maOrderPrice; $this->slorder['clientOid'] = str_replace("SL", "SLC", $this->slorder['clientOid']); $respSl = $this->createSlOrder(); if($respSl){ $apiTelegram->sendAlertTelegram("Cambia precio de Sl en Ventas a $this->maOrderPrice"); }else{ $apiTelegram->sendAlertTelegram("No es posible cambiar precio de Sl en Ventas a $this->maOrderPrice"); } } } $retres["docntrl"] = 1; $ext = 1; $retres["porSm"] = 1.0; $retres["doit"] = 1; var_dump(" Comp.- statusLi:" . $statusLi . " preOpe:" . $preOpe . chr(10)); break; } } } } } }