gota

package module
v0.0.0-...-5a1a59c Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BollingerBandsResult

type BollingerBandsResult struct {
	gomposable.Bands[float64]
	Basis float64 `json:"basis"`
}

type Indicator

type Indicator interface {
	IsWarm() bool
}

Indicator defined the common behaviour of all package indicators.

type IndicatorATR

type IndicatorATR struct {
	// contains filtered or unexported fields
}

IndcatorAtr calculates Average True Range. @see: https://www.investopedia.com/terms/a/atr.asp

func NewIndicatorATR

func NewIndicatorATR(window int) *IndicatorATR

NewIndicatorATR creates an instance of the IndicatorAtr for given `window`.

func (*IndicatorATR) Add

func (indicator *IndicatorATR) Add(candles ...gomposable.OHLCAble[float64]) (y float64, ok bool)

func (*IndicatorATR) IsWarm

func (indicator *IndicatorATR) IsWarm() bool

func (*IndicatorATR) MarshalJSON

func (indicator *IndicatorATR) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler interface.

func (*IndicatorATR) UnmarshalJSON

func (indicator *IndicatorATR) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface.

type IndicatorBollingerBands

type IndicatorBollingerBands struct {
	// contains filtered or unexported fields
}

IndicatorBollingerBands calculates Bollinger Bands. @see: https://www.investopedia.com/terms/b/bollingerbands.asp

func NewIndicatorBollingerBands

func NewIndicatorBollingerBands(window int, sigma float64) *IndicatorBollingerBands

NewIndicatorBollingerBands creates an instance of the IndicatorBollingerBands for given `window` and `sigma`.

func (*IndicatorBollingerBands) Add

func (indicator *IndicatorBollingerBands) Add(x ...float64) (y *BollingerBandsResult, ok bool)

Add records given `x...` and reports the bollinger bands. The retured `ok` value reports whether the indicator is ready to produce result.

func (*IndicatorBollingerBands) IsWarm

func (indicator *IndicatorBollingerBands) IsWarm() bool

IsWarm reports whether the indicator is ready to produce result.

func (*IndicatorBollingerBands) MarshalJSON

func (indicator *IndicatorBollingerBands) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler interface.

func (*IndicatorBollingerBands) UnmarshalJSON

func (indicator *IndicatorBollingerBands) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface.

type IndicatorEMA

type IndicatorEMA struct {
	// contains filtered or unexported fields
}

IndicatorEMA calculates exponential moving average.

EMA today = α Px today + (1 − α) EMA yesterday α = 2 / (window + 1)

func NewIndicatorEMA

func NewIndicatorEMA(window int) *IndicatorEMA

NewIndicatorEMA creates an instance of the IndicatorEMA for given `window`.

func (*IndicatorEMA) Add

func (indicator *IndicatorEMA) Add(x ...float64) (y float64, ok bool)

Add records given `x...` and reports the exponential moving average. The retured `ok` value reports whether the indicator is ready to produce result.

func (*IndicatorEMA) IsWarm

func (indicator *IndicatorEMA) IsWarm() bool

IsWarm reports whether the indicator is ready to produce result.

func (*IndicatorEMA) MarshalJSON

func (indicator *IndicatorEMA) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler interface.

func (*IndicatorEMA) UnmarshalJSON

func (indicator *IndicatorEMA) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface.

type IndicatorRMA

type IndicatorRMA struct {
	// contains filtered or unexported fields
}

IndicatorRMA calculates the TradingView `RMA` (It is the exponentially weighted moving average with alpha = 1 / length.). @see: https://www.tradingview.com/pine-script-reference/v5/#fun_ta{dot}rma

func NewIndicatorRMA

func NewIndicatorRMA(window int) *IndicatorRMA

func (*IndicatorRMA) Add

func (indicator *IndicatorRMA) Add(x ...float64) (y float64, ok bool)

func (*IndicatorRMA) IsWarm

func (indicator *IndicatorRMA) IsWarm() bool

func (*IndicatorRMA) MarshalJSON

func (indicator *IndicatorRMA) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler interface.

func (*IndicatorRMA) UnmarshalJSON

func (indicator *IndicatorRMA) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface.

type IndicatorSMA

type IndicatorSMA struct {
	// contains filtered or unexported fields
}

IndicatorSMA calculates simple moving average. @see: https://www.investopedia.com/terms/s/sma.asp

func NewIndicatorSMA

func NewIndicatorSMA(window int) *IndicatorSMA

NewIndicatorSMA create instance of IndicatorSMA for given `window`.

func (*IndicatorSMA) Add

func (indicator *IndicatorSMA) Add(x ...float64) (y float64, ok bool)

Add records given `x...` and reports the simple moving average. The retured `ok` value reports whether the indicator is ready to produce result.

func (*IndicatorSMA) IsWarm

func (indicator *IndicatorSMA) IsWarm() bool

IsWarm reports whether the indicator is ready to produce result.

func (*IndicatorSMA) MarshalJSON

func (indicator *IndicatorSMA) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler interface.

func (*IndicatorSMA) UnmarshalJSON

func (indicator *IndicatorSMA) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface.

type IndicatorTR

type IndicatorTR struct {
	// contains filtered or unexported fields
}

IndicatorTR calculate True Range.

func NewIndicatorTR

func NewIndicatorTR() *IndicatorTR

NewIndicatorTR creates an instance of the IndicatorTR.

func (*IndicatorTR) Add

func (indicator *IndicatorTR) Add(candles ...gomposable.OHLCAble[float64]) (y float64, ok bool)

func (*IndicatorTR) MarshalJSON

func (indicator *IndicatorTR) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler interface.

func (*IndicatorTR) UnmarshalJSON

func (indicator *IndicatorTR) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface.

type SamplerCandleDecimal

type SamplerCandleDecimal struct {
	// contains filtered or unexported fields
}

func NewCandleSamplerDecimal

func NewCandleSamplerDecimal(d time.Duration) *SamplerCandleDecimal

func (*SamplerCandleDecimal) OnPx

func (sampler *SamplerCandleDecimal) OnPx(px decimal.Decimal, t time.Time) (candle *gomposable.OHLCVT[decimal.Decimal], gotSlice bool)

func (*SamplerCandleDecimal) OnVolume

func (sampler *SamplerCandleDecimal) OnVolume(vol decimal.Decimal, t time.Time) (candle *gomposable.OHLCVT[decimal.Decimal], gotSlice bool)

func (*SamplerCandleDecimal) Overwrite

func (sampler *SamplerCandleDecimal) Overwrite(candle gomposable.OHLCVTAble[decimal.Decimal])

type SamplerCandleFloat64

type SamplerCandleFloat64 struct {
	// contains filtered or unexported fields
}

func NewCandleSamplerFloat64

func NewCandleSamplerFloat64(d time.Duration) *SamplerCandleFloat64

func (*SamplerCandleFloat64) OnPx

func (sampler *SamplerCandleFloat64) OnPx(px float64, t time.Time) (candle *gomposable.OHLCVT[float64], gotSlice bool)

func (*SamplerCandleFloat64) OnVolume

func (sampler *SamplerCandleFloat64) OnVolume(vol float64, t time.Time) (candle *gomposable.OHLCVT[float64], gotSlice bool)

func (*SamplerCandleFloat64) Overwrite

func (sampler *SamplerCandleFloat64) Overwrite(candle gomposable.OHLCVTAble[float64])

Jump to

Keyboard shortcuts

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