All Projects → DannyBen → Php Quandl

DannyBen / Php Quandl

Licence: mit
Easy access to the Quandl Data API using PHP

Projects that are alternatives of or similar to Php Quandl

Unifi Api Browser
Tool to browse data exposed by Ubiquiti's UniFi Controller API (demo: https://api-browser-demo.artofwifi.net/)
Stars: ✭ 677 (+1227.45%)
Mutual labels:  api, api-client
Slack
🎉✨ Slack API client for Node and browsers.
Stars: ✭ 903 (+1670.59%)
Mutual labels:  api, api-client
Client
GitLab API v4 client for PHP
Stars: ✭ 763 (+1396.08%)
Mutual labels:  api, api-client
Unifi Api Client
A PHP API client class to interact with Ubiquiti's UniFi Controller API
Stars: ✭ 602 (+1080.39%)
Mutual labels:  api, api-client
Hashapi Lib Node
Tierion Hash API client library for Node.js
Stars: ✭ 20 (-60.78%)
Mutual labels:  api, api-client
Client
DigitalOcean API v2 client for PHP
Stars: ✭ 604 (+1084.31%)
Mutual labels:  api, api-client
Cv4pve Api Java
Proxmox VE Client API JAVA
Stars: ✭ 17 (-66.67%)
Mutual labels:  api, api-client
Insomnia
The open-source, cross-platform API client for GraphQL, REST, and gRPC.
Stars: ✭ 18,969 (+37094.12%)
Mutual labels:  api, api-client
Genius Php
PHP library for Genius API (http://genius.com/developers)
Stars: ✭ 10 (-80.39%)
Mutual labels:  api, api-client
Abclinuxuapi
API for http://abclinuxu.cz.
Stars: ✭ 8 (-84.31%)
Mutual labels:  api, api-client
Datafire
A framework for building integrations and APIs
Stars: ✭ 487 (+854.9%)
Mutual labels:  api, api-client
Apipie
Transform api declaration to js object for frontend. Inspired by VueRouter, koa-middleware and axios.
Stars: ✭ 29 (-43.14%)
Mutual labels:  api, api-client
Node Vault
Client for HashiCorp's Vault
Stars: ✭ 391 (+666.67%)
Mutual labels:  api, api-client
Pyowm
A Python wrapper around the OpenWeatherMap web API
Stars: ✭ 654 (+1182.35%)
Mutual labels:  api, api-client
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (+601.96%)
Mutual labels:  api, api-client
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+1460.78%)
Mutual labels:  api, api-client
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+5592.16%)
Mutual labels:  api, api-client
Hubspot Php
HubSpot PHP API Client
Stars: ✭ 273 (+435.29%)
Mutual labels:  api, api-client
Cortex4py
Python API Client for Cortex
Stars: ✭ 22 (-56.86%)
Mutual labels:  api, api-client
Hoppscotch
👽 Open source API development ecosystem https://hoppscotch.io
Stars: ✭ 34,569 (+67682.35%)
Mutual labels:  api, api-client

PHP Quandl

Latest Stable Version Build Status Maintainability


This library provides easy access to the Quandl API using PHP.

It provides several convenience methods to common Quandl API endpoints, as well as a generic method to access any of Quandl's endpoints directly.


Geting Started

Include the Quandl.php class in your code, and run one of the examples.

To install with composer:

$ composer require dannyben/php-quandl

Examples

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

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

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

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

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

$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:

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

To access any Quandl API endpoint directly, use the get method

$quandl = new Quandl($api_key);
$data = $quandl->get("databases/WIKI");

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

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

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

You may also set these properties later (see below);

Public Properties

$api_key

$quandl->api_key = "YOUR KEY";

Set your API key

$format

$quandl->format = 'csv';

Set the output format. Can be: csv, xml, json, and object (which will return a php object obtained with json_decode()).

$force_curl

$quandl->force_curl = true;

Force download using curl. By default, we will try to download with file_get_contents if available, and fall back to curl only as a last resort.

$no_ssl_verify

$quandl->no_ssl_verify = true;

Disables curl SSL verification. Set to true if you get an error saying "SSL certificate problem".

$timeout

$quandl->timeout = 60;

Set the timeout for the download operations.

$last_url

print $quandl->last_url;

Holds the last API URL as requested from Quandl, for debugging.

$error

print $quandl->error;

In case there was an error getting the data from Quandl, the request response will be false and this property will contain the error message.

$was_cached

print $quandl->was_cached;

When using a cache handler, this property will be set to true if the response came from the cache.

Methods

get

mixed get( string $path [, array $params ] )

// Examples
$data = $quandl->get( 'datasets/EOD/QQQ' );
$data = $quandl->get( 'datasets/EOD/QQQ', ['rows' => 5] );

Returns an object containing the response from any of Quandl's API endpoints. 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.

getSymbol

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

// Examples
$data = $quandl->getSymbol( 'WIKI/AAPL' );
$data = $quandl->getSymbol( 'WIKI/AAPL', ['rows' => 5] );

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] )

// Examples
$data = $quandl->getSearch( "gold" );
$data = $quandl->getSearch( "gold", 1, 10 );

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] )

// Examples
$data = $quandl->getList( 'WIKI' );
$data = $quandl->getList( 'WIKI', 1, 10 );

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

getMeta

mixed getMeta( string $source )

// Example
$data = $quandl->getMeta( 'WIKI' );

Returns metadata about a symbol.

getDatabases

mixed getDatabases( [int $page, int $per_page] )

// Examples
$data = $quandl->getDatabases();
$data = $quandl->getDatabases( 1, 10 );

Returns a list of available databases. Number of results per page is limited to 100 by default.

getBulk

This feature is only supported with premium databases.

boolean getBulk( string $database, string $path [, boolean $complete] )

// Examples
boolean getBulk( 'EOD', 'eod-partial.zip' );
boolean getBulk( 'EOD', 'eod-full.zip', true );

Downloads the entire database and saves it to a ZIP file. If $complete is true (false by default), it will download the entire database, otherwise, it will download the last day only.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].