Total Complexity | 7 |
Total Lines | 76 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class PublicTradeResponseItem extends AbstractResponse |
||
8 | { |
||
9 | /** |
||
10 | * Trade ID |
||
11 | * @var string $tradeId |
||
12 | */ |
||
13 | private string $tradeId; |
||
14 | |||
15 | /** |
||
16 | * Timestamp (trading time in the match box) |
||
17 | * @var \DateTime $tradingTime |
||
18 | */ |
||
19 | private \DateTime $tradingTime; |
||
20 | |||
21 | /** |
||
22 | * Price |
||
23 | * @var float $price |
||
24 | */ |
||
25 | private float $price; |
||
26 | |||
27 | /** |
||
28 | * Quantity |
||
29 | * @var float $quantity |
||
30 | */ |
||
31 | private float $quantity; |
||
32 | |||
33 | /** |
||
34 | * True indicates buy side is taker, false indicates sell side is taker |
||
35 | * @var bool $isTaker |
||
36 | */ |
||
37 | private bool $isTaker; |
||
38 | |||
39 | /** |
||
40 | * Trade type. 0:Spot trade. 1:Paradigm block trade |
||
41 | * @var int $tradeType |
||
42 | */ |
||
43 | private int $tradeType; |
||
44 | |||
45 | public function __construct(array $data) |
||
46 | { |
||
47 | $this->price = $data['p']; |
||
48 | $this->quantity = $data['q']; |
||
49 | $this->tradeId = $data['v']; |
||
50 | $this->tradeType = $data['type']; |
||
51 | $this->isTaker = $data['m']; |
||
52 | $this->tradingTime = DateTimeHelper::makeFromTimestamp($data['t']); |
||
53 | } |
||
54 | |||
55 | public function getPrice(): float |
||
56 | { |
||
57 | return $this->price; |
||
58 | } |
||
59 | |||
60 | public function getQuantity(): float |
||
61 | { |
||
62 | return $this->quantity; |
||
63 | } |
||
64 | |||
65 | public function getTradeId(): string |
||
66 | { |
||
67 | return $this->tradeId; |
||
68 | } |
||
69 | |||
70 | public function getTradeType(): int |
||
73 | } |
||
74 | |||
75 | public function getTradingTime(): \DateTime |
||
78 | } |
||
79 | |||
80 | public function getIsTaker(): bool |
||
81 | { |
||
85 |