category

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 7 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"   // 通达信日期
)

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 GetCodeList added in v0.7.11

func GetCodeList() []string

GetCodeList 加载全部股票代码

func GetMarket deprecated added in v0.7.11

func GetMarket(symbol string) string

GetMarket 判断股票ID对应的证券市场匹配规则

['50', '51', '60', '90', '110'] 为 sh
['00', '12','13', '18', '15', '16', '18', '20', '30', '39', '115'] 为 sz
['5', '6', '9'] 开头的为 sh, 其余为 sz

Deprecated: 不推荐使用

func GetMarketName added in v0.7.17

func GetMarketName(marketId Market) string

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

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 检测市场代码

func GetMarketId added in v0.7.11

func GetMarketId(symbol string) Market

GetMarketId 获得市场ID Deprecated: 不推荐使用

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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