Tell me how to correctly calculate the volume for the required period?

Why, when calculating the volume for 24 hours using the volume property,
$api->candlesticks(“UMAUSDT”, “1d”); - For example

and in
$api->prevDay(“UMAUSDT”); -
quoteVolume

The meanings are different!
What am I doing wrong? I want to calculate the volume in candlesticks for a given interval of 1d for example or for 5 minutes, what formula should I use to calculate and what properties need to be added to get it as in prevDay(quoteVolume)
?
Right now I’m simply adding it into candlesticks, but the values ​​differ from prevDay

     $volume24 = 0;
       foreach ($ticks1d as $key => $value) {
            $volume24 = $volume24+=$value["volume"];
        }
        
        $volume24 = number_format($volume24 / 1000000, 3) . 'M';

In
$api->kline([“UMAUSDT”], “1d”, function($api, $symbol, $chart) {…

the value of the calculated volume for 1d also does not coincide with prevDay(“UMAUSDT”)

Hi,

Could you provide additional details such as which library you are using to communicate with the API?