A Laravel package to integrate with TAAPI.io for retrieving various financial indicators.
-
Install the package via Composer:
composer require asolonytkyi/laravel-taapio
-
Publish the configuration file:
php artisan vendor:publish --provider="ASolonytkyi\Taapi\Containers\Taapi\Providers\TaapiServiceProvider"
-
Add your TAAPI.io API key to your
.env
file:TAAPI_API_KEY=your_api_key_here
The package configuration file is located at config/taapi.php
. You can customize the configuration as needed.
To retrieve a single indicator, use the getIndicator
method:
use ASolonytkyi\Taapi\Containers\Taapi\Facades\Taapi;
use ASolonytkyi\Taapi\Containers\Taapi\Constants\Exchanges;
use ASolonytkyi\Taapi\Containers\Taapi\Constants\Intervals;
use ASolonytkyi\Taapi\Containers\Taapi\Constants\Indicators;
$data = Taapi::getIndicator(Indicators::ADX, [
'exchange' => Exchanges::BINANCE,
'symbol' => 'BTC/USDT',
'interval' => Intervals::ONE_HOUR,
'backtrack' => 5,
'chart' => 'candlestick',
'addResultTimestamp' => true,
'gaps' => false,
'results' => 'json',
'period' => 14,
'multiplier' => 1.5,
]);
print_r($data);
To retrieve multiple indicators in a single request, use the getIndicators
method:
use ASolonytkyi\Taapi\Containers\Taapi\Facades\Taapi;
use ASolonytkyi\Taapi\Containers\Taapi\Constants\Exchanges;
use ASolonytkyi\Taapi\Containers\Taapi\Constants\Intervals;
use ASolonytkyi\Taapi\Containers\Taapi\Constants\Indicators;
$data = Taapi::getIndicators([
'exchange' => Exchanges::BINANCE,
'symbol' => 'BTC/USDT',
'interval' => Intervals::ONE_MINUTE,
'indicators' => [
[
'indicator' => Indicators::SUPER_TREND,
'period' => 20,
'multiplier' => 12.0,
],
[
'indicator' => Indicators::CMO,
'period' => 20,
],
[
'indicator' => Indicators::RSI,
'period' => 20,
],
[
'indicator' => Indicators::TANH,
'period' => 20,
],
[
'indicator' => Indicators::EMA,
'period' => 20,
],
[
'indicator' => Indicators::EOM,
'period' => 20,
],
],
]);
print_r($data);
The following indicators are available for use:
Indicators::SUPER_TREND
Indicators::CMO
Indicators::RSI
Indicators::TANH
Indicators::EMA
Indicators::EOM
Indicators::ADX
- more
The following exchanges are available for use:
Exchanges::BINANCE
Exchanges::BINANCE_FUTURES
Exchanges::BITSTAMP
Exchanges::WHITEBIT
Exchanges::BYBIT
Exchanges::GATEIO
Exchanges::COINBASE
Exchanges::BINANCE_US
Exchanges::KRAKEN
The following intervals are available for use:
Intervals::ONE_MINUTE
Intervals::FIVE_MINUTES
Intervals::FIFTEEN_MINUTES
Intervals::THIRTY_MINUTES
Intervals::ONE_HOUR
Intervals::TWO_HOURS
Intervals::FOUR_HOURS
Intervals::TWELVE_HOURS
Intervals::ONE_DAY
Errors are handled and returned as arrays with status
, message
, and statusCode
keys. Example:
$data = Taapi::getIndicator('invalid_indicator', [
'exchange' => Exchanges::BINANCE,
'symbol' => 'BTC/USDT',
'interval' => Intervals::ONE_HOUR,
]);
if ($data['status'] === 'error') {
echo 'Error: ' . $data['message'];
}
This package is open-sourced software licensed under the MIT license.
- Alexandr Solonytskyi
For more information, visit the TAAPI.io documentation.