Documentation
¶
Index ¶
- Variables
- type Symbol
- func (s Symbol) CountBetweenTimes(t1, t2 time.Time) int64
- func (s Symbol) Duration() time.Duration
- func (s Symbol) IsAligned(t time.Time) bool
- func (s Symbol) Opt() *Symbol
- func (s Symbol) RoundInterval(start, end *time.Time) (time.Time, time.Time)
- func (s Symbol) RoundTime(t time.Time) time.Time
- func (s Symbol) String() string
- func (s Symbol) Validate() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidPeriod is returned when the period is invalid. ErrInvalidPeriod = errors.New("invalid period") )
Functions ¶
This section is empty.
Types ¶
type Symbol ¶
type Symbol string
Symbol is a period symbol.
const ( // M1 is a period of 1 minute. M1 Symbol = "M1" // M3 is a period of 3 minutes. M3 Symbol = "M3" // M5 is a period of 5 minutes. M5 Symbol = "M5" // M15 is a period of 15 minutes. M15 Symbol = "M15" // M30 is a period of 30 minutes. M30 Symbol = "M30" // H1 is a period of 1 hour. H1 Symbol = "H1" // H2 is a period of 2 hours. H2 Symbol = "H2" // H4 is a period of 4 hours. H4 Symbol = "H4" // H6 is a period of 6 hours. H6 Symbol = "H6" // H8 is a period of 8 hours. H8 Symbol = "H8" // H12 is a period of 12 hours. H12 Symbol = "H12" // D1 is a period of 1 day. D1 Symbol = "D1" // D3 is a period of 3 days. D3 Symbol = "D3" // W1 is a period of 1 week. W1 Symbol = "W1" )
func FromDuration ¶
FromDuration converts a duration into its corresponding symbol.
func FromSeconds ¶
FromSeconds returns a period from seconds.
func FromString ¶
FromString converts a string in a symbol and checks if it's valid.
func UniqueArray ¶
UniqueArray returns a unique array of symbols.
func (Symbol) CountBetweenTimes ¶
CountBetweenTimes returns the number of candlesticks between times.
func (Symbol) RoundInterval ¶
RoundInterval takes an interval (represented by start, end) and returns the closest time before or equal to 'start' corresponding to the period and the closest time after or equal to 'end' corresponding to the period.
Example: if M1 then 1:30 to 2:30 will become 1:00 to 3:00.
Click to show internal directories.
Click to hide internal directories.