Documentation
¶
Index ¶
- Constants
- Variables
- func IntegerDay(t time.Time) time.Time
- func NewHostDial(hosts []string) ios.DialFunc
- func NewRandomDial(hosts []string) ios.DialFunc
- func NewRangeDial(hosts []string) ios.DialFunc
- func NewTCPDial(addr string) ios.DialFunc
- func NewTimer(spec string, retry int, up Updater) error
- func WithDebug(b ...bool) client.Option
- func WithLevel(level int) client.Option
- func WithRedial(b ...bool) client.Option
- type Client
- func Dial(addr string, op ...client.Option) (cli *Client, err error)
- func DialDefault(op ...client.Option) (cli *Client, err error)
- func DialHosts(hosts []string, op ...client.Option) (cli *Client, err error)
- func DialHostsRandom(hosts []string, op ...client.Option) (cli *Client, err error)
- func DialHostsRange(hosts []string, op ...client.Option) (cli *Client, err error)
- func DialWith(dial ios.DialFunc, op ...client.Option) (cli *Client, err error)
- func (this *Client) GetCallAuction(code string) (*protocol.CallAuctionResp, error)
- func (this *Client) GetCode(exchange protocol.Exchange, start uint16) (*protocol.CodeResp, error)
- func (this *Client) GetCodeAll(exchange protocol.Exchange) (*protocol.CodeResp, error)
- func (this *Client) GetCount(exchange protocol.Exchange) (*protocol.CountResp, error)
- func (this *Client) GetETFCodeAll() ([]string, error)
- func (this *Client) GetGbbq(code string) (*protocol.GbbqResp, error)
- func (this *Client) GetGbbqAll() (map[string][]*protocol.Gbbq, error)
- func (this *Client) GetHistoryMinute(date, code string) (*protocol.MinuteResp, error)
- func (this *Client) GetHistoryMinuteTrade(date, code string, start, count uint16) (*protocol.TradeResp, error)
- func (this *Client) GetHistoryMinuteTradeDay(date, code string) (*protocol.TradeResp, error)
- func (this *Client) GetHistoryTrade(date, code string, start, count uint16) (*protocol.TradeResp, error)
- func (this *Client) GetHistoryTradeBefore(code string, w *Workday, before time.Time) (protocol.Trades, error)
- func (this *Client) GetHistoryTradeDay(date, code string) (*protocol.TradeResp, error)
- func (this *Client) GetHistoryTradeFull(code string, w *Workday) (protocol.Trades, error)
- func (this *Client) GetIndex(Type uint8, code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndex5Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndex15Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndex30Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndex60Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndexAll(Type uint8, code string) (*protocol.KlineResp, error)
- func (this *Client) GetIndexCodeAll() ([]string, error)
- func (this *Client) GetIndexDay(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndexDayAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetIndexDayUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetIndexMinute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetIndexMonthAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetIndexQuarterAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetIndexUntil(Type uint8, code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetIndexWeekAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetIndexYearAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKline(Type uint8, code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKline5Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKline5MinuteAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKline5MinuteUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKline15Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKline15MinuteAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKline15MinuteUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKline30Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKline30MinuteAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKline30MinuteUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKline60Minute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKline60MinuteAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKline60MinuteUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineAll(Type uint8, code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineDay(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineDayAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineDayUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineHour(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineHourAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineHourUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineMinute(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineMinuteAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineMinuteUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineMonth(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineMonthAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineMonthUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineQuarter(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineQuarterAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineQuarterUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineUntil(Type uint8, code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineWeek(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineWeekAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineWeekUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetKlineYear(code string, start, count uint16) (*protocol.KlineResp, error)
- func (this *Client) GetKlineYearAll(code string) (*protocol.KlineResp, error)
- func (this *Client) GetKlineYearUntil(code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
- func (this *Client) GetMinute(code string) (*protocol.MinuteResp, error)
- func (this *Client) GetMinuteTrade(code string, start, count uint16) (*protocol.TradeResp, error)
- func (this *Client) GetMinuteTradeAll(code string) (*protocol.TradeResp, error)
- func (this *Client) GetQuote(codes ...string) (protocol.QuotesResp, error)
- func (this *Client) GetStockCodeAll() ([]string, error)
- func (this *Client) GetTrade(code string, start, count uint16) (*protocol.TradeResp, error)
- func (this *Client) GetTradeAll(code string) (*protocol.TradeResp, error)
- func (this *Client) SendFrame(f *protocol.Frame, cache ...any) (any, error)
- func (this *Client) SetTimeout(t time.Duration)
- type CodeModel
- type CodeModels
- type Codes
- type CodesBase
- func (this *CodesBase) Get(code string) *CodeModel
- func (this *CodesBase) GetETFCodes(limits ...int) []string
- func (this *CodesBase) GetETFs(limits ...int) CodeModels
- func (this *CodesBase) GetIndexCodes(limits ...int) []string
- func (this *CodesBase) GetIndexes(limits ...int) CodeModels
- func (this *CodesBase) GetName(code string) string
- func (this *CodesBase) GetStockCodes(limits ...int) []string
- func (this *CodesBase) GetStocks(limits ...int) CodeModels
- func (this *CodesBase) Iter() iter.Seq2[string, *CodeModel]
- func (this *CodesBase) Update(ls []*CodeModel)
- type CodesOption
- func WithCodesClient(c *Client) CodesOption
- func WithCodesDB(db *xorms.Engine) CodesOption
- func WithCodesDialClient(dial DialClientFunc) CodesOption
- func WithCodesDialDB(dial DialDBFunc) CodesOption
- func WithCodesOption(op ...CodesOption) CodesOption
- func WithCodesRetry(retry int) CodesOption
- func WithCodesSpec(spec string) CodesOption
- type DialClientFunc
- type DialCodesFunc
- type DialDBFunc
- type DialGbbqFunc
- type DialPoolFunc
- type DialResult
- type DialWorkdayFunc
- type Gbbq
- func (this *Gbbq) All() map[string][]*protocol.Gbbq
- func (this *Gbbq) GetEquity(code string, t time.Time) *protocol.Equity
- func (this *Gbbq) GetFactors(code string, ks protocol.Klines) []*protocol.Factor
- func (this *Gbbq) GetTurnover(code string, t time.Time, volume int64) float64
- func (this *Gbbq) GetXRXDs(code string) protocol.XRXDs
- func (this *Gbbq) Update() error
- type GbbqOption
- func WithGbbqClient(c *Client) GbbqOption
- func WithGbbqDB(db *xorms.Engine) GbbqOption
- func WithGbbqDialClient(dial DialClientFunc) GbbqOption
- func WithGbbqDialDB(dial func() (*xorms.Engine, error)) GbbqOption
- func WithGbbqOption(op ...GbbqOption) GbbqOption
- func WithGbbqRetry(retry int) GbbqOption
- func WithGbbqSpec(spec string) GbbqOption
- type ICodes
- type IGbbq
- type IPool
- type Manage
- type Option
- func WithClients(clients int) Option
- func WithCodes(codes ICodes) Option
- func WithDialCodes(dial DialCodesFunc) Option
- func WithDialGbbq(dial DialGbbqFunc) Option
- func WithDialGbbqDefault() Option
- func WithDialPool(dial DialPoolFunc) Option
- func WithDialWorkday(dial DialWorkdayFunc) Option
- func WithGbbq(gbbq IGbbq) Option
- func WithOption(op ...Option) Option
- func WithPool(pool IPool) Option
- func WithWorkday(w *Workday) Option
- type Pool
- type UpdateModel
- type Updated
- type Updater
- type Workday
- func (this *Workday) Is(t time.Time) bool
- func (this *Workday) Iter(start, end time.Time, desc ...bool) iter.Seq[time.Time]
- func (this *Workday) IterYear(year int, desc ...bool) iter.Seq[time.Time]
- func (this *Workday) Range(start, end time.Time, f func(t time.Time) bool)
- func (this *Workday) RangeYear(year int, f func(t time.Time) bool)
- func (this *Workday) TodayIs() bool
- func (this *Workday) Update() error
- type WorkdayModel
- type WorkdayOption
- func WithWorkdayClient(c *Client) WorkdayOption
- func WithWorkdayDB(db *xorms.Engine) WorkdayOption
- func WithWorkdayDialClient(dial DialClientFunc) WorkdayOption
- func WithWorkdayDialDB(dial DialDBFunc) WorkdayOption
- func WithWorkdayOption(op ...WorkdayOption) WorkdayOption
- func WithWorkdayRetry(retry int) WorkdayOption
- func WithWorkdaySpec(spec string) WorkdayOption
Constants ¶
const ( LevelNone = common.LevelNone LevelDebug = common.LevelDebug LevelWrite = common.LevelWrite LevelRead = common.LevelRead LevelInfo = common.LevelInfo LevelError = common.LevelError LevelAll = common.LevelAll )
const ( DefaultClients = 1 DefaultRetry = 3 DefaultDataDir = "./data" DefaultDatabaseDir = "./data/database" DefaultCodesSpec = "0 1 9 * * *" DefaultWorkdaySpec = "0 3 9 * * *" DefaultGbbqSpec = "0 5 9 * * *" )
Variables ¶
var ( // Hosts 所有服务器地址(2024-11-30测试通过) Hosts = func() []string { lenSH := len(SHHosts) lenBJ := len(BJHosts) lenGZ := len(GZHosts) lenWH := len(WHHosts) ls := make([]string, lenSH+lenBJ+lenGZ+lenWH) copy(ls[:lenSH], SHHosts) copy(ls[lenSH:lenSH+lenBJ], BJHosts) copy(ls[lenSH+lenBJ:lenSH+lenBJ+lenGZ], GZHosts) copy(ls[lenSH+lenBJ+lenGZ:lenSH+lenBJ+lenGZ+lenWH], WHHosts) return ls }() // SHHosts 上海服务器地址 SHHosts = []string{ "124.71.187.122", "122.51.120.217", "111.229.247.189", "124.70.176.52", "123.60.186.45", "122.51.232.182", "118.25.98.114", "124.70.199.56", "121.36.225.169", "123.60.70.228", "123.60.73.44", "124.70.133.119", "124.71.187.72", "123.60.84.66", } // BJHosts 北京服务器地址 BJHosts = []string{ "121.36.54.217", "121.36.81.195", "123.249.15.60", "124.70.75.113", "120.46.186.223", "124.70.22.210", "139.9.133.247", } // GZHosts 广州服务器地址,客户端上可能显示深圳 GZHosts = []string{ "124.71.85.110", "139.9.51.18", "139.159.239.163", "124.71.9.153", "116.205.163.254", "116.205.171.132", "116.205.183.150", "111.230.186.52", "110.41.4.4", "110.41.2.72", "110.41.154.219", "110.41.147.114", } // WHHosts 武汉服务器地址 WHHosts = []string{ "119.97.185.59", } )
Functions ¶
func NewHostDial ¶
func NewRandomDial ¶
func NewRangeDial ¶
func NewTCPDial ¶
Types ¶
type Client ¶
type Client struct {
*client.Client //客户端实例
Wait *wait.Entity //异步回调,设置超时时间,超时则返回错误
// contains filtered or unexported fields
}
func DialDefault ¶
DialDefault 默认连接方式
func DialHostsRandom ¶
DialHostsRandom 与服务器建立连接,多个服务器随机连接
func DialHostsRange ¶
DialHostsRange 遍历设置的服务地址进行连接,成功则结束遍历
func (*Client) GetCallAuction ¶ added in v0.0.56
func (this *Client) GetCallAuction(code string) (*protocol.CallAuctionResp, error)
func (*Client) GetCode ¶
GetCode 获取市场内指定范围内的所有证券代码,一次固定返回1000只,上证股票有效范围370-1480 上证前370只是395/399开头的(中证500/总交易等辅助类),在后面的话是一些100开头的国债 600开头的股票是上证A股,属于大盘股,其中6006开头的股票是最早上市的股票, 6016开头的股票为大盘蓝筹股;900开头的股票是上证B股; 000开头的股票是深证A股,001、002开头的股票也都属于深证A股, 其中002开头的股票是深证A股中小企业股票;200开头的股票是深证B股; 300开头的股票是创业板股票;400开头的股票是三板市场股票。
func (*Client) GetCodeAll ¶
GetCodeAll 通过多次请求的方式获取全部证券代码
func (*Client) GetETFCodeAll ¶ added in v0.0.57
GetETFCodeAll 获取所有ETF代码,带前缀例sz159399
func (*Client) GetGbbqAll ¶ added in v0.0.61
func (*Client) GetHistoryMinute ¶
func (this *Client) GetHistoryMinute(date, code string) (*protocol.MinuteResp, error)
GetHistoryMinute 获取历史分时数据
func (*Client) GetHistoryMinuteTrade ¶
func (this *Client) GetHistoryMinuteTrade(date, code string, start, count uint16) (*protocol.TradeResp, error)
GetHistoryMinuteTrade 获取历史分时交易 只能获取昨天及之前的数据,服务器最多返回2000条,count-start<=2000,如果日期输入错误,则返回0 历史数据只能查到20000609
func (*Client) GetHistoryMinuteTradeDay ¶
GetHistoryMinuteTradeDay 获取历史某天分时全部交易,通过多次请求来拼接,只能获取昨天及之前的数据 历史数据只能查到20000609
func (*Client) GetHistoryTrade ¶
func (*Client) GetHistoryTradeBefore ¶
func (this *Client) GetHistoryTradeBefore(code string, w *Workday, before time.Time) (protocol.Trades, error)
GetHistoryTradeBefore 获取上市至今的分时成交
func (*Client) GetHistoryTradeDay ¶
GetHistoryTradeDay 获取历史某天分时全部交易,通过多次请求来拼接,只能获取昨天及之前的数据
func (*Client) GetHistoryTradeFull ¶
GetHistoryTradeFull 获取上市至今的分时成交
func (*Client) GetIndex ¶
func (this *Client) GetIndex(Type uint8, code string, start, count uint16) (*protocol.KlineResp, error)
GetIndex 获取指数,接口是和k线一样的,但是解析不知道怎么区分(解析方式不一致),所以加一个方法
func (*Client) GetIndex5Minute ¶
func (*Client) GetIndex15Minute ¶
func (*Client) GetIndex30Minute ¶
func (*Client) GetIndex60Minute ¶
func (*Client) GetIndexAll ¶
GetIndexAll 获取全部k线数据
func (*Client) GetIndexCodeAll ¶ added in v0.0.57
GetIndexCodeAll 获取所有指数代码,带前缀例sz399001
func (*Client) GetIndexDay ¶
func (*Client) GetIndexDayAll ¶
func (*Client) GetIndexDayUntil ¶
func (*Client) GetIndexMinute ¶
func (*Client) GetIndexMonthAll ¶
func (*Client) GetIndexQuarterAll ¶
func (*Client) GetIndexUntil ¶
func (this *Client) GetIndexUntil(Type uint8, code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
GetIndexUntil 获取指数k线数据,通过多次请求来拼接,直到满足func返回true
func (*Client) GetIndexWeekAll ¶
func (*Client) GetIndexYearAll ¶
func (*Client) GetKline ¶
func (this *Client) GetKline(Type uint8, code string, start, count uint16) (*protocol.KlineResp, error)
GetKline 获取k线数据,推荐收盘之后获取,否则会获取到当天的数据
func (*Client) GetKline5Minute ¶
GetKline5Minute 获取五分钟k线数据
func (*Client) GetKline5MinuteAll ¶
GetKline5MinuteAll 获取5分钟k线全部数据
func (*Client) GetKline5MinuteUntil ¶
func (*Client) GetKline15Minute ¶
GetKline15Minute 获取十五分钟k线数据
func (*Client) GetKline15MinuteAll ¶
GetKline15MinuteAll 获取十五分钟k线全部数据
func (*Client) GetKline15MinuteUntil ¶
func (*Client) GetKline30Minute ¶
GetKline30Minute 获取三十分钟k线数据
func (*Client) GetKline30MinuteAll ¶
GetKline30MinuteAll 获取三十分钟k线全部数据
func (*Client) GetKline30MinuteUntil ¶
func (*Client) GetKline60Minute ¶
GetKline60Minute 获取60分钟k线数据
func (*Client) GetKline60MinuteAll ¶
GetKline60MinuteAll 获取60分钟k线全部数据
func (*Client) GetKline60MinuteUntil ¶
func (*Client) GetKlineAll ¶
GetKlineAll 获取全部k线数据
func (*Client) GetKlineDay ¶
GetKlineDay 获取日k线数据
func (*Client) GetKlineDayAll ¶
GetKlineDayAll 获取日k线全部数据
func (*Client) GetKlineDayUntil ¶
func (*Client) GetKlineHour ¶
GetKlineHour 获取小时k线数据
func (*Client) GetKlineHourAll ¶
GetKlineHourAll 获取小时k线全部数据
func (*Client) GetKlineHourUntil ¶
func (*Client) GetKlineMinute ¶
GetKlineMinute 获取一分钟k线数据,每次最多800条,最多只能获取24000条数据
func (*Client) GetKlineMinuteAll ¶
GetKlineMinuteAll 获取一分钟k线全部数据,最多只能获取24000条数据
func (*Client) GetKlineMinuteUntil ¶
func (*Client) GetKlineMonth ¶
GetKlineMonth 获取月k线数据
func (*Client) GetKlineMonthAll ¶
GetKlineMonthAll 获取月k线全部数据
func (*Client) GetKlineMonthUntil ¶
func (*Client) GetKlineQuarter ¶
GetKlineQuarter 获取季k线数据
func (*Client) GetKlineQuarterAll ¶
GetKlineQuarterAll 获取季k线全部数据
func (*Client) GetKlineQuarterUntil ¶
func (*Client) GetKlineUntil ¶
func (this *Client) GetKlineUntil(Type uint8, code string, f func(k *protocol.Kline) bool) (*protocol.KlineResp, error)
GetKlineUntil 获取k线数据,通过多次请求来拼接,直到满足func返回true
func (*Client) GetKlineWeek ¶
GetKlineWeek 获取周k线数据
func (*Client) GetKlineWeekAll ¶
GetKlineWeekAll 获取周k线全部数据
func (*Client) GetKlineWeekUntil ¶
func (*Client) GetKlineYear ¶
GetKlineYear 获取年k线数据
func (*Client) GetKlineYearAll ¶
GetKlineYearAll 获取年k线数据
func (*Client) GetKlineYearUntil ¶
func (*Client) GetMinute ¶
func (this *Client) GetMinute(code string) (*protocol.MinuteResp, error)
GetMinute 获取分时数据,todo 解析好像不对,先用历史数据
func (*Client) GetMinuteTrade ¶
GetMinuteTrade 获取分时交易详情,服务器最多返回1800条,count-start<=1800
func (*Client) GetMinuteTradeAll ¶
GetMinuteTradeAll 获取分时全部交易详情,todo 只做参考 因为交易实时在进行,然后又是分页读取的,所以会出现读取间隔内产生的交易会丢失
func (*Client) GetQuote ¶
func (this *Client) GetQuote(codes ...string) (protocol.QuotesResp, error)
GetQuote 获取盘口五档报价
func (*Client) GetStockCodeAll ¶ added in v0.0.57
GetStockCodeAll 获取所有股票代码,带前缀例sz000001
func (*Client) GetTradeAll ¶
type CodeModel ¶
type CodeModel struct {
ID int64 `json:"id"` //主键
Name string `json:"name"` //名称,有时候名称会变,例STxxx
Code string `json:"code" xorm:"index"` //代码
Exchange string `json:"exchange" xorm:"index"` //交易所
Multiple uint16 `json:"multiple"` //倍数
Decimal int8 `json:"decimal"` //小数位
LastPrice float64 `json:"lastPrice"` //昨收价格
EditDate int64 `json:"editDate" xorm:"updated"` //修改时间
InDate int64 `json:"inDate" xorm:"created"` //创建时间
}
type CodeModels ¶
type CodeModels []*CodeModel
func (CodeModels) Codes ¶
func (this CodeModels) Codes() []string
type Codes ¶
type Codes struct {
*CodesBase
// contains filtered or unexported fields
}
func NewCodes ¶
func NewCodes(op ...CodesOption) (*Codes, error)
func NewCodesMysql ¶
func NewCodesMysql(dsn string, op ...CodesOption) (*Codes, error)
func NewCodesSqlite ¶
func NewCodesSqlite(op ...CodesOption) (*Codes, error)
type CodesBase ¶
type CodesBase struct {
// contains filtered or unexported fields
}
func NewCodesBase ¶
func NewCodesBase() *CodesBase
func (*CodesBase) GetETFCodes ¶
GetETFCodes 获取基金代码,sz159xxx,sh510xxx,sh511xxx
func (*CodesBase) GetETFs ¶
func (this *CodesBase) GetETFs(limits ...int) CodeModels
GetETFs 获取基金代码,sz159xxx,sh510xxx,sh511xxx
func (*CodesBase) GetIndexCodes ¶
GetIndexCodes 获取基金代码,sz159xxx,sh510xxx,sh511xxx
func (*CodesBase) GetIndexes ¶
func (this *CodesBase) GetIndexes(limits ...int) CodeModels
GetIndexes 获取基金代码,sz159xxx,sh510xxx,sh511xxx
func (*CodesBase) GetStockCodes ¶
GetStockCodes 获取股票代码,sh6xxx sz0xx sz30xx
func (*CodesBase) GetStocks ¶
func (this *CodesBase) GetStocks(limits ...int) CodeModels
GetStocks 获取股票代码,sh6xxx sz0xx sz30xx
type CodesOption ¶ added in v0.0.58
type CodesOption func(*Codes)
func WithCodesClient ¶ added in v0.0.58
func WithCodesClient(c *Client) CodesOption
func WithCodesDB ¶ added in v0.0.58
func WithCodesDB(db *xorms.Engine) CodesOption
func WithCodesDialClient ¶ added in v0.0.58
func WithCodesDialClient(dial DialClientFunc) CodesOption
func WithCodesDialDB ¶ added in v0.0.58
func WithCodesDialDB(dial DialDBFunc) CodesOption
func WithCodesOption ¶ added in v0.0.58
func WithCodesOption(op ...CodesOption) CodesOption
func WithCodesRetry ¶ added in v0.0.58
func WithCodesRetry(retry int) CodesOption
func WithCodesSpec ¶ added in v0.0.58
func WithCodesSpec(spec string) CodesOption
type DialClientFunc ¶ added in v0.0.58
type DialCodesFunc ¶
type DialDBFunc ¶ added in v0.0.58
type DialGbbqFunc ¶ added in v0.0.61
type DialPoolFunc ¶ added in v0.0.58
type DialResult ¶
DialResult 连接结果
func FastHosts ¶
func FastHosts(hosts ...string) []DialResult
FastHosts 通过tcp(ping不可用)连接速度的方式筛选排序可用的地址
type DialWorkdayFunc ¶
type Gbbq ¶ added in v0.0.61
type Gbbq struct {
// contains filtered or unexported fields
}
func NewGbbq ¶ added in v0.0.61
func NewGbbq(op ...GbbqOption) (*Gbbq, error)
func (*Gbbq) GetFactors ¶ added in v0.0.61
func (*Gbbq) GetTurnover ¶ added in v0.0.62
type GbbqOption ¶ added in v0.0.61
type GbbqOption func(e *Gbbq)
func WithGbbqClient ¶ added in v0.0.61
func WithGbbqClient(c *Client) GbbqOption
func WithGbbqDB ¶ added in v0.0.61
func WithGbbqDB(db *xorms.Engine) GbbqOption
func WithGbbqDialClient ¶ added in v0.0.61
func WithGbbqDialClient(dial DialClientFunc) GbbqOption
func WithGbbqDialDB ¶ added in v0.0.61
func WithGbbqDialDB(dial func() (*xorms.Engine, error)) GbbqOption
func WithGbbqOption ¶ added in v0.0.61
func WithGbbqOption(op ...GbbqOption) GbbqOption
func WithGbbqRetry ¶ added in v0.0.61
func WithGbbqRetry(retry int) GbbqOption
func WithGbbqSpec ¶ added in v0.0.61
func WithGbbqSpec(spec string) GbbqOption
type ICodes ¶
type ICodes interface {
Iter() iter.Seq2[string, *CodeModel]
Get(code string) *CodeModel
GetName(code string) string
GetStocks(limit ...int) CodeModels
GetStockCodes(limit ...int) []string
GetETFs(limit ...int) CodeModels
GetETFCodes(limit ...int) []string
GetIndexes(limit ...int) CodeModels
GetIndexCodes(limit ...int) []string
}
var DefaultCodes ICodes
DefaultCodes 增加单例,部分数据需要通过Codes里面的信息计算
type Manage ¶
type Manage struct {
IPool
Codes ICodes
Workday *Workday
Gbbq IGbbq
// contains filtered or unexported fields
}
func (*Manage) AddWorkdayTask ¶
AddWorkdayTask 添加工作日任务
func (*Manage) RangeIndexes ¶
RangeIndexes 遍历所有指数
func (*Manage) RangeStocks ¶
RangeStocks 遍历所有股票
type Option ¶
type Option func(m *Manage)
func WithClients ¶
func WithDialCodes ¶
func WithDialCodes(dial DialCodesFunc) Option
func WithDialGbbq ¶ added in v0.0.61
func WithDialGbbq(dial DialGbbqFunc) Option
func WithDialGbbqDefault ¶ added in v0.0.61
func WithDialGbbqDefault() Option
func WithDialPool ¶ added in v0.0.58
func WithDialPool(dial DialPoolFunc) Option
func WithDialWorkday ¶
func WithDialWorkday(dial DialWorkdayFunc) Option
func WithOption ¶ added in v0.0.60
func WithWorkday ¶
type UpdateModel ¶
func (*UpdateModel) TableName ¶
func (*UpdateModel) TableName() string
type Workday ¶
type Workday struct {
// contains filtered or unexported fields
}
func NewWorkday ¶
func NewWorkday(op ...WorkdayOption) (*Workday, error)
func NewWorkdayMysql ¶
func NewWorkdayMysql(dsn string, op ...WorkdayOption) (*Workday, error)
func NewWorkdaySqlite ¶
func NewWorkdaySqlite(op ...WorkdayOption) (*Workday, error)
type WorkdayModel ¶
type WorkdayModel struct {
ID int64 `json:"id"` //主键
Unix int64 `json:"unix"` //时间戳
Date string `json:"date"` //日期
}
WorkdayModel 工作日
func (*WorkdayModel) TableName ¶
func (this *WorkdayModel) TableName() string
type WorkdayOption ¶ added in v0.0.58
type WorkdayOption func(w *Workday)
func WithWorkdayClient ¶ added in v0.0.58
func WithWorkdayClient(c *Client) WorkdayOption
func WithWorkdayDB ¶ added in v0.0.58
func WithWorkdayDB(db *xorms.Engine) WorkdayOption
func WithWorkdayDialClient ¶ added in v0.0.58
func WithWorkdayDialClient(dial DialClientFunc) WorkdayOption
func WithWorkdayDialDB ¶ added in v0.0.58
func WithWorkdayDialDB(dial DialDBFunc) WorkdayOption
func WithWorkdayOption ¶ added in v0.0.58
func WithWorkdayOption(op ...WorkdayOption) WorkdayOption
func WithWorkdayRetry ¶ added in v0.0.58
func WithWorkdayRetry(retry int) WorkdayOption
func WithWorkdaySpec ¶ added in v0.0.58
func WithWorkdaySpec(spec string) WorkdayOption
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
CheckGetHistoryErr
command
|
|
|
CheckHosts
command
|
|
|
Codes2
command
|
|
|
CodesHTTP
command
|
|
|
Connect
command
|
|
|
DecodeGBBQ
command
|
|
|
DialHostsRange
command
|
|
|
FastHosts
command
|
|
|
GetBjCodes
command
|
|
|
GetCallauction
command
|
|
|
GetCode
command
|
|
|
GetCodeAll
command
|
|
|
GetCount
command
|
|
|
GetETFCodeNumber
command
|
|
|
GetFQ
command
|
|
|
GetGbbq
command
|
|
|
GetHistoryMinute
command
|
|
|
GetHistoryTrade
command
|
|
|
GetHistoryTradeAll
command
|
|
|
GetIndex
command
|
|
|
GetKline30MinuteAll
command
|
|
|
GetKlineDay
command
|
|
|
GetKlineDayAll
command
|
|
|
GetKlineDayFactor
command
|
|
|
GetKlineMinute
command
|
|
|
GetKlineUntil
command
|
|
|
GetKlineYear
command
|
|
|
GetMinute
command
|
|
|
GetMinuteTrade
command
|
|
|
GetQuote
command
|
|
|
GetStockCodeAll
command
|
|
|
GetTrade
command
|
|
|
GetTurnover
command
|
|
|
Income
command
|
|
|
Manage
command
|
|
|
ManageMysql
command
|
|
|
PullKline
command
|
|
|
PullTrade
command
|
|
|
TradesToKlines
command
|
|
|
WorkdayAndCodes
command
|
|
|
lib
|
|





