tachart

package
v0.0.0-...-12052a3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateCandleLabel = errors.New("candles with duplicated labels")
)

Functions

This section is empty.

Types

type Candle

type Candle struct {
	Label string  // x-axis label for this candle. Usually a timestamp, e.g. "2018/1/24 08:00"
	O     float64 // open
	H     float64 // high
	L     float64 // low
	C     float64 // close
	V     float64 // volume
}

type Config

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

func NewConfig

func NewConfig() *Config

func (*Config) AddIndicator

func (c *Config) AddIndicator(vals ...Indicator) *Config

func (*Config) AddJSFunc

func (c *Config) AddJSFunc(js string) *Config

func (*Config) AddOverlay

func (c *Config) AddOverlay(vals ...Indicator) *Config

func (*Config) SetAssetsHost

func (c *Config) SetAssetsHost(assetsHost string) *Config

func (*Config) SetBottomRowContent

func (c *Config) SetBottomRowContent(content string, h int) *Config

func (*Config) SetChartHeight

func (c *Config) SetChartHeight(h int) *Config

func (*Config) SetChartWidth

func (c *Config) SetChartWidth(w int) *Config

func (*Config) SetDraggable

func (c *Config) SetDraggable(draggable bool) *Config

func (*Config) SetEventDescWrapWidth

func (c *Config) SetEventDescWrapWidth(w int) *Config

func (*Config) SetLeftColContent

func (c *Config) SetLeftColContent(content string, w int) *Config

func (*Config) SetPrecision

func (c *Config) SetPrecision(p int) *Config

func (*Config) SetRightColContent

func (c *Config) SetRightColContent(content string, w int) *Config

func (*Config) SetTheme

func (c *Config) SetTheme(t Theme) *Config

func (*Config) SetTopRowContent

func (c *Config) SetTopRowContent(content string, h int) *Config

func (*Config) UseRepoAssets

func (c *Config) UseRepoAssets() *Config

type Event

type Event struct {
	Type        EventType
	Label       string // x-axis label. Should match to one of the candles
	Description string // any user-defined description wants to appear on tooltip
	EventMark   EventMark
}

type EventMark

type EventMark struct {
	Name        string // mark label string
	FontColor   string // mark label font color
	BgColor     string // mark icon color
	BorderColor string // mark icon border color, default to BgColor if empty
	SymbolSize  int    // symbol size, use default if 0
}

type EventType

type EventType byte
const (
	Long        EventType = 'L'
	Short       EventType = 'S'
	Open        EventType = 'O'
	Close       EventType = 'C'
	CustomEvent EventType = 'X'
)

type Indicator

type Indicator interface {
	// contains filtered or unexported methods
}

func NewATR

func NewATR(n int) Indicator

func NewBBandsEMA

func NewBBandsEMA(n int, nStdDev float64) Indicator

func NewBBandsSMA

func NewBBandsSMA(n int, nStdDev float64) Indicator

func NewBar

func NewBar(name string, vals []float64) Indicator

func NewBoundedLine

func NewBoundedLine(name string, vals []float64, min, max, lowerMarker, upperMarker float64) Indicator

func NewEMA

func NewEMA(n int) Indicator

func NewLine

func NewLine(name string, vals []float64) Indicator

func NewLine2

func NewLine2(n0 string, vals0 []float64, n1 string, vals1 []float64) Indicator

func NewLine3

func NewLine3(n0 string, vals0 []float64, n1 string, vals1 []float64, n2 string, vals2 []float64) Indicator

func NewMACD

func NewMACD(fast, slow, signal int) Indicator

func NewRSI

func NewRSI(n int, oversold, overbought float64) Indicator

func NewSMA

func NewSMA(n int) Indicator

type TAChart

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

func New

func New(cfg Config) *TAChart

func (TAChart) GenStatic

func (c TAChart) GenStatic(cdls []Candle, events []Event, path string) error

type Theme

type Theme string
const (
	ThemeWhite         Theme = "white"
	ThemeDark          Theme = "dark"
	ThemeChalk         Theme = "chalk"
	ThemeEssos         Theme = "essos"
	ThemeInfographic   Theme = "infographic"
	ThemeMacarons      Theme = "macarons"
	ThemePurplePassion Theme = "purple-passion"
	ThemeRoma          Theme = "roma"
	ThemeRomantic      Theme = "romantic"
	ThemeShine         Theme = "shine"
	ThemeVintage       Theme = "vintage"
	ThemeWalden        Theme = "walden"
	ThemeWesteros      Theme = "westeros"
	ThemeWonderland    Theme = "wonderland"
)

Jump to

Keyboard shortcuts

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