cheesaw/alpha-vantage-bundle

此包已被废弃,不再维护。未建议替代包。

此Bundle将Alphavantage API集成到Symfony

安装: 26

依赖项: 0

建议者: 0

安全: 0

星标: 2

关注者: 0

分支: 0

开放问题: 0

类型:symfony-bundle

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

此包将http://alphavantage.co/股票和加密货币API集成到Symfony 3/4/5。

要求

  • PHP 7.4+
  • composer
  • Alphavantage API密钥,您可以在这里申请

安装

composer require cheesaw/alpha-vantage-bundle

设置

将您的API密钥设置为环境变量

CHEESAW_ALPHA_VANTAGE_API_KEY=YOUR-API-KEY

使用方法

只需使用客户端,它将被Symfony自动注入到您的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);
}

代码将输出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%" } }

贡献

  1. 分支此仓库
  2. 编写您的代码
  3. 创建一个新的pull request

常见问题解答

有任何问题,请给我发消息!

许可

License