calendar

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 7, 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 NasdaqJson = `` /* 10869-byte string literal not displayed */

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	// contains filtered or unexported fields
}
var Nasdaq *Calendar = New(NasdaqJson)

Nasdaq implements market calendar for the NASDAQ.

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) 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) 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