doxadoxa / php-indicators

PHP的指标库。

dev-master 2019-04-12 14:15 UTC

This package is auto-updated.

Last update: 2024-09-13 02:53:54 UTC


README

交易指标库。它需要简化与 trader 扩展的工作。

要求

  • php 7.3+
  • ext-trader

安装

composer install doxadoxa/phpindicators

测试

尚未提供测试。

示例

$klines = ExternalApi::getKlines('btcusdt', '1m');

$ohlvc = new OHLVC( $klines );

$sma14 = $ohlvc->close()->sma(14);
$sma3 = $ohlvc->close()->sma(3);
$atr = $ohlvc->atr(3);

if ( $sma3->crossBelow( $sma14 ) ) {
    Trader::setStopLossOn( $sma3[0] - $atr[0] * 10 );
}