作者 karlet

feat:设置读取杠杆,能缓存杠杆

... ... @@ -42,6 +42,7 @@ class CmBroker
/** @var Pos[] $positions */
public $positions = [];
public $name = '';
public $levers = [];
public function __construct($plat, ApiInfo $apiInfo)
... ... @@ -248,13 +249,17 @@ class CmBroker
}
$levers = $resNew;
}
$this->levers = $levers; //缓存levers
return $levers;
}
//设置杠杆
public function setLever($symbol, $lever)
{
$symbol = $this->getSymbolOri($symbol, $this->plat);
$this->exBroker->setLever($symbol, $lever);
$res = $this->exBroker->setLever($symbol, $lever);
if ($res) {
$this->levers[$symbol] = $lever;
}
}
//查询获取全部持仓
public function getAllPos(): array
... ...