BoxLang 🚀 A New JVM Dynamic Language Learn More...

AlphaVantage

v1.0.3 Modules

AlphaVantage CFML API wrapper

Wraps the AlphaVantage API for easy CFML usage using the Hyper ColdBox module.

AlphaVantage Release

Getting Started

  1. Install this module - box install AlphaVantage
  2. Configure AlphaVantage API secrets using .env
  3. OR configure AlphaVantage API via ColdBox moduleSettings

Environment Variable Configuration

AlphaVantage can mainly be configured using environment variables:

  • ALPHAVANTAGE_API_KEY - Required API key for authenticating with the AlphaVantage API
  • FINNUHB_API_URL - base URL of the AlphaVantage API.

You'll need to either use commandbox-dotenv to automatically populate environment variables from the .env file on server start, or manually read this file to populate environment variables inside your application.

# .env file
# AlphaVantage API Credentials
ALPHAVANTAGE_API_KEY=
ALPHAVANTAGE_API_URL=https://alphavantage.io/api/v1

As an aside, PLEASE ensure you ignore this file in your .gitignore!

ColdBox Module Configuration via ModuleSettings

Set this in config/ColdBox.cfc in the configure() method:

moduleSettings.alphavantage = {
    apiKey : "blablasecret",
    apiURL : "my.url"
};

API Reference

Each api method returns a HyperResponse object with the following methods (not exhaustive):

  • response.isSuccess() - boolean
  • response.isError() - boolean
  • response.json() - JSON deserialized to a struct or array
  • response.getData() - unchanged data payload

See the Hyper docs for more info on using a HyperResponse.

Fundamentals

getCompanyOverview

var response = getInstance( "Fundamentals@AlphaVantage" ).getCompanyOverview( "MSFT" );
ParameterTypeDescription
symbolstringRequired. Stock symbol to fetch

GetCompanyEarnings

var response = getInstance( "Fundamentals@AlphaVantage" ).getCompanyEarnings( "MSFT" );
ParameterTypeDescription
symbolstringRequired. Stock symbol to fetch

v1.0.3

21 Jul 2021 — 17:54: 57 UTC

other

  • *: 📖 DOC: Improved README with API Reference docs (c3a6734)
  • *: 🐛 FIX: Correct ModuleConfig apikey in ALphaVantageClient configuration (7978352)
  • *: 👌 IMPROVE: Update Release workflow name for cooler github badge (f32f33f)

$ box install alphavantage

No collaborators yet.
 
  • {{ getFullDate("2021-07-21T15:25:24Z") }}
  • {{ getFullDate("2021-07-21T17:55:02Z") }}
  • 1,193
  • 0