Skip to content

Instantly share code, notes, and snippets.

@devbanana
Created February 2, 2020 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devbanana/b25681af493e2fe4030b78f30dcb21f2 to your computer and use it in GitHub Desktop.
Save devbanana/b25681af493e2fe4030b78f30dcb21f2 to your computer and use it in GitHub Desktop.
Fetch historical prices from IEX
<?php
require_once 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cloud.iexapis.com/stable/',
]);
$response = $client->get('stock/AAPL/chart/5d', [
'query' => [
'token' => $_ENV['IEXKEY'],
],
]);
echo $response->getBody() . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment