market

package
v0.0.0-...-ba8b4c8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2015 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(market Market)

添加市场

func Monitor

func Monitor() error

监视市场(所有操作的入口)

Types

type America

type America struct{}

美股市场

func (America) Companies

func (m America) Companies() ([]Company, error)

更新上市公司列表

func (America) Crawl

func (m America) Crawl(code string, day time.Time) (string, error)

抓取

func (America) Name

func (m America) Name() string

func (America) Timezone

func (m America) Timezone() string

type China

type China struct{}

中国证券市场

func (China) Companies

func (m China) Companies() ([]Company, error)

更新上市公司列表

func (China) Crawl

func (m China) Crawl(code string, day time.Time) (string, error)

抓取

func (China) Name

func (m China) Name() string

func (China) Timezone

func (m China) Timezone() string

type Company

type Company struct {
	Market string
	Name   string
	Code   string
}

公司

type CompanyList

type CompanyList []Company

公司列表

func (CompanyList) Len

func (l CompanyList) Len() int

func (CompanyList) Less

func (l CompanyList) Less(i, j int) bool

func (*CompanyList) Load

func (l *CompanyList) Load(market Market) error

从存档读取上市公司列表

func (CompanyList) Save

func (l CompanyList) Save(market Market) error

保存上市公司列表到文件

func (CompanyList) Swap

func (l CompanyList) Swap(i, j int)

type HongKong

type HongKong struct{}

香港证券市场

func (HongKong) Companies

func (m HongKong) Companies() ([]Company, error)

更新上市公司列表

func (HongKong) Crawl

func (m HongKong) Crawl(code string, day time.Time) (string, error)

抓取

func (HongKong) Name

func (m HongKong) Name() string

func (HongKong) Timezone

func (m HongKong) Timezone() string

type Market

type Market interface {
	//	名称
	Name() string
	//	时区
	Timezone() string
	//	获取上市公司列表
	Companies() ([]Company, error)

	//	抓取任务(每日)
	Crawl(companyCode string, day time.Time) (string, error)
}

市场更新

type ParseResult

type ParseResult struct {
	Success bool
	Message string
	Pre     []Peroid60
	Regular []Peroid60
	Post    []Peroid60
}

type Peroid60

type Peroid60 struct {
	Market string
	Code   string
	Time   time.Time
	Open   float32
	Close  float32
	High   float32
	Low    float32
	Volume int64
}

func QueryPeroid60

func QueryPeroid60(market, code string, start, end time.Time) ([]Peroid60, error)

查询

type YahooChart

type YahooChart struct {
	Result []YahooResult `json:"result"`
	Err    *YahooError   `json:"error"`
}

type YahooError

type YahooError struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

type YahooIndicators

type YahooIndicators struct {
	Quotes []YahooQuote `json:"quote"`
}

type YahooJson

type YahooJson struct {
	Chart YahooChart `json:"chart"`
}

type YahooMeta

type YahooMeta struct {
	Currency             string              `json:"currency"`
	Symbol               string              `json:"symbol"`
	ExchangeName         string              `json:"exchangeName"`
	InstrumentType       string              `json:"instrumentType"`
	FirstTradeDate       int64               `json:"firstTradeDate"`
	GMTOffset            int                 `json:"gmtoffset"`
	Timezone             string              `json:"timezone"`
	PreviousClose        float32             `json:"previousClose"`
	Scale                int                 `json:"scale"`
	CurrentTradingPeriod YahooTradingPeroid  `json:"currentTradingPeriod"`
	TradingPeriods       YahooTradingPeroids `json:"tradingPeriods"`
	DataGranularity      string              `json:"dataGranularity"`
	ValidRanges          []string            `json:"validRanges"`
}

type YahooQuote

type YahooQuote struct {
	Open   []float32 `json:"open"`
	Close  []float32 `json:"close"`
	High   []float32 `json:"high"`
	Low    []float32 `json:"low"`
	Volume []int64   `json:"volume"`
}

type YahooResult

type YahooResult struct {
	Meta       YahooMeta       `json:"meta"`
	Timestamp  []int64         `json:"timestamp"`
	Indicators YahooIndicators `json:"indicators"`
}

type YahooTradingPeroid

type YahooTradingPeroid struct {
	Pre     YahooTradingPeroidSection `json:"pre"`
	Regular YahooTradingPeroidSection `json:"regular"`
	Post    YahooTradingPeroidSection `json:"post"`
}

type YahooTradingPeroidSection

type YahooTradingPeroidSection struct {
	Timezone  string `json:"timezone"`
	Start     int64  `json:"start"`
	End       int64  `json:"end"`
	GMTOffset int    `json:"gmtoffset"`
}

type YahooTradingPeroids

type YahooTradingPeroids struct {
	Pres     [][]YahooTradingPeroidSection `json:"pre"`
	Regulars [][]YahooTradingPeroidSection `json:"regular"`
	Posts    [][]YahooTradingPeroidSection `json:"post"`
}

Jump to

Keyboard shortcuts

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