zahav/zahav-laravel

Free, open source crypto trading bot for Laravel.

dev-main 2022-02-02 16:07 UTC

This package is auto-updated.

Last update: 2024-09-29 05:56:16 UTC


README

This package provides an easily customisable trading bot to implement in your own projects. It follows a conservative trading strategy and supports the Coinspot API.

Installation via Composer

Add zahav/zahav-laravel to your composer.json:

composer require "zahav/cryptobot"

Register our service provider in config/app.php, within the providers array:

'providers' => [
    // ...
    Zahav\ZahavLaravel\ZahavServiceProvider::class,
    // ...
],

To use the configured Zahav client, import the facade each time:

use Zahav\ZahavLaravel\Facades\Zahav;

Optionally, you can register an alias in config/app.php:

'aliases' => [
    // ...
    'Zahav' => Zahav\ZahavLaravel\Facades\Zahav::class,
],

Configuration

Publish the default config file to your application so you can make modifications:

foo@bar:~$ php artisan vendor:publish

Next, you should configure your CoinspotAPI keys in your application's .env file. You can retrieve your Coinspot API keys from the Coinspot settings page:

COINSPOT_KEY=
COINSPOT_SECRET=
ZAHAV_STRATEGY=conservative
ZAHAV_BUY_AMOUNT=0.0025
ZAHAV_SELL_AMOUNT=0.025

Usage

Zahav includes an Artisan command that will complete a buy/sell trade pair. You may run the worker using the zahav:work Artisan command.

foo@bar:~$ php artisan zahav:work

For regular trading, you can add a cron entry to keep your zahav:work process running.

0 * * * * php /home/forge/app.com/artisan zahav:work >> /dev/null 2>&1