Skip to content

An API wrapper in Go for AlphaVantage

License

Notifications You must be signed in to change notification settings

portfoliotree/alphavantage

Repository files navigation

AlphaVantage Go Client

Go Reference Test

This is an unofficial REST API wrapper for https://www.alphavantage.co

The Command Line Interface

Installation

  1. Ensure you have a recent version of Go installed.
  2. Execute go install github.com/portfoliotree/alphavantage/cmd/av@latest
  3. Check to see if it installed by executing av help

Authentication

Set an environment variable ALPHA_VANTAGE_TOKEN with your token.

Commands

quotes

Fetches time series data for given symbols and writes the CSV result to a file.

  • Given av is installed and the environment variable ALPHA_VANTAGE_TOKEN is set
  • When you run av quotes --function=TIME_SERIES_MONTHLY IBM and it succeeds
  • Then you will see a file "IBM.csv" in your current directory

The --function may have any of the values listed in global_quote.go.

listing-status

Fetches listing status and writes the result to a CSV file.

  • Given av is installed and the environment variable ALPHA_VANTAGE_TOKEN is set
  • When you run av listing-status --listed=false and it succeeds
  • Then you will see a file "listing_status_false.csv" in your current directory

symbol-search

Queries the search endpoint and writes the output to stdout (standard out not a file).

  • Given av is installed and the environment variable ALPHA_VANTAGE_TOKEN is set
  • When you run av symbol-search 'VMware' and it succeeds
  • Then you will see the result printed to standard out formatted as CSV.

help

Documents the above commands.

The output looks something like this.

av - An AlphaVantage CLI in Go

Global Flags:
  -token string
    	api authentication token

Commands:
  listing-status
	Fetch listing & de-listing status.
	https://www.alphavantage.co/documentation/#listing-status
  quotes
	Fetch time series stock quotes.
	https://www.alphavantage.co/documentation/#time-series-data
  symbol-search
	Writes symbol search results to stdout.
	https://www.alphavantage.co/documentation/#symbolsearch

Supported Endpoints

Not all endpoints are supported yet. Make an Issue or PR if you'd like to have more endpoints covered.

I have found the CSV encoding easier to parse.

  • TIME_SERIES_INTRADAY
  • TIME_SERIES_DAILY
  • TIME_SERIES_DAILY_ADJUSTED
  • TIME_SERIES_MONTHLY
  • TIME_SERIES_MONTHLY_ADJUSTED
  • Quote
  • Search Endpoint
  • Company Overview
  • Income Statement
  • Balance Sheet
  • Cashflow
  • Earnings
  • Listing & Delisting Status
  • Earnings Calendar
  • IPO Calendar

None implemented.

None implemented (I generally just use FRED directly).

None implemented.