php-binance-api.php
public function displayDepth(array $array)
    {
        $output = '';
        foreach ([
            'asks',
            'bids',
        ] as $type) {
            $entries = $array[$type];
            if ($type === 'asks') {
                $entries = array_reverse($entries);
            }

            $output .= "{$type}:" . PHP_EOL;
            foreach ($entries as $price => $quantity) {
                $total = number_format($price * $quantity, 8, '.', '');
                $quantity = str_pad(str_pad(number_format(rtrim($quantity, '.0')), 10, ' ', STR_PAD_LEFT), 15);
                $output .= "{$price} {$quantity} {$total}" . PHP_EOL;
            }
            // echo str_repeat('-', 32).PHP_EOL;
        }
        return $output;
    }
public function displayDepth(array $array)
    {
        $output = '';
        foreach ([
            'asks',
            'bids',
        ] as $type) {
            $entries = $array[$type];
            if ($type === 'asks') {
                $entries = array_reverse($entries);
            }

            $output .= "{$type}:" . PHP_EOL;
            foreach ($entries as $price => $quantity) {
                $total = number_format($price * $quantity, 8, '.', '');
                $quantity = str_pad(str_pad(number_format(rtrim($quantity, '.0')), 10, ' ', STR_PAD_LEFT), 15);
                $output .= "{$price} {$quantity} {$total}" . PHP_EOL;
            }
            // echo str_repeat('-', 32).PHP_EOL;
        }
        return $output;
    }
public function displayDepth ( array $ array ) { $ output = '' ; foreach ( [ 'asks' , 'bids' , ] as $ type ) { $ entries = $ array [ $ type ] ; if ( $ type === 'asks' ) { $ entries = array_reverse ( $ entries ) ; } $ output .= "{$type}:" . PHP_EOL ; foreach ( $ entries as $ price => $ quantity ) { $ total = number_format ( $ price * $ quantity , 8 , '.' , '' ) ; $ quantity = str_pad ( str_pad ( number_format ( rtrim ( $ quantity , '.0' ) ) , 10 , ' ' , STR_PAD_LEFT ) , 15 ) ; $ output .= "{$price} {$quantity} {$total}" . PHP_EOL ; } // echo str_repeat('-', 32).PHP_EOL; } return $ output ; }
displayDepth Formats nicely for console output

$outputString = $api->displayDepth($array);

@param $array array
@return string of the depth information
displayDepth Formats nicely for console output