作者 karlet

feat:成交数据增加lever

... ... @@ -19,8 +19,9 @@ class WsDataTrade
public float $quoteVol; //计价货币数量 成交额
public int $ts; //时间戳 ms
public string $tradeId;
public int $lever;
public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId)
public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever)
{
$this->platform = $platform;
$this->posSide = $posSide;
... ... @@ -33,6 +34,7 @@ class WsDataTrade
$this->quoteVol = $quoteVol;
$this->ts = $ts;
$this->tradeId = $tradeId;
$this->lever = $lever;
}
public function toArray()
... ... @@ -49,6 +51,7 @@ class WsDataTrade
'quoteVol' => $this->quoteVol,
'ts' => $this->ts,
'tradeId' => $this->tradeId,
'lever' => $this->lever,
];
}
... ... @@ -71,7 +74,8 @@ class WsDataTrade
$quoteVol = $price * $qty;
$ts = $data['uTime'];
$tradeId = $data['tradeId'];
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId);
$lever = (int)$data['lever'];
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever);
}
return null;
}
... ...