Laravel package for trader extension interface. Forked from laratrade/trader which seems to have been abandoned. The main purpose of this fork is to update composer.json dependencies so that:
- PHP 8.1 is required
- it can be installed on current Laravel versions.
Make sure all dependencies have been installed before moving on:
Register this fork in your composer.json 'repositories' section:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rgasch/trader"
}
],
Pull the package via Composer (it will use this fork which you defined above):
$ composer require laratrade/traderVia dependency injection
<?php
use Laratrade\Trader\Contracts\Trader;
class MyClass
{
/**
* The trader instance.
*
* @var Trader
*/
protected $trader;
/**
* Create a new instance.
*
* @param Trader $trader
*/
public function __construct(Trader $trader)
{
$this->indicatorManager = $trader;
}
/**
* Handle my function.
*/
public function myFunction()
{
...
$acos = $this->trader->acos($real);
...
}
}Via facade
<?php
use Laratrade\Trader\Facades\Trader;
class MyClass
{
/**
* Handle my function.
*/
public function myFunction()
{
...
$acos = Trader::acos($real);
...
}
}Via helper
<?php
class MyClass
{
/**
* Handle my function.
*/
public function myFunction()
{
...
$acos = trader()->acos($real);
...
}
}<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_SMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_EMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_WMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_DEMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_TEMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_TRIMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_KAMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_MAMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::MA_TYPE_T3;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::REAL_MIN;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::REAL_MAX;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_ADX;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_ADXR;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_ATR;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_CMO;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_DX;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_EMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_HT_DCPERIOD;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_HT_DCPHASE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_HT_PHASOR;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_HT_SINE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_HT_TRENDLINE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_HT_TRENDMODE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_KAMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_MAMA;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_MFI;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_MINUS_DI;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_MINUS_DM;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_NATR;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_PLUS_DI;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_PLUS_DM;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_RSI;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_STOCHRSI;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_T3;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_ALL;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::FUNC_UNST_NONE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::COMPATIBILITY_DEFAULT;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::COMPATIBILITY_METASTOCK;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_SUCCESS;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_LIB_NOT_INITIALIZE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_BAD_PARAM;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_ALLOC_ERR;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_GROUP_NOT_FOUND;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_FUNC_NOT_FOUND;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INVALID_HANDLE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INVALID_PARAM_HOLDER;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INVALID_PARAM_HOLDER_TYPE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INVALID_PARAM_FUNCTION;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INPUT_NOT_ALL_INITIALIZE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_OUTPUT_NOT_ALL_INITIALIZE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_OUT_OF_RANGE_START_INDEX;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_OUT_OF_RANGE_END_INDEX;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INVALID_LIST_TYPE;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_BAD_OBJECT;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_NOT_SUPPORTED;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_INTERNAL_ERROR;<?php
use Laratrade\Trader\Contracts\Trader;
echo Trader::ERR_UNKNOWN_ERROR;Vector Trigonometric ACos
$result = Trader::acos($real);Chaikin A/D Line
$result = Trader::ad(array $high, array $low, array $close, array $volume);Vector Arithmetic Add
$result = Trader::add(array $real0, array $real1);Chaikin A/D Oscillator
$result = Trader::adosc(array $high, array $low, array $close, array $volume, int $fastPeriod = 3, int $slowPeriod = 10);Average Directional Movement Index
$result = Trader::adx(array $high, array $low, array $close, int $timePeriod = 14);Average Directional Movement Index Rating
$result = Trader::adxr(array $high, array $low, array $close, int $timePeriod = 14);Absolute Price Oscillator
$result = Trader::apo(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $mAType = 0);Aroon
$result = Trader::aroon(array $high, array $low, int $timePeriod = 14);Aroon Oscillator
$result = Trader::aroonosc(array $high, array $low, int $timePeriod = 14);Vector Trigonometric ASin
$result = Trader::asin(array $real);Vector Trigonometric ATan
$result = Trader::atan(array $real);Average True Range
$result = Trader::atr(array $high, array $low, array $close, int $timePeriod = 14);Average Price
$result = Trader::avgprice(array $open, array $high, array $low, array $close);Bollinger Bands
$result = Trader::bbands(array $real, int $timePeriod = 5, float $nbDevUp = 2.0, float $nbDevDn = 2.0, int $mAType = 0);Beta
$result = Trader::beta(array $real0, array $real1, int $timePeriod = 5);Balance Of Power
$result = Trader::bop(array $open, array $high, array $low, array $close);Commodity Channel Index
$result = Trader::cci(array $high, array $low, array $close, int $timePeriod = null);Two Crows
$result = Trader::cdl2crows(array $open, array $high, array $low, array $close);Three Black Crows
$result = Trader::cdl3blackcrows(array $open, array $high, array $low, array $close);Three Inside Up/Down
$result = Trader::cdl3inside(array $open, array $high, array $low, array $close);Three-Line Strike
$result = Trader::cdl3linestrike(array $open, array $high, array $low, array $close);Three Outside Up/Down
$result = Trader::cdl3outside(array $open, array $high, array $low, array $close);Three Stars In The South
$result = Trader::cdl3starsinsouth(array $open, array $high, array $low, array $close);Three Advancing White Soldiers
$result = Trader::cdl3whitesoldiers(array $open, array $high, array $low, array $close);Abandoned Baby
$result = Trader::cdlabandonedbaby(array $open, array $high, array $low, array $close, float $penetration = 0.3);Advance Block
$result = Trader::cdladvanceblock(array $open, array $high, array $low, array $close);Belt-hold
$result = Trader::cdlbelthold(array $open, array $high, array $low, array $close);Breakaway
$result = Trader::cdlbreakaway(array $open, array $high, array $low, array $close);Closing Marubozu
$result = Trader::cdlclosingmarubozu(array $open, array $high, array $low, array $close);Concealing Baby Swallow
$result = Trader::cdlclosingmarubozu(array $open, array $high, array $low, array $close);Counterattack
$result = Trader::cdlconcealbabyswall(array $open, array $high, array $low, array $close);Dark Cloud Cover
$result = Trader::cdldarkcloudcover(array $open, array $high, array $low, array $close, float $penetration = 0.5);Doji
$result = Trader::cdldoji(array $open, array $high, array $low, array $close);Doji Star
$result = Trader::cdldojistar(array $open, array $high, array $low, array $close);Dragonfly Doji
$result = Trader::cdldragonflydoji(array $open, array $high, array $low, array $close);Engulfing Pattern
$result = Trader::cdlengulfing(array $open, array $high, array $low, array $close);Evening Doji Star
$result = Trader::cdleveningdojistar(array $open, array $high, array $low, array $close, float $penetration = 0.3);Evening Star
$result = Trader::cdleveningstar(array $open, array $high, array $low, array $close, float $penetration = 0.3);Up/Down-gap side-by-side white lines
$result = Trader::cdlgapsidesidewhite(array $open, array $high, array $low, array $close);Gravestone Doji
$result = Trader::cdlgravestonedoji(array $open, array $high, array $low, array $close);Hammer
$result = Trader::cdlhammer(array $open, array $high, array $low, array $close);Hanging Man
$result = Trader::cdlhangingman(array $open, array $high, array $low, array $close);Harami Pattern
$result = Trader::cdlharami(array $open, array $high, array $low, array $close);Harami Cross Pattern
$result = Trader::cdlharamicross(array $open, array $high, array $low, array $close);High-Wave Candle
$result = Trader::cdlhighwave(array $open, array $high, array $low, array $close);Hikkake Pattern
$result = Trader::cdlhikkake(array $open, array $high, array $low, array $close);Modified Hikkake Pattern
$result = Trader::cdlhikkakemod(array $open, array $high, array $low, array $close);Homing Pigeon
$result = Trader::cdlhomingpigeon(array $open, array $high, array $low, array $close);Identical Three Crows
$result = Trader::cdlidentical3crows(array $open, array $high, array $low, array $close);In-Neck Pattern
$result = Trader::cdlinneck(array $open, array $high, array $low, array $close);Inverted Hammer
$result = Trader::cdlinvertedhammer(array $open, array $high, array $low, array $close);Kicking
$result = Trader::cdlkicking(array $open, array $high, array $low, array $close);Kicking - bull/bear determined by the longer marubozu
$result = Trader::cdlkickingbylength(array $open, array $high, array $low, array $close);Ladder Bottom
$result = Trader::cdlladderbottom(array $open, array $high, array $low, array $close);Long Legged Doji
$result = Trader::cdllongleggeddoji(array $open, array $high, array $low, array $close);Long Line Candle
$result = Trader::cdllongline(array $open, array $high, array $low, array $close);Marubozu
$result = Trader::cdlmarubozu(array $open, array $high, array $low, array $close);Matching Low
$result = Trader::cdlmatchinglow(array $open, array $high, array $low, array $close);Mat Hold
$result = Trader::cdlmathold(array $open, array $high, array $low, array $close, float $penetration = 0.5);Morning Doji Star
$result = Trader::cdlmorningdojistar(array $open, array $high, array $low, array $close, float $penetration = 0.3);Morning Star
$result = Trader::cdlmorningstar(array $open, array $high, array $low, array $close, float $penetration = 0.3);On-Neck Pattern
$result = Trader::cdlonneck(array $open, array $high, array $low, array $close);Piercing Pattern
$result = Trader::cdlpiercing(array $open, array $high, array $low, array $close);Rickshaw Man
$result = Trader::cdlrickshawman(array $open, array $high, array $low, array $close);Rising/Falling Three Methods
$result = Trader::cdlrisefall3methods(array $open, array $high, array $low, array $close);Separating Lines
$result = Trader::cdlseparatinglines(array $open, array $high, array $low, array $close);Shooting Star
$result = Trader::cdlshootingstar(array $open, array $high, array $low, array $close);Short Line Candle
$result = Trader::cdlshortline(array $open, array $high, array $low, array $close);Spinning Top
$result = Trader::cdlspinningtop(array $open, array $high, array $low, array $close);Stalled Pattern
$result = Trader::cdlstalledpattern(array $open, array $high, array $low, array $close);Stick Sandwich
$result = Trader::cdlsticksandwich(array $open, array $high, array $low, array $close);Takuri (Dragonfly Doji with very long lower shadow)
$result = Trader::cdltakuri(array $open, array $high, array $low, array $close);Tasuki Gap
$result = Trader::cdltasukigap(array $open, array $high, array $low, array $close);Thrusting Pattern
$result = Trader::cdlthrusting(array $open, array $high, array $low, array $close);Tristar Pattern
$result = Trader::cdltristar(array $open, array $high, array $low, array $close);Unique 3 River
$result = Trader::cdlunique3river(array $open, array $high, array $low, array $close);Upside Gap Two Crows
$result = Trader::cdlupsidegap2crows(array $open, array $high, array $low, array $close);Upside/Downside Gap Three Methods
$result = Trader::cdlxsidegap3methods(array $open, array $high, array $low, array $close);Vector Ceil
$result = Trader::ceil(array $real);Chande Momentum Oscillator
$result = Trader::cmo(array $real, int $timePeriod = 14);Pearson's Correlation Coefficient (r)
$result = Trader::correl(array $real0, array $real1, int $timePeriod = 30);Vector Trigonometric Cos
$result = Trader::cos(array $real);Vector Trigonometric Cosh
$result = Trader::cosh(array $real);Double Exponential Moving Average
$result = Trader::dema(array $real, int $timePeriod = 30);Vector Arithmetic Div
$result = Trader::div(array $real0, array $real1);Directional Movement Index
$result = Trader::dx(array $high, array $low, array $close, int $timePeriod = 14);Exponential Moving Average
$result = Trader::ema(array $real, int $timePeriod = 30);Get error code
$result = Trader::errno();Vector Arithmetic Exp
$result = Trader::exp(array $real);Vector Floor
$result = Trader::floor(array $real);Get compatibility mode
$result = Trader::get_compat();Get unstable period
$result = Trader::get_unstable_period(int $functionId);Hilbert Transform - Dominant Cycle Period
$result = Trader::ht_dcperiod(array $real);Hilbert Transform - Dominant Cycle Phase
$result = Trader::ht_dcphase(array $real);Hilbert Transform - Phasor Components
$result = Trader::ht_phasor(array $open, array $close);Hilbert Transform - SineWave
$result = Trader::ht_sine(array $open, array $close);Hilbert Transform - Instantaneous Trendline
$result = Trader::ht_trendline(array $real);Hilbert Transform - Trend vs Cycle Mode
$result = Trader::ht_trendmode(array $real);Kaufman Adaptive Moving Average
$result = Trader::kama(array $real, int $timePeriod = 30);Linear Regression Angle
$result = Trader::linearreg_angle(array $real, int $timePeriod = 14);Linear Regression Intercept
$result = Trader::linearreg_intercept(array $real, int $timePeriod = 14);Linear Regression Slope
$result = Trader::linearreg_slope(array $real, int $timePeriod = 14);Linear Regression
$result = Trader::linearreg(array $real, int $timePeriod = 14);Vector Log Natural
$result = Trader::ln(array $real);Vector Log10
$result = Trader::log10(array $real);Moving average
$result = Trader::ma(array $real, int $timePeriod = 30, int $mAType = 0);Moving Average Convergence/Divergence
$result = Trader::macd(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $signalPeriod = 9);MACD with controllable MA type
$result = Trader::macdext(array $real, int $fastPeriod = 12, int $fastMAType = 0, int $slowPeriod = 26, int $slowMAType = 0, int $signalPeriod = 9);Moving Average Convergence/Divergence Fix 12/26
$result = Trader::macdfix(array $real, int $signalPeriod = 9);MESA Adaptive Moving Average
$result = Trader::mama(array $real, float $fastLimit = 0.5, float $slowLimit = 0.05);Moving average with variable period
$result = Trader::mavp(array $real, array $periods, int $minPeriod = 2, int $maxPeriod = 30, int $mAType = 0);Highest value over a specified period
$result = Trader::max(array $real, int $timePeriod = 30);Index of highest value over a specified period
$result = Trader::maxindex(array $real, int $timePeriod = 30);Median Price
$result = Trader::medprice(array $high, array $low);Money Flow Index
$result = Trader::mfi(array $high, array $low, array $close, array $volume, int $timePeriod = 14);MidPoint over period
$result = Trader::midpoint(array $real, int $timePeriod = 14);Midpoint Price over period
$result = Trader::midprice(array $high, array $low, int $timePeriod = 14);Lowest value over a specified period
$result = Trader::min(array $real, int $timePeriod = 30);Index of lowest value over a specified period
$result = Trader::minindex(array $real, int $timePeriod = 30);Lowest and highest values over a specified period
$result = Trader::minmax(array $real, int $timePeriod = 30);Indexes of lowest and highest values over a specified period
$result = Trader::minmaxindex(array $real, int $timePeriod = 30);Minus Directional Indicator
$result = Trader::minus_di(array $high, array $low, array $close, int $timePeriod = 14);Minus Directional Movement
$result = Trader::minus_dm(array $high, array $low, int $timePeriod = 14);Momentum
$result = Trader::mom(array $real, int $timePeriod = 10);Vector Arithmetic Mult
$result = Trader::mult(array $real0, array $real1);Normalized Average True Range
$result = Trader::natr(array $high, array $low, array $close, int $timePeriod = 14);On Balance Volume
$result = Trader::obv(array $real, array $volume);Plus Directional Indicator
$result = Trader::plus_di(array $high, array $low, array $close, int $timePeriod = 14);Plus Directional Movement
$result = Trader::plus_dm(array $high, array $low, int $timePeriod = 14);Percentage Price Oscillator
$result = Trader::ppo(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $mAType = 0);Rate of change : ((price/prevPrice)-1)*100
$result = Trader::roc(array $real, int $timePeriod = 10);Rate of change Percentage: (price-prevPrice)/prevPrice
$result = Trader::rocp(array $real, int $timePeriod = 10);Rate of change ratio 100 scale: (price/prevPrice)*100
$result = Trader::rocr100(array $real, int $timePeriod = 10);Rate of change ratio: (price/prevPrice)
$result = Trader::rocr(array $real, int $timePeriod = 10);Relative Strength Index
$result = Trader::rsi(array $real, int $timePeriod = 14);Parabolic SAR
$result = Trader::sar(array $high, array $low, float $acceleration = 0.02, float $maximum = 0.2);Parabolic SAR - Extended
$result = Trader::sarext(array $high, array $low, float $startValue = 0.0, float $offsetOnReverse = 0.0, float $accelerationInitLong = 0.02, float $accelerationLong = 0.02, float $accelerationMaxLong = 0.2, float $accelerationInitShort = 0.02, float $accelerationShort = 0.02, float $accelerationMaxShort = 0.2);Set compatibility mode
Trader::set_compat(int $compatId);Set unstable period
Trader::set_unstable_period(int $functionId, int $timePeriod);Vector Trigonometric Sin
$result = Trader::sin(array $real);Vector Trigonometric Sinh
$result = Trader::sinh(array $real);Simple Moving Average
$result = Trader::sma(array $real, int $timePeriod = 30);Vector Square Root
$result = Trader::sqrt(array $real);Standard Deviation
$result = Trader::stddev(array $real, int $timePeriod = 5, float $nbDev = 1.0);Stochastic
$result = Trader::stoch(array $high, array $low, array $close, int $fastK_Period = 5, int $slowK_Period = 3, int $slowK_MAType = 0, int $slowD_Period = 3, int $slowD_MAType = 0);Stochastic Fast
$result = Trader::stochf(array $high, array $low, array $close, int $fastK_Period = 5, int $fastD_Period = 3, int $fastD_MAType = 0);Stochastic Relative Strength Index
$result = Trader::stochrsi(array $real, int $timePeriod = 14, int $fastK_Period = 5, int $fastD_Period = 3, int $fastD_MAType = 0);Vector Arithmetic Subtraction
$result = Trader::sub(array $real0, array $real1);Summation
$result = Trader::sum(array $real, int $timePeriod = 30);Triple Exponential Moving Average (T3)
$result = Trader::t3(array $real, int $timePeriod = 5, float $vFactor = 0.7);Vector Trigonometric Tan
$result = Trader::tan(array $real);Vector Trigonometric Tanh
$result = Trader::tanh(array $real);Triple Exponential Moving Average
$result = Trader::tema(array $real, int $timePeriod = 30);True Range
$result = Trader::trange(array $high, array $low, array $close);Triangular Moving Average
$result = Trader::trima(array $real, int $timePeriod = 30);1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
$result = Trader::trix(array $real, int $timePeriod = 30);Time Series Forecast
$result = Trader::tsf(array $real, int $timePeriod = 14);Typical Price
$result = Trader::typprice(array $high, array $low, array $close);Ultimate Oscillator
$result = Trader::ultosc(array $high, array $low, array $close, int $timePeriod1 = 7, int $timePeriod2 = 14, int $timePeriod3 = 28);Variance
$result = Trader::var(array $real, int $timePeriod = 5, float $nbDev = 1.0);Weighted Close Price
$result = Trader::wclprice(array $high, array $low, array $close);Williams' %R
$result = Trader::willr(array $high, array $low, array $close, int $timePeriod = 14);Weighted Moving Average
$result = Trader::wma(array $real, int $timePeriod = 30);$ composer testIf you discover any security related issues, please use the issue tracker.
The MIT License (MIT). Please see License File for more information.