banta

package module
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 7 Imported by: 8

README

Ban Technical Analysis

中文文档

banta is an event-based technical analysis framework. It updates and caches indicators on each K-line, and the indicator calculation results are reused globally. It aims to provide a high degree of freedom, high performance, simple and easy-to-use indicator framework.

Core Concept

Traditional technical analysis libraries such as ta-lib and pandas-ta are very popular and have undergone a lot of performance optimization. They are very fast when calculating hundreds or thousands of candlesticks at a time.

However, when using these libraries in your robot's real-time trading, you need to pass the data of the previous hundreds of candlesticks at the same time when you receive a new candlestick. If you are running more symbols or if you are running on 1m or even 1s, the calculation delay will be too large to be tolerated.

Many people have used TradingView. The PineScript it uses is an event-based technical analysis engine. It does not re-run the previous candlesticks when receiving a new candlestick, but uses the cached results from the previous candlesticks.

This is also the design concept of BanTA, based on events, running once for each candlestick, and using the cached results from the previous candlesticks.

How BanTA Works

In BanTA, Series sequence is the key type. Basically, all return values are sequences. The Series has the Data []float64 field, which records the values of the current indicator for each candlestick.

The most commonly used e.Close is the closing price sequence. e.Close.Get(0) is the current closing price of type float64;

Calculating the average is also simple: ma5 := ta.SMA(e.Close, 5), the returned ma5 is also a sequence;

Some indicators such as KDJ generally return two fields k and d kdjRes := ta.KDJ(e.High, e.Low, e.Close, 9, 3, 3).Cols, you can get an array of two sequences from Cols.

Supported indicators

Comparison of consistency with common indicator platform results
banta MyTT TA-lib Class TA-lib Metastock Pandas-TA TradingView
AvgPrice
Sum
SMA T1
EMA T1 T1 T2
EMABy1 T1 T2 T2 T3
RMA -- -- -- T1 --
VWMA -- -- --
WMA
HMA -- -- --
TR -- --
ATR T1 T2 T3
MACD T1 T2 T1 T3
RSI T1 T2 T3
KDJ T1 T2 T1 T3
Stoch -- --
BBANDS
Aroon -- T1
ADX -- T1 T2
ADXBy1 -- T1 T1 T2
PluMinDI -- -- --
PluMinDM -- -- --
ROC --
TNR/ER -- -- -- -- --
CCI
CMF -- -- --
KAMA -- ✔~ ✔~ T1 ✔~
WillR --
StochRSI -- ✔~
MFI
RMI -- -- -- -- ✔~
CTI -- -- -- T1
LinReg -- -- -- ?
CMO -- T1
CMOBy1 -- T1 T1 T1
CHOP -- -- -- T1
ALMA -- -- -- T1
Stiffness -- -- -- --
PercentRank -- -- -- -- ✔~
CRSI -- -- -- -- ✔~
CRSIBy1 -- community -- -- --
-- This platform does not have this indicator
✔ The calculation results are consistent with this platform
✔~ The calculation results are basically consistent with this platform (with some deviation)
Ti The calculation results are inconsistent with this platform

How to Use

package main
import (
	"fmt"
	ta "github.com/banbox/banta"
)

var envMap = make(map[string]*ta.BarEnv)

func OnBar(symbol string, timeframe string, bar *ta.Kline) {
	envKey := fmt.Sprintf("%s_%s", symbol, timeframe)
	e, ok := envMap[envKey]
	if !ok {
		e = &ta.BarEnv{
			TimeFrame: timeframe,
			BarNum:    1,
		}
		envMap[envKey] = e
	}
	e.OnBar(bar)
	ma5 := ta.SMA(e.Close, 5)
	ma30 := ta.SMA(e.Close, 30)
	atr := ta.ATR(e.High, e.Low, e.Close, 14).Get(0)
	xnum := ta.Cross(ma5, ma30)
	if xnum == 1 {
		// ma5 cross up ma30
		curPrice := e.Close.Get(0) // or bar.Close
		stopLoss := curPrice - atr
		fmt.Printf("open long at %f, stoploss: %f", curPrice, stopLoss)
	} else if xnum == -1 {
		// ma5 cross down ma30
		curPrice := e.Close.Get(0)
		fmt.Printf("close long at %f", curPrice)
	}
	kdjRes := ta.KDJ(e.High, e.Low, e.Close, 9, 3, 3).Cols
	k, d := kdjRes[0], kdjRes[1]
}

Documentation

Index

Constants

View Source
const (
	MinPenLen = 5
	CLInit    = 0 // 尚未确认有效
	CLValid   = 1 // 确认有效,尚未完成
	CLDone    = 2 // 确认有效,已完成,不会再改

	ParseLevelPen    = 1
	ParseLevelSeg    = 2
	ParseLevelCentre = 3
	ParseLevelTrend  = 4

	DefMaxPen = 1000 // 默认保存的最大笔数量
)
View Source
const (
	EvtNew    = 1
	EvtChange = 2
	EvtRemove = 3
)

Variables

View Source
var (
	ErrInvalidSeriesVal = errors.New("invalid val for Series")
	ErrGetDataOfMerged  = errors.New("try get Data of merged series var")
)

Functions

func Cross

func Cross(se *Series, obj2 interface{}) int

Cross 计算最近一次交叉的距离。如果两个都变化,则两个都必须是序列。或者一个是常数一个是序列 返回值:正数上穿,负数下穿,0表示未知或重合;abs(ret) - 1表示交叉点与当前bar的距离

func RemoveFromArr added in v0.1.3

func RemoveFromArr[T comparable](arr []T, it T, num int) []T

Types

type BarEnv

type BarEnv struct {
	TimeStart  int64
	TimeStop   int64
	Exchange   string
	MarketType string
	Symbol     string
	TimeFrame  string
	TFMSecs    int64 //周期的毫秒间隔
	BarNum     int
	MaxCache   int
	VNum       int
	Open       *Series
	High       *Series
	Low        *Series
	Close      *Series
	Volume     *Series
	Info       *Series
	Data       map[string]interface{}
}

func (*BarEnv) BarCount added in v0.1.8

func (e *BarEnv) BarCount(start int64) float64

func (*BarEnv) NewSeries added in v0.1.3

func (e *BarEnv) NewSeries(data []float64) *Series

func (*BarEnv) OnBar

func (e *BarEnv) OnBar(barMs int64, open, high, low, close, volume, info float64)

func (*BarEnv) Reset

func (e *BarEnv) Reset()

func (*BarEnv) TrimOverflow

func (e *BarEnv) TrimOverflow()

type CCentre added in v0.1.3

type CCentre struct {
	*CTwoPoint
	Overlap [2]float64 // 中枢重叠区间
	Range   [2]float64 // 中枢高低区间
	Dirt    float64
}

中枢

func (*CCentre) SetEnd added in v0.1.3

func (c *CCentre) SetEnd(p *CPoint)

type CGraph added in v0.1.3

type CGraph struct {
	Pens       []*CPen
	Segs       []*CSeg
	Trends     []*CTrend
	Bars       []*Kline
	Centres    []*CCentre
	OnPoint    func(p *CPoint, evt int)
	OnPen      func(p *CPen, evt int)
	OnSeg      func(p *CSeg, evt int)
	OnCentre   func(c *CCentre, evt int)
	BarNum     int // 最后一个bar的序号,从1开始
	ParseLevel int // 期望解析到的等级,0不限制
	ParseTo    int // 解析到K线的位置,序号,非索引
	MaxPen     int // 保存最大笔数量,默认1000
	// contains filtered or unexported fields
}

func (*CGraph) AddBar added in v0.1.3

func (c *CGraph) AddBar(e *BarEnv) *CGraph

func (*CGraph) AddBars added in v0.1.3

func (c *CGraph) AddBars(barId int, bars ...*Kline) *CGraph

func (*CGraph) AddPen added in v0.1.3

func (c *CGraph) AddPen(pen *CPen)

AddPen 添加到Pens

func (*CGraph) AddSeg added in v0.1.3

func (c *CGraph) AddSeg(seg *CSeg)

func (*CGraph) Bar added in v0.1.3

func (c *CGraph) Bar(v int) *Kline

Bar 返回指定序号的Bar

func (*CGraph) Dump added in v0.1.3

func (c *CGraph) Dump() []*DrawLine

func (*CGraph) NewPen added in v0.1.3

func (c *CGraph) NewPen(a, b *CPoint) *CPen

func (*CGraph) NewPoint added in v0.1.3

func (c *CGraph) NewPoint(dirt float64, price float64, barId int) *CPoint

NewPoint 返回新点,不添加到Points

func (*CGraph) Parse added in v0.1.3

func (c *CGraph) Parse()

func (*CGraph) Remove added in v0.1.3

func (c *CGraph) Remove(o interface{}) bool

type CPen added in v0.1.3

type CPen struct {
	*CTwoPoint
	Dirt float64 // 1向上   -1向下
	Prev *CPen
	Next *CPen
}

func (*CPen) Clear added in v0.1.3

func (p *CPen) Clear()

Clear 删除笔对前后的关联

func (*CPen) Clone added in v0.1.3

func (p *CPen) Clone() *CPen

type CPoint added in v0.1.3

type CPoint struct {
	Graph      *CGraph
	Dirt       float64 // 1顶分型,-1底分型
	BarId      int     // 此bar的序号
	Price      float64 // 价格
	StartPen   *CPen
	EndPen     *CPen
	StartSeg   *CSeg
	EndSeg     *CSeg
	StartTrend *CTrend
	EndTrend   *CTrend
	Next       *CPoint
}

func (*CPoint) Clear added in v0.1.3

func (p *CPoint) Clear()

func (*CPoint) Clone added in v0.1.3

func (p *CPoint) Clone() *CPoint

func (*CPoint) Move added in v0.1.3

func (p *CPoint) Move(barId int, price float64) *CPoint

func (*CPoint) PenTo added in v0.1.3

func (p *CPoint) PenTo(other *CPoint) *CPen

func (*CPoint) PensTo added in v0.1.3

func (p *CPoint) PensTo(end *CPoint) []*CPen

PensTo 从当前点出发,到指定点的所有笔

func (*CPoint) State added in v0.1.3

func (p *CPoint) State() int

State 分型状态,只返回CLInit/CLDone分别表示无效、有效

func (*CPoint) StrPoint added in v0.1.3

func (p *CPoint) StrPoint() string

type CSeg added in v0.1.3

type CSeg struct {
	*CTwoPoint
	Dirt    float64      // 1向上  0不确定  -1向下
	Feas    [][2]float64 // 特征序列
	InForce bool         // 标记此线段是否必须以顶底分型确认
	Temp    bool         // 标记此线段是假设的,需要再次检查是否有效
	Prev    *CSeg
	Next    *CSeg
	Centre  *CCentre // 此线段所属中枢,只对中间部分线段设置;一个线段只可属于一个中枢
}

线段

func (*CSeg) AddFeature added in v0.1.3

func (s *CSeg) AddFeature(f [2]float64)

AddFeature 将笔作为特征序列

func (*CSeg) CalcFeatures added in v0.1.3

func (s *CSeg) CalcFeatures()

CalcFeatures 重新计算线段的所有特征序列,当线段结束点修改时调用此方法

func (*CSeg) Clear added in v0.1.3

func (s *CSeg) Clear()

func (*CSeg) IsValid added in v0.1.3

func (s *CSeg) IsValid() bool

func (*CSeg) SetEnd added in v0.1.3

func (s *CSeg) SetEnd(p *CPoint)

func (*CSeg) SetLastFea added in v0.1.3

func (s *CSeg) SetLastFea(f [2]float64)

type CTrend added in v0.1.3

type CTrend struct {
	*CTwoPoint
	Dirt float64 // 1向上  0不确定  -1向下
	Prev *CTrend
	Next *CTrend
}

func (*CTrend) Clear added in v0.1.3

func (t *CTrend) Clear()

type CTwoPoint added in v0.1.3

type CTwoPoint struct {
	Graph *CGraph
	Start *CPoint
	End   *CPoint
	State int // 状态:0/1/2
}

func (*CTwoPoint) String added in v0.1.3

func (p *CTwoPoint) String() string

func (*CTwoPoint) ToFeature added in v0.1.3

func (p *CTwoPoint) ToFeature() [2]float64

type CrossLog

type CrossLog struct {
	Time    int64
	PrevVal float64
	Hist    []*XState // 正数表示上穿,负数下穿,绝对值表示BarNum
}

type DrawLine added in v0.1.3

type DrawLine struct {
	StartPos   int
	StartPrice float64
	StopPos    int
	StopPrice  float64
}

type Kline

type Kline struct {
	Time   int64
	Open   float64
	High   float64
	Low    float64
	Close  float64
	Volume float64
	Info   float64
}

type Series

type Series struct {
	ID    int
	Env   *BarEnv
	Data  []float64
	Cols  []*Series
	Time  int64
	More  interface{}
	Subs  map[string]map[int]*Series // 由此序列派生的;function:hash:object
	XLogs map[int]*CrossLog          // 此序列交叉记录
	// contains filtered or unexported fields
}

func ADL added in v0.1.3

func ADL(env *BarEnv) *Series

ADL Accumulation/Distribution Line

func ADX

func ADX(high *Series, low *Series, close *Series, period int) *Series

ADX Average Directional Index

suggest period: 14

return [maDX, plusDI, minusDI]

func ADXBy added in v0.1.3

func ADXBy(high *Series, low *Series, close *Series, period int, method int) *Series
ADXBy Average Directional Index

method=0 classic ADX method=1 TradingView "ADX and DI for v4"

suggest period: 14

return [maDX, plusDI, minusDI]

func ALMA added in v0.1.6

func ALMA(obj *Series, period int, sigma, distOff float64) *Series

ALMA Arnaud Legoux Moving Average

period: window size. Default: 10

sigma: Smoothing value. Default 6.0

distOff: min 0 (smoother), max 1 (more responsive). Default: 0.85

func ATR

func ATR(high *Series, low *Series, close *Series, period int) *Series

ATR Average True Range

suggest period: 14

func Aroon added in v0.1.3

func Aroon(high *Series, low *Series, period int) *Series

Aroon 阿隆指标

Reflects the distance between the highest price and the lowest price within a certain period of time. 反映了一段时间内出现最高价和最低价距离当前时间的远近。

AroonUp: (period - HighestBar(high, period+1)) / period * 100

AroonDn: (period - LowestBar(low, period+1)) / period * 100

Osc: AroonUp - AroonDn

return [AroonUp, Osc, AroonDn]

func AvgDev added in v0.1.3

func AvgDev(obj *Series, period int) *Series

AvgDev sum(abs(Vi - mean))/period

func AvgPrice added in v0.1.3

func AvgPrice(e *BarEnv) *Series

AvgPrice typical price=(h+l+c)/3

func BBANDS

func BBANDS(obj *Series, period int, stdUp, stdDn float64) *Series

BBANDS Bollinger Bands 布林带指标

period: 20, stdUp: 2, stdDn: 2

return [upper, mid, lower]

func CCI added in v0.1.3

func CCI(obj *Series, period int) *Series
CCI Commodity Channel Index

https://www.tradingview.com/support/solutions/43000502001-commodity-channel-index-cci/

suggest period: 20

func CHOP added in v0.1.6

func CHOP(e *BarEnv, period int) *Series

CHOP Choppiness Index

suggest period: 14

higher values equal more choppiness, while lower values indicate directional trending. 值越高,波动性越大,而值越低,则表示有方向性趋势。

func CMF added in v0.1.3

func CMF(env *BarEnv, period int) *Series

CMF Chaikin Money Flow

https://www.tradingview.com/scripts/chaikinmoneyflow/?solution=43000501974

suggest period: 20

func CMO added in v0.1.6

func CMO(obj *Series, period int) *Series

CMO Chande Momentum Oscillator

suggest period: 9

Same implementation as ta-lib For TradingView, use: CMOBy(obj, period, 1)

func CMOBy added in v0.1.6

func CMOBy(obj *Series, period int, maType int) *Series

CMOBy Chande Momentum Oscillator

suggest period: 9

maType: 0: ta-lib 1: tradingView

func CRSI added in v0.1.8

func CRSI(obj *Series, period, upDn, roc int) *Series

CRSI Connors RSI

suggest period:3, upDn:2, roc:100

Basically the same as TradingView

func CRSIBy added in v0.1.8

func CRSIBy(obj *Series, period, upDn, roc, vtype int) *Series

CRSIBy Connors RSI

suggest period:3, upDn:2, roc:100

vtype: 0 Calculation in TradingView method

1 Calculation in ta-lib community method:

chg = close_col / close_col.shift(1)
updown = np.where(chg.gt(1), 1.0, np.where(chg.lt(1), -1.0, 0.0))
rsi = ta.RSI(close_arr, timeperiod=3)
ud = ta.RSI(updown, timeperiod=2)
roc = ta.ROC(close_arr, 100)
crsi = (rsi + ud + roc) / 3

func CTI added in v0.1.4

func CTI(obj *Series, period int) *Series

CTI Correlation Trend Indicator

The Correlation Trend Indicator is an oscillator created by John Ehler in 2020. It assigns a value depending on how close prices in that range are to following a positively- or negatively-sloping straight line. Values range from -1 to 1. This is a wrapper for LinRegAdv.

suggest period: 20

func ChaikinOsc added in v0.1.3

func ChaikinOsc(env *BarEnv, short int, long int) *Series

ChaikinOsc Chaikin Oscillator

https://www.tradingview.com/support/solutions/43000501979-chaikin-oscillator/

short: 3, long: 10

func EMA

func EMA(obj *Series, period int) *Series

EMA Exponential Moving Average 指数移动均线

Latest value weight: 2/(n+1)

最近一个权重:2/(n+1)

func EMABy

func EMABy(obj *Series, period int, initType int) *Series

EMABy 指数移动均线 最近一个权重:2/(n+1) initType:0使用SMA初始化,1第一个有效值初始化

func ER added in v0.1.5

func ER(obj *Series, period int) *Series

ER Efficiency Ratio / Trend to Noise Ratio

suggest period: 8

func HL2 added in v0.1.6

func HL2(h, l *Series) *Series

func HLC3 added in v0.1.8

func HLC3(h, l, c *Series) *Series

HLC3 typical price=(h+l+c)/3

func HMA added in v0.1.4

func HMA(obj *Series, period int) *Series

HMA Hull Moving Average

suggest period: 9

func HeikinAshi

func HeikinAshi(e *BarEnv) *Series

HeikinAshi return [open,high,low,close]

func Highest

func Highest(obj *Series, period int) *Series

func HighestBar added in v0.1.3

func HighestBar(obj *Series, period int) *Series

func KAMA added in v0.1.3

func KAMA(obj *Series, period int) *Series

KAMA Kaufman Adaptive Moving Average

period: 10 fixed: (fast: 2, slow: 30)

func KAMABy added in v0.1.3

func KAMABy(obj *Series, period int, fast, slow int) *Series

KAMABy Kaufman Adaptive Moving Average

period: 10, fast: 2, slow: 30

func KDJ

func KDJ(high *Series, low *Series, close *Series, period int, sm1 int, sm2 int) *Series

KDJ alias: stoch indicator;

period: 9, sm1: 3, sm2: 3

return (K, D, RSV)

func KDJBy

func KDJBy(high *Series, low *Series, close *Series, period int, sm1 int, sm2 int, maBy string) *Series

KDJBy alias: stoch indicator;

period: 9, sm1: 3, sm2: 3

return (K, D, RSV)

func LinReg added in v0.1.4

func LinReg(obj *Series, period int) *Series

LinReg Linear Regression Moving Average

Linear Regression Moving Average (LINREG). This is a simplified version of a Standard Linear Regression. LINREG is a rolling regression of one variable. A Standard Linear Regression is between two or more variables.

func LinRegAdv added in v0.1.4

func LinRegAdv(obj *Series, period int, angle, intercept, degrees, r, slope, tsf bool) *Series

func Lowest

func Lowest(obj *Series, period int) *Series

func LowestBar added in v0.1.3

func LowestBar(obj *Series, period int) *Series

func MACD

func MACD(obj *Series, fast int, slow int, smooth int) *Series

MACD

Internationally, init_type=0 is used, while MyTT and China mainly use init_type=1 国外主流使用init_type=0,MyTT和国内主要使用init_type=1

fast: 12, slow: 26, smooth: 9

return [macd, signal]

func MACDBy

func MACDBy(obj *Series, fast int, slow int, smooth int, initType int) *Series

func MFI added in v0.1.3

func MFI(e *BarEnv, period int) *Series

MFI Money Flow Index

https://corporatefinanceinstitute.com/resources/career-map/sell-side/capital-markets/money-flow-index/

suggest period: 14

func PercentRank added in v0.1.8

func PercentRank(obj *Series, period int) *Series

PercentRank

calculates the percentile rank of a bar value in a data set.

func PluMinDI added in v0.1.8

func PluMinDI(high *Series, low *Series, close *Series, period int) *Series

PluMinDI

suggest period: 14

return [plus di, minus di]

func PluMinDM added in v0.1.8

func PluMinDM(high *Series, low *Series, close *Series, period int) *Series

PluMinDM

suggest period: 14

return [Plus DM, Minus DM]

func RMA

func RMA(obj *Series, period int) *Series

RMA Relative Moving Average 相对移动均线

The difference from EMA is: both the numerator and denominator are reduced by 1 Latest value weight: 1/n

和EMA区别是:分子分母都减一
最近一个权重:1/n

func RMABy

func RMABy(obj *Series, period int, initType int, initVal float64) *Series

RMABy Relative Moving Average 相对移动均线

The difference from EMA is: both the numerator and denominator are reduced by 1 The most recent weight: 1/n

和EMA区别是:分子分母都减一
最近一个权重:1/n

initType: 0 initialize with SMA, 1 initialize with the first valid value

initVal defaults to Nan

initType:0使用SMA初始化,1第一个有效值初始化

initVal 默认Nan

func RMI added in v0.1.3

func RMI(obj *Series, period int, montLen int) *Series

RMI Relative Momentum Index https://theforexgeek.com/relative-momentum-index/

period: 14, montLen: 3

func ROC

func ROC(obj *Series, period int) *Series

ROC rate of change

suggest period: 9

func RSI

func RSI(obj *Series, period int) *Series

RSI Relative Strength Index 计算相对强度指数

suggest period: 14

func RSI50 added in v0.1.3

func RSI50(obj *Series, period int) *Series

RSI50 Relative Strength Index 计算相对强度指数-50

func SMA

func SMA(obj *Series, period int) *Series

func StdDev

func StdDev(obj *Series, period int) *Series
StdDev Standard Deviation 标准差和均值

suggest period: 20

return [stddev,sumVal]

func StdDevBy

func StdDevBy(obj *Series, period int, ddof int) *Series
StdDevBy Standard Deviation

suggest period: 20

return [stddev,sumVal]

func Stiffness added in v0.1.6

func Stiffness(obj *Series, maLen, stiffLen, stiffMa int) *Series

Stiffness Indicator

maLen: 100, stiffLen: 60, stiffMa: 3

func Stoch added in v0.1.3

func Stoch(high, low, close *Series, period int) *Series

Stoch 100 * (close - lowest(low, period)) / (highest(high, period) - lowest(low, period))

use KDJ if you want to apply SMA/RMA to this

suggest period: 14

func StochRSI added in v0.1.3

func StochRSI(obj *Series, rsiLen int, stochLen int, maK int, maD int) *Series

StochRSI StochasticRSI

rsiLen: 14, stochLen: 14, maK: 3, maD: 3

return [fastK, fastD]

func Sum

func Sum(obj *Series, period int) *Series

func TD

func TD(obj *Series) *Series
TD Tom DeMark Sequence(狄马克序列)

over bought: 9,13

over sell: -9, -13

9和13表示超买;-9和-13表示超卖

func TR

func TR(high *Series, low *Series, close *Series) *Series

func UpDown added in v0.1.8

func UpDown(obj *Series, vtype int) *Series

UpDown

vtype: 0 TradingView (Count consecutive times)

1 classic (abs count up to 1)

func VWMA added in v0.1.3

func VWMA(price *Series, vol *Series, period int) *Series

VWMA Volume Weighted Moving Average 成交量加权平均价格

sum(price*volume)/sum(volume)

suggest period: 20

func WMA added in v0.1.4

func WMA(obj *Series, period int) *Series

WMA Weighted Moving Average.

the weighting factors decrease in arithmetic progression.

suggest period: 9

func WillR added in v0.1.3

func WillR(e *BarEnv, period int) *Series

WillR William's Percent R

suggest period: 14

func (*Series) Abs

func (s *Series) Abs() *Series

func (*Series) Add

func (s *Series) Add(obj interface{}) *Series

func (*Series) Append

func (s *Series) Append(obj interface{}) *Series

func (*Series) Back added in v0.1.3

func (s *Series) Back(num int) *Series

func (*Series) Cached

func (s *Series) Cached() bool

func (*Series) Cut

func (s *Series) Cut(keepNum int)

func (*Series) Get

func (s *Series) Get(i int) float64

func (*Series) Len

func (s *Series) Len() int

func (*Series) Max added in v0.1.8

func (s *Series) Max(obj interface{}) *Series

func (*Series) Min added in v0.1.8

func (s *Series) Min(obj interface{}) *Series

func (*Series) Mul

func (s *Series) Mul(obj interface{}) *Series

func (*Series) Range

func (s *Series) Range(start, stop int) []float64

Range 获取范围内的值。 start 起始位置,0是最近的 stop 结束位置,不含

func (*Series) Set added in v0.1.3

func (s *Series) Set(obj interface{}) *Series

func (*Series) Sub

func (s *Series) Sub(obj interface{}) *Series

func (*Series) To added in v0.1.3

func (s *Series) To(k string, v int) *Series

type XState

type XState struct {
	Sign   int
	BarNum int
}

Jump to

Keyboard shortcuts

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