calendar

package
v2.3.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package calendar provides market calendar, with which you can check if the market is open at specific point of time. Though the package is generalized to support different market calendars, only the NASDAQ is implemented at this moment. You can create your own calendar if you provide the calendar json string. See nasdaq.go for the format.

Index

Constants

This section is empty.

Variables

View Source
var Nasdaq = New(NasdaqJson)

Nasdaq implements market calendar for the NASDAQ.

View Source
var NasdaqJson = `` /* 10869-byte string literal not displayed */

Functions

This section is empty.

Types

type Calendar

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

func New

func New(calendarJSON string) *Calendar

func (*Calendar) EpochIsMarketOpen

func (calendar *Calendar) EpochIsMarketOpen(epoch int64) bool

EpochIsMarketOpen returns true if epoch in calendar's timezone is in the market hours

func (*Calendar) EpochMarketClose

func (calendar *Calendar) EpochMarketClose(epoch int64) *time.Time

EpochMarketClose determines the market close time of the day that the supplied epoch timestamp occurs on. Returns nil if it is not a market day.

func (*Calendar) IsMarketDay

func (calendar *Calendar) IsMarketDay(t time.Time) bool

IsMarketDay check if today is a trading day or not.

func (*Calendar) IsMarketOpen

func (calendar *Calendar) IsMarketOpen(t time.Time) bool

IsMarketOpen returns true if t is in the market hours

func (*Calendar) MarketClose

func (calendar *Calendar) MarketClose(t time.Time) (mktClose *time.Time)

MarketClose determines the market close time of the day that the supplied timestamp occurs on. Returns nil if it is not a market day.

func (*Calendar) Tz

func (calendar *Calendar) Tz() *time.Location

type MarketState

type MarketState int
const (
	Closed MarketState = iota
	EarlyClose
)

type Time

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

func ParseTime

func ParseTime(tstr string) Time

Jump to

Keyboard shortcuts

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