定制 royopa/quandl-elephant-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

royopa/quandl-elephant-api

Composer 安装命令:

composer require royopa/quandl-elephant-api

包简介

A API to provide easy access to the Quandl API using PHP

README 文档

README

http://royopa.github.io/quandl-elephant-api

This project is a fork of php-quandl, a great API to provide easy access to the Quandl API using PHP.

The name of this project was changed to answer the PHP Licensing.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

Install

To install with composer:

composer require royopa/quandl-elephant-api

Examples

This is a basic call. It will return a PHP object with price data for AAPL:

use Royopa\Quandl;

$api_key = "YOUR_KEY_HERE";
$quandl  = new Quandl($api_key);
$data    = $quandl->getSymbol("GOOG/NASDAQ_AAPL");

You may pass any parameter that is mentioned in the Quandl documentation:

use Royopa\Quandl;

$quandl = new Quandl($api_key);
$data = $quandl->getSymbol($symbol, [
	"sort_order"      => "desc",
	"exclude_headers" => true,
	"rows"            => 10,
	"column"          => 4, 
]);

The date range options get a special treatment. You may use any date string that PHP's strtotime() understands.

use Royopa\Quandl;

$quandl = new Quandl($api_key, "csv");
$data = $quandl->getSymbol($symbol, [
	"trim_start" => "today-30 days",
	"trim_end"   => "today",
]);

You can also search the entire Quandl database and get a list of supported symbols in a data source:

use Royopa\Quandl;

$quandl = new Quandl($api_key);
$data   = $quandl->getSearch("crude oil");
$data   = $quandl->getList("WIKI", 1, 10);

More examples can be found in the examples.php file

Caching

You may provide the quandl object with a cache handler function. This function should be responsible for both reading from your cache and storing to it.

See the example_cache.php file.

Reference

Constructor and public properties

The constructor accepts two optional parameters: $api_key and $format:

$quandl = new Quandl("YOUR KEY", "csv");

You may also set these properties later:

$quandl->api_key = "YOUR KEY";
$quandl->format  = "json";

$format can be one of csv, xml, json, and object (which will return a php object obtained with json_decode()).

After each call to Quandl, the property $last_url will be set for debugging and other purposes. In case there was an error getting the data from Quandl, the result will be false and the property $error will contain the error message.

getSymbol

mixed getSymbol( string $symbol [, array $params ] )

Returns an object containing data for a given symbol. The format of the result depends on the value of $quandl->format.

The optional parameters array is an associative key => value array with any of the parameters supported by Quandl.

You do not need to pass auth_token in the array, it will be automatically appended.

getSearch

mixed getSearch( string $query [, int $page, int $per_page] )

Returns a search result object. Number of results per page is limited to 300 by default.

Note that currently Quandl does not support CSV response for this node so if $quandl->format is "csv", this call will return a JSON string instead.

getList

mixed getList( string $source [, int $page, int $per_page] )

Returns a list of symbols in a given source. Number of results per page is limited to 300 by default.

Tests

From the project directory, tests can be ran using:

./vendor/bin/phpunit

royopa/quandl-elephant-api 适用场景与选型建议

royopa/quandl-elephant-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 06 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 royopa/quandl-elephant-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 royopa/quandl-elephant-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 royopa/quandl-elephant-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 98
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-19