作者 karlet

feat:增加币安获取全部杠杆

... ... @@ -280,7 +280,7 @@ class CmBroker
public function getLevers()
{
$levers = $this->exBroker->getAllLevers();
if ($this->plat == self::PLAT_OKX) {
if ($this->plat == self::PLAT_OKX || $this->plat == self::PLAT_BINANCE) {
$resNew = [];
foreach ($levers as $key => $value) {
$symbol = $this->getSymbolSt($key); //转换为标准交易对
... ...
... ... @@ -46,6 +46,13 @@ class Api
$method = "POST";
return $this->request($method, $url, $params, $this->apiInfo);
}
//获取账户持仓风险v2
public function getPositionRiskV2($params)
{
$url = "/fapi/v2/positionRisk";
$method = "GET";
return $this->request($method, $url, $params, $this->apiInfo);
}
//------------------------------------
... ...
... ... @@ -96,4 +96,14 @@ class ExBroker
}
return $res;
}
//获取所有账户杠杆
public function getAllLeverage()
{
$res = $this->api->getPositionRiskV2([]);
$retArr = [];
foreach ($res as $v) {
$retArr[$v['symbol']] = $v['leverage'];
}
return $retArr;
}
}
... ...