Documentation ¶
Index ¶
- Constants
- Variables
- func CanInitialize(lastModified ...time.Time) (toInit bool)
- func CanUpdate(lastModified ...time.Time) (updated bool)
- func CanUpdateInRealtime(lastModified ...time.Time) (updateInRealTime bool, status int)
- func CheckCallAuctionClose(timestamp time.Time) (canUpdate bool)
- func CheckCallAuctionOpen(timestamp time.Time) (canUpdate bool)
- func CheckCallAuctionTime(timestamp time.Time) (canUpdate bool)
- func CompareTime(t1, t2 string) (bool, error)
- func CurrentlyTrading(date ...string) bool
- func DateIsTradingDay(date ...string) bool
- func FixTradeDate(datetime string, format ...string) string
- func GetCurrentDate() (currentDate string)
- func GetCurrentlyDay() (currentlyDay string)
- func GetFrontTradeDay() string
- func GetLastDayForUpdate() string
- func GetTodayTimeByString(timeStr string) (time.Time, error)
- func IndexToday() string
- func IsHoliday(date string) bool
- func IsTimeInRange(timeStr, startStr, endStr string) (bool, error)
- func IsTrading(date ...string) bool
- func LastNDate(date string, n ...int) []string
- func LastTradeDate() string
- func Minutes(date ...string) int
- func NextTradeDate(date string) string
- func Today() string
- func TradeRange(start, end string) []string
- type Calendar
- type TimeRange
- type TimeStatus
Constants ¶
View Source
const ( CN_TransactionTimeFormat = "15:04" // 分笔成交时间格式 CN_SERVERTIME_FORMAT = "15:04:05.000" // 服务器时间格式 CN_SERVERTIME_SHORT_FORMAT = "15:04:05" // 服务器时间格式 )
View Source
const ( CN_MarketInitTime = "09:00:00.000" // A股数据初始化时间 CN_TradingStartTime = "09:15:00.000" // A股数据开始时间 CN_TradingSuspendBeginTime = "11:30:00.000" // A股午间休市开始时间 CN_TradingSuspendEndTime = "12:59:59.999" // A股午间休市结束时间 CN_TradingStopTime = "15:00:00.000" // A股数据结束时间 CN_CallAuctionAmBegin = "09:15:00.000" // 早盘集合竞价开始时间 CN_CallAuctionAmEnd = "09:27:59.999" // 早盘集合竞价结束时间 CN_CallAuctionPmBegin = "14:57:00.000" // 尾盘集合竞价开始时间 CN_CallAuctionPmEnd = "15:01:59.999" // 尾盘集合竞价结束时间 )
交易日时间相关常量
View Source
const ( BEGIN_A_AUCTION = "09:15:00" // A股上午集合竞价开始时间 END_A_AUCTION = "09:25:00" // A股上午集合竞价结束时间 END_A_AUCTION_SPE = "09:26:00" // A股上午集合竞价结束时间过一分钟 BEGIN_P_AUCTION = "14:57:00" // A股下午集合竞价开始时间 END_P_AUCTION = "15:01:00" // A股下午集合竞价结束时间 END_P_AUCTION_SPE = "15:02:00" // A股下午集合竞价结束时间过一分钟 )
集合竞价时间相关常量
View Source
const ( CN_DEFAULT_TOTALFZNUM = 240 // A股默认全天交易240分钟 BEGIN_A_AM_HOUR = 9 // A股开市-时 BEGIN_A_AM_MINUTE = 30 // A股开市-分 END_A_AM_HOUR = 11 // A股休市-时 END_A_AM_MINUTE = 30 // A股休市-分 BEGIN_A_PM_HOUR = 13 // A股开市-时 BEGIN_A_PM_MINUTE = 0 // A股开市-分 END_A_PM_HOUR = 15 // A股休市-时 END_A_PM_MINUTE = 0 // A股休市-分 )
分时数据相关常量
View Source
const (
TimeOnly = time.TimeOnly // 时分秒的格式
)
View Source
const (
TradingDayDateFormat = "2006-01-02" // 交易日历日期格式
)
Variables ¶
View Source
var (
CN_TOTALFZNUM = 0 // A股全天交易的分钟数
)
View Source
var (
ErrNoUpdateRequired = errors.New("No update required")
)
Functions ¶
func CanInitialize ¶
CanInitialize 数据是否初始化(One-time update)
func CanUpdateInRealtime ¶
CanUpdateInRealtime 能否实时更新
func CheckCallAuctionClose ¶
CheckCallAuctionClose 检查当前时间是否集合竞价阶段
func CheckCallAuctionOpen ¶
CheckCallAuctionOpen 检查当前时间是否集合竞价阶段
func CheckCallAuctionTime ¶
CheckCallAuctionTime 检查当前时间是否集合竞价阶段
func CompareTime ¶
CompareTime 比较两个时间字符串大小 如果t1 <= t2 返回true,否则返回false 如果格式不正确或转换错误,返回错误
func GetCurrentDate ¶
func GetCurrentDate() (currentDate string)
GetCurrentDate 获取数据有效的最后一个交易日, 以9点整划分
func GetCurrentlyDay ¶
func GetCurrentlyDay() (currentlyDay string)
GetCurrentlyDay 获取数据有效的最后一个交易日, 以9点15分划分
func GetTodayTimeByString ¶
GetTodayTimeByString 返回当天指定时刻的时间
func IsTimeInRange ¶
Types ¶
type TimeStatus ¶
type TimeStatus = int
const ( //ExchangeLastClosing TimeStatus = -2 // 隔日收盘收, 交易停止 ExchangePreMarket TimeStatus = -1 // 盘前 ExchangeSuspend TimeStatus = 0 // 休市中, 交易暂停 ExchangeTrading TimeStatus = 1 // 交易中 ExchangeCallAuction TimeStatus = 2 // 交易中, 集合竞价 ExchangeClosing TimeStatus = 3 // 当日收盘, 交易停止 )
Click to show internal directories.
Click to hide internal directories.