Documentation
¶
Index ¶
- Constants
- func GetPtrString(v string) *string
- func GetPtrTime(v time.Time) *time.Time
- type BulkEod
- type BulkEodParams
- type BulkEodService
- type Client
- func (c *Client) Do(req *retryablehttp.Request, data interface{}) (*Response, error)
- func (c *Client) GetApiToken() string
- func (c *Client) GetBaseUrl() *url.URL
- func (c *Client) GetCountryCode() string
- func (c *Client) GetDefaultFormat() RequestFormat
- func (c *Client) NewGetRequest(requestUrl string, headers *map[string]string) (*retryablehttp.Request, error)
- type ClientOption
- type Exchange
- type ExchangeParams
- type ExchangesService
- type Ohlcv
- type OhlcvParams
- type OhlcvService
- type Params
- type RequestClient
- type RequestFormat
- type Response
- type Ticker
- type TickerParams
- type TickerService
Constants ¶
View Source
const ( DefaultRateLimitPercent = 0.75 DefaultBurstPercent = 0.25 )
View Source
const ( RateLimitHeader = "X-RateLimit-Limit" RateLimitRemainingHeader = "X-RateLimit-Remaining" )
Variables ¶
This section is empty.
Functions ¶
func GetPtrString ¶
Types ¶
type BulkEod ¶
type BulkEod struct {
Code string `csv:"Code" json:"code"`
Exchange string `csv:"Ex" json:"exchange_short_name"`
Date string `csv:"Date" json:"date"`
Open float64 `csv:"Open" json:"open"`
High float64 `csv:"High" json:"high"`
Low float64 `csv:"Low" json:"low"`
Close float64 `csv:"Close" json:"close"`
AdjustedClose float64 `csv:"Adjusted_close" json:"adjusted_close"`
Volume int `csv:"Volume" json:"volume"`
}
type BulkEodParams ¶
type BulkEodParams struct {
ApiToken string `url:"api_token"`
Format RequestFormat `url:"fmt"`
Exchange string `url:"-"`
}
func NewBulkEodParams ¶
func NewBulkEodParams(apiToken string, exchange *string, format *RequestFormat) *BulkEodParams
func (*BulkEodParams) BuildPath ¶
func (b *BulkEodParams) BuildPath(baseUrl *url.URL) (string, error)
func (*BulkEodParams) GetEncoded ¶
func (b *BulkEodParams) GetEncoded() (string, error)
type BulkEodService ¶
type BulkEodService struct {
// contains filtered or unexported fields
}
func NewBulkEodService ¶
func NewBulkEodService(c RequestClient) *BulkEodService
func (*BulkEodService) GetBulkEod ¶
func (b *BulkEodService) GetBulkEod(exchange *string, format *RequestFormat) ([]*BulkEod, *Response, error)
type Client ¶
type Client struct {
UserAgent string
// services
OhlcvService *OhlcvService
ExchangesService *ExchangesService
TickerService *TickerService
BulkEodService *BulkEodService
// contains filtered or unexported fields
}
func (*Client) Do ¶
func (c *Client) Do(req *retryablehttp.Request, data interface{}) (*Response, error)
func (*Client) GetApiToken ¶
func (*Client) GetBaseUrl ¶
func (*Client) GetCountryCode ¶
func (*Client) GetDefaultFormat ¶
func (c *Client) GetDefaultFormat() RequestFormat
func (*Client) NewGetRequest ¶
type ClientOption ¶
func SetPercentOfRateLimit ¶
func SetPercentOfRateLimit(maxPercent float64) ClientOption
type ExchangeParams ¶
type ExchangeParams struct {
ApiToken string `url:"api_token"`
Format RequestFormat `url:"fmt"`
}
func NewExchangeParams ¶
func NewExchangeParams(apiToken string) *ExchangeParams
func (*ExchangeParams) BuildPath ¶
func (e *ExchangeParams) BuildPath(baseUrl *url.URL) (string, error)
func (*ExchangeParams) GetEncoded ¶
func (e *ExchangeParams) GetEncoded() (string, error)
type ExchangesService ¶
type ExchangesService struct {
// contains filtered or unexported fields
}
func NewExchangesService ¶
func NewExchangesService(c RequestClient) *ExchangesService
func (*ExchangesService) GetExchanges ¶
func (e *ExchangesService) GetExchanges() ([]*Exchange, *Response, error)
type Ohlcv ¶
type Ohlcv struct {
Date string `csv:"Date" json:"date"`
Open float64 `csv:"Open" json:"open"`
High float64 `csv:"High" json:"high"`
Low float64 `csv:"Low" json:"low"`
Close float64 `csv:"Close" json:"close"`
AdjClose float64 `csv:"Adjusted_close" json:"adjusted_close"`
Volume float64 `csv:"Volume" json:"volume"`
// Set via ParseDate from standard urlDateFormat
DateParsed *time.Time `csv:"-" json:"-"`
}
Ohlcv represents the OHLCV response for both JSON and CSV formats for historical EOD data.
type OhlcvParams ¶
type OhlcvParams struct {
Symbol string `url:"-"`
CountryCode string `url:"-"`
Format *RequestFormat `url:"fmt"`
FromTime *time.Time `url:"-"`
ToTime *time.Time `url:"-"`
From *string `url:"from,omitempty"`
To *string `url:"from,omitempty"`
ApiToken string `url:"api_token"`
}
func (*OhlcvParams) GetEncoded ¶
func (o *OhlcvParams) GetEncoded() (string, error)
type OhlcvService ¶
type OhlcvService struct {
// contains filtered or unexported fields
}
func NewOhlcvService ¶
func NewOhlcvService(c RequestClient) *OhlcvService
type RequestClient ¶
type RequestFormat ¶
type RequestFormat string
func GetFormatCsv ¶
func GetFormatCsv() *RequestFormat
func GetFormatJson ¶
func GetFormatJson() *RequestFormat
type Response ¶
func (*Response) SetHeaderValues ¶
func (r *Response) SetHeaderValues()
type Ticker ¶
type Ticker struct {
Code string `json:"Code" csv:"Code"`
Name string `json:"Name" csv:"Name"`
Country string `json:"Country" csv:"Country"`
Exchange string `json:"Exchange" csv:"Exchange"`
Currency string `json:"Currency" csv:"Currency"`
Type string `json:"Type" csv:"Type"`
Isin *string `json:"Isin,omitempty" csv:"Isin,omitempty"`
}
type TickerParams ¶
type TickerParams struct {
ApiToken string `url:"api_token"`
Format *RequestFormat `url:"fmt"`
ExchangeCode *string `url:"-"`
}
func NewTickerParams ¶
func NewTickerParams(apiToken, exchangeCode string, format RequestFormat) *TickerParams
func NewTickerParamsDefault ¶
func NewTickerParamsDefault(apiToken string) *TickerParams
func (*TickerParams) GetEncoded ¶
func (t *TickerParams) GetEncoded() (string, error)
type TickerService ¶
type TickerService struct {
// contains filtered or unexported fields
}
func NewTickerService ¶
func NewTickerService(c RequestClient) *TickerService
func (*TickerService) GetTickers ¶
func (t *TickerService) GetTickers(exchangeCode string, format *RequestFormat) ([]*Ticker, *Response, error)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
examples/bulk_eod
command
|
|
|
examples/csv_request
command
|
|
|
examples/exchanges
command
|
|
|
examples/json_request
command
|
|
|
examples/tickers
command
|
Click to show internal directories.
Click to hide internal directories.