https://github.com/radicalloop/eodhistoricaldata
EOD Historical Data API Client Wrapper (Financial and Stock Market API) for Laravel/PHP
https://github.com/radicalloop/eodhistoricaldata
exchange-api laravel php stocks-api
Last synced: 5 months ago
JSON representation
EOD Historical Data API Client Wrapper (Financial and Stock Market API) for Laravel/PHP
- Host: GitHub
- URL: https://github.com/radicalloop/eodhistoricaldata
- Owner: radicalloop
- License: mit
- Created: 2017-12-08T13:20:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-15T10:15:59.000Z (over 1 year ago)
- Last Synced: 2024-10-15T12:12:20.341Z (over 1 year ago)
- Topics: exchange-api, laravel, php, stocks-api
- Language: PHP
- Homepage: https://eodhistoricaldata.com
- Size: 46.9 KB
- Stars: 20
- Watchers: 5
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EOD Historical Data API Client Wrapper for Laravel/PHP
[](https://travis-ci.org/radicalloop/eodhistoricaldata)
[](https://packagist.org/packages/radicalloop/eodhistoricaldata)
[](https://packagist.org/packages/radicalloop/eodhistoricaldata)
[](https://packagist.org/packages/radicalloop/eodhistoricaldata)
## Installation
To install this package via the `composer require` command:
```bash
$ composer require radicalloop/eodhistoricaldata
```
```
## Laravel
No configuration required for Laravel >= 5.5+, It will use the auto-discovery function.
In Laravel <= 5.4 (or if you are not using auto-discovery) register the service provider by adding it to the `providers` key in `config/app.php`. Also register the facade by adding it to the `aliases` key in `config/app.php`.
```php
'providers' => [
...
RadicalLoop\Eod\EodServiceProvider::class,
],
'aliases' => [
...
'Eod' => RadicalLoop\Eod\Facades\Eod::class,
]
```
## Configuration
To get started, you'll need to publish all vendor assets:
```bash
$ php artisan vendor:publish --provider="RadicalLoop\Eod\EodServiceProvider"
```
This will create a `config/eod.php` file in your app that you can modify to set your configuration.
Set your Eod historical data API token in the file:
```bash
return [
'api_token' => 'put your token here'
];
```
## Usage
Here you can see an example of just how simple this package is to use.
### Stocks API
```php
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();
```
To check other Stock API usages, refer [Test Cases](tests/StockTest.php) here.
### Exchanges API
```php
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');
```
To check other Exchanges API usages, refer [Test Cases](tests/ExchangeTest.php) here.
## PHP
For PHP you can create an object like below.
```php
use RadicalLoop\Eod\Config;
use RadicalLoop\Eod\Eod;
$stock = (new Eod(new Config($apiToken)))->stock();
$exchange = (new Eod(new Config($apiToken)))->exchange();
```
## Support
Contact: [www.radicalloop.com](https://www.radicalloop.com) — hello@radicalloop.com