Documentation ¶
Index ¶
- type Source
- type YahooFinance
- func (yahoo YahooFinance) Crawl(_market market.Market, company market.Company, date time.Time) (*market.CompanyDailyQuote, error)
- func (yahoo YahooFinance) Expiration() time.Duration
- func (yahoo YahooFinance) ParallelMax() int
- func (yahoo YahooFinance) RetryCount() int
- func (yahoo YahooFinance) RetryInterval() time.Duration
- type YahooQuote
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Source ¶
type Source interface { // 数据能报保存多长时间(能查到的最早数据距今多长时间) Expiration() time.Duration // 获取公司每日报价 Crawl(_market market.Market, company market.Company, date time.Time) (*market.CompanyDailyQuote, error) // 最大并发数 ParallelMax() int // 失败重试次数 RetryCount() int // 失败重试时间间隔 RetryInterval() time.Duration }
Source 数据源
type YahooFinance ¶
type YahooFinance struct{}
YahooFinance 雅虎财经数据源
func (YahooFinance) Crawl ¶
func (yahoo YahooFinance) Crawl(_market market.Market, company market.Company, date time.Time) (*market.CompanyDailyQuote, error)
Crawl 获取公司每天的报价
func (YahooFinance) Expiration ¶
func (yahoo YahooFinance) Expiration() time.Duration
Expiration 最早能查到60天前的数据
func (YahooFinance) RetryInterval ¶
func (yahoo YahooFinance) RetryInterval() time.Duration
RetryInterval 失败重试时间间隔
type YahooQuote ¶
type YahooQuote struct { Chart struct { Result []struct { Meta struct { Currency string `json:"currency"` Symbol string `json:"symbol"` ExchangeName string `json:"exchangeName"` InstrumentType string `json:"instrumentType"` FirstTradeDate int64 `json:"firstTradeDate"` GMTOffset int64 `json:"gmtoffset"` Timezone string `json:"timezone"` PreviousClose float32 `json:"previousClose"` Scale int `json:"scale"` CurrentTradingPeriod struct { Pre struct { Timezone string `json:"timezone"` Start int64 `json:"start"` End int64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` } `json:"pre"` Regular struct { Timezone string `json:"timezone"` Start int64 `json:"start"` End int64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` } `json:"regular"` Post struct { Timezone string `json:"timezone"` Start int64 `json:"start"` End int64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` } `json:"post"` } `json:"currentTradingPeriod"` TradingPeriods struct { Pres [][]struct { Timezone string `json:"timezone"` Start int64 `json:"start"` End int64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` } `json:"pre"` Regulars [][]struct { Timezone string `json:"timezone"` Start int64 `json:"start"` End int64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` } `json:"regular"` Posts [][]struct { Timezone string `json:"timezone"` Start int64 `json:"start"` End int64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` } `json:"post"` } `json:"tradingPeriods"` DataGranularity string `json:"dataGranularity"` ValidRanges []string `json:"validRanges"` } `json:"meta"` Timestamp []int64 `json:"timestamp"` Indicators struct { Quotes []struct { Open []float32 `json:"open"` Close []float32 `json:"close"` High []float32 `json:"high"` Low []float32 `json:"low"` Volume []int64 `json:"volume"` } `json:"quote"` } `json:"indicators"` } `json:"result"` Err *struct { Code string `json:"code"` Description string `json:"description"` } `json:"error"` } `json:"chart"` }
YahooQuote 雅虎财经返回的json
Click to show internal directories.
Click to hide internal directories.