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
.envfile: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_TRENDIndicators::CMOIndicators::RSIIndicators::TANHIndicators::EMAIndicators::EOMIndicators::ADX- more
The following exchanges are available for use:
Exchanges::BINANCEExchanges::BINANCE_FUTURESExchanges::BITSTAMPExchanges::WHITEBITExchanges::BYBITExchanges::GATEIOExchanges::COINBASEExchanges::BINANCE_USExchanges::KRAKEN
The following intervals are available for use:
Intervals::ONE_MINUTEIntervals::FIVE_MINUTESIntervals::FIFTEEN_MINUTESIntervals::THIRTY_MINUTESIntervals::ONE_HOURIntervals::TWO_HOURSIntervals::FOUR_HOURSIntervals::TWELVE_HOURSIntervals::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.