作者 karlet

feat:成交增加手续费

... ... @@ -16,12 +16,13 @@ class WsDataTrade
public float $qty; //币种真实数量
public float $lot; //合约张数
public float $pnl; //盈亏
public float $fee; //手续费
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, $lever)
public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever)
{
$this->platform = $platform;
$this->posSide = $posSide;
... ... @@ -31,6 +32,7 @@ class WsDataTrade
$this->qty = $qty;
$this->lot = $lot;
$this->pnl = $pnl;
$this->fee = $fee;
$this->quoteVol = $quoteVol;
$this->ts = $ts;
$this->tradeId = $tradeId;
... ... @@ -48,6 +50,7 @@ class WsDataTrade
'qty' => $this->qty,
'lot' => $this->lot,
'pnl' => $this->pnl,
'fee' => $this->fee,
'quoteVol' => $this->quoteVol,
'ts' => $this->ts,
'tradeId' => $this->tradeId,
... ... @@ -71,11 +74,12 @@ class WsDataTrade
$lot = (float)$data['fillSz'];
$qty = round($lot * $symbolInfo->ctVal, $symbolInfo->qtyPrec);
$pnl = (float)$data['fillPnl'];
$fee = (float)$data['fillFee'];
$quoteVol = $price * $qty;
$ts = $data['uTime'];
$tradeId = $data['tradeId'];
$lever = (int)$data['lever'];
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever);
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever);
}
return null;
}
... ...