Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

This bundle integrates the alphavantage api into Symfony

License

Notifications You must be signed in to change notification settings

cHeeSaW/alpha-vantage-bundle

Repository files navigation

AlphaVantageBundle

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

About

This bundle integrates the alphavantage api into Symfony

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages