PHP code example of radicalloop / eodhistoricaldata

1. Go to this page and download the library: Download radicalloop/eodhistoricaldata 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 / eodhistoricaldata example snippets


'providers' => [
    ...
    RadicalLoop\Eod\EodServiceProvider::class,
],

'aliases' => [
    ...
    'Eod' => RadicalLoop\Eod\Facades\Eod::class,
]

use Eod;

$stock = Eod::stock();

// JSON 
$stock->realTime('AAPL.US')->json();
$stock->eod('AAPL.US')->json();

// Download CSV 
$stock->realTime('AAPL.US' ['s' => ['VTI','EUR','FX']])->download();
$stock->eod('AAPL.US')->download();

// Save CSV to specific path
$stock->realTime('AAPL.US')->save('path/to/save/csv/stock.csv');

// For other parameters, for ex. dividend api with other params
$stock->dividend('AAPL.US', ['from' => '2017-01-01'])->json();

use Eod;

$exchange = Eod::exchange();

// JSON 
$exchange->symbol('US')->json();
$exchange->multipleTicker('US')->json();
$exchange->details('US')->json();

// Download CSV 
$exchange->symbol('US')->download();
$exchange->multipleTicker('US')->download();

// Save CSV to specific path
$exchange->symbol('US')->save('path/to/save/csv/stock.csv');

use RadicalLoop\Eod\Config;
use RadicalLoop\Eod\Eod;

$stock    = (new Eod(new Config($apiToken)))->stock();
$exchange = (new Eod(new Config($apiToken)))->exchange();