sd

package
v0.0.0-...-db37da4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	His_Url     = "" /* 173-byte string literal not displayed */
	Stock_List  = "http://quote.eastmoney.com/stocklist.html"
	Real_HQ_Url = "http://qt.gtimg.cn/q=${code}"

	Root_Dir      = "zgcj"
	DLS_DIR       = "dls"
	OUT_DIR       = "output"
	HF_EXT        = "csv"
	Market_SH     = "sh"
	Market_SZ     = "sz"
	Var_Code      = "${code}"
	Var_Start     = "${start}"
	Var_End       = "${end}"
	Code_Regx_Exp = "(6|0|3)[\\d]{5}"

	ENC_CODE = "gbk"
	R_HQ_SEP = "\n"
)
View Source
const (
	RHQ_T = "~"
	RHQ_Q = "\""
)
View Source
const (
	C_Step int = 60
	P_SH       = '6'
)

Variables

This section is empty.

Functions

func Backup

func Backup(days int)

func BackupCodes

func BackupCodes()

func BackupDays

func BackupDays(days int) bool

func DirCodesPath

func DirCodesPath() string

func DirHisPath

func DirHisPath(code string) string

func GetReal

func GetReal(isS bool, code []string) (string, error)

func GetStockCodes

func GetStockCodes() ([]string, error)

获取所有股票的代码

func ReadCodes

func ReadCodes() ([]string, error)

func SplitRealStr

func SplitRealStr(str string) map[string][]string

func StockIsSh

func StockIsSh(code string) bool

func ValidCodes

func ValidCodes(codes []string) []string

Types

type By

type By func(t1, t2 *DayLine) bool

func ByAmp

func ByAmp(asc bool) By

func ByNad

func ByNad(asc bool) By

func ByVolume

func ByVolume(asc bool) By

type DayLine

type DayLine struct {
	UTIME      time.Time //更新时间
	TCLOSE     float64   //收盘价
	HIGH       float64   //最高价
	LOW        float64   //最低价
	TOPEN      float64   //开盘价
	LCLOSE     float64   //前收盘
	CHG        float64   //涨跌额
	PCHG       float64   //涨跌幅
	TURNOVER   float64   //换手率
	VOTURNOVER float64   //成交量
	VATURNOVER float64   //成交金额
	TCAP       float64   //总市值
	MCAP       float64   //流通市值
}

股票日线行情

func (DayLine) GetAmplitude

func (this DayLine) GetAmplitude() float64

获取振幅

func (DayLine) GetAvgPrice

func (this DayLine) GetAvgPrice() float64

获取平均成交价格

func (DayLine) GetNADeviation

func (this DayLine) GetNADeviation() float64

(现价-均价)/均价

func (DayLine) GetQuoteChange

func (this DayLine) GetQuoteChange() string

获取涨跌幅

func (DayLine) String

func (this DayLine) String() string

type DayLines

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

func (*DayLines) FindLowestDay

func (this *DayLines) FindLowestDay(days int) (*DayLine, int)

func (*DayLines) Get

func (this *DayLines) Get(fromIndex, endIndex int) []DayLine

func (*DayLines) GetHighestPrice

func (this *DayLines) GetHighestPrice(days int) float64

func (*DayLines) GetLowestPrice

func (this *DayLines) GetLowestPrice(days int) float64

func (*DayLines) Len

func (this *DayLines) Len() int

func (*DayLines) Less

func (this *DayLines) Less(i, j int) bool

func (*DayLines) Size

func (this *DayLines) Size() int

func (*DayLines) Sorts

func (this *DayLines) Sorts(bys ...By)

func (*DayLines) Swap

func (this *DayLines) Swap(i, j int)

type NowLine

type NowLine struct {
	NDAY   *DayLine
	HLIMIT float64 //涨停价
	LLIMIT float64 //跌停价
	PEV    float64 //市盈率
	PBV    float64 //市净率
	AMP    float64 //振幅
}

func NewNowLine

func NewNowLine(hqs []string) *NowLine

func (NowLine) String

func (this NowLine) String() string

type Stock

type Stock struct {
	Code string
	Name string

	Now    *NowLine
	Before *DayLines
	// contains filtered or unexported fields
}

func NewStock

func NewStock(code string) *Stock

func (*Stock) ReadHistory

func (this *Stock) ReadHistory() bool

func (Stock) String

func (this Stock) String() string

func (*Stock) UpdateNow

func (this *Stock) UpdateNow(hqs []string)

type StockLowest

type StockLowest struct {
	Code    string
	DevAmp  float64
	DevDays int
	Low     *DayLine
}

type StockLowests

type StockLowests []StockLowest

func (StockLowests) Len

func (c StockLowests) Len() int

func (StockLowests) Less

func (c StockLowests) Less(i, j int) bool

func (StockLowests) Swap

func (c StockLowests) Swap(i, j int)

type Stocks

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

func NewStocks

func NewStocks() (*Stocks, error)

func (*Stocks) DropMost

func (this *Stocks) DropMost(days int)

跌幅最大

func (*Stocks) Get

func (this *Stocks) Get(code string) *Stock

func (*Stocks) GetStocks

func (this *Stocks) GetStocks() []*Stock

func (*Stocks) UpdateHistory

func (this *Stocks) UpdateHistory() int

func (*Stocks) UpdateNow

func (this *Stocks) UpdateNow() int

Jump to

Keyboard shortcuts

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