作者 karlet

feat:成交增加手续费

@@ -16,12 +16,13 @@ class WsDataTrade @@ -16,12 +16,13 @@ class WsDataTrade
16 public float $qty; //币种真实数量 16 public float $qty; //币种真实数量
17 public float $lot; //合约张数 17 public float $lot; //合约张数
18 public float $pnl; //盈亏 18 public float $pnl; //盈亏
  19 + public float $fee; //手续费
19 public float $quoteVol; //计价货币数量 成交额 20 public float $quoteVol; //计价货币数量 成交额
20 public int $ts; //时间戳 ms 21 public int $ts; //时间戳 ms
21 public string $tradeId; 22 public string $tradeId;
22 public int $lever; 23 public int $lever;
23 24
24 - public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever) 25 + public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever)
25 { 26 {
26 $this->platform = $platform; 27 $this->platform = $platform;
27 $this->posSide = $posSide; 28 $this->posSide = $posSide;
@@ -31,6 +32,7 @@ class WsDataTrade @@ -31,6 +32,7 @@ class WsDataTrade
31 $this->qty = $qty; 32 $this->qty = $qty;
32 $this->lot = $lot; 33 $this->lot = $lot;
33 $this->pnl = $pnl; 34 $this->pnl = $pnl;
  35 + $this->fee = $fee;
34 $this->quoteVol = $quoteVol; 36 $this->quoteVol = $quoteVol;
35 $this->ts = $ts; 37 $this->ts = $ts;
36 $this->tradeId = $tradeId; 38 $this->tradeId = $tradeId;
@@ -48,6 +50,7 @@ class WsDataTrade @@ -48,6 +50,7 @@ class WsDataTrade
48 'qty' => $this->qty, 50 'qty' => $this->qty,
49 'lot' => $this->lot, 51 'lot' => $this->lot,
50 'pnl' => $this->pnl, 52 'pnl' => $this->pnl,
  53 + 'fee' => $this->fee,
51 'quoteVol' => $this->quoteVol, 54 'quoteVol' => $this->quoteVol,
52 'ts' => $this->ts, 55 'ts' => $this->ts,
53 'tradeId' => $this->tradeId, 56 'tradeId' => $this->tradeId,
@@ -71,11 +74,12 @@ class WsDataTrade @@ -71,11 +74,12 @@ class WsDataTrade
71 $lot = (float)$data['fillSz']; 74 $lot = (float)$data['fillSz'];
72 $qty = round($lot * $symbolInfo->ctVal, $symbolInfo->qtyPrec); 75 $qty = round($lot * $symbolInfo->ctVal, $symbolInfo->qtyPrec);
73 $pnl = (float)$data['fillPnl']; 76 $pnl = (float)$data['fillPnl'];
  77 + $fee = (float)$data['fillFee'];
74 $quoteVol = $price * $qty; 78 $quoteVol = $price * $qty;
75 $ts = $data['uTime']; 79 $ts = $data['uTime'];
76 $tradeId = $data['tradeId']; 80 $tradeId = $data['tradeId'];
77 $lever = (int)$data['lever']; 81 $lever = (int)$data['lever'];
78 - return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever); 82 + return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever);
79 } 83 }
80 return null; 84 return null;
81 } 85 }