Download the PHP package dirkolbrich/yahoo-finance-query without Composer

On this page you can find all versions of the php package dirkolbrich/yahoo-finance-query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yahoo-finance-query

*For your Information: This is an abandoned project.*

As with Yahoo's latest API change (March 2017), and while I am moving more and more to Golang, I will no longer maintain this PHP package. Feel free to fork and make your own adjustments.

Thank you for your interest. I'll leave this files permanently for your and my documentation. The public available code example on my own webspace will be terminated.

*My personal special Thank You goes to all contributors. You tought me a lot.*


YahooFinanceQuery

A PHP class to query the Yahoo Finance API.

Features

Example

You can find an example.php file under /example.

Installation

require via composer.json in your project root

Implementation

As simple as that:

or as static:

Configuration

YahooFinanceQuery can be configured to return the data as an array or the raw json. Default returnType is array.

The config setting has to be passed as an array array('returnType' => 'array') or array('returnType' => 'json').

At initialisation:

or as static:

At run-time:

The current config setting can be retrieved with:

To retrieve the raw cURL result use raw() as addition to the query. This method must be called before the actural query method.

To force the query via the YQL api (if possible), use the yql() method within the query string. This method must be called before the actural query method. The default is set to not use YQL, as I think YQL querys are unreliable and often with truncated results.

Usage

Querys are chainable. Use the get() method to to retrieve the results.

The following query methods are available:

  1. symbolSuggest($string)

    Query for symbol suggestion via the YAHOO.Finance.SymbolSuggest.ssCallback

  2. quote(array $symbol [, array $params])

    Query for current quote for given symbols and given parameters.

    The passed parameter $symbol must be an array. Several symbols can be passed.

    The passed parameter $params is optional and must be an array too. It accepts the parameters as a written word or as tags. See as reference the $quoteParams variable in the class definition. If $params is empty, the query will use all possible params.

    The params 'Symbol', 'LastTradeTime' and 'LastTradeDate' will be quered by default. There will be a unified UTC 'LastTradeTimestamp' added to the result array.

  3. historicalQuote(array $symbol [, $startDate, $endDate, $param])

    Query for historical quotes for given symbol with given start date and end date.

    Only one $symbol can be passed per query and must be a string.

    $startDate and $endDate must be in the format YYYY-MM-DD. If no dates are passed, the query will grab all available historical quotes. If only one date is passed, the other one will be set to the maximum available.

    $param is set to default d = daily. See $historicalQuoteParams variable for other options.

    I recommend not to use the yql() method with historical quotes, as the YQL console permits only up to 365 single result quotes. To retrieve a full set of historical quotes will not be possible via YQL.

  4. intraDay($symbol [, $period, $param])

    Query finance.yahoo.com for intraday quotes. The symbol must be passed as as string.

    $period is optional and default set to 1d. It is possible to retrieve intraday quotes for up to the last 15 days.

    $param is optional and default set to quote. For other options see the $intraDayParams variable.

  5. stockInfo($symbol)

    Query finance.yahoo.com for basic stock information. The symbol must be passed as as string.

  6. indexList(array $symbol)

    Query for an index which returns the symbol and name of the components. Several symbols may be passed as an array.

    See http://finance.yahoo.com/intlindices?e=europe for more symbols to world indices. The caret ^ character must be part of the symbol.

  7. sectorList()

    Query for a complete list of sectors and their corresponding industries.

    This function is static without any params.

    Which returns an array in this form:

Recources

Some informative blog post and websites:

Yahoo YQL homepage

Blog post on that matter

Blog post from Joseph D. Purcell with an overview over finance API'S is a good entry point

www.gummy-stuff.org explains the Yahoo Finance .csv API

An overview over different api endpoints by Matthias Brusdeylins (german)

Tutorial for the YQL console by Thomas Belser (german)


All versions of yahoo-finance-query with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dirkolbrich/yahoo-finance-query contains the following files

Loading the files please wait ....