mschindler83 / alpha-vantage
Alpha Vantage API 包装器
v1.0.0
2020-03-09 13:44 UTC
Requires
- php: >=7.4
- ext-json: *
- beberlei/assert: ^3.2
- guzzlehttp/guzzle: ~6.0
- mschindler83/array-access: ^1.5
- opis/json-schema: ^1.0
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-09-19 22:56:39 UTC
README
Alpha Vantage API 的包装库 需要 PHP >= 7.4
安装
composer require mschindler83/alpha-vantage
特性
- 获取外汇汇率
- 搜索符号
- 获取全球报价
- [...] 更多功能即将推出
使用示例
获取客户端实例
$alphaVantage = \Mschindler83\AlphaVantage\Client::instance($apiKey)
获取外汇汇率
$request = ForexExchangeRateRequest::convert('EUR', 'USD');
$exchangeRate = $alphaVantage->forexExchangeRate($request);
echo $exchangeRate->exchangeRate();
搜索符号
$request = SearchRequest::queryString('MSCI World');
$searchResults = $alphaVantage->search($request);
$allResultsArray = $searchResults->items();
echo $allResultsArray[0]->symbol();
获取全球报价
$request = GlobalQuoteRequest::symbol('IWDA.LON');
$globalQuote = $alphaVantage->globalQuote($request);
echo $globalQuote->open();
echo $globalQuote->high();
echo $globalQuote->low();
[...]