Skip to content

Laravel package for trader extension interface.

License

Notifications You must be signed in to change notification settings

laratrade/trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laratrade Trader

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Laravel package for trader extension interface.

Requirements

Make sure all dependencies have been installed before moving on:

Install

Pull the package via Composer:

$ composer require laratrade/trader

Usage

Via 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);
        ...
    }
}

Constants

MA_TYPE_SMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_SMA;

MA_TYPE_EMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_EMA;

MA_TYPE_WMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_WMA;

MA_TYPE_DEMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_DEMA;

MA_TYPE_TEMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_TEMA;

MA_TYPE_TRIMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_TRIMA;

MA_TYPE_KAMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_KAMA;

MA_TYPE_MAMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_MAMA;

MA_TYPE_T3

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::MA_TYPE_T3;

REAL_MIN

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::REAL_MIN;

REAL_MAX

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::REAL_MAX;

FUNC_UNST_ADX

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_ADX;

FUNC_UNST_ADXR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_ADXR;

FUNC_UNST_ATR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_ATR;

FUNC_UNST_CMO

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_CMO;

FUNC_UNST_DX

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_DX;

FUNC_UNST_EMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_EMA;

FUNC_UNST_HT_DCPERIOD

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_HT_DCPERIOD;

FUNC_UNST_HT_DCPHASE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_HT_DCPHASE;

FUNC_UNST_HT_PHASOR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_HT_PHASOR;

FUNC_UNST_HT_SINE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_HT_SINE;

FUNC_UNST_HT_TRENDLINE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_HT_TRENDLINE;

FUNC_UNST_HT_TRENDMODE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_HT_TRENDMODE;

FUNC_UNST_KAMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_KAMA;

FUNC_UNST_MAMA

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_MAMA;

FUNC_UNST_MFI

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_MFI;

FUNC_UNST_MINUS_DI

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_MINUS_DI;

FUNC_UNST_MINUS_DM

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_MINUS_DM;

FUNC_UNST_NATR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_NATR;

FUNC_UNST_PLUS_DI

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_PLUS_DI;

FUNC_UNST_PLUS_DM

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_PLUS_DM;

FUNC_UNST_RSI

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_RSI;

FUNC_UNST_STOCHRSI

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_STOCHRSI;

FUNC_UNST_T3

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_T3;

FUNC_UNST_ALL

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_ALL;

FUNC_UNST_NONE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::FUNC_UNST_NONE;

COMPATIBILITY_DEFAULT

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::COMPATIBILITY_DEFAULT;

COMPATIBILITY_METASTOCK

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::COMPATIBILITY_METASTOCK;

ERR_SUCCESS

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_SUCCESS;

ERR_LIB_NOT_INITIALIZE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_LIB_NOT_INITIALIZE;

ERR_BAD_PARAM

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_BAD_PARAM;

ERR_ALLOC_ERR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_ALLOC_ERR;

ERR_GROUP_NOT_FOUND

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_GROUP_NOT_FOUND;

ERR_FUNC_NOT_FOUND

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_FUNC_NOT_FOUND;

ERR_INVALID_HANDLE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INVALID_HANDLE;

ERR_INVALID_PARAM_HOLDER

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INVALID_PARAM_HOLDER;

ERR_INVALID_PARAM_HOLDER_TYPE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INVALID_PARAM_HOLDER_TYPE;

ERR_INVALID_PARAM_FUNCTION

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INVALID_PARAM_FUNCTION;

ERR_INPUT_NOT_ALL_INITIALIZE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INPUT_NOT_ALL_INITIALIZE;

ERR_OUTPUT_NOT_ALL_INITIALIZE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_OUTPUT_NOT_ALL_INITIALIZE;

ERR_OUT_OF_RANGE_START_INDEX

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_OUT_OF_RANGE_START_INDEX;

ERR_OUT_OF_RANGE_END_INDEX

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_OUT_OF_RANGE_END_INDEX;

ERR_INVALID_LIST_TYPE

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INVALID_LIST_TYPE;

ERR_BAD_OBJECT

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_BAD_OBJECT;

ERR_NOT_SUPPORTED

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_NOT_SUPPORTED;

ERR_INTERNAL_ERROR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_INTERNAL_ERROR;

ERR_UNKNOWN_ERROR

<?php

use Laratrade\Trader\Contracts\Trader;

echo Trader::ERR_UNKNOWN_ERROR;

Functions

acos

Vector Trigonometric ACos

$acos = Trader::acos($real);

ad

Chaikin A/D Line

$ad = Trader::ad($real);

add

Vector Arithmetic Add

$add = Trader::add($real);

adosc

Chaikin A/D Oscillator

$add = Trader::add($real);

adx

Average Directional Movement Index

$adx = Trader::adx($real);

adxr

Average Directional Movement Index Rating

$adx = Trader::adx($real);

apo

Absolute Price Oscillator

$adx = Trader::apo($real);

aroon

Aroon

aroonosc

Aroon Oscillator

asin

Vector Trigonometric ASin

atan

Vector Trigonometric ATan

atr

Average True Range

avgprice

Average Price

bbands

Bollinger Bands

beta

Beta

bop

Balance Of Power

cci

Commodity Channel Index

cdl2crows

Two Crows

cdl3blackcrows

Three Black Crows

cdl3inside

Three Inside Up/Down

cdl3linestrike

Three-Line Strike

cdl3outside

Three Outside Up/Down

cdl3starsinsouth

Three Stars In The South

cdl3whitesoldiers

Three Advancing White Soldiers

cdlabandonedbaby

Abandoned Baby

cdladvanceblock

Advance Block

cdlbelthold

Belt-hold

cdlbreakaway

Breakaway

cdlclosingmarubozu

Closing Marubozu

cdlconcealbabyswall

Concealing Baby Swallow

cdlcounterattack

Counterattack

cdldarkcloudcover

Dark Cloud Cover

cdldoji

Doji

cdldojistar

Doji Star

cdldragonflydoji

Dragonfly Doji

cdlengulfing

Engulfing Pattern

cdleveningdojistar

Evening Doji Star

cdleveningstar

Evening Star

cdlgapsidesidewhite

Up/Down-gap side-by-side white lines

cdlgravestonedoji

Gravestone Doji

cdlhammer

Hammer

cdlhangingman

Hanging Man

cdlharami

Harami Pattern

cdlharamicross

Harami Cross Pattern

cdlhighwave

High-Wave Candle

cdlhikkake

Hikkake Pattern

cdlhikkakemod

Modified Hikkake Pattern

cdlhomingpigeon

Homing Pigeon

cdlidentical3crows

Identical Three Crows

cdlinneck

In-Neck Pattern

cdlinvertedhammer

Inverted Hammer

cdlkicking

Kicking

cdlkickingbylength

Kicking - bull/bear determined by the longer marubozu

cdlladderbottom

Ladder Bottom

cdllongleggeddoji

Long Legged Doji

cdllongline

Long Line Candle

cdlmarubozu

Marubozu

cdlmatchinglow

Matching Low

cdlmathold

Mat Hold

cdlmorningdojistar

Morning Doji Star

cdlmorningstar

Morning Star

cdlonneck

On-Neck Pattern

cdlpiercing

Piercing Pattern

cdlrickshawman

Rickshaw Man

cdlrisefall3methods

Rising/Falling Three Methods

cdlseparatinglines

Separating Lines

cdlshootingstar

Shooting Star

cdlshortline

Short Line Candle

cdlspinningtop

Spinning Top

cdlstalledpattern

Stalled Pattern

cdlsticksandwich

Stick Sandwich

cdltakuri

Takuri (Dragonfly Doji with very long lower shadow)

cdltasukigap

Tasuki Gap

cdlthrusting

Thrusting Pattern

cdltristar

Tristar Pattern

cdlunique3river

Unique 3 River

cdlupsidegap2crows

Upside Gap Two Crows

cdlxsidegap3methods

Upside/Downside Gap Three Methods

ceil

Vector Ceil

cmo

Chande Momentum Oscillator

correl

Pearson's Correlation Coefficient (r)

cos

Vector Trigonometric Cos

cosh

Vector Trigonometric Cosh

dema

Double Exponential Moving Average

div

Vector Arithmetic Div

dx

Directional Movement Index

ema

Exponential Moving Average

errno

Get error code

exp

Vector Arithmetic Exp

floor

Vector Floor

get_compat

Get compatibility mode

get_unstable_period

Get unstable period

ht_dcperiod

Hilbert Transform - Dominant Cycle Period

ht_dcphase

Hilbert Transform - Dominant Cycle Phase

ht_phasor

Hilbert Transform - Phasor Components

ht_sine

Hilbert Transform - SineWave

ht_trendline

Hilbert Transform - Instantaneous Trendline

ht_trendmode

Hilbert Transform - Trend vs Cycle Mode

kama

Kaufman Adaptive Moving Average

linearreg_angle

Linear Regression Angle

linearreg_intercept

Linear Regression Intercept

linearreg_slope

Linear Regression Slope

linearreg

Linear Regression

ln

Vector Log Natural

log10

Vector Log10

ma

Moving average

macd

Moving Average Convergence/Divergence

macdext

MACD with controllable MA type

macdfix

Moving Average Convergence/Divergence Fix 12/26

mama

MESA Adaptive Moving Average

mavp

Moving average with variable period

max

Highest value over a specified period

maxindex

Index of highest value over a specified period

medprice

Median Price

mfi

Money Flow Index

midpoint

MidPoint over period

midprice

Midpoint Price over period

min

Lowest value over a specified period

minindex

Index of lowest value over a specified period

minmax

Lowest and highest values over a specified period

minmaxindex

Indexes of lowest and highest values over a specified period

minus_di

Minus Directional Indicator

minus_dm

Minus Directional Movement

mom

Momentum

mult

Vector Arithmetic Mult

natr

Normalized Average True Range

obv

On Balance Volume

plus_di

Plus Directional Indicator

plus_dm

Plus Directional Movement

ppo

Percentage Price Oscillator

roc

Rate of change : ((price/prevPrice)-1)*100

rocp

Rate of change Percentage: (price-prevPrice)/prevPrice

rocr100

Rate of change ratio 100 scale: (price/prevPrice)*100

rocr

Rate of change ratio: (price/prevPrice)

rsi

Relative Strength Index

sar

Parabolic SAR

sarext

Parabolic SAR - Extended

set_compat

Set compatibility mode

set_unstable_period

Set unstable period

sin

Vector Trigonometric Sin

sinh

Vector Trigonometric Sinh

sma

Simple Moving Average

sqrt

Vector Square Root

stddev

Standard Deviation

stoch

Stochastic

stochf

Stochastic Fast

stochrsi

Stochastic Relative Strength Index

sub

Vector Arithmetic Subtraction

sum

Summation

t3

Triple Exponential Moving Average (T3)

tan

Vector Trigonometric Tan

tanh

Vector Trigonometric Tanh

tema

Triple Exponential Moving Average

trange

True Range

trima

Triangular Moving Average

trix

1-day Rate-Of-Change (ROC) of a Triple Smooth EMA

tsf

Time Series Forecast

typprice

Typical Price

ultosc

Ultimate Oscillator

var

Variance

wclprice

Weighted Close Price

willr

Williams' %R

wma

Weighted Moving Average

Testing

$ composer test

Security

If you discover any security related issues, please use the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.