作者 karlet

feat:修复api为空判断

... ... @@ -99,7 +99,10 @@ class CmBroker
//复制一个新的实例
public function copy()
{
$apiInfo = new ApiInfo($this->apiInfo->key, $this->apiInfo->secret, $this->apiInfo->passphrase);
$apiInfo = null;
if ($this->apiInfo) {
$apiInfo = new ApiInfo($this->apiInfo->key, $this->apiInfo->secret, $this->apiInfo->passphrase);
}
$cmBroker = new CmBroker($this->plat, $apiInfo);
$cmBroker->symbolInfos = $this->symbolInfos;
$cmBroker->positions = $this->positions;
... ... @@ -767,7 +770,7 @@ class CmBroker
}
private function initPosMode()
{
if ($this->plat == self::PLAT_OKX && $this->apiInfo->key != '') {
if ($this->plat == self::PLAT_OKX && $this->apiInfo && $this->apiInfo->key != '') {
$res = $this->exBroker->getAccountConfig();
$config = $res['data'][0];
$this->posMode = $config['posMode'] == 'long_short_mode' ? self::MODE_TWO_SIDE : self::MODE_ONE_SIDE;
... ...