Issues (51)

example/11_SpreadData.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * @author  Fabian Hanisch
4
 * @since   16.07.2017 02:55
5
 * @version 1.0
6
 */
7
require_once(__DIR__ . '/../vendor/autoload.php');
8
9
try {
10
    $api = new \HanischIt\KrakenApi\KrakenApi(
11
        "Your-API-Key",
12
        "Your-API-Sign"
13
    );
14
15
    $tradableAssetPairResponse = $api->getSpreadData('XETHZEUR');
16
17
    echo "Last: " . date("Y-m-d H:i:s", $tradableAssetPairResponse->getLast()) . " \n";
0 ignored issues
show
The method getLast() does not exist on HanischIt\KrakenApi\Model\ResponseInterface. It seems like you code against a sub-type of HanischIt\KrakenApi\Model\ResponseInterface such as HanischIt\KrakenApi\Call...es\RecentTradesResponse or HanischIt\KrakenApi\Call\OHLCData\OHLCDataResponse or HanischIt\KrakenApi\Call...Data\SpreadDataResponse. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
    echo "Last: " . date("Y-m-d H:i:s", $tradableAssetPairResponse->/** @scrutinizer ignore-call */ getLast()) . " \n";
Loading history...
18
19
    foreach ($tradableAssetPairResponse->getSpreads() as $spread) {
0 ignored issues
show
The method getSpreads() does not exist on HanischIt\KrakenApi\Model\ResponseInterface. It seems like you code against a sub-type of HanischIt\KrakenApi\Model\ResponseInterface such as HanischIt\KrakenApi\Call...Data\SpreadDataResponse. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
    foreach ($tradableAssetPairResponse->/** @scrutinizer ignore-call */ getSpreads() as $spread) {
Loading history...
20
        echo date("Y-m-d H:i:s",
21
                $spread->getTime()) . " / Ask: " . $spread->getAsk() . " / Bid: " . $spread->getBid() . "\n";
22
    }
23
} catch (Exception $e) {
24
    echo $e->getMessage();
25
}
26