category

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

知识库

1. 除权除息的详细计算方法

例如:某股票股权登记日的收盘价为18.00元,10股配3股,即每股配股数为0.3,配股价为每股6.00元,则次日股价为(18.00+6.00×0.3)÷(1+0.3)=15.23(元)。

计算除权除息价:

除权除息价=(股权登记日的收盘价-每股所分红利现金额+配股价×每股配股数)÷(1+每股送红股数+每股配股数);

例如:某股票股权登记日的收盘价为20.35元,每10股派发现金红利4.00元,送1股,配2股,配股价为5.50元/股,即每股分红0.4元,送0.1股,配0.2股,则次日除权除息价为(20.35-0.4+5.50×0.2)÷(1+0.1+0.2)=16.19(元)。

Documentation

Index

Constants

View Source
const (
	// CACHE_DIR_MODE 目录权限
	CACHE_DIR_MODE os.FileMode = 0755
	// CACHE_FILE_MODE 文件权限
	CACHE_FILE_MODE os.FileMode = 0644

	// DEBUG 调试开关
	DEBUG = false
	// CACHE_REPLACE 文件替换模式, 会用到os.TRUNC
	CACHE_REPLACE = os.O_CREATE | os.O_RDWR | os.O_TRUNC
	// CACHE_UPDATE 更新
	CACHE_UPDATE = os.O_CREATE | os.O_WRONLY
)
View Source
const (
	D_OK    = 0x00000000 // 数据正常
	D_ERROR = 0x40000000 // 数据错误
	D_ECODE = 0x00000001 // 代码错误
	D_ENET  = 0x00000002 // 网络异常
	D_EDATA = 0x00000004 // 数据错误
	D_EDISK = 0x00000008 // 写文件错误
	D_ENEED = 0x00000010 // 不需要更新
)
View Source
const (
	MARKET_SH string = "sh" // 上海
	MARKET_SZ string = "sz" // 深圳
	MARKET_BJ string = "bj" // 北京
	MARKET_HK string = "hk" // 香港
	MARKET_US string = "us" // 美国
)
View Source
const (
	// USEC_PER_SEC number of microseconds per second
	USEC_PER_SEC int64 = 1000000
	// MsecPerSec number of milliseconds per second
	MsecPerSec int64 = 1000
	// SecondOfDay 一天的秒数
	SecondOfDay int64 = 24 * 60 * 60
	// MillisecondsOfDay 一天的毫秒数
	MillisecondsOfDay int64 = SecondOfDay * MsecPerSec
	// RealTimenterval 实时数据间隔时间, 单位毫秒
	RealTimenterval int64 = 5 * 1000

	// NullState 正常状态, 字符串"01"
	NullState   = "00"
	NormalState = "01"

	// 历史数据获取的时间, 时, 分, 秒
	HistoryUpdateHour = 17
	HistoryUpdateMin  = 0
	HistoryUpdateSec  = 0

	CACHE_DATE = "20060102"   // 缓存日期
	INDEX_DATE = "2006-01-02" // 索引日期格式
	TDX_DATE   = "20060102"   // 通达信日期
	YearOnly   = "2006"
)
View Source
const (
	MARKET_CN_FIRST_DATE = "19901219" // 上证指数的第一个交易日
)

Variables

View Source
var (
	// DATA_ROOT_PATH 数据根路径
	DATA_ROOT_PATH = "~/.quant1x"
	// KLINE_PATH 日线数据文件路径
	KLINE_PATH = DATA_ROOT_PATH + "/day"
	// LOG_ROOT_PATH 日志路径
	LOG_ROOT_PATH = DATA_ROOT_PATH + "/logs"
)

Functions

func AssertIndexByMarketAndCode added in v1.2.6

func AssertIndexByMarketAndCode(marketId Market, code string) (isIndex bool)

AssertIndexByMarketAndCode 通过市场id和短码判断是否指数

func AssertIndexBySecurityCode added in v1.2.9

func AssertIndexBySecurityCode(securityCode string) (isIndex bool)

AssertIndexBySecurityCode 通过证券代码判断是否指数

func CodeIsIndex added in v0.8.16

func CodeIsIndex(securityCode string) bool

CodeIsIndex 证券代码是否指数

func GetMarketName added in v0.7.17

func GetMarketName(marketId Market) string

GetMarketName 通过市场ID取得市场名称缩写

func GetMonthDay added in v1.1.6

func GetMonthDay() (string, string)

GetMonthDay 获得当前月的初始和结束日期

func GetQuarterDay added in v1.1.6

func GetQuarterDay(months ...int) (string, string)

GetQuarterDay 获得当前季度的初始和结束日期

func GetWeekDay added in v1.1.6

func GetWeekDay() (string, string)

GetWeekDay 获得当前周的初始和结束日期

func MarketLimit added in v0.8.16

func MarketLimit(securityCode string) float64

MarketLimit 涨跌停板限制

Types

type Market added in v0.7.11

type Market = uint8
const (
	MARKET_ID_SHENZHEN Market = iota // 深圳
	MARKET_ID_SHANGHAI Market = 1    // 上海
	MARKET_ID_BEIJING  Market = 2    // 北京
	MARKET_ID_HONGKONG Market = 21   // 香港
	MARKET_ID_USA      Market = 22   // 美国
)

func DetectMarket added in v0.7.11

func DetectMarket(symbol string) (marketId Market, market string, code string)

DetectMarket 检测市场代码

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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