Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type BidAsk
- type Candle
- type CandlesResponse
- type Chart
- type ChartData
- type ChartResponse
- type Client
- type Date
- type Dealt
- type DealtData
- type DealtsOptions
- type DealtsResponse
- type Error
- type ErrorResponse
- type Info
- type IntradayService
- func (s *IntradayService) Chart(symbolID string, oddLot bool) (*ChartResponse, error)
- func (s *IntradayService) Dealts(symbolID string, limit int, offset int, oddLot bool) (*DealtsResponse, error)
- func (s *IntradayService) Meta(symbolID string, oddLot bool) (*MetaResponse, error)
- func (s *IntradayService) Quote(symbolID string, oddLot bool) (*QuoteResponse, error)
- func (s *IntradayService) Volumes(symbolID string, oddLot bool) (*VolumesResponse, error)
- type IntradyOptions
- type Last
- type MarketDataOptions
- type MarketDataService
- type Meta
- type MetaData
- type MetaResponse
- type Order
- type Price
- type PriceLimit
- type Quote
- type QuoteData
- type QuoteResponse
- type Timestamp
- type Total
- type Trade
- type Trial
- type Volume
- type VolumesData
- type VolumesResponse
Constants ¶
const (
Version = "1.2.0"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors
Types ¶
type CandlesResponse ¶
type Chart ¶
type Chart struct { Averages []decimal.Decimal `json:"a"` // 當日個股於此分鐘的成交均價 Opens []decimal.Decimal `json:"o"` // 此分鐘的開盤價 Highs []decimal.Decimal `json:"h"` // 此分鐘的最高價 Lows []decimal.Decimal `json:"l"` // 此分鐘的最低價 Closes []decimal.Decimal `json:"c"` // 此分鐘的收盤價 Volumes []int `json:"v"` // 此分鐘的成交量 (指數:金額;個股:張數;興櫃股票及零股:股數) Timestamps []Timestamp `json:"t"` }
type ChartResponse ¶
type Client ¶
type Client struct { // Services used for talking to different parts of the API Intrady *IntradayService MarketData *MarketDataService // contains filtered or unexported fields }
A Client manages communication with the Fugle API.
type Date ¶ added in v1.2.0
func (*Date) UnmarshalJSON ¶ added in v1.2.0
UnmarshalJSON handles incoming JSON.
type DealtsOptions ¶
type DealtsResponse ¶
type Error ¶
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Details Error `json:"error"` }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Info ¶
type Info struct { Date Date `json:"date"` // 本筆資料所屬日期 Type string `json:"type"` // ticker 類別 Exchange string `json:"exchange"` // 交易所 Market string `json:"market"` // 市場別 SymbolID string `json:"symbolId"` // 股票代號 CountryCode string `json:"countryCode"` // 股票所屬國家ISO2代碼 TimeZone string `json:"timeZone"` // 股票所屬時區 LastUpdatedAt time.Time `json:"lastUpdatedAt"` // 本筆資料最後更新時間 }
type IntradayService ¶
type IntradayService struct {
// contains filtered or unexported fields
}
IntradayService handles communication with the intraday related methods of the Fugle API.
Fugle API docs: https://developer.fugle.tw/docs/data/intraday/overview
func (*IntradayService) Chart ¶
func (s *IntradayService) Chart(symbolID string, oddLot bool) (*ChartResponse, error)
提供盤中個股/指數 線圖時所需的各項即時資訊 See https://developer.fugle.tw/docs/data/intraday/chart
func (*IntradayService) Dealts ¶
func (s *IntradayService) Dealts(symbolID string, limit int, offset int, oddLot bool) (*DealtsResponse, error)
取得個股當日所有成交資訊(ex: 個股價量、大盤總量) See https://developer.fugle.tw/docs/data/intraday/dealts
func (*IntradayService) Meta ¶
func (s *IntradayService) Meta(symbolID string, oddLot bool) (*MetaResponse, error)
提供盤中個股/指數當日基本資訊 See https://developer.fugle.tw/docs/data/intraday/meta
func (*IntradayService) Quote ¶
func (s *IntradayService) Quote(symbolID string, oddLot bool) (*QuoteResponse, error)
提供盤中個股/指數逐筆交易金額、狀態、最佳五檔及統計資訊 See https://developer.fugle.tw/docs/data/intraday/quote
func (*IntradayService) Volumes ¶
func (s *IntradayService) Volumes(symbolID string, oddLot bool) (*VolumesResponse, error)
提供盤中個股即時分價量 See https://developer.fugle.tw/docs/data/intraday/volumes
type IntradyOptions ¶
type Last ¶
type Last struct { At time.Time `json:"at"` // 最新一筆成交時間 Transaction int `json:"transaction"` // 總成交筆數 TradeValue decimal.Decimal `json:"tradeValue"` // 總成交金額 TradeVolume int `json:"tradeVolume"` // 總成交數量 BidOrders int `json:"bidOrders"` // 總委買筆數 AskOrders int `json:"askOrders"` // 總委賣筆數 BidVolume int `json:"bidVolume"` // 總委買數量 AskVolume int `json:"askVolume"` // 總委賣數量 Serial int `json:"serial"` // 最新一筆成交之序號 }
type MarketDataOptions ¶
type MarketDataService ¶
type MarketDataService struct {
// contains filtered or unexported fields
}
MarketDataService handles communication with the marketdata related methods of the Fugle API.
Fugle API docs: https://developer.fugle.tw/docs/data/marketdata/candles
func (*MarketDataService) Candles ¶
func (s *MarketDataService) Candles(symbolID string, from Date, to Date) (*CandlesResponse, error)
提供歷史股價資料,包含開高低收量 (OHLCV)。歷史資料目前設計單次呼叫的資料區間以一年為限;資料區間最遠可回溯至 2010 年! See https://developer.fugle.tw/docs/data/marketdata/candles
type Meta ¶
type Meta struct { Market string `json:"market"` // 股票所屬市場別 NameZhTw string `json:"nameZhTw"` // 股票中文簡稱 IndustryZhTw string `json:"industryZhTw"` // 股票所屬產業別 PreviousClose decimal.Decimal `json:"previousClose"` // 上次收盤價 PriceReference decimal.Decimal `json:"priceReference"` // 今日參考價 PriceHighLimit decimal.Decimal `json:"priceHighLimit"` // 漲停價 PriceLowLimit decimal.Decimal `json:"priceLowLimit"` // 跌停價 CanDayBuySell bool `json:"canDayBuySell"` // 是否可先買後賣現股當沖 CanDaySellBuy bool `json:"canDaySellBuy"` // 是否可先賣後買現股當沖 CanShortMargin bool `json:"canShortMargin"` // 是否豁免平盤下融券賣出 CanShortLend bool `json:"canShortLend"` // 是否豁免平盤下借券賣出 TradingUnit int `json:"tradingUnit"` // 交易單位 Currency string `json:"currency"` // 交易幣別代號 IsTerminated bool `json:"isTerminated"` // 今日是否已終止上市 IsSuspended bool `json:"isSuspended"` // 今日是否暫停買賣 TypeZhTw string `json:"typeZhTw"` // 股票類別 Abnormal string `json:"abnormal"` // 警示或處置股標示 (正常、注意、處置、注意及處置、再次處置、注意及再次處置、彈性處置、注意及彈性處置) IsUnusuallyRecommended bool `json:"isUnusuallyRecommended"` // 是否為投資理財節目異常推介個股 IsNewlyCompiled bool `json:"isNewlyCompiled"` // 是否為新編指數 (僅指數類別) }
type MetaResponse ¶
type PriceLimit ¶
type PriceLimit int
const ( Normal PriceLimit = 0 // 正常 LimitDown PriceLimit = 1 // 跌停 LimitUp PriceLimit = 2 // 漲停 )
type Quote ¶
type Quote struct { IsCurbing bool `json:"isCurbing"` // 最近一次更新是否為瞬間價格穩定措施 IsCurbingFall bool `json:"isCurbingFall"` // 最近一次更新是否為暫緩撮合且瞬間趨跌 IsCurbingRise bool `json:"isCurbingRise"` // 最近一次更新是否為暫緩撮合且瞬間趨漲 IsTrial bool `json:"isTrial"` // 最近一次更新是否為試算 IsOpenDelayed bool `json:"isOpenDelayed"` // 最近一次更新是否為延後開盤狀態 IsCloseDelayed bool `json:"isCloseDelayed"` // 最近一次更新是否為延後收盤狀態 IsHalting bool `json:"isHalting"` // 最近一次更新是否為暫停交易 IsDealt bool `json:"isDealt"` // 最近一次更新是否包含最新成交(試撮)價 IsClosed bool `json:"isClosed"` // 當日是否為已收盤 Total Total `json:"total"` Trial Trial `json:"trial"` Trade Trade `json:"trade"` Order Order `json:"order"` Last Last `json:"last"` PriceHigh Price `json:"priceHigh"` // 當日之最高價,第一次到達當日最高價之時間 PriceLow Price `json:"priceLow"` // 當日之最低價,第一次到達當日最低價之時間 PriceOpen Price `json:"priceOpen"` // 當日之開盤價,開盤定義:當天第一筆成交時才開盤,當日第一筆成交時間 PriceAverage Price `json:"priceAvg"` // 當日之成交均價,當日最後一筆成交時間 Change decimal.Decimal `json:"change"` // 當日股價之漲跌 ChangePercent decimal.Decimal `json:"changePercent"` // 當日股價之漲跌幅 Amplitude decimal.Decimal `json:"amplitude"` // 當日股價之振幅 PriceLimit PriceLimit `json:"priceLimit"` }
type QuoteResponse ¶
type Timestamp ¶
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON handles incoming JSON.
type Total ¶
type Total struct { At time.Time `json:"at"` // 最新一筆成交時間 Transaction int `json:"transaction"` // 總成交筆數 TradeValue decimal.Decimal `json:"tradeValue"` // 總成交金額 TradeVolume int `json:"tradeVolume"` // 總成交數量 TradeVolumeAtBid int `json:"tradeVolumeAtBid"` // 個股內盤成交量 TradeVolumeAtAsk int `json:"tradeVolumeAtAsk"` // 個股外盤成交量 BidOrders int `json:"bidOrders"` // 總委買筆數 (僅加權、櫃買指數) AskOrders int `json:"askOrders"` // 總委賣筆數 (僅加權、櫃買指數) BidVolume int `json:"bidVolume"` // 總委買數量 (僅加權、櫃買指數) AskVolume int `json:"askVolume"` // 總委賣數量 (僅加權、櫃買指數) Serial int `json:"serial"` // 最新一筆成交之序號 }
type VolumesData ¶
type VolumesResponse ¶
type VolumesResponse struct { APIVersion string `json:"apiVersion"` Data VolumesData `json:"data"` }