php-binance-api.php
private function chartData(string $symbol, string $interval, array $ticks)
    {
        if (!isset($this->info[$symbol])) {
            $this->info[$symbol] = [];
        }

        if (!isset($this->info[$symbol][$interval])) {
            $this->info[$symbol][$interval] = [];
        }

        $output = [];
        foreach ($ticks as $tick) {
            list($openTime, $open, $high, $low, $close, $assetVolume, $closeTime, $baseVolume, $trades, $assetBuyVolume, $takerBuyVolume, $ignored) = $tick;
            $output[$openTime] = [
                "open" => $open,
                "high" => $high,
                "low" => $low,
                "close" => $close,
                "volume" => $baseVolume,
                "openTime" => $openTime,
                "closeTime" => $closeTime,
                "assetVolume" => $assetVolume,
                "baseVolume" => $baseVolume,
                "trades" => $trades,
                "assetBuyVolume" => $assetBuyVolume,
                "takerBuyVolume" => $takerBuyVolume,
                "ignored" => $ignored,
            ];
        }

        if (isset($openTime)) {
            $this->info[$symbol][$interval]['firstOpen'] = $openTime;
        }

        return $output;
    }
private function chartData(string $symbol, string $interval, array $ticks)
    {
        if (!isset($this->info[$symbol])) {
            $this->info[$symbol] = [];
        }

        if (!isset($this->info[$symbol][$interval])) {
            $this->info[$symbol][$interval] = [];
        }

        $output = [];
        foreach ($ticks as $tick) {
            list($openTime, $open, $high, $low, $close, $assetVolume, $closeTime, $baseVolume, $trades, $assetBuyVolume, $takerBuyVolume, $ignored) = $tick;
            $output[$openTime] = [
                "open" => $open,
                "high" => $high,
                "low" => $low,
                "close" => $close,
                "volume" => $baseVolume,
                "openTime" => $openTime,
                "closeTime" => $closeTime,
                "assetVolume" => $assetVolume,
                "baseVolume" => $baseVolume,
                "trades" => $trades,
                "assetBuyVolume" => $assetBuyVolume,
                "takerBuyVolume" => $takerBuyVolume,
                "ignored" => $ignored,
            ];
        }

        if (isset($openTime)) {
            $this->info[$symbol][$interval]['firstOpen'] = $openTime;
        }

        return $output;
    }
private function chartData ( string $ symbol , string $ interval , array $ ticks ) { if ( ! isset ( $ this -> info [ $ symbol ] ) ) { $ this -> info [ $ symbol ] = [ ] ; } if ( ! isset ( $ this -> info [ $ symbol ] [ $ interval ] ) ) { $ this -> info [ $ symbol ] [ $ interval ] = [ ] ; } $ output = [ ] ; foreach ( $ ticks as $ tick ) { list ( $ openTime , $ open , $ high , $ low , $ close , $ assetVolume , $ closeTime , $ baseVolume , $ trades , $ assetBuyVolume , $ takerBuyVolume , $ ignored ) = $ tick ; $ output [ $ openTime ] = [ "open" => $ open , "high" => $ high , "low" => $ low , "close" => $ close , "volume" => $ baseVolume , "openTime" => $ openTime , "closeTime" => $ closeTime , "assetVolume" => $ assetVolume , "baseVolume" => $ baseVolume , "trades" => $ trades , "assetBuyVolume" => $ assetBuyVolume , "takerBuyVolume" => $ takerBuyVolume , "ignored" => $ ignored , ] ; } if ( isset ( $ openTime ) ) { $ this -> info [ $ symbol ] [ $ interval ] [ 'firstOpen' ] = $ openTime ; } return $ output ; }
chartData Convert kline data into object

$object = $this->chartData($symbol, $interval, $ticks);

@param $symbol string of your currency
@param $interval string the time interval
@param $ticks array of the canbles array
@return array object of the chartdata
chartData Convert kline data into object