| Conditions | 3 |
| Paths | 3 |
| Total Lines | 27 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function testFundingRateHistoryResponse() |
||
| 14 | { |
||
| 15 | echo "\n //// --- //// \n"; |
||
| 16 | |||
| 17 | $bybit = (new BybitAPI())->setCredentials('https://api-testnet.bybit.com'); |
||
| 18 | |||
| 19 | $response = $bybit->publicEndpoint(FundingRateHistory::class, (new FundingRateHistoryRequest())->setSymbol('BTCUSDT'))->execute(); |
||
| 20 | |||
| 21 | if ($response->getReturnCode() == 0) { |
||
| 22 | echo "CODE: {$response->getReturnCode()}\n"; |
||
| 23 | echo "MESSAGE: {$response->getReturnMessage()}\n"; |
||
| 24 | |||
| 25 | /** @var IFundingRateHistoryResponseInterface $fundingRatesInfo */ |
||
| 26 | $fundingRatesInfo = $response->getResult(); |
||
| 27 | foreach ($fundingRatesInfo->getFundingRates() as $fundingRate) { |
||
| 28 | echo "-----\n"; |
||
| 29 | echo "Time: {$fundingRate->getFundingRateTimestamp()->format('Y-m-d H:i:s')}\n"; |
||
| 30 | echo "Symbol: {$fundingRate->getSymbol()}\n"; |
||
| 31 | echo "Rate: {$fundingRate->getFundingRate()}\n"; |
||
| 32 | } |
||
| 33 | |||
| 34 | $this->assertTrue(true); |
||
| 35 | } else { |
||
| 36 | echo "API ERORR: " . get_class($this) . "\n"; |
||
| 37 | echo "CODE: {$response->getReturnCode()} \n"; |
||
| 38 | echo "MESSAGE: {$response->getReturnMessage()} \n"; |
||
| 39 | echo "EXTENDED:" . implode(";\n", $response->getExtendedInfo()) . "\n"; |
||
| 40 | } |
||
| 43 |