tradingdays

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2017 License: MIT Imports: 9 Imported by: 0

README

gogrs - tradingdays

GoDoc Build Status

Documentation

Overview

Package tradingdays - Check the day is open or not and at which period time 股市開休市判斷(支援非國定假日:颱風假)與當日區間判斷(盤中、盤後、盤後盤)

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadCSV

func DownloadCSV(replace bool)

DownloadCSV 更新開休市表

https://s3-ap-northeast-1.amazonaws.com/toomore/gogrs/list.csv 下載表更新,主要發生在非國定假日,如:颱風假。

func FindRecentlyOpened

func FindRecentlyOpened(date time.Time) time.Time

FindRecentlyOpened 回傳最近一個開市時間(UTC 0)

func IsOpen

func IsOpen(year int, month time.Month, day int) bool

IsOpen 判斷是否為開休日

Example
fmt.Println(IsOpen(2015, 4, 17))
fmt.Println(IsOpen(2015, 5, 1))
Output:

true
false

Types

type TimePeriod

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

TimePeriod 簡單計算時間是否在當日的開盤前、盤中、盤後盤、收盤的時間

相關時間:

  • 開盤前 00:00 ~ 09:00
  • 盤中 09:00 ~ 13:30
  • 盤後盤 13:30 ~ 14:30
  • 收盤 14:30 ~ 24:00

證交所會在 13:30 後產生一次報表,14:30 盤後盤零股交易後還會再產生一次報表。

func NewTimePeriod

func NewTimePeriod(date time.Time) *TimePeriod

NewTimePeriod 建立一個時間區間判斷

Example
var tp = NewTimePeriod(time.Date(2015, 5, 8, 20, 0, 0, 0, utils.TaipeiTimeZone))
fmt.Println(tp.AtBefore(), tp.AtOpen(), tp.AtAfterOpen(), tp.AtClose())
Output:

false false false true

func (TimePeriod) AtAfterOpen

func (t TimePeriod) AtAfterOpen() bool

AtAfterOpen 檢查是否為 盤後盤(1330-1430) 期間

func (TimePeriod) AtBefore

func (t TimePeriod) AtBefore() bool

AtBefore 檢查是否為 開盤前(0000-0900) 期間

func (TimePeriod) AtClose

func (t TimePeriod) AtClose() bool

AtClose 檢查是否為 收盤(1430-2400)期間

func (TimePeriod) AtOpen

func (t TimePeriod) AtOpen() bool

AtOpen 檢查是否為 開盤(0900-1330) 期間

Jump to

Keyboard shortcuts

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