PHP code example of asolonytskyi / laravel-taapio

1. Go to this page and download the library: Download asolonytskyi/laravel-taapio 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/ */

    

asolonytskyi / laravel-taapio example snippets


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);

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);

$data = Taapi::getIndicator('invalid_indicator', [
    'exchange' => Exchanges::BINANCE,
    'symbol' => 'BTC/USDT',
    'interval' => Intervals::ONE_HOUR,
]);

if ($data['status'] === 'error') {
    echo 'Error: ' . $data['message'];
}
sh
    php artisan vendor:publish --provider="ASolonytkyi\Taapi\Containers\Taapi\Providers\TaapiServiceProvider"