data

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CNStockClosedDays = buildDaysMap(
	cnStockClosedDays2015,
	cnStockClosedDays2016,
	cnStockClosedDays2017,
	cnStockClosedDays2018,
	cnStockClosedDays2019,
	cnStockClosedDays2020,
	cnStockClosedDays2021,
	cnStockClosedDays2022,
	cnStockClosedDays2023,
	cnStockClosedDays2024,
	cnStockClosedDays2025,
	cnStockClosedDays2026,
)

Deprecated: 旧的显式休市日表实现,当前已由位图实现替代,保留仅用于过渡。

View Source
var CNStockOpenDays = map[base.Date]struct{}{}

Deprecated: 旧的显式开市日表实现,当前已由位图实现替代,保留仅用于过渡。

View Source
var CNStockTradeBitmaps = YearTradeBitmaps{
	2015: {
		Year: 2015,
		Bits: [6]uint64{
			17546252431090579952,
			17938936617515252985,
			9005479514664287868,
			4475726955660943166,
			11474746313552285599,
			33522118289359,
		},
	},
	2016: {
		Year: 2016,
		Bits: [6]uint64{
			18010985692485549304,
			8717266729624878716,
			4502748540540264254,
			11474746313567358879,
			14960745193605949379,
			34353245189095,
		},
	},
	2017: {
		Year: 2017,
		Bits: [6]uint64{
			4502748545304993596,
			11402688718724124575,
			14960745193635309519,
			16703744633674003431,
			17575244353683651059,
			8588311297273,
		},
	},
	2018: {
		Year: 2018,
		Bits: [6]uint64{
			11470700110777143198,
			14852658799360337871,
			16703743534162375655,
			17575244353691777523,
			18010994213696600313,
			4294155648636,
		},
	},
	2019: {
		Year: 2019,
		Bits: [6]uint64{
			14960744661062510542,
			16199341474334766055,
			17575244353154906611,
			8787622176845888761,
			9005497106839977596,
			28535356890942,
		},
	},
	2020: {
		Year: 2020,
		Bits: [6]uint64{
			16703744631585240038,
			13972364647500413427,
			18010149788770532601,
			9005497106850332284,
			4502748553361465150,
			67044236578719,
		},
	},
	2021: {
		Year: 2021,
		Bits: [6]uint64{
			18010741326026276088,
			6987884472714608252,
			4502748484705689406,
			11474746313567358879,
			14960745193622595343,
			34353245189095,
		},
	},
	2022: {
		Year: 2022,
		Bits: [6]uint64{
			9005497073564335736,
			3493942235283562302,
			11474746313533804447,
			10349059175211067343,
			16703744633657750503,
			17176622594547,
		},
	},
	2023: {
		Year: 2023,
		Bits: [6]uint64{
			4502748553295142716,
			10970343154228121503,
			14960692417080321999,
			16703744633674003431,
			17575244353683618291,
			8588311297273,
		},
	},
	2024: {
		Year: 2024,
		Bits: [6]uint64{
			11474609424369700766,
			13951938873886238671,
			16703744625084068839,
			17575244353691777523,
			18010994213679955169,
			57070713781884,
		},
	},
	2025: {
		Year: 2025,
		Bits: [6]uint64{
			16703744605890933734,
			16206150066434275827,
			18010994213683887353,
			9005497106850332284,
			4502748553394888510,
			31859864489887,
		},
	},
	2026: {
		Year: 2026,
		Bits: [6]uint64{
			17564055723367528944,
			16209554360604982521,
			9005494907827076732,
			4502748553425166142,
			11474746313552283551,
			33522118289359,
		},
	},
}

CNStockTradeBitmaps 保存中国 A 股各年的交易日真值位图。

View Source
var USStockTradeBitmaps = YearTradeBitmaps{
	2015: {
		Year: 2015,
		Bits: [6]uint64{
			17575173984947337714,
			18010994213432229113,
			8969468309831302780,
			4358633365349310270,
			11474746313567358879,
			33247240381903,
		},
	},
	2016: {
		Year: 2016,
		Bits: [6]uint64{
			18010959029328444664,
			9005497106849283708,
			4358633365345115966,
			11402688719529430943,
			14960745193638455247,
			33253733561063,
		},
	},
	2017: {
		Year: 2017,
		Bits: [6]uint64{
			4501622653518290748,
			11474745763811544991,
			14888687599599478735,
			16685730235164521447,
			17575244353691777523,
			8313433390265,
		},
	},
	2018: {
		Year: 2018,
		Bits: [6]uint64{
			11474183363613921182,
			14960745193621678031,
			16631687039635551207,
			17566237154437036531,
			18010994213700664569,
			21611463523932,
		},
	},
	2019: {
		Year: 2019,
		Bits: [6]uint64{
			14960463718660696014,
			16703727041487959015,
			17503186759653587443,
			18006490614073294073,
			9005497106850332284,
			28260478981950,
		},
	},
	2020: {
		Year: 2020,
		Bits: [6]uint64{
			16703603896185123814,
			17575244284972300787,
			17938936619662605561,
			8717266730698620540,
			4502748553425166142,
			66494480763807,
		},
	},
	2021: {
		Year: 2021,
		Bits: [6]uint64{
			18010959029328444664,
			9005497106716114556,
			4358633365345115966,
			11402688719529430943,
			14960745193638455247,
			34215806235367,
		},
	},
	2022: {
		Year: 2022,
		Bits: [6]uint64{
			9003245307036581500,
			4502747453913538366,
			11402684321480822687,
			14924716396619491279,
			16703744633674003431,
			16626866780531,
		},
	},
	2023: {
		Year: 2023,
		Bits: [6]uint64{
			4501622653518290748,
			11474746309272391583,
			14888685400576223183,
			16685730235164521447,
			17575244353691777523,
			8313433390265,
		},
	},
	2024: {
		Year: 2024,
		Bits: [6]uint64{
			11474183363613921182,
			14960745193621678031,
			16559625047551112167,
			17566237154437036531,
			18010994213700664569,
			56520957963900,
		},
	},
	2025: {
		Year: 2025,
		Bits: [6]uint64{
			16703603896185123558,
			17575235557598755315,
			17938934420639350009,
			9003245307036647036,
			4502748553425166142,
			31584986581919,
		},
	},
	2026: {
		Year: 2026,
		Bits: [6]uint64{
			17575173984947337714,
			18010994213432229113,
			8969466110808047228,
			4358633365349310270,
			11474746313567358879,
			33247240381903,
		},
	},
}

USStockTradeBitmaps 保存美股各年的交易日真值位图。

Functions

This section is empty.

Types

type YearTradeBitmap

type YearTradeBitmap struct {
	Year int
	Bits [6]uint64
}

YearTradeBitmap 表示某一年的交易日真值位图。 6 个 uint64 共 384 bit,足够覆盖一年 366 天。 Bits 中 bit 0 表示当年 1 月 1 日,bit 1 表示 1 月 2 日,以此类推。 bit=1 表示交易日,bit=0 表示非交易日。

type YearTradeBitmaps added in v1.0.0

type YearTradeBitmaps map[int]YearTradeBitmap

YearTradeBitmaps 表示按年份索引的交易日真值位图集合。

func (YearTradeBitmaps) IsTradeDay added in v1.0.0

func (bitmaps YearTradeBitmaps) IsTradeDay(day *base.CalendarDate) (bool, error)

IsTradeDay 判断给定日期是否为交易日。

func (YearTradeBitmaps) ListTradeDays added in v1.0.0

func (bitmaps YearTradeBitmaps) ListTradeDays(start, end *base.CalendarDate) ([]base.Date, error)

ListTradeDays 返回闭区间 [start, end] 内的交易日列表。

func (YearTradeBitmaps) OffsetTradeDay added in v1.0.0

func (bitmaps YearTradeBitmaps) OffsetTradeDay(day *base.CalendarDate, offset int) (base.Date, error)

OffsetTradeDay 返回交易日偏移结果。 offset > 0 时,返回 day 之后的第 offset 个交易日,不包含 day 当天。 offset < 0 时,返回 day 之前的第 -offset 个交易日,不包含 day 当天。 offset == 0 时,仅当 day 当天是交易日时返回 day,否则返回 error。

func (YearTradeBitmaps) SupportedYearRange added in v1.0.0

func (bitmaps YearTradeBitmaps) SupportedYearRange() (minYear, maxYear int, ok bool)

SupportedYearRange 返回位图数据覆盖的年份范围。

Jump to

Keyboard shortcuts

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