Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/SimpleApplicationsOrg/stock/alphavantage" ) func main() { avClient, err := alphavantage.NewAVClient() if err != nil { fmt.Printf("error getting client: %s", err.Error()) return } response, err := avClient.TimeSeriesIntraday("GOOGL", "1min") if err != nil { fmt.Printf("error calling api: %s", err.Error()) return } metaData := *response.MetaData fmt.Println(metaData.Information(), metaData.OutputSize()) fmt.Println(metaData.LastRefreshed(), metaData.TimeZone()) fmt.Println(metaData.Interval()) timeSeries := *response.TimeSeries for _, timeStamp := range timeSeries.TimeStamps() { value := (timeSeries)[timeStamp] fmt.Println(timeStamp, value.Open(), value.High(), value.Low(), value.Close(), value.Volume()) } }
Output:
Index ¶
Examples ¶
Constants ¶
const ( // Intraday function Intraday = "TIME_SERIES_INTRADAY" // Daily function Daily = "TIME_SERIES_DAILY" // DailyAdjusted function DailyAdjusted = "TIME_SERIES_DAILY_ADJUSTED" // Weekly function Weekly = "TIME_SERIES_WEEKLY" // Monthly function Monthly = "TIME_SERIES_MONTHLY" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AVClient ¶
type AVClient struct {
// contains filtered or unexported fields
}
AVClient is the client for the Alpha Vantage API
func NewAVClient ¶
NewAVClient gives a specific Alpha Vantage API client
func (*AVClient) TimeSeries ¶
func (api *AVClient) TimeSeries(function, symbol string) (*TimeSeriesData, error)
TimeSeries gets daily, weekly and monthly series
func (*AVClient) TimeSeriesIntraday ¶
func (api *AVClient) TimeSeriesIntraday(symbol, interval string) (*TimeSeriesData, error)
TimeSeriesIntraday returns intraday time series (timestamp, open, high, low, close, volume) of the equity specified, updated realtime.
type MetaData ¶
MetaData about the time series data
func (MetaData) Information ¶
Information gives the metadata value
func (MetaData) LastRefreshed ¶
LastRefreshed gives the value for that metadata
func (MetaData) OutputSize ¶
OutputSize give the value for that metadata
type TimeSeries ¶
TimeSeries temporal resolution with the timestamp as the keys
func (TimeSeries) TimeStamps ¶
func (t TimeSeries) TimeStamps() []string
TimeStamps gives an array with all the value keys from the time series
type TimeSeriesData ¶
type TimeSeriesData struct { MetaData *MetaData TimeSeries *TimeSeries }
TimeSeriesData contains realtime and historical equity data in 4 different temporal resolutions: (1) intraday, (2) daily, (3) weekly, and (4) monthly. Daily, weekly, and monthly time series contain up to 20 years of historical data. Intraday time series typically span the past 10 to 15 active trading days.