作者 karlet

feat:空api可以不初始化账户信息

... ... @@ -67,11 +67,13 @@ class CmBroker
public $levers = [];
public $uid;
public $posMode = '';
public ?ApiInfo $apiInfo;
public function __construct($plat, ?ApiInfo $apiInfo, $wsHost = null, $restHost = null)
{
$this->plat = $plat;
$this->apiInfo = $apiInfo;
$exBroker = null;
if ($plat == self::PLAT_OKX) {
$exBroker = new OkxBroker($apiInfo);
... ... @@ -752,7 +754,7 @@ class CmBroker
}
private function initPosMode()
{
if ($this->plat == self::PLAT_OKX) {
if ($this->plat == self::PLAT_OKX && $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;
... ...