types

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 6 Imported by: 0

README

Algotiqa Types

Datatypes common to all platform components

Documentation

Index

Constants

View Source
const NilValue int = 9999

Variables

This section is empty.

Functions

This section is empty.

Types

type Date

type Date int

func NewDate

func NewDate(year int, month int, day int) Date

func ParseIntDate

func ParseIntDate(value string, required bool) (Date, error)

func ToDate

func ToDate(t *time.Time) Date

func Today

func Today(loc *time.Location) Date

func (Date) AddDays

func (dt Date) AddDays(days int) Date

func (Date) Day

func (dt Date) Day() int

func (Date) Days

func (dt Date) Days(d Date) int

func (Date) IsNil

func (dt Date) IsNil() bool

func (Date) IsToday

func (dt Date) IsToday(loc *time.Location) bool

func (Date) IsValid

func (dt Date) IsValid() bool

func (Date) Month

func (dt Date) Month() int

func (Date) String

func (dt Date) String() string

func (Date) ToDateTime

func (dt Date) ToDateTime(endDay bool, loc *time.Location) time.Time

func (Date) Year

func (dt Date) Year() int

type Time

type Time int16

func NewTime

func NewTime(hours, mins int) Time

func ParseIntTime

func ParseIntTime(value string, required bool) (Time, error)

func ParseStringTime

func ParseStringTime(time string) (Time, error)

func (Time) Add

func (t Time) Add(time Time) Time

func (Time) AddMinutes

func (t Time) AddMinutes(mins int) Time

func (Time) AsMinutes added in v0.0.7

func (t Time) AsMinutes() int

func (Time) Hour

func (t Time) Hour() int

func (Time) IsNil

func (t Time) IsNil() bool

func (Time) IsValid

func (t Time) IsValid() bool

func (Time) Minute

func (t Time) Minute() int

func (Time) String

func (t Time) String() string

func (Time) Sub

func (t Time) Sub(time Time) Time

type TradingSession

type TradingSession struct {
	Slots []*TradingSlot `json:"slots"`
}

func NewTradingSession added in v0.0.5

func NewTradingSession(config string) (*TradingSession, error)

func (*TradingSession) CrossSessions added in v0.0.4

func (ts *TradingSession) CrossSessions(prev time.Time, next time.Time) bool

func (*TradingSession) CrossSlots added in v0.0.4

func (ts *TradingSession) CrossSlots(prev time.Time, next time.Time) bool

func (*TradingSession) FindSlot added in v0.0.6

func (ts *TradingSession) FindSlot(t time.Time) *TradingSlot

func (*TradingSession) Granularity added in v0.0.3

func (ts *TradingSession) Granularity() int

type TradingSlot

type TradingSlot struct {
	Day        int  `json:"day"`
	Open       Time `json:"open"`
	Close      Time `json:"close"`
	EndSession bool `json:"end"`
}

func (*TradingSlot) IsInside added in v0.0.4

func (s *TradingSlot) IsInside(dow int, t Time) bool

func (*TradingSlot) MinutesSinceOpen added in v0.0.8

func (s *TradingSlot) MinutesSinceOpen(t time.Time) int

Jump to

Keyboard shortcuts

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