作者 karlet

feat:成交增加订单id和clordid

... ... @@ -20,9 +20,11 @@ class WsDataTrade
public float $quoteVol; //计价货币数量 成交额
public int $ts; //时间戳 ms
public string $tradeId;
public string $ordId;
public string $cliOrdId;
public int $lever;
public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever)
public function __construct($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $ordId, $cliOrdId, $lever)
{
$this->platform = $platform;
$this->posSide = $posSide;
... ... @@ -36,6 +38,8 @@ class WsDataTrade
$this->quoteVol = $quoteVol;
$this->ts = $ts;
$this->tradeId = $tradeId;
$this->ordId = $ordId;
$this->cliOrdId = $cliOrdId;
$this->lever = $lever;
}
... ... @@ -54,6 +58,8 @@ class WsDataTrade
'quoteVol' => $this->quoteVol,
'ts' => $this->ts,
'tradeId' => $this->tradeId,
'ordId' => $this->ordId,
'cliOrdId' => $this->cliOrdId,
'lever' => $this->lever,
];
}
... ... @@ -79,7 +85,9 @@ class WsDataTrade
$ts = $data['uTime'];
$tradeId = $data['tradeId'];
$lever = (int)$data['lever'];
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever);
$ordId = $data['ordId'];
$cliOrdId = $data['clOrdId'];
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $ordId, $cliOrdId, $lever);
}
return null;
}
... ... @@ -101,7 +109,9 @@ class WsDataTrade
$quoteVol = $price * $qty;
$ts = $order['T'];
$tradeId = $order['t'];
$ordId = $order['i'];
$cliOrdId = $order['c'];
$lever = 0;
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $lever);
return new WsDataTrade($platform, $posSide, $symbol, $side, $price, $qty, $lot, $pnl, $fee, $quoteVol, $ts, $tradeId, $ordId, $cliOrdId, $lever);
}
}
... ...