1 | <?php |
||
2 | |||
3 | namespace HanischIt\KrakenApi\Call\OHLCData; |
||
4 | |||
5 | use HanischIt\KrakenApi\Enum\VisibilityEnum; |
||
6 | use HanischIt\KrakenApi\Model\RequestInterface; |
||
7 | |||
8 | /** |
||
9 | * Class OHLCDataRequest |
||
10 | * @package HanischIt\KrakenApi\Call\OHLCData |
||
11 | */ |
||
12 | class OHLCDataRequest implements RequestInterface |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $pair; |
||
19 | |||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | private $interval; |
||
24 | |||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | private $since; |
||
29 | |||
30 | /** |
||
31 | * OHLCDataRequest constructor. |
||
32 | * @param string $pair |
||
33 | * @param int $interval |
||
34 | * @param int $since |
||
35 | */ |
||
36 | 2 | public function __construct($pair, $interval, $since) |
|
37 | { |
||
38 | 2 | $this->pair = $pair; |
|
39 | 2 | $this->interval = $interval; |
|
40 | 2 | $this->since = $since; |
|
41 | 2 | } |
|
42 | |||
43 | /** |
||
44 | * Returns the api request name |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | 1 | public function getMethod() |
|
49 | { |
||
50 | 1 | return 'OHLC'; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | 1 | public function getVisibility() |
|
57 | { |
||
58 | 1 | return VisibilityEnum::VISIBILITY_PUBLIC; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return array |
||
63 | */ |
||
64 | 1 | public function getRequestData() |
|
65 | { |
||
66 | 1 | $ret = []; |
|
67 | 1 | $ret["pair"] = $this->pair; |
|
68 | 1 | if (null !== $this->interval) { |
|
0 ignored issues
–
show
introduced
by
![]() |
|||
69 | 1 | $ret["interval"] = $this->interval; |
|
70 | 1 | } |
|
71 | 1 | if (null !== $this->since) { |
|
0 ignored issues
–
show
|
|||
72 | 1 | $ret["since"] = $this->since; |
|
73 | 1 | } |
|
74 | 1 | return $ret; |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | 1 | public function getResponseClassName() |
|
81 | { |
||
82 | 1 | return OHLCDataResponse::class; |
|
83 | } |
||
84 | } |
||
85 |