goalphavantage

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 12 Imported by: 0

README

goalphavantage

API Wrapper for Alphavantage based in golang

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InValidInputError = errors.New("invalid input provided")
)

Functions

func IsAPIError added in v0.0.3

func IsAPIError(err error) bool

Types

type APIError

type APIError struct {
	Message string
}

func (*APIError) Error

func (a *APIError) Error() string

type ActiveListing

type ActiveListing struct {
	Symbol    string `json:"symbol"`
	Name      string `json:"name"`
	Exchange  string `json:"exchange"`
	AssetType string `json:"assetType"`
}

type BoolString added in v0.0.4

type BoolString string

func (BoolString) Valid added in v0.0.4

func (b BoolString) Valid() bool

type Client

type Client struct {
	BaseURL string

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string) *Client

func (*Client) GetLatestActiveListingStatus

func (c *Client) GetLatestActiveListingStatus(ctx context.Context) (*[]ActiveListing, error)

func (*Client) GetNewsSentiment

func (c *Client) GetNewsSentiment(ctx context.Context, options *NewsSentimentOptions) (*NewsSentimentResponse, error)

func (*Client) GetTimeSeriesStockData added in v0.0.4

func (c *Client) GetTimeSeriesStockData(ctx context.Context, options *CoreStockSharedInputOptions) (*CoreStockResponse, error)

func (*Client) GetTopGainersLosers

func (c *Client) GetTopGainersLosers(ctx context.Context) (*RankingResponse, error)

type CoreStockData added in v0.0.4

type CoreStockData struct {
	Open                  *string `json:"1. open"`
	High                  *string `json:"2. high"`
	Low                   *string `json:"3. low"`
	Close                 *string `json:"4. close"`
	Volume                *string `json:"5. volume,omitempty"`
	AdjustedClose         *string `json:"5. adjusted close,omitempty"`
	VolumeForAdjustedCall *string `json:"6. volume,omitempty"`
	DividendAmount        *string `json:"7. dividend amount,omitempty"`
}

type CoreStockResponse added in v0.0.4

type CoreStockResponse struct {
	MetaData                  *MetaData                 `json:"Meta Data,omitempty"`
	LatestQuote               *GlobalQuote              `json:"Global Quote,omitempty"`
	MonthlyAdjustedTimeSeries map[string]*CoreStockData `json:"Monthly Adjusted Time Series,omitempty"`
	MonthlyTimeSeries         map[string]*CoreStockData `json:"Monthly Time Series,omitempty"`
	OneMinTimeSeries          map[string]*CoreStockData `json:"Time Series (1min),omitempty"`
	FiveMinTimeSeries         map[string]*CoreStockData `json:"Time Series (5min),omitempty"`
	FifteenMinTimeSeries      map[string]*CoreStockData `json:"Time Series (15min),omitempty"`
	ThirtyMinTimeSeries       map[string]*CoreStockData `json:"Time Series (30min),omitempty"`
	HourTimeSeries            map[string]*CoreStockData `json:"Time Series (60min),omitempty"`
	DailyTimeSeries           map[string]*CoreStockData `json:"Time Series (Daily),omitempty"`
	WeeklyTimeSeries          map[string]*CoreStockData `json:"Weekly Time Series,omitempty"`
	WeeklyAdjustedTimeSeries  map[string]*CoreStockData `json:"Weekly Adjusted Time Series,omitempty"`
}

type CoreStockSharedInputOptions added in v0.0.4

type CoreStockSharedInputOptions struct {
	Function      Function   `url:"function"`
	Symbol        string     `url:"symbol"`
	Interval      Interval   `url:"interval"`
	Datatype      DataType   `url:"datatype, omitempty"`
	Adjusted      BoolString `url:"adjusted, omitempty"`
	ExtendedHours BoolString `url:"extended_hours, omitempty"`
	Month         string     `url:"month, omitempty"`
	OutputSize    OutputSize `url:"outputsize, omitempty"`
}

func (CoreStockSharedInputOptions) Valid added in v0.0.4

type DataType added in v0.0.4

type DataType string

func (DataType) Valid added in v0.0.4

func (d DataType) Valid() bool

type Function added in v0.0.4

type Function string

func (Function) Valid added in v0.0.4

func (f Function) Valid() bool

type GlobalQuote added in v0.0.4

type GlobalQuote struct {
	Symbol           *string `json:"01. symbol"`
	Open             *string `json:"02. open"`
	High             *string `json:"03. high"`
	Low              *string `json:"04. low"`
	Price            *string `json:"05. price"`
	Volume           *string `json:"06. volume"`
	LatestTradingDay *string `json:"07. latest trading day"`
	PreviousClose    *string `json:"08. previous close"`
	Change           *string `json:"09. change"`
	ChangePercent    *string `json:"10. change percent"`
}

type Interval added in v0.0.4

type Interval string

func (Interval) Valid added in v0.0.4

func (i Interval) Valid() bool

type MetaData added in v0.0.4

type MetaData struct {
	Information   *string `json:"1. Information,omitempty"`
	Symbol        *string `json:"2. Symbol,omitempty"`
	LastRefreshed *string `json:"3. Last Refreshed,omitempty"`
	Interval      *string `json:"4. Interval,omitempty"`
	OutputSize    *string `json:"5. Output Size,omitempty"`
	TimeZone      *string `json:"6. Time Zone,omitempty"`
}

type NewsFeed

type NewsFeed struct {
	Title                 *string            `json:"title"`
	URL                   *string            `json:"url"`
	TimePublished         *string            `json:"time_published"`
	Authors               []*string          `json:"authors"`
	Summary               *string            `json:"summary"`
	BannerImage           *string            `json:"banner_image"`
	Source                *string            `json:"source"`
	CategoryWithinSource  *string            `json:"category_within_source"`
	SourceDomain          *string            `json:"source_domain"`
	Topics                []*TopicRelevance  `json:"topics"`
	OverallSentimentScore *float64           `json:"overall_sentiment_score"`
	OverallSentimentLabel *string            `json:"overall_sentiment_label"`
	TickerSentiment       []*TickerSentiment `json:"ticker_sentiment"`
}

type NewsSentimentOptions

type NewsSentimentOptions struct {
	Tickers  []string `url:"tickers,omitempty"`
	Topics   []Topic  `url:"topics,omitempty"`
	TimeFrom string   `url:"time_from,omitempty"`
	TimeTo   string   `url:"time_to,omitempty"`
	Sort     Sort     `url:"sort,omitempty"`
	Limit    int      `url:"limit,omitempty"`
}

func (NewsSentimentOptions) Valid added in v0.0.4

func (n NewsSentimentOptions) Valid() bool

type NewsSentimentResponse

type NewsSentimentResponse struct {
	Items                    *string     `json:"items"`
	SentimentScoreDefinition *string     `json:"sentiment_score_definition"`
	RelevanceScoreDefinition *string     `json:"relevance_score_definition"`
	Feed                     []*NewsFeed `json:"feed"`
}

type OutputSize added in v0.0.4

type OutputSize string

func (OutputSize) Valid added in v0.0.4

func (o OutputSize) Valid() bool

type RankedStock

type RankedStock struct {
	Ticker           *string `json:"ticker"`
	Price            *string `json:"price"`
	ChangeAmount     *string `json:"change_amount"`
	ChangePercentage *string `json:"change_percentage"`
	Volume           *string `json:"volume"`
}

type RankingResponse

type RankingResponse struct {
	Metadata           *string        `json:"metadata"`
	LastUpdated        *string        `json:"last_updated"`
	TopGainers         []*RankedStock `json:"top_gainers"`
	TopLosers          []*RankedStock `json:"top_losers"`
	MostActivelyTraded []*RankedStock `json:"most_actively_traded"`
}

type Sort

type Sort string

func (Sort) Valid added in v0.0.4

func (s Sort) Valid() bool

type TickerSentiment

type TickerSentiment struct {
	Ticker               *string `json:"ticker"`
	RelevanceScore       *string `json:"relevance_score"`
	TickerSentimentScore *string `json:"ticker_sentiment_score"`
	TickerSentimentLabel *string `json:"ticker_sentiment_label"`
}

type Topic

type Topic string

func (Topic) Valid added in v0.0.4

func (t Topic) Valid() bool

type TopicRelevance

type TopicRelevance struct {
	Topic          *string `json:"topic"`
	RelevanceScore *string `json:"relevance_score"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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