alphaVantage

package
v0.0.0-...-b86247b Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjustedQuote

type AdjustedQuote struct {
	Ticker           string
	Time             time.Time
	Open             float64
	High             float64
	Low              float64
	Close            float64
	AdjustedClose    float64
	Volume           float64
	DividendAmount   float64
	SplitCoefficient float64
}

type AdjustedTimeSeries

type AdjustedTimeSeries map[time.Time]AdjustedQuote

func (AdjustedTimeSeries) Sorted

func (ts AdjustedTimeSeries) Sorted() []AdjustedQuote

func (*AdjustedTimeSeries) SortedTimes

func (ts *AdjustedTimeSeries) SortedTimes() []time.Time

type AlphaVantageClient

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

func Client

func Client() *AlphaVantageClient

func (*AlphaVantageClient) BaseUrl

func (c *AlphaVantageClient) BaseUrl(baseUrl string) *AlphaVantageClient

func (*AlphaVantageClient) HttpClient

func (c *AlphaVantageClient) HttpClient(httpClient *http.Client) *AlphaVantageClient

func (*AlphaVantageClient) Key

func (*AlphaVantageClient) Quote

func (a *AlphaVantageClient) Quote(symbol string) (*RealTimeQuote, *ApiError)

func (*AlphaVantageClient) RetryAttempts

func (c *AlphaVantageClient) RetryAttempts(retryAttempts int) *AlphaVantageClient

func (*AlphaVantageClient) TimeSeriesDaily

func (a *AlphaVantageClient) TimeSeriesDaily(symbol string, size Size) (TimeSeries, *ApiError)

func (*AlphaVantageClient) TimeSeriesDailyAdjusted

func (a *AlphaVantageClient) TimeSeriesDailyAdjusted(symbol string, size Size) (AdjustedTimeSeries, *ApiError)

func (*AlphaVantageClient) TimeSeriesIntraday

func (a *AlphaVantageClient) TimeSeriesIntraday(symbol string, interval Interval, size Size) (TimeSeries, *ApiError)

func (*AlphaVantageClient) TimeSeriesMonthly

func (a *AlphaVantageClient) TimeSeriesMonthly(symbol string) (TimeSeries, *ApiError)

func (*AlphaVantageClient) TimeSeriesMonthlyAdjusted

func (a *AlphaVantageClient) TimeSeriesMonthlyAdjusted(symbol string) (AdjustedTimeSeries, *ApiError)

func (*AlphaVantageClient) TimeSeriesWeekly

func (a *AlphaVantageClient) TimeSeriesWeekly(symbol string) (TimeSeries, *ApiError)

func (*AlphaVantageClient) TimeSeriesWeeklyAdjusted

func (a *AlphaVantageClient) TimeSeriesWeeklyAdjusted(symbol string) (AdjustedTimeSeries, *ApiError)

type ApiError

type ApiError struct {
	Type    ErrorType
	Message string
}

func ToApiError

func ToApiError(e error, errorType ErrorType) *ApiError

func (*ApiError) Error

func (e *ApiError) Error() string

type ErrorType

type ErrorType string
const (
	ERROR_REQUEST_FAILED ErrorType = "REQUEST_FAILED"
	ERROR_PARSE          ErrorType = "RESPONSE_PARSE"
	ERROR_RATE_LIMIT     ErrorType = "RATE_LIMIT"
	ERROR_OTHER          ErrorType = "OTHER"
)

type Interval

type Interval string
const (
	INTERVAL_1  Interval = "1min"
	INTERVAL_5  Interval = "5min"
	INTERVAL_15 Interval = "5min"
	INTERVAL_30 Interval = "30min"
	INTERVAL_60 Interval = "360min"
)

type Quote

type Quote struct {
	Ticker string
	Time   time.Time
	Open   float64
	High   float64
	Low    float64
	Close  float64
	Volume float64
}

type RealTimeQuote

type RealTimeQuote struct {
	Ticker            string
	Time              time.Time
	Open              float64
	High              float64
	Low               float64
	Current           float64
	Volume            float64
	LatestTradingDate time.Time
	PreviousClose     float64
	PercentChange     float64
}

type Size

type Size string
const (
	SIZE_COMPACT Size = "compact"
	SIZE_FULL    Size = "full"
)

type TimeSeries

type TimeSeries map[time.Time]Quote

func (TimeSeries) Sorted

func (ts TimeSeries) Sorted() []Quote

func (*TimeSeries) SortedTimes

func (ts *TimeSeries) SortedTimes() []time.Time

Jump to

Keyboard shortcuts

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