PHP code example of radicalloop / yahoo-finance-query

1. Go to this page and download the library: Download radicalloop/yahoo-finance-query library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

radicalloop / yahoo-finance-query example snippets


use DirkOlbrich\YahooFinanceQuery\YahooFinanceQuery;
// [...]
$query = new YahooFinanceQuery;

use DirkOlbrich\YahooFinanceQuery\YahooFinanceQuery;
// [...]
YahooFinanceQuery->make();

$query = new YahooFinanceQuery(array('returnType' => 'json'));

YahooFinanceQuery->make(array('returnType' => 'json'));

$query = new YahooFinanceQuery;
$query->config(array('returnType' => 'json'));

$query->getConfig();

$query->raw()->quote()->get();

$query->yql()->quote()->get();

$data = $query->method()->get();

    $string = 'basf';
    $data = $query->symbolSuggest($string)->get();
    

    $symbol = array('bas.de');
    $params = array('LastTradePriceOnly', 'x', 'c1');
    $data = $query->quote($symbol, $params)->get();
    

    $symbol = array('bas.de');
    $startDate = 2013-07-26;
    $endDate = 2014-01-06;
    $param = 'd';
    $data = $query->historicalQuote($symbol, $startDate, $endDate, $param)->get();
    

    $symbol = 'bas.de';
    $period = '5d';
    $data = $query->intraDay($symbol, $period)->get();
    

    $symbol = 'bas.de';
    $data = $query->stockInfo($symbol)->get();
    

    $symbol = array('^GDAXI');
    $data = $query->indexList($symbol)->get();
    

    $data = $query->sectorList()->get();
    

    Array (
        [0] => Array (
            [name] => Basic Materials
            [industries] => Array (
                [0] => Array (
                    [name] => Agricultural Chemicals
                    [id] => 112 )
                [1] => Array (
                    [name] => Aluminum
                    [id] => 132 )
                ... )
            )
        [1] => Array (
            [name] => Conglomerates
            [industries] => Array ( ... )
            )