types

package
v0.0.0-...-e3e60e4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Interval12h = Interval("12h")
View Source
var Interval15m = Interval("15m")
View Source
var Interval1d = Interval("1d")
View Source
var Interval1h = Interval("1h")
View Source
var Interval1m = Interval("1m")
View Source
var Interval1mo = Interval("1mo")
View Source
var Interval1ms = Interval("1ms")
View Source
var Interval1s = Interval("1s")
View Source
var Interval1w = Interval("1w")
View Source
var Interval2h = Interval("2h")
View Source
var Interval2w = Interval("2w")
View Source
var Interval30m = Interval("30m")
View Source
var Interval3d = Interval("3d")
View Source
var Interval3m = Interval("3m")
View Source
var Interval4h = Interval("4h")
View Source
var Interval5m = Interval("5m")
View Source
var Interval6h = Interval("6h")
View Source
var SupportedIntervals = map[Interval]int{
	Interval1s:  1,
	Interval1m:  1 * 60,
	Interval3m:  3 * 60,
	Interval5m:  5 * 60,
	Interval15m: 15 * 60,
	Interval30m: 30 * 60,
	Interval1h:  60 * 60,
	Interval2h:  60 * 60 * 2,
	Interval4h:  60 * 60 * 4,
	Interval6h:  60 * 60 * 6,
	Interval12h: 60 * 60 * 12,
	Interval1d:  60 * 60 * 24,
	Interval3d:  60 * 60 * 24 * 3,
	Interval1w:  60 * 60 * 24 * 7,
	Interval2w:  60 * 60 * 24 * 14,
	Interval1mo: 60 * 60 * 24 * 30,
}

Functions

func BeginningOfTheDay

func BeginningOfTheDay(t time.Time) time.Time

func MustParseUnixTimestamp

func MustParseUnixTimestamp(a string) time.Time

func Over24Hours

func Over24Hours(since time.Time) bool

func ParseInterval

func ParseInterval(input Interval) int

func ParseTimeWithFormats

func ParseTimeWithFormats(strTime string, formats []string) (time.Time, error)

Types

type Interval

type Interval string

func (Interval) Duration

func (i Interval) Duration() time.Duration

func (Interval) Milliseconds

func (i Interval) Milliseconds() int

Milliseconds is specially handled, for better precision for ms level interval, calling Seconds and Minutes directly might trigger panic error

func (Interval) Minutes

func (i Interval) Minutes() int

func (Interval) Seconds

func (i Interval) Seconds() int

func (Interval) String

func (i Interval) String() string

func (*Interval) UnmarshalJSON

func (i *Interval) UnmarshalJSON(b []byte) (err error)

type IntervalSlice

type IntervalSlice []Interval

func (IntervalSlice) StringSlice

func (s IntervalSlice) StringSlice() (slice []string)

type IntervalWindow

type IntervalWindow struct {
	// The interval of kline
	Interval Interval `json:"interval"`

	// The windows size of the indicator (for example, EWMA and SMA)
	Window int `json:"window"`

	// RightWindow is used by the pivot indicator
	RightWindow int `json:"rightWindow"`
}

IntervalWindow is used by the indicators

func (IntervalWindow) String

func (iw IntervalWindow) String() string

type IntervalWindowBandWidth

type IntervalWindowBandWidth struct {
	IntervalWindow
	BandWidth float64 `json:"bandWidth"`
}

type LooseFormatTime

type LooseFormatTime time.Time

LooseFormatTime parses date time string with a wide range of formats.

func ParseLooseFormatTime

func ParseLooseFormatTime(s string) (LooseFormatTime, error)

func (LooseFormatTime) MarshalJSON

func (t LooseFormatTime) MarshalJSON() ([]byte, error)

func (LooseFormatTime) Time

func (t LooseFormatTime) Time() time.Time

func (*LooseFormatTime) UnmarshalJSON

func (t *LooseFormatTime) UnmarshalJSON(data []byte) error

func (*LooseFormatTime) UnmarshalYAML

func (t *LooseFormatTime) UnmarshalYAML(unmarshal func(interface{}) error) error

type MillisecondTimestamp

type MillisecondTimestamp time.Time

func MustParseMillisecondTimestamp

func MustParseMillisecondTimestamp(a string) MillisecondTimestamp

func NewMillisecondTimestampFromInt

func NewMillisecondTimestampFromInt(i int64) MillisecondTimestamp

func (MillisecondTimestamp) String

func (t MillisecondTimestamp) String() string

func (MillisecondTimestamp) Time

func (t MillisecondTimestamp) Time() time.Time

func (*MillisecondTimestamp) UnmarshalJSON

func (t *MillisecondTimestamp) UnmarshalJSON(data []byte) error

type NanosecondTimestamp

type NanosecondTimestamp time.Time

func (NanosecondTimestamp) Time

func (t NanosecondTimestamp) Time() time.Time

func (*NanosecondTimestamp) UnmarshalJSON

func (t *NanosecondTimestamp) UnmarshalJSON(data []byte) error

type Time

type Time time.Time

Time type implements the driver value for sqlite

func NewTimeFromUnix

func NewTimeFromUnix(sec int64, nsec int64) Time

func (Time) After

func (t Time) After(time2 time.Time) bool

func (Time) Before

func (t Time) Before(time2 time.Time) bool

func (Time) Equal

func (t Time) Equal(time2 time.Time) bool

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

func (t *Time) Scan(src interface{}) error

func (Time) String

func (t Time) String() string

func (Time) Time

func (t Time) Time() time.Time

func (Time) Unix

func (t Time) Unix() int64

func (Time) UnixMilli

func (t Time) UnixMilli() int64

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the driver.Valuer interface see http://jmoiron.net/blog/built-in-interfaces/

type Timestamp

type Timestamp time.Time

Timestamp is used for parsing unix timestamp (seconds)

func (Timestamp) Format

func (t Timestamp) Format(layout string) string

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (Timestamp) String

func (t Timestamp) String() string

func (Timestamp) Time

func (t Timestamp) Time() time.Time

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(o []byte) error

Jump to

Keyboard shortcuts

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