|
@@ -286,4 +286,25 @@ class ExBroker |
|
@@ -286,4 +286,25 @@ class ExBroker |
|
286
|
}
|
286
|
}
|
|
287
|
return $levers;
|
287
|
return $levers;
|
|
288
|
}
|
288
|
}
|
|
|
|
289
|
+ //设置杠杆
|
|
|
|
290
|
+ public function setLever($instId, $lever)
|
|
|
|
291
|
+ {
|
|
|
|
292
|
+ $param = [
|
|
|
|
293
|
+ 'instId' => $instId,
|
|
|
|
294
|
+ 'lever' => $lever,
|
|
|
|
295
|
+ 'mgnMode' => 'cross',
|
|
|
|
296
|
+ ];
|
|
|
|
297
|
+ $res = $this->api->setLeverage($param);
|
|
|
|
298
|
+ if ($res && $res['code'] == 0) {
|
|
|
|
299
|
+ output($instId, '设置杠杆为:', $lever);
|
|
|
|
300
|
+ return true;
|
|
|
|
301
|
+ } else {
|
|
|
|
302
|
+ $msg = $res['msg'];
|
|
|
|
303
|
+ if ($res["data"] && $res["data"]["msg"]) {
|
|
|
|
304
|
+ $msg = $res["data"]["msg"];
|
|
|
|
305
|
+ }
|
|
|
|
306
|
+ output($instId, '设置杠杆错误', $msg);
|
|
|
|
307
|
+ return false;
|
|
|
|
308
|
+ }
|
|
|
|
309
|
+ }
|
|
289
|
} |
310
|
} |