作者 karlet

feat:成交数据增加lever

@@ -19,8 +19,9 @@ class WsDataTrade @@ -19,8 +19,9 @@ class WsDataTrade
19 public float $quoteVol; //计价货币数量 成交额 19 public float $quoteVol; //计价货币数量 成交额
20 public int $ts; //时间戳 ms 20 public int $ts; //时间戳 ms
21 public string $tradeId; 21 public string $tradeId;
  22 + public int $lever;
22 23
23 - public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId) 24 + public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever)
24 { 25 {
25 $this->platform = $platform; 26 $this->platform = $platform;
26 $this->posSide = $posSide; 27 $this->posSide = $posSide;
@@ -33,6 +34,7 @@ class WsDataTrade @@ -33,6 +34,7 @@ class WsDataTrade
33 $this->quoteVol = $quoteVol; 34 $this->quoteVol = $quoteVol;
34 $this->ts = $ts; 35 $this->ts = $ts;
35 $this->tradeId = $tradeId; 36 $this->tradeId = $tradeId;
  37 + $this->lever = $lever;
36 } 38 }
37 39
38 public function toArray() 40 public function toArray()
@@ -49,6 +51,7 @@ class WsDataTrade @@ -49,6 +51,7 @@ class WsDataTrade
49 'quoteVol' => $this->quoteVol, 51 'quoteVol' => $this->quoteVol,
50 'ts' => $this->ts, 52 'ts' => $this->ts,
51 'tradeId' => $this->tradeId, 53 'tradeId' => $this->tradeId,
  54 + 'lever' => $this->lever,
52 ]; 55 ];
53 } 56 }
54 57
@@ -71,7 +74,8 @@ class WsDataTrade @@ -71,7 +74,8 @@ class WsDataTrade
71 $quoteVol = $price * $qty; 74 $quoteVol = $price * $qty;
72 $ts = $data['uTime']; 75 $ts = $data['uTime'];
73 $tradeId = $data['tradeId']; 76 $tradeId = $data['tradeId'];
74 - return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId); 77 + $lever = (int)$data['lever'];
  78 + return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $quoteVol, $ts, $tradeId, $lever);
75 } 79 }
76 return null; 80 return null;
77 } 81 }