cheesaw/alpha-vantage-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

This Bundle integrates the Alphavantage API into Symfony

v2.0.2 2021-04-12 11:40 UTC

This package is auto-updated.

Last update: 2023-02-11 09:01:07 UTC


README

Build Status Quality Coverage Dependencies Maintainability

This bundle integrates the http://alphavantage.co/ Stock and Crypto API into Symfony 3/4/5.

Requirements

  • PHP 7.4+
  • composer
  • Alphavantage API-key, claim yours here

Installation

composer require cheesaw/alpha-vantage-bundle

Setup

Set your API-key into an env var

CHEESAW_ALPHA_VANTAGE_API_KEY=YOUR-API-KEY

Usage

Just use the client, it will be autowired by Symfony into your Services/Controllers

/**
 * @Route("test/av/get", name="cheesaw_alphavantage_test")
 * @throws Exception
 */
public function alphaVantageTestAction(AlphaVantage $alphaVantageClient): Response
{
    $stockTimeSeries = new StockTimeSeries(StockTimeSeries::GLOBAL_QUOTE, 'BLDP');
    $response = $alphaVantageClient->get($stockTimeSeries);
    return new Response($response);
}

The code will output json:

{ "Global Quote": { "01. symbol": "BLDP", "02. open": "10.6200", "03. high": "10.9800", "04. low": "10.4500", "05. price": "10.9300", "06. volume": "1086884", "07. latest trading day": "2020-02-06", "08. previous close": "10.6300", "09. change": "0.3000", "10. change percent": "2.8222%" } }

Contributing

  1. Fork this repository
  2. Write your code
  3. Create a new pull request

FAQ

On any questions, send me a message!

License

License