MarketInfoResponse   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 19
dl 0
loc 94
rs 10
c 2
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getBasket() 0 3 1
A getLeverage() 0 3 1
A getCirculation() 0 3 1
A getLtCode() 0 3 1
A __construct() 0 8 1
A getNavTime() 0 3 1
A getNav() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\LeverageToken\MarketInfo\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
use Carpenstar\ByBitAPI\Spot\LeverageToken\MarketInfo\Interfaces\IMarketInfoResponseInterface;
8
9
class MarketInfoResponse extends AbstractResponse implements IMarketInfoResponseInterface
10
{
11
    /**
12
     * Total position value = basket value * total circulation
13
     * @var float $basket
14
     */
15
    private float $basket;
16
17
    /**
18
     * Circulating supply in the secondary market
19
     * @var float $circulation
20
     */
21
    private float $circulation;
22
23
    /**
24
     * Real Leverage calculated by last traded price.
25
     * @var float $leverage
26
     */
27
    private float $leverage;
28
29
    /**
30
     * Abbreviation of the LT
31
     * @var string $ltCode
32
     */
33
    private string $ltCode;
34
35
    /**
36
     * Net asset value
37
     * @var float $nav
38
     */
39
    private float $nav;
40
41
    /**
42
     * Update time for net asset value
43
     * @var \DateTime $navTime
44
     */
45
    private \DateTime $navTime;
46
47
    public function __construct(array $data)
48
    {
49
        $this->basket = (float) $data['basket'];
50
        $this->leverage = (float) $data['leverage'];
51
        $this->nav = (float) $data['nav'];
52
        $this->circulation = (float) $data['circulation'];
53
        $this->navTime = DateTimeHelper::makeFromTimestamp($data['navTime']);
54
        $this->ltCode = $data['ltCode'];
55
    }
56
57
    /**
58
     * @return float
59
     */
60
    public function getBasket(): float
61
    {
62
        return $this->basket;
63
    }
64
65
    /**
66
     * @return float
67
     */
68
    public function getCirculation(): float
69
    {
70
        return $this->circulation;
71
    }
72
73
    /**
74
     * @return float
75
     */
76
    public function getLeverage(): float
77
    {
78
        return $this->leverage;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function getLtCode(): string
85
    {
86
        return $this->ltCode;
87
    }
88
89
    /**
90
     * @return float
91
     */
92
    public function getNav(): float
93
    {
94
        return $this->nav;
95
    }
96
97
    /**
98
     * @return \DateTime
99
     */
100
    public function getNavTime(): \DateTime
101
    {
102
        return $this->navTime;
103
    }
104
}
105