-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
4,718 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/.idea | ||
/vendor | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
|
||
# Laravel TAAPI Package | ||
|
||
A Laravel package to integrate with TAAPI.io for retrieving various financial indicators. | ||
|
||
## Installation | ||
|
||
1. Install the package via Composer: | ||
|
||
```sh | ||
composer require asolonytkyi/laravel-taapi | ||
``` | ||
|
||
2. Publish the configuration file: | ||
|
||
```sh | ||
php artisan vendor:publish --provider="ASolonytkyi\Taapi\Containers\Taapi\Providers\TaapiServiceProvider" | ||
``` | ||
|
||
3. Add your TAAPI.io API key to your `.env` file: | ||
|
||
```env | ||
TAAPI_API_KEY=your_api_key_here | ||
``` | ||
|
||
## Configuration | ||
|
||
The package configuration file is located at `config/taapi.php`. You can customize the configuration as needed. | ||
|
||
## Usage | ||
|
||
### Retrieving a Single Indicator | ||
|
||
To retrieve a single indicator, use the `getIndicator` method: | ||
|
||
```php | ||
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); | ||
``` | ||
|
||
### Retrieving Multiple Indicators | ||
|
||
To retrieve multiple indicators in a single request, use the `getIndicators` method: | ||
|
||
```php | ||
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); | ||
``` | ||
|
||
## Available Indicators | ||
|
||
The following indicators are available for use: | ||
|
||
- `Indicators::SUPER_TREND` | ||
- `Indicators::CMO` | ||
- `Indicators::RSI` | ||
- `Indicators::TANH` | ||
- `Indicators::EMA` | ||
- `Indicators::EOM` | ||
- `Indicators::ADX` | ||
- [more](https://taapi.io/indicators/) | ||
|
||
## Available Exchanges | ||
|
||
The following [exchanges](https://taapi.io/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` | ||
|
||
## Available Intervals | ||
|
||
The following [intervals](https://taapi.io/documentation/integration/direct/) 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` | ||
|
||
## Error Handling | ||
|
||
Errors are handled and returned as arrays with `status`, `message`, and `statusCode` keys. Example: | ||
|
||
```php | ||
$data = Taapi::getIndicator('invalid_indicator', [ | ||
'exchange' => Exchanges::BINANCE, | ||
'symbol' => 'BTC/USDT', | ||
'interval' => Intervals::ONE_HOUR, | ||
]); | ||
if ($data['status'] === 'error') { | ||
echo 'Error: ' . $data['message']; | ||
} | ||
``` | ||
## License | ||
This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). | ||
## Author | ||
- Alexandr Solonytskyi | ||
For more information, visit the [TAAPI.io documentation](https://taapi.io/documentation/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "asolonytskyi/laravel-taapio", | ||
"description": "A Laravel package to integrate with TAAPI.io", | ||
"keywords": ["laravel", "taapi", "api", "indicators"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Andrii Solonytskyi", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.3|^7.4|^8.1|^8.2|^8.3", | ||
"illuminate/support": "^8.0|^9.0|^10.0", | ||
"guzzlehttp/guzzle": "^7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"ASolonytkyi\\Taapi\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"ASolonytkyi\\Taapi\\Tests\\": "tests/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"ASolonytkyi\\Taapi\\Containers\\Taapi\\Providers\\TaapiServiceProvider" | ||
], | ||
"aliases": { | ||
"Taapi": "ASolonytkyi\\Taapi\\Containers\\Taapi\\Facades\\Taapi" | ||
} | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"version": "1.0.0", | ||
"require-dev": { | ||
"phpunit/phpunit": "^11.2" | ||
} | ||
} |
Oops, something went wrong.