Conditions | 2 |
Paths | 2 |
Total Lines | 26 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function testSuccessEndpoint() |
||
15 | { |
||
16 | $bybit = (new BybitAPI())->setCredentials('https://api-testnet.bybit.com'); |
||
17 | |||
18 | $indexPriceKlineResponse = $bybit->publicEndpoint(IndexPriceKline::class, (new IndexPriceKlineRequest()) |
||
19 | ->setSymbol('BTCUSDT') |
||
20 | ->setInterval(EnumIntervals::HOUR_1) |
||
21 | ->setStart('2024-07-11 10:00:00') |
||
22 | ->setEnd('2024-07-12 11:00:00') |
||
23 | ->setLimit(4) |
||
24 | )->execute(); |
||
25 | |||
26 | echo "Return code: {$indexPriceKlineResponse->getReturnCode()}\n"; |
||
27 | echo "Return message: {$indexPriceKlineResponse->getReturnMessage()}\n"; |
||
28 | |||
29 | /** @var IndexPriceKlineResponseItem $indexItem */ |
||
30 | foreach ($indexPriceKlineResponse->getResult()->getKlineList() as $indexItem) { |
||
|
|||
31 | echo " --- \n"; |
||
32 | echo "Start Time: {$indexItem->getStartTime()->format('Y-m-d H:i:s')}\n"; |
||
33 | echo "Open Price: {$indexItem->getOpen()}\n"; |
||
34 | echo "High Price: {$indexItem->getHigh()}\n"; |
||
35 | echo "Low Price: {$indexItem->getLow()}\n"; |
||
36 | echo "Close Price: {$indexItem->getClose()}\n"; |
||
37 | } |
||
38 | |||
39 | $this->assertTrue(true); |
||
40 | } |
||
41 | } |