api

package
v4.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const SuccessOutcome = "Success"
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"

XigniteDayLayout 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(ctx context.Context, identifiers []string) (GetQuotesResponse, error)
	ListSymbols(ctx context.Context, exchange string) (ListSymbolsResponse, error)
	ListIndexSymbols(ctx context.Context, indexGroup string) (ListIndexSymbolsResponse, error)
	GetRealTimeBars(ctx context.Context, identifier string, start, end time.Time,
	) (response GetBarsResponse, err error)
	GetIndexBars(ctx context.Context, identifier string, start, end time.Time,
	) (response GetIndexBarsResponse, err error)
	GetQuotesRange(ctx context.Context, identifier string, startDate, endDate time.Time,
	) (response GetQuotesRangeResponse, err error)
	GetIndexQuotesRange(ctx context.Context, 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 with a default http client.

func NewDefaultAPIClient

func NewDefaultAPIClient(token string, timeoutSec int, baseURL string, endpoints Endpoints) *DefaultClient

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

func (*DefaultClient) GetIndexBars

func (c *DefaultClient) GetIndexBars(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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 Endpoints added in v4.1.23

type Endpoints struct {
	EquityRealTimeGetQuotes        string
	EquityRealTimeListSymbols      string
	EquityRealTimeGetBars          string
	EquityHistoricalGetQuotesRange string
	IndexRealTimeGetBars           string
	IndexHistoricalListSymbols     string
	IndexHistoricalGetQuotesRange  string
}

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"`
}

GetIndexQuotesRangeResponse 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"`
	Message            string        `json:"Message"`
	ExceptionMessage   string        `json:"ExceptionMessage"`
	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