Documentation ¶
Index ¶
- Constants
- Variables
- func CheckResponse(r *http.Response) error
- type BidAsk
- type Client
- type DelistedSecurity
- type ErrorResponse
- type Market
- type MarketData
- type MarketDataService
- type Quote
- type QuoteService
- func (s *QuoteService) Download(code string, year int, month time.Month) ([]Quote, error)
- func (s *QuoteService) DownloadTpex(code string, year int, month time.Month) ([]Quote, error)
- func (s *QuoteService) DownloadTwse(code string, year int, month time.Month) ([]Quote, error)
- func (s *QuoteService) MinimumDate(m Market) civil.Date
- func (s *QuoteService) Realtime(codes ...string) (map[string]RealtimeQuote, error)
- type RealtimeQuote
- type Security
- type SecurityService
Constants ¶
View Source
const (
Version = "1.1.6"
)
Variables ¶
View Source
var ( // 當查詢不到個股日成交資訊丟出此錯誤 ErrNoData = errors.New("no data found") // 當查詢日期超出限制的時候丟出此錯誤 ErrDateOutOffRange = errors.New("date out of range") )
View Source
var Securities = map[string]Security{}/* 49637 elements not displayed */
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors
Types ¶
type Client ¶
type Client struct { // Services used for talking to different parts of the API. MarketData *MarketDataService Security *SecurityService Quote *QuoteService // contains filtered or unexported fields }
A Client manages communication with the API.
func (*Client) DoTransformToDocument ¶
func (c *Client) DoTransformToDocument(req *http.Request, t transform.Transformer) (*goquery.Document, error)
DoTransformToDocument sends an API request and returns the goquery.Document.
type DelistedSecurity ¶
下市的有價證卷
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type MarketData ¶ added in v1.1.0
type MarketDataService ¶ added in v1.1.0
type MarketDataService struct {
// contains filtered or unexported fields
}
func (*MarketDataService) DownloadTpex ¶ added in v1.1.0
func (s *MarketDataService) DownloadTpex(year int, month time.Month) ([]MarketData, error)
從證券櫃檯買賣中心下載盤後每日市場成交資訊
func (*MarketDataService) DownloadTwse ¶ added in v1.1.0
func (s *MarketDataService) DownloadTwse(year int, month time.Month) ([]MarketData, error)
從台灣證卷交易所下載盤後每日市場成交資訊
func (*MarketDataService) MinimumDate ¶ added in v1.1.0
func (s *MarketDataService) MinimumDate(m Market) civil.Date
台灣證卷交易所或是證券櫃檯買賣中心有最小查詢日期的限制
type QuoteService ¶
type QuoteService struct {
// contains filtered or unexported fields
}
func (*QuoteService) DownloadTpex ¶
從證券櫃檯買賣中心下載盤後個股日成交資訊
func (*QuoteService) DownloadTwse ¶
從台灣證卷交易所下載盤後個股日成交資訊
func (*QuoteService) MinimumDate ¶ added in v1.1.0
func (s *QuoteService) MinimumDate(m Market) civil.Date
台灣證卷交易所或是證券櫃檯買賣中心有最小查詢日期的限制
func (*QuoteService) Realtime ¶
func (s *QuoteService) Realtime(codes ...string) (map[string]RealtimeQuote, error)
從台灣證卷交易所下載即時個股成交資訊
type RealtimeQuote ¶
type RealtimeQuote struct { At time.Time // 最新一筆成交時間 Code string // 股票代號 Name string // 簡稱 FullName string // 全名 Price decimal.Decimal // 最新一筆成交價 Open decimal.Decimal // 開盤價 High decimal.Decimal // 最高價 Low decimal.Decimal // 最低價 Volume int // 總成交量 Bids []BidAsk // 最佳五檔委買資料 Asks []BidAsk // 最佳五檔委賣資料 }
type Security ¶
type Security struct { Type string // 有價證卷類別 Code string // 有價證券代號 Name string // 有價證券名稱 ISIN string // 國際證卷辨識號碼 IPO civil.Date // 上市日 Market Market // 市場別 Industry string // 產業 CFI string // CFICode Remark string // 備註 }
有價證券
type SecurityService ¶
type SecurityService struct {
// contains filtered or unexported fields
}
func (*SecurityService) Download ¶
func (s *SecurityService) Download() ([]Security, error)
從台灣證卷交易所下載上市及上櫃國際證券資料
func (*SecurityService) DownloadTpexDelisted ¶
func (s *SecurityService) DownloadTpexDelisted(page int) ([]DelistedSecurity, error)
從證券櫃檯買賣中心下載下櫃的國際證券資料
func (*SecurityService) DownloadTwseDelisted ¶
func (s *SecurityService) DownloadTwseDelisted() ([]DelistedSecurity, error)
從台灣證卷交易所下載下市的國際證券資料
Click to show internal directories.
Click to hide internal directories.