Documentation
¶
Index ¶
- Constants
- Variables
- func GetBjCodes() ([]string, error)
- func GetTHSDayKlineFull(code string, c *tdx.Client) ([3][]*Kline, error)
- func KlinesToCsv(filename string, code, name string, ks protocol.Klines) error
- func ListenCodesAndEquityHTTP(port int, codesOption []tdx.CodesOption, equityOption []tdx.EquityOption) error
- func ListenCodesHTTP(port int, op ...tdx.CodesOption) error
- func TradeToCsv(filename string, ts protocol.Trades) error
- type CodesHTTP
- type EquityHTTP
- type Factor
- type Factors
- type Income
- type Incomes
- type Kline
- type KlineHandler
- type KlineTable
- type Klines
- type PullKline
- type PullKlineConfig
- type PullKlineMysql
- type PullTrade
Constants ¶
View Source
const ( Minute = "minute" Minute5 = "5minute" Minute15 = "15minute" Minute30 = "30minute" Hour = "hour" Day = "day" Week = "week" Month = "month" Quarter = "quarter" Year = "year" )
View Source
const ( UrlSinaFactorHfq = "https://finance.sina.com.cn/realstock/company/%s/hfq.js" UrlSinaFactorQfq = "https://finance.sina.com.cn/realstock/company/%s/qfq.js" Sina_QFQ = "qfq" Sina_HFQ = "hfq" )
View Source
const ( UrlTHSDayKline = "http://d.10jqka.com.cn/v6/line/hs_%s/0%d/all.js" THS_BFQ uint8 = 0 //不复权 THS_QFQ uint8 = 1 //前复权 THS_HFQ uint8 = 2 //后复权 )
Variables ¶
View Source
var ( AllKlineType = []string{Minute, Minute5, Minute15, Minute30, Hour, Day, Week, Month, Quarter, Year} KlineTableMap = map[string]*KlineTable{ Minute: NewKlineTable(tableMinute, func(c *tdx.Client) KlineHandler { return c.GetKlineMinuteUntil }), Minute5: NewKlineTable(table5Minute, func(c *tdx.Client) KlineHandler { return c.GetKline5MinuteUntil }), Minute15: NewKlineTable(table15Minute, func(c *tdx.Client) KlineHandler { return c.GetKline15MinuteUntil }), Minute30: NewKlineTable(table30Minute, func(c *tdx.Client) KlineHandler { return c.GetKline30MinuteUntil }), Hour: NewKlineTable(tableHour, func(c *tdx.Client) KlineHandler { return c.GetKlineHourUntil }), Day: NewKlineTable(tableDay, func(c *tdx.Client) KlineHandler { return c.GetKlineDayUntil }), Week: NewKlineTable(tableWeek, func(c *tdx.Client) KlineHandler { return c.GetKlineWeekUntil }), Month: NewKlineTable(tableMonth, func(c *tdx.Client) KlineHandler { return c.GetKlineMonthUntil }), Quarter: NewKlineTable(tableQuarter, func(c *tdx.Client) KlineHandler { return c.GetKlineQuarterUntil }), Year: NewKlineTable(tableYear, func(c *tdx.Client) KlineHandler { return c.GetKlineYearUntil }), } )
View Source
var (
DefaultMinuteKlineExportTitle = []any{"日期", "时间", "开盘", "最高", "最低", "收盘", "成交量(手)", "成交额(元)"}
)
Functions ¶
func GetBjCodes ¶
func GetTHSDayKlineFull ¶
GetTHSDayKlineFull 获取[不复权,前复权,后复权]数据,并补充成交金额数据 前复权,和通达信对的上,和东方财富对不上 后复权,和通达信,东方财富都对不上
func ListenCodesAndEquityHTTP ¶ added in v0.0.59
func ListenCodesAndEquityHTTP(port int, codesOption []tdx.CodesOption, equityOption []tdx.EquityOption) error
func ListenCodesHTTP ¶
func ListenCodesHTTP(port int, op ...tdx.CodesOption) error
Types ¶
type EquityHTTP ¶ added in v0.0.59
type EquityHTTP struct {
// contains filtered or unexported fields
}
func DialEquityHTTP ¶ added in v0.0.59
func DialEquityHTTP(address string, spec ...string) (e *EquityHTTP, err error)
func (*EquityHTTP) Update ¶ added in v0.0.59
func (this *EquityHTTP) Update() error
type Factor ¶ added in v0.0.55
type Factors ¶ added in v0.0.55
type Factors []*Factor
func GetSinaFactor ¶ added in v0.0.55
func GetSinaFactorFull ¶ added in v0.0.55
type Income ¶
type Kline ¶
type Kline struct {
Code string `json:"code"` //代码
Date int64 `json:"date"` //时间节点 2006-01-02 15:00
Open protocol.Price `json:"open"` //开盘价
High protocol.Price `json:"high"` //最高价
Low protocol.Price `json:"low"` //最低价
Close protocol.Price `json:"close"` //收盘价
Volume int64 `json:"volume"` //成交量
Amount protocol.Price `json:"amount"` //成交额
InDate int64 `json:"inDate" xorm:"created"` //创建时间
}
type KlineHandler ¶
type KlineTable ¶
type KlineTable struct {
Kline `xorm:"extends"`
Handler func(c *tdx.Client) KlineHandler `xorm:"-"`
// contains filtered or unexported fields
}
func NewKlineTable ¶
func NewKlineTable(tableName string, handler func(c *tdx.Client) KlineHandler) *KlineTable
func (*KlineTable) TableName ¶
func (this *KlineTable) TableName() string
type PullKline ¶
type PullKline struct {
Config PullKlineConfig
// contains filtered or unexported fields
}
func NewPullKline ¶
func NewPullKline(cfg PullKlineConfig) *PullKline
type PullKlineConfig ¶
type PullKlineMysql ¶
type PullKlineMysql struct {
Config PullKlineConfig
DB *xorms.Engine
// contains filtered or unexported fields
}
func NewPullKlineMysql ¶
func NewPullKlineMysql(cfg PullKlineConfig) (*PullKlineMysql, error)
func (*PullKlineMysql) Name ¶
func (this *PullKlineMysql) Name() string
Click to show internal directories.
Click to hide internal directories.