realtime

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2017 License: MIT Imports: 10 Imported by: 0

README

gogrs - realtime

GoDoc Build Status

Documentation

Overview

Package realtime - Fetch realtime stock data info 擷取盤中個股、指數即時股價資訊

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	BestAskPrice   []float64              // 最佳五檔賣出價資訊
	BestBidPrice   []float64              // 最佳五檔買進價資訊
	BestAskVolume  []int64                // 最佳五檔賣出量資訊
	BestBidVolume  []int64                // 最佳五檔買進量資訊
	Open           float64                // 開盤價格
	Highest        float64                // 最高價
	Lowest         float64                // 最低價
	Price          float64                // 該盤成交價格
	LimitUp        float64                // 漲停價
	LimitDown      float64                // 跌停價
	Volume         float64                // 該盤成交量
	VolumeAcc      float64                // 累計成交量
	YesterdayPrice float64                // 昨日收盤價格
	TradeTime      time.Time              // 交易時間
	Info           StockInfo              // 相關資訊
	SysInfo        map[string]interface{} // 系統回傳資訊
}

Data is realtime return formated data.

type StockBlob

type StockBlob struct {
	Rtcode    string
	UserDelay int
	Rtmessage string
	Referer   string
	MsgArray  msgArray
	QueryTime map[string]interface{}
}

StockBlob return map data.

type StockInfo

type StockInfo struct {
	Exchange string // tse or otc
	FullName string // Full company name.
	Name     string // Stock name.
	No       string // Stock no
	Ticker   string // Ticker symbol(股票代號)
	Category string // 股票類別代號
}

StockInfo is base stock info.

type StockRealTime

type StockRealTime struct {
	No          string      // 股票代碼
	Date        time.Time   // 擷取時間
	UnixMapData unixMapData // 時間資料暫存
	Exchange    string      // tse, otc
}

StockRealTime start with No, Timestamp, Date.

func NewFRMSA

func NewFRMSA(Date time.Time) *StockRealTime

NewFRMSA 寶島指數

Example
farmsa := NewFRMSA(tradingdays.FindRecentlyOpened(time.Now()))
data, _ := farmsa.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:tse FullName: Name:寶島股價指數 No:FRMSA Ticker:FRMSA.tw Category:tidx.tw}

func NewOTC

func NewOTC(No string, Date time.Time) *StockRealTime

NewOTC 建立一個上櫃股票

Example
otc := NewOTC("8446", tradingdays.FindRecentlyOpened(time.Now()))
data, _ := otc.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:otc FullName:華研國際音樂股份有限公司 Name:華研 No:8446 Ticker:8446.tw Category:32}

func NewOTCI

func NewOTCI(Date time.Time) *StockRealTime

NewOTCI 上櫃指數

Example
otc := NewOTCI(tradingdays.FindRecentlyOpened(time.Now()))
data, _ := otc.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:otc FullName: Name:櫃買指數 No:o00 Ticker:o00.tw Category:oidx.tw}

func NewTWSE

func NewTWSE(No string, Date time.Time) *StockRealTime

NewTWSE 建立一個上市股票

Example
twse := NewTWSE("2618", tradingdays.FindRecentlyOpened(time.Now()))
data, _ := twse.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:tse FullName:長榮航空股份有限公司 Name:長榮航 No:2618 Ticker:2618.tw Category:15}

func NewWeight

func NewWeight(Date time.Time) *StockRealTime

NewWeight 大盤指數

Example
weight := NewWeight(tradingdays.FindRecentlyOpened(time.Now()))
data, _ := weight.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:tse FullName: Name:發行量加權股價指數 No:t00 Ticker:t00.tw Category:tidx.tw}

func (*StockRealTime) Get

func (stock *StockRealTime) Get() (Data, error)

Get return stock realtime map data.

Example (Otc)

擷取 華研(8446) 上櫃即時盤股價資訊

r := NewOTC("8446", tradingdays.FindRecentlyOpened(time.Now()))

data, _ := r.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:otc FullName:華研國際音樂股份有限公司 Name:華研 No:8446 Ticker:8446.tw Category:32}
Example (Twse)

擷取 長榮航(2618) 上市即時盤股價資訊

r := NewTWSE("2618", tradingdays.FindRecentlyOpened(time.Now()))

data, _ := r.Get()
fmt.Printf("%+v", data.Info)
Output:

{Exchange:tse FullName:長榮航空股份有限公司 Name:長榮航 No:2618 Ticker:2618.tw Category:15}

func (StockRealTime) URL

func (stock StockRealTime) URL() string

URL return realtime url path.

Jump to

Keyboard shortcuts

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