正在显示
1 个修改的文件
包含
6 行增加
和
1 行删除
| @@ -42,6 +42,7 @@ class CmBroker | @@ -42,6 +42,7 @@ class CmBroker | ||
| 42 | /** @var Pos[] $positions */ | 42 | /** @var Pos[] $positions */ |
| 43 | public $positions = []; | 43 | public $positions = []; |
| 44 | public $name = ''; | 44 | public $name = ''; |
| 45 | + public $levers = []; | ||
| 45 | 46 | ||
| 46 | 47 | ||
| 47 | public function __construct($plat, ApiInfo $apiInfo) | 48 | public function __construct($plat, ApiInfo $apiInfo) |
| @@ -248,13 +249,17 @@ class CmBroker | @@ -248,13 +249,17 @@ class CmBroker | ||
| 248 | } | 249 | } |
| 249 | $levers = $resNew; | 250 | $levers = $resNew; |
| 250 | } | 251 | } |
| 252 | + $this->levers = $levers; //缓存levers | ||
| 251 | return $levers; | 253 | return $levers; |
| 252 | } | 254 | } |
| 253 | //设置杠杆 | 255 | //设置杠杆 |
| 254 | public function setLever($symbol, $lever) | 256 | public function setLever($symbol, $lever) |
| 255 | { | 257 | { |
| 256 | $symbol = $this->getSymbolOri($symbol, $this->plat); | 258 | $symbol = $this->getSymbolOri($symbol, $this->plat); |
| 257 | - $this->exBroker->setLever($symbol, $lever); | 259 | + $res = $this->exBroker->setLever($symbol, $lever); |
| 260 | + if ($res) { | ||
| 261 | + $this->levers[$symbol] = $lever; | ||
| 262 | + } | ||
| 258 | } | 263 | } |
| 259 | //查询获取全部持仓 | 264 | //查询获取全部持仓 |
| 260 | public function getAllPos(): array | 265 | public function getAllPos(): array |
-
请 注册 或 登录 后发表评论