php-binance-api.php
public function cumulative(array $depth)
    {
        $bids = [];
        $asks = [];
        $cumulative = 0;
        foreach ($depth['bids'] as $price => $quantity) {
            $cumulative += $quantity;
            $bids[] = [
                $price,
                $cumulative,
            ];
        }
        $cumulative = 0;
        foreach ($depth['asks'] as $price => $quantity) {
            $cumulative += $quantity;
            $asks[] = [
                $price,
                $cumulative,
            ];
        }
        return [
            "bids" => $bids,
            "asks" => array_reverse($asks),
        ];
    }
public function cumulative(array $depth)
    {
        $bids = [];
        $asks = [];
        $cumulative = 0;
        foreach ($depth['bids'] as $price => $quantity) {
            $cumulative += $quantity;
            $bids[] = [
                $price,
                $cumulative,
            ];
        }
        $cumulative = 0;
        foreach ($depth['asks'] as $price => $quantity) {
            $cumulative += $quantity;
            $asks[] = [
                $price,
                $cumulative,
            ];
        }
        return [
            "bids" => $bids,
            "asks" => array_reverse($asks),
        ];
    }
public function cumulative ( array $ depth ) { $ bids = [ ] ; $ asks = [ ] ; $ cumulative = 0 ; foreach ( $ depth [ 'bids' ] as $ price => $ quantity ) { $ cumulative += $ quantity ; $ bids [ ] = [ $ price , $ cumulative , ] ; } $ cumulative = 0 ; foreach ( $ depth [ 'asks' ] as $ price => $ quantity ) { $ cumulative += $ quantity ; $ asks [ ] = [ $ price , $ cumulative , ] ; } return [ "bids" => $ bids , "asks" => array_reverse ( $ asks ) , ] ; }
cumulative Converts depth cache into a cumulative array

$cumulative = $api->cumulative($depth);

@param $depth array cache array
@return array cumulative depth cache
cumulative Converts depth cache into a cumulative array