略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: trader_avgprice

2024-04-28

trader_avgprice

(PECL trader >= 0.2.0)

trader_avgpriceAverage Price

说明

trader_avgprice(
    array $open,
    array $high,
    array $low,
    array $close
): array

参数

open

开盘价,浮点数数组。

high

高价,浮点数数组。

low

低价,浮点数数组。

close

收盘价,浮点数数组。

返回值

Returns an array with calculated data or false on failure.

add a noteadd a note

User Contributed Notes 1 note

up
1
geekgirl dot joy at gmail dot com
1 year ago
<?php
$p
trader_avgprice([1,2] , [1.2, 3] , [0.99, 2] , [1.2, 2.5]);
var_dump($p);
/*
array(2) {
  [0]=>
  float(1.097) // (1 + 1.2 + 0.99 + 1.2) / 4
  [1]=>
  float(2.375) // (2 + 3 + 2 + 2.5) / 4
}
*/

官方地址:https://www.php.net/manual/en/function.trader-avgprice.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3