indicator

package module
v0.0.0-...-396db7e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 8 Imported by: 6

README

Technical indicator

Binding TA-Lib and Tulip indicator for Golang

Installation

go get code.afis.me/trading/indicator

Included TA-Lib version 4.0 (from git)

If you need recompile, in debian you need to install some packages

sudo apt-get install build-essential autogen autoconf libtool
make build
How to use
# run example test
make test

Documentation

Index

Constants

View Source
const (
	//BuiltIn -
	BuiltIn = iota
	//TAlib -
	TAlib
	//Tulip -
	Tulip
	//All -
	All
	//Fastest -
	Fastest
)

Variables

View Source
var MANames = []string{
	"SMA",
	"EMA",
	"WMA",
	"DEMA",
	"TEMA",
	"TRIMA",
	"KAMA",
	"MAMA",
	"ZLEMA",
	"HMA",
}

MANames -

Functions

func GetCandleMomentStringName

func GetCandleMomentStringName(k CandleMoment) (sc string)

GetCandleMomentStringName -

func GetMAStringName

func GetMAStringName(k MAType) (sc string)

GetMAStringName -

func GetPluginName

func GetPluginName(id int) (rs string)

GetPluginName -

func GetResultName

func GetResultName(in CandleResult) (sc string)

GetResultName -

Types

type AdxDi

type AdxDi struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

AdxDi - Average Directional Movement Index with PlusDi and MinusDi

func NewAdxWithDi

func NewAdxWithDi(opt AdxDiOption) *AdxDi

NewAdxWithDi -

func (*AdxDi) All

func (cc *AdxDi) All() *AdxDi

All -

func (*AdxDi) BuiltIn

func (cc *AdxDi) BuiltIn() *AdxDi

BuiltIn -

func (*AdxDi) Compare

func (cc *AdxDi) Compare() (rs string)

Compare -

func (*AdxDi) Fastest

func (cc *AdxDi) Fastest() *AdxDi

Fastest -

func (*AdxDi) Result

func (cc *AdxDi) Result(res int) (out AdxDiOutput)

Result -

func (*AdxDi) ResultAll

func (cc *AdxDi) ResultAll() (out []AdxDiOutput)

ResultAll -

func (*AdxDi) TAlib

func (cc *AdxDi) TAlib() *AdxDi

TAlib -

func (*AdxDi) Tulip

func (cc *AdxDi) Tulip() *AdxDi

Tulip -

type AdxDiOption

type AdxDiOption struct {
	High   []float64
	Low    []float64
	Close  []float64
	Period int
}

AdxDiOption -

type AdxDiOutput

type AdxDiOutput struct {
	Type    int
	Error   error
	Timer   time.Duration
	Adx     []float64
	PlusDi  []float64
	MinusDi []float64
}

AdxDiOutput -

type Ao

type Ao struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Ao - Awesome Oscillator

func NewAo

func NewAo(opt AoOption) *Ao

NewAo -

func (*Ao) All

func (cc *Ao) All() *Ao

All -

func (*Ao) Compare

func (cc *Ao) Compare() (rs string)

Compare -

func (*Ao) Fastest

func (cc *Ao) Fastest() *Ao

Fastest -

func (*Ao) Result

func (cc *Ao) Result(res int) (out GenralOutput)

Result -

func (*Ao) ResultAll

func (cc *Ao) ResultAll() (out []GenralOutput)

ResultAll -

func (*Ao) Tulip

func (cc *Ao) Tulip() *Ao

Tulip -

type AoOption

type AoOption struct {
	High []float64
	Low  []float64
}

AoOption -

type BBands

type BBands struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

BBands - Bollinger Bands

func NewBBBand

func NewBBBand(opt BBandsOption) *BBands

NewBBBand -

func (*BBands) All

func (cc *BBands) All() *BBands

All -

func (*BBands) BuiltIn

func (cc *BBands) BuiltIn() *BBands

BuiltIn -

func (*BBands) Compare

func (cc *BBands) Compare() (rs string)

Compare -

func (*BBands) Fastest

func (cc *BBands) Fastest() *BBands

Fastest -

func (*BBands) Result

func (cc *BBands) Result(res int) (out BBandsOutput)

Result -

func (*BBands) ResultAll

func (cc *BBands) ResultAll() (out []BBandsOutput)

ResultAll -

func (*BBands) TAlib

func (cc *BBands) TAlib() *BBands

TAlib -

func (*BBands) Tulip

func (cc *BBands) Tulip() *BBands

Tulip -

type BBandsOption

type BBandsOption struct {
	Real   []float64
	Period int
	DevUp  float64
	DevDn  float64
	MaType int
}

BBandsOption -

type BBandsOutput

type BBandsOutput struct {
	Type   int
	Error  error
	Timer  time.Duration
	Upper  []float64
	Middle []float64
	Lower  []float64
}

BBandsOutput -

type CandleMoment

type CandleMoment int

CandleMoment -

const (
	//CandleMomentAllPattern -
	CandleMomentAllPattern CandleMoment = iota + 99

	//CandleMomentBullishRiseFall3Methods -
	CandleMomentBullishRiseFall3Methods
	//CandleMomentBearishRiseFall3Methods -
	CandleMomentBearishRiseFall3Methods

	//CandleMomentHammerPattern -
	CandleMomentHammerPattern
	//CandleMomentInvertedHammerPattern -
	CandleMomentInvertedHammerPattern
	//CandleMomentBullishEngulfing -
	CandleMomentBullishEngulfing
	//CandleMomentPiercingLine -
	CandleMomentPiercingLine
	//CandleMomentMorningStar -
	CandleMomentMorningStar
	//CandleMomentThreeWhiteSoldiers -
	CandleMomentThreeWhiteSoldiers
	//CandleMomentBullishHarami -
	CandleMomentBullishHarami
	//CandleMomentBullishAbandonedBaby -
	CandleMomentBullishAbandonedBaby
	//CandleMomentBullishMarubozu -
	CandleMomentBullishMarubozu

	//CandleMomentHangingMan -
	CandleMomentHangingMan
	//CandleMomentShootingStar -
	CandleMomentShootingStar
	//CandleMomentBearishEngulfing -
	CandleMomentBearishEngulfing
	//CandleMomentEveningStar -
	CandleMomentEveningStar
	//CandleMomentThreeBlackCrows -
	CandleMomentThreeBlackCrows
	//CandleMomentDarkCloudCover -
	CandleMomentDarkCloudCover
	//CandleMomentBearishHarami -
	CandleMomentBearishHarami
	//CandleMomentBearishAbandonedBaby -
	CandleMomentBearishAbandonedBaby
	//CandleMomentBearishMarubozu -
	CandleMomentBearishMarubozu

	//CandleMomentAllEngulfing -
	CandleMomentAllEngulfing
	//CandleMomentAllHarami -
	CandleMomentAllHarami
)

func GetAllPattern

func GetAllPattern() (vals []CandleMoment)

GetAllPattern -

type CandleResult

type CandleResult int

CandleResult -

const (
	//CandleResultCall -
	CandleResultCall CandleResult = iota + 1
	//CandleResultPut -
	CandleResultPut
	//CandleResultNeutral -
	CandleResultNeutral
)

type Cci

type Cci struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cci - Commodity Channel Index

func NewCci

func NewCci(opt CciOption) *Cci

NewCci -

func (*Cci) All

func (cc *Cci) All() *Cci

All -

func (*Cci) BuiltIn

func (cc *Cci) BuiltIn() *Cci

BuiltIn -

func (*Cci) Compare

func (cc *Cci) Compare() (rs string)

Compare -

func (*Cci) Fastest

func (cc *Cci) Fastest() *Cci

Fastest -

func (*Cci) Result

func (cc *Cci) Result(res int) (out CciOutput)

Result -

func (*Cci) ResultAll

func (cc *Cci) ResultAll() (out []CciOutput)

ResultAll -

func (*Cci) TAlib

func (cc *Cci) TAlib() *Cci

TAlib -

func (*Cci) Tulip

func (cc *Cci) Tulip() *Cci

Tulip -

type CciOption

type CciOption struct {
	High   []float64
	Low    []float64
	Close  []float64
	Period int
}

CciOption -

type CciOutput

type CciOutput struct {
	Type  int
	Error error
	Timer time.Duration
	Data  []float64
}

CciOutput -

type Crossover

type Crossover struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Crossover -

func NewCrossover

func NewCrossover(opt CrossoverOption) *Crossover

NewCrossover -

func (*Crossover) All

func (cc *Crossover) All() *Crossover

All -

func (*Crossover) Compare

func (cc *Crossover) Compare() (rs string)

Compare -

func (*Crossover) Fastest

func (cc *Crossover) Fastest() *Crossover

Fastest -

func (*Crossover) Result

func (cc *Crossover) Result(res int) (out GenralOutput)

Result -

func (*Crossover) ResultAll

func (cc *Crossover) ResultAll() (out []GenralOutput)

ResultAll -

func (*Crossover) Tulip

func (cc *Crossover) Tulip() *Crossover

Tulip -

type CrossoverOption

type CrossoverOption struct {
	Up   []float64
	Down []float64
}

CrossoverOption -

type GenralOutput

type GenralOutput struct {
	Type      int
	Error     error
	Data      []float64
	Direction CandleResult
	Timer     time.Duration
}

GenralOutput -

type LinearReg

type LinearReg struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LinearReg - Linear Regression

func NewLinearReg

func NewLinearReg(opt LinearRegOption) *LinearReg

NewLinearReg -

func (*LinearReg) All

func (cc *LinearReg) All() *LinearReg

All -

func (*LinearReg) BuiltIn

func (cc *LinearReg) BuiltIn() *LinearReg

BuiltIn -

func (*LinearReg) Compare

func (cc *LinearReg) Compare() (rs string)

Compare -

func (*LinearReg) Fastest

func (cc *LinearReg) Fastest() *LinearReg

Fastest -

func (*LinearReg) Result

func (cc *LinearReg) Result(res int) (out GenralOutput)

Result -

func (*LinearReg) ResultAll

func (cc *LinearReg) ResultAll() (out []GenralOutput)

ResultAll -

func (*LinearReg) TAlib

func (cc *LinearReg) TAlib() *LinearReg

TAlib -

func (*LinearReg) Tulip

func (cc *LinearReg) Tulip() *LinearReg

Tulip -

type LinearRegOption

type LinearRegOption struct {
	Real   []float64
	Period int
}

LinearRegOption -

type MA

type MA struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MA - Moving Average

func NewMA

func NewMA(opt MAOption) *MA

NewMA -

func (*MA) All

func (cc *MA) All() *MA

All -

func (*MA) BuiltIn

func (cc *MA) BuiltIn() *MA

BuiltIn -

func (*MA) Compare

func (cc *MA) Compare() (rs string)

Compare -

func (*MA) Fastest

func (cc *MA) Fastest() *MA

Fastest -

func (*MA) Result

func (cc *MA) Result(res int) (out GenralOutput)

Result -

func (*MA) ResultAll

func (cc *MA) ResultAll() (out []GenralOutput)

ResultAll -

func (*MA) TAlib

func (cc *MA) TAlib() *MA

TAlib -

func (*MA) Tulip

func (cc *MA) Tulip() *MA

Tulip -

type MAOption

type MAOption struct {
	Real   []float64
	Period int
	MAType MAType
}

MAOption -

type MAType

type MAType int

MAType -

const (
	//SMA -
	SMA MAType = iota
	//EMA -
	EMA
	//WMA -
	WMA
	//DEMA -
	DEMA
	//TEMA -
	TEMA
	//TRIMA -
	TRIMA
	//KAMA -
	KAMA
	//MAMA -
	MAMA
	//ZLEMA -
	ZLEMA
	//HMA -
	HMA
)

type Mom

type Mom struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Mom - Momentum

func NewMom

func NewMom(opt MomOption) *Mom

NewMom -

func (*Mom) All

func (cc *Mom) All() *Mom

All -

func (*Mom) BuiltIn

func (cc *Mom) BuiltIn() *Mom

BuiltIn -

func (*Mom) Compare

func (cc *Mom) Compare() (rs string)

Compare -

func (*Mom) Fastest

func (cc *Mom) Fastest() *Mom

Fastest -

func (*Mom) Result

func (cc *Mom) Result(res int) (out GenralOutput)

Result -

func (*Mom) ResultAll

func (cc *Mom) ResultAll() (out []GenralOutput)

ResultAll -

func (*Mom) TAlib

func (cc *Mom) TAlib() *Mom

TAlib -

func (*Mom) Tulip

func (cc *Mom) Tulip() *Mom

Tulip -

type MomOption

type MomOption struct {
	Real   []float64
	Period int
}

MomOption -

type Pattern

type Pattern struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Pattern - Candle Pattern

func NewPattern

func NewPattern(opt PatternOption) *Pattern

NewPattern -

func (*Pattern) All

func (cc *Pattern) All() *Pattern

All -

func (*Pattern) Fastest

func (cc *Pattern) Fastest() *Pattern

Fastest -

func (*Pattern) Result

func (cc *Pattern) Result(res int) (out PatternOut)

Result -

func (*Pattern) TAlib

func (cc *Pattern) TAlib() *Pattern

TAlib -

type PatternOption

type PatternOption struct {
	Open                    []float64
	High                    []float64
	Low                     []float64
	Close                   []float64
	PatternType             []CandleMoment
	SendAllPatternDetection bool
}

PatternOption -

type PatternOut

type PatternOut struct {
	PatternAll map[CandleMoment]CandleResult
	Pattern    map[CandleMoment]CandleResult
	Error      error
	Timer      time.Duration
}

PatternOut -

type Rsi

type Rsi struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Rsi - Relative Strength Index

func NewRsi

func NewRsi(opt RsiOption) *Rsi

NewRsi -

func (*Rsi) All

func (cc *Rsi) All() *Rsi

All -

func (*Rsi) BuiltIn

func (cc *Rsi) BuiltIn() *Rsi

BuiltIn -

func (*Rsi) Compare

func (cc *Rsi) Compare() (rs string)

Compare -

func (*Rsi) Fastest

func (cc *Rsi) Fastest() *Rsi

Fastest -

func (*Rsi) Result

func (cc *Rsi) Result(res int) (out GenralOutput)

Result -

func (*Rsi) ResultAll

func (cc *Rsi) ResultAll() (out []GenralOutput)

ResultAll -

func (*Rsi) TAlib

func (cc *Rsi) TAlib() *Rsi

TAlib -

func (*Rsi) Tulip

func (cc *Rsi) Tulip() *Rsi

Tulip -

type RsiOption

type RsiOption struct {
	Real   []float64
	Period int
}

RsiOption -

type Stoch

type Stoch struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Stoch - Stochastic

func NewStoch

func NewStoch(opt StochOption) *Stoch

NewStoch -

func (*Stoch) All

func (cc *Stoch) All() *Stoch

All -

func (*Stoch) BuiltIn

func (cc *Stoch) BuiltIn() *Stoch

BuiltIn -

func (*Stoch) Compare

func (cc *Stoch) Compare() (rs string)

Compare -

func (*Stoch) Fastest

func (cc *Stoch) Fastest() *Stoch

Fastest -

func (*Stoch) Result

func (cc *Stoch) Result(res int) (out StochOutput)

Result -

func (*Stoch) ResultAll

func (cc *Stoch) ResultAll() (out []StochOutput)

ResultAll -

func (*Stoch) TAlib

func (cc *Stoch) TAlib() *Stoch

TAlib -

func (*Stoch) Tulip

func (cc *Stoch) Tulip() *Stoch

Tulip -

type StochOption

type StochOption struct {
	High        []float64
	Low         []float64
	Close       []float64
	KPeriod     int
	SlowKPeriod int
	DPeriod     int
}

StochOption -

type StochOutput

type StochOutput struct {
	Type  int
	Error error
	Timer time.Duration
	SlowK []float64
	SlowD []float64
}

StochOutput -

type Tsf

type Tsf struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Tsf - Time Series Forecast

func NewTsf

func NewTsf(opt TsfOption) *Tsf

NewTsf -

func (*Tsf) All

func (cc *Tsf) All() *Tsf

All -

func (*Tsf) BuiltIn

func (cc *Tsf) BuiltIn() *Tsf

BuiltIn -

func (*Tsf) Compare

func (cc *Tsf) Compare() (rs string)

Compare -

func (*Tsf) Fastest

func (cc *Tsf) Fastest() *Tsf

Fastest -

func (*Tsf) Result

func (cc *Tsf) Result(res int) (out GenralOutput)

Result -

func (*Tsf) ResultAll

func (cc *Tsf) ResultAll() (out []GenralOutput)

ResultAll -

func (*Tsf) TAlib

func (cc *Tsf) TAlib() *Tsf

TAlib -

func (*Tsf) Tulip

func (cc *Tsf) Tulip() *Tsf

Tulip -

type TsfOption

type TsfOption struct {
	Real   []float64
	Period int
}

TsfOption -

Directories

Path Synopsis
Package talib is a pure Go port of TA-Lib (http://ta-lib.org) Technical Analysis Library
Package talib is a pure Go port of TA-Lib (http://ta-lib.org) Technical Analysis Library

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL