candlestick

package
v0.0.0-...-5e10106 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCandlestickType  error = errors.New("struct-not-candlestick")
	ErrExchangeMismatch error = errors.New("exchange-mismatch")
	ErrPairMismatch     error = errors.New("pair-mismatch")
	ErrPeriodMismatch   error = errors.New("period-mismatch")
)
View Source
var (
	ErrInvalidExchange    = errors.New("invalid-exchange")
	ErrInvalidBaseSymbol  = errors.New("invalid-base-symbol")
	ErrInvalidQuoteSymbol = errors.New("invalid-quote-symbol")
	ErrInvalidPeriod      = errors.New("invalid-period")
)

Functions

This section is empty.

Types

type Candlestick

type Candlestick struct {
	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 (Candlestick) Equal

func (cs Candlestick) Equal(b Candlestick) bool

type ExportedList

type ExportedList struct {
	// in:body
	// Candlesticks exchange
	// Required: true
	Exchange string `json:"exchange"`
	// Candlesticks pair
	// Required: true
	Pair pair.Pair `json:"pair"`
	// Candlesticks period
	// Required: true
	Period string `json:"period"`
	// List of requeste candlesticks by time (RFC3339Nano)
	// Required: true
	// Example: {"2006-01-02T15:04:05.999Z":{"close":0,"high":0,"low":0,"open":0}}
	Candlesticks map[timestamp.Timestamp]Candlestick `json:"candlesticks,omitempty"`
}

swagger:model CandlestickList

type List

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

func NewList

func NewList(id ListID) *List

func (*List) Delete

func (l *List) Delete(t ...timestamp.Timestamp)

func (List) Exchange

func (l List) Exchange() string

func (List) First

func (l List) First() (timestamp.Timestamp, Candlestick, bool)

func (List) Get

func (l List) Get(ts timestamp.Timestamp) (Candlestick, bool)

func (*List) HasUncomplete

func (l *List) HasUncomplete() bool

func (List) ID

func (l List) ID() ListID

func (List) Last

func (l List) Last() (timestamp.Timestamp, Candlestick, bool)

func (List) Len

func (l List) Len() int

func (*List) Loop

func (l *List) Loop(callback func(ts timestamp.Timestamp, cs Candlestick) (bool, error)) error

func (List) MarshalJSON

func (l List) MarshalJSON() ([]byte, error)

func (*List) Merge

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

func (*List) MergeTimeSeries

func (l *List) MergeTimeSeries(ts timeseries.TimeSeries, options *timeseries.MergeOptions) error

func (List) Pair

func (l List) Pair() pair.Pair

func (List) Period

func (l List) Period() period.Period

func (*List) ReplaceUncomplete

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

func (*List) Set

func (l *List) Set(ts timestamp.Timestamp, c Candlestick) error

func (*List) UnmarshalJSON

func (l *List) UnmarshalJSON(data []byte) error

type ListID

type ListID struct {
	Exchange string
	Pair     pair.Pair
	Period   period.Period
}

type Request

type Request struct {
	// in:query
	//
	// Candlesticks exchange
	// Required: true
	Exchange string `json:"exchange" schema:"exchange,ruired"`
	// Candlesticks base symbol
	// Required: true
	BaseSymbol string `json:"base_symbol" schema:"base_symbol,ruired"`
	// Candlesticks quote symbol
	// Required: true
	QuoteSymbol string `json:"quote_symbol" schema:"quote_symbol,ruired"`
	// Candlesticks period
	// Required: true
	PeriodName string `json:"period_name" schema:"period_name,ruired"`
	// Start time for candlesticks
	// Required: false
	Start *timestamp.Timestamp `json:"start" schema:"start"`
	// End time for candlesticks
	// Required: false
	End *timestamp.Timestamp `json:"end" schema:"end"`
	// contains filtered or unexported fields
}

Candlesticks ruest payload swagger:parameters candlesticks

func (Request) Period

func (r Request) Period() period.Period

func (*Request) Process

func (r *Request) Process() error

func (Request) Validate

func (r Request) Validate() error

Jump to

Keyboard shortcuts

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