crawler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URLCenter map[TargetURL]*url.URL

Functions

func ParseArray

func ParseArray(array *otto.Value) ([]*otto.Value, error)

Types

type ApiData

type ApiData struct {
	Code     string
	Content  []FundValue
	Records  int64
	Pages    int64
	CurrPage int64
}

type BasicFund

type BasicFund struct {
	ID        string
	ShortCode string

	// TODO: could it be enum?
	NameCN string
	Type   string
	// pin yin name
	NamePY string
}

type DefaultCrawlerCallBack

type DefaultCrawlerCallBack struct {
}

func (*DefaultCrawlerCallBack) OnBasicFund

func (cb *DefaultCrawlerCallBack) OnBasicFund([]*BasicFund)

func (*DefaultCrawlerCallBack) OnHistoryValue

func (cb *DefaultCrawlerCallBack) OnHistoryValue(*ApiData)

type FundCrawler

type FundCrawler interface {
	SetCallBack(FundCrawlerCallBack)
	GetAllBasicFund(sync bool)
	GetHistoryValue(sync bool, code string, page int, sdate string, edate string)
	ConsumeHistoryValueQueue()
}

func NewFundCrawler

func NewFundCrawler() FundCrawler

type FundCrawlerCallBack

type FundCrawlerCallBack interface {
	OnBasicFund([]*BasicFund)
	OnHistoryValue(*ApiData)
}

type FundValue

type FundValue struct {
	Date          time.Time
	NetAssetValue float64
	DailyDelta    float64
	BuyState      string
	SellState     string
}

type TargetURL

type TargetURL string
const (
	FundCodeSearch TargetURL = "FundCodeSearch"
	HistoryValue   TargetURL = "HistoryValue"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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