candlestick

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPeriodMismatch   = errors.New("period-mismatch")
	ErrCandlestickType  = errors.New("struct-not-candlestick")
	ErrExchangeMismatch = errors.New("exchange-mismatch")
	ErrPairMismatch     = errors.New("pair-mismatch")
)
View Source
var (
	ErrInvalidPriceType = errors.New("invalid-price-type")
)

Functions

This section is empty.

Types

type Candlestick

type Candlestick struct {
	Time       time.Time `bson:"time"    json:"time,omitempty"`
	Open       float64   `bson:"open"     json:"open,omitempty"`
	High       float64   `bson:"high"     json:"high,omitempty"`
	Low        float64   `bson:"low"      json:"low,omitempty"`
	Close      float64   `bson:"close"    json:"close,omitempty"`
	Volume     float64   `bson:"volume"   json:"volume,omitempty"`
	Uncomplete bool      `bson:"complete" json:"uncomplete,omitempty"`
}

func MergeListIntoOneCandlestick

func MergeListIntoOneCandlestick(csl *List, per period.Symbol) (time.Time, Candlestick)

func (Candlestick) Equal

func (cs Candlestick) Equal(b Candlestick) bool

func (Candlestick) Price

func (cs Candlestick) Price(p Price) float64

func (Candlestick) String

func (cs Candlestick) String() string

type List

type List struct {
	Exchange string
	Pair     string
	Period   period.Symbol
	timeserie.TimeSerie[Candlestick]
}

func NewList

func NewList(exchange, pair string, period period.Symbol) *List

func NewListFrom

func NewListFrom(l *List) *List

func (List) Extract

func (l List) Extract(start, end time.Time, limit uint) *List

func (*List) FillMissing

func (l *List) FillMissing(start, end time.Time, filling Candlestick) error

FillMissing will add the 'filling' candlestick at each interval between 'start' included and 'end' included when there is a missing candlestick at the tested interval.

func (List) GetMissingRange

func (cl List) GetMissingRange(start, end time.Time, limit uint) []timeserie.TimeRange

func (List) GetMissingTimes

func (cl List) GetMissingTimes(start, end time.Time, limit uint) []time.Time

GetMissingTimes returns an array of missing time in the candlestick list

func (List) GetUncompleteRange

func (cl List) GetUncompleteRange() []timeserie.TimeRange

func (List) GetUncompleteTimes

func (cl List) GetUncompleteTimes() []time.Time

GetUncompleteTimes returns an array of time from candlesticks that are marked as uncomplete (i.e. data pulled when candlestick covering time was not complete)

func (*List) Loop

func (l *List) Loop(f func(Candlestick) (bool, error)) error

func (*List) Merge

func (l *List) Merge(l2 *List, options *timeserie.MergeOptions) error

func (*List) MustSet

func (l *List) MustSet(c Candlestick) *List

func (*List) ReplaceUncomplete

func (l *List) ReplaceUncomplete(l2 *List)

func (*List) Set

func (l *List) Set(c Candlestick) error

func (List) String

func (l List) String() string

func (List) ToArray

func (cl List) ToArray() []Candlestick

type Price

type Price string
const (
	PriceIsOpen  Price = "open"
	PriceIsHigh  Price = "high"
	PriceIsLow   Price = "low"
	PriceIsClose Price = "close"
)

func (Price) String

func (pt Price) String() string

func (Price) Validate

func (pt Price) Validate() error

Jump to

Keyboard shortcuts

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