api

package
v4.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// XigniteBaseURL is a Base URL for Quick Xignite API
	// (https://www.marketdata-cloud.quick-co.jp/Products/)
	XigniteBaseURL = "https://api.marketdata-cloud.quick-co.jp"
	// GetQuotesURL is the URL of Get Quotes endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/GetQuotes)
	GetQuotesURL = XigniteBaseURL + "/QUICKEquityRealTime.json/GetQuotes"
	// ListSymbolsURL is the URL of List Symbols endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/ListSymbols)
	ListSymbolsURL = XigniteBaseURL + "/QUICKEquityRealTime.json/ListSymbols"
	// ListIndexSymbolsURL is the URL of List Symbols endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKIndexHistorical/Overview/ListSymbols)
	// /QUICKEquityRealTime.json/ListSymbols : list symbols for a exchange
	// /QUICKIndexHistorical.json/ListSymbols : list index symbols for an index group (ex. TOPIX)
	ListIndexSymbolsURL = XigniteBaseURL + "/QUICKIndexHistorical.json/ListSymbols"
	// GetQuotesRangeURL is the URL of Get Quotes Range endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityHistorical/Overview/GetQuotesRange)
	// GetBarsURL is the URL of Get Bars endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/GetBars)
	GetBarsURL = XigniteBaseURL + "/QUICKEquityRealTime.json/GetBars"
	// GetIndexBarsURL is the URL of QuickIndexRealTime/GetBars endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKIndexRealTime/Overview/GetBars)
	GetIndexBarsURL   = XigniteBaseURL + "/QUICKIndexRealTime.json/GetBars"
	GetQuotesRangeURL = XigniteBaseURL + "/QUICKEquityHistorical.json/GetQuotesRange"
	// GetIndexQuotesRangeURL is the URL of Get Index Quotes Range endpoint
	// (https://www.marketdata-cloud.quick-co.jp/Products/QUICKIndexHistorical/Overview/GetQuotesRange)
	GetIndexQuotesRangeURL = XigniteBaseURL + "/QUICKIndexHistorical.json/GetQuotesRange"
)
View Source
const XigniteDateTimeLayout = "2006/01/02 15:04:05"

XigniteDateTimeLayout is a layout of Datetime string returned from Xignite API

View Source
const XigniteDayLayout = "2006/01/02"

XigniteDay is a layout of Datetime string returned from Xignite GetQuotesRange API

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

type Bar struct {
	StartDateTime XigniteDateTime `json:"StartDateTime,omitempty"`
	EndDateTime   XigniteDateTime `json:"EndDateTime,omitempty"`
	UTCOffSet     int             `json:"UTCOffSet"`
	Open          float32         `json:"Open"`
	High          float32         `json:"High"`
	Low           float32         `json:"Low"`
	Close         float32         `json:"Close"`
	Volume        float32         `json:"Volume"` // Get Bars API returns a float value for Volume, not int
}

type Client

type Client interface {
	GetRealTimeQuotes(identifiers []string) (GetQuotesResponse, error)
	ListSymbols(exchange string) (ListSymbolsResponse, error)
	ListIndexSymbols(indexGroup string) (ListIndexSymbolsResponse, error)
	GetRealTimeBars(identifier string, start, end time.Time) (response GetBarsResponse, err error)
	GetIndexBars(identifier string, start, end time.Time) (response GetIndexBarsResponse, err error)
	GetQuotesRange(identifier string, startDate, endDate time.Time) (response GetQuotesRangeResponse, err error)
	GetIndexQuotesRange(identifier string, startDate, endDate time.Time) (response GetIndexQuotesRangeResponse, err error)
}

Client calls an endpoint and returns the parsed response

type DefaultClient

type DefaultClient struct {
	// contains filtered or unexported fields
}

DefaultClient is the Xignite API client object.

func NewDefaultAPIClient

func NewDefaultAPIClient(token string, timeoutSec int) *DefaultClient

NewDefaultAPIClient initializes Xignite API client with the specified API token and HTTP timeout[sec].

func (*DefaultClient) GetIndexBars

func (c *DefaultClient) GetIndexBars(identifier string, start, end time.Time) (response GetIndexBarsResponse, err error)

GetIndexBars calls QUICKIndex/GetBars endpoint of Xignite API with a specified identifier, time period and Precision=FiveMinutes, and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKIndexRealTime/Overview/GetBars

func (*DefaultClient) GetIndexQuotesRange

func (c *DefaultClient) GetIndexQuotesRange(identifier string, startDate, endDate time.Time,
) (response GetIndexQuotesRangeResponse, err error)

GetIndexQuotesRange calls QUICKIndexHistorical/GetQuotesRange endpoint with a specified index symbol and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKIndexHistorical/Overview/GetQuotesRange As of 2019-08, the API response model is exactly the same as Get Quotes Range API

func (*DefaultClient) GetQuotesRange

func (c *DefaultClient) GetQuotesRange(identifier string, startDate, endDate time.Time) (response GetQuotesRangeResponse, err error)

GetQuotesRange calls QUICKEquityHistorical/GetQuotesRange endpoint of Xignite API with a specified identifier // and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/GetQuotes

func (*DefaultClient) GetRealTimeBars

func (c *DefaultClient) GetRealTimeBars(identifier string, start, end time.Time) (response GetBarsResponse, err error)

GetRealTimeBars calls GetBars endpoint of Xignite API with a specified identifier, time period and Precision=FiveMinutes, and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/GetBars

func (*DefaultClient) GetRealTimeQuotes

func (c *DefaultClient) GetRealTimeQuotes(identifiers []string) (response GetQuotesResponse, err error)

GetRealTimeQuotes calls GetQuotes endpoint of Xignite API with specified identifiers // and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/GetQuotes

func (*DefaultClient) ListIndexSymbols

func (c *DefaultClient) ListIndexSymbols(indexGroup string) (response ListIndexSymbolsResponse, err error)

ListIndexSymbols calls QUICKIndexHistorical.json/ListSymbols endpoint of Xignite API with a specified index group and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKIndexHistorical/Overview/ListSymbols indexGroup: INDXJPX, IND_NIKKEI

func (*DefaultClient) ListSymbols

func (c *DefaultClient) ListSymbols(exchange string) (response ListSymbolsResponse, err error)

ListSymbols calls /QUICKEquityRealTime.json/ListSymbols endpoint of Xignite API with a specified exchange and returns the parsed API response https://www.marketdata-cloud.quick-co.jp/Products/QUICKEquityRealTime/Overview/ListSymbols exchange: XTKS, XNGO, XSAP, XFKA, XJAS, XTAM

type EndOfDayQuote

type EndOfDayQuote struct {
	Date                           XigniteDay `json:"Date"`
	Open                           float32    `json:"Open"`
	High                           float32    `json:"High"`
	Low                            float32    `json:"Low"`
	Close                          float32    `json:"Close"`
	ExchangeOfficialClose          float32    `json:"ExchangeOfficialClose"`
	PreviousClose                  float32    `json:"PreviousClose"`
	Volume                         int64      `json:"Volume"`
	PreviousExchangeOfficialClose  float32    `json:"PreviousExchangeOfficialClose"`
	ChangeFromPreviousClose        float32    `json:"ChangeFromPreviousClose"`
	PercentChangeFromPreviousClose float32    `json:"PercentChangeFromPreviousClose"`
}

EndOfDayQuote object in GetQuotesRangeResponse

type EquityQuote

type EquityQuote struct {
	Outcome  string    `json:"Outcome"`
	Message  string    `json:"Message"`
	Security *Security `json:"Security"`
	Quote    *Quote    `json:"Quote"`
}

EquityQuote object in GetQuotesResponse

type GetBarsResponse

type GetBarsResponse struct {
	Outcome    string    `json:"Outcome"`
	DelaySec   float32   `json:"Delay"`
	Message    string    `json:"Message"`
	Security   *Security `json:"Security"`
	ArrayOfBar []Bar     `json:"ArrayOfBar"`
}

--------------------------

type GetIndexBarsResponse

type GetIndexBarsResponse struct {
	Outcome       string    `json:"Outcome"`
	DelaySec      float32   `json:"Delay"`
	Message       string    `json:"Message"`
	IndexAndGroup *Security `json:"IndexAndGroup"`
	ArrayOfBar    []Bar     `json:"ArrayOfBar"`
}

--------------------------

type GetIndexQuotesRangeResponse

type GetIndexQuotesRangeResponse struct {
	Outcome              string          `json:"Outcome"`
	Message              string          `json:"Message"`
	IndexAndGroup        *Security       `json:"IndexAndGroup"`
	ArrayOfEndOfDayQuote []EndOfDayQuote `json:"ArrayOfEndOfDayQuote"`
}

GetQuotesRangeResponse is a response model for the QuickIndexHistorical/GetQuotesRange endpoint

type GetQuotesRangeResponse

type GetQuotesRangeResponse struct {
	Outcome              string          `json:"Outcome"`
	Message              string          `json:"Message"`
	Security             *Security       `json:"Security"`
	ArrayOfEndOfDayQuote []EndOfDayQuote `json:"ArrayOfEndOfDayQuote"`
}

-------------------------- GetQuotesRangeResponse is a response model for the QUICKEquityHistorical/GetQuotesRange endpoint

type GetQuotesResponse

type GetQuotesResponse struct {
	DelaySec           float32       `json:"Delay"`
	ArrayOfEquityQuote []EquityQuote `json:"ArrayOfEquityQuote"`
}

GetQuotesResponse is a response model for Get Quotes endpoint

type Index

type Index struct {
	Symbol string `json:"Symbol"`
}

Index object in ListIndexSymbolsResponse

type ListIndexSymbolsResponse

type ListIndexSymbolsResponse struct {
	Outcome      string  `json:"Outcome"`
	Message      string  `json:"Message"`
	ArrayOfIndex []Index `json:"ArrayOfIndex"`
}

-------------------------- ListIndexSymbolsResponse is a response model for the /QUICKIndexHistorical.json/ListSymbols endpoint

type ListSymbolsResponse

type ListSymbolsResponse struct {
	Outcome                    string                `json:"Outcome"`
	Message                    string                `json:"Message"`
	ArrayOfSecurityDescription []SecurityDescription `json:"ArrayOfSecurityDescription"`
}

ListSymbolsResponse is a response model for the /QUICKEquityRealTime.json/ListSymbols endpoint

type Quote

type Quote struct {
	DateTime    XigniteDateTime `json:"DateTime,omitempty"`
	Ask         float32         `json:"Ask"`
	AskSize     float32         `json:"AskSize"`
	AskDateTime XigniteDateTime `json:"AskDateTime,omitempty"`
	Bid         float32         `json:"Bid"`
	BidSize     float32         `json:"BidSize"`
	BidDateTime XigniteDateTime `json:"BidDateTime,omitempty"`
	// Stocks to be listed => LastMarketDate is "",
	// Stocks that are listed but don't have Ask/Bid data => LastMarketDate is a normal datetime string
	LastMarketDate XigniteDay `json:"LastMarketDate"`
	// price of the most recent deal
	Last                           float32 `json:"Last"`
	LastSize                       float32 `json:"LastSize"`
	Open                           float32 `json:"Open"`
	High                           float32 `json:"High"`
	Low                            float32 `json:"Low"`
	Close                          float32 `json:"Close"`
	PreviousClose                  float32 `json:"PreviousClose"`
	Volume                         int64   `json:"Volume"`
	ExchangeOfficialClose          float32 `json:"ExchangeOfficialClose"`
	PreviousExchangeOfficialClose  float32 `json:"PreviousExchangeOfficialClose"`
	ChangeFromPreviousClose        float32 `json:"ChangeFromPreviousClose"`
	PercentChangeFromPreviousClose float32 `json:"PercentChangeFromPreviousClose"`
	UTCOffSet                      int     `json:"UTCOffSet"`
}

Quote object in Equity Quote object

type Security

type Security struct {
	Symbol string `json:"Symbol"`
}

Security object in EquityQuote object

type SecurityDescription

type SecurityDescription struct {
	Symbol string `json:"Symbol"`
}

SecurityDescription object in ListSymbolsResponse

type XigniteDateTime

type XigniteDateTime time.Time

XigniteDateTime is a date time in XigniteDateTimeLayout format

func (*XigniteDateTime) UnmarshalJSON

func (cd *XigniteDateTime) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a string in the XigniteDateTime Layout

type XigniteDay

type XigniteDay time.Time

XigniteDay is a date (yyyy/mm/dd) in XigniteDateTimeLayout format

func (*XigniteDay) UnmarshalJSON

func (cd *XigniteDay) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a string in the XigniteDay Layout

Jump to

Keyboard shortcuts

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