dev-master
9999999-devLaravel Bittrex API wrapper / facade
MIT
The Requires
- php >=5.6.0
- guzzlehttp/guzzle ^6.3
The Development Requires
by Michael Messerli
laravel crypto bitcoin cryptocurrency bittrex
Laravel Bittrex API wrapper / facade
This packages provides a nice and easy wrapper around the Bittrex API for use in your Laravel application., (*2)
In order to use the Bittrex API, you must have an account and API keys., (*3)
Retrieve your balance statements for all coins, (*4)
use Messerli90\Bittrex\Bittrex; $bittrex = new Bittrex(config('services.bittrex.key'), config('services.bittrex.secret')); $balances = $bittrex->getBalances(); return $balances;
{ "success": true, "message": "", "result": [ { "Currency": "BTC", "Balance": 2.20529678, "Available": 2.20529678, "Pending": 0, "CryptoAddress": null }, { "Currency": "LTC", "Balance": 12.96782052, "Available": 12.96782052, "Pending": 0, "CryptoAddress": null } ] }
Add messerli90/bittrex
to your composer.json
., (*5)
"messerli90/bittrex": "~1.0"
or, (*6)
composer require messerli90/bittrex
Run composer update
to pull down the latest version of the package., (*7)
Now open up app/config/app.php
and add the service provider to your providers
array., (*8)
'providers' => array( Messerli90\Bittrex\BittrexServiceProvider::class, )
Optionally, add the facade to your aliases
array, (*9)
'Bittrex' => \Messerli90\Bittrex\Facades\Bittrex::class,
Add the bittrex
to your config/services.php
array, (*10)
'bittrex' => [ 'key' => 'YOUR_API_KEY', 'secret' => 'YOUR_API_SECRET' ]
use Messerli90\Bittrex\Bittrex; $bittrex = new Bittrex(config('services.bittrex.key'), config('services.bittrex.secret'));
// Used to get the open and available trading markets at Bittrex along with other meta data. $bittrex->getMarkets(); // Used to get all supported currencies at Bittrex along with other meta data. $bittrex->getCurrencies(); // Used to get the current tick values for a market. $bittrex->getTicker('BTC-LTC'); // Used to get the last 24 hour summary of all active exchanges $bittrex->getMarketSummaries(); // Used to get the last 24 hour summary of all active exchanges $bittrex->getMarketSummary('BTC-LTC'); // Used to get retrieve the orderbook for a given market $bittrex->getOrderBook('BTC-LTC', 'both'); // Used to retrieve the latest trades that have occured for a specific market. $bittrex->getMarketHistory('BTC-LTC');
// Used to place a buy order in a specific market. Use buylimit to place limit orders. Make sure you have the proper permissions set on your API keys for this call to work $bittrex->buyLimit('BTC-LTC', 1.2, 1.3); // Used to place an sell order in a specific market. Use selllimit to place limit orders. $bittrex->sellLimit('BTC-LTC', 1.2, 1.3); // Used to cancel a buy or sell order. $bittrex->cancel('ORDER_UUID'); // Get all orders that you currently have opened. A specific market can be requested $bittrex->getOpenOrders('BTC-LTC');
// Used to retrieve all balances from your account $bittrex->getBalances(); // Used to retrieve the balance from your account for a specific currency. $bittrex->getBalance('BTC'); // Used to retrieve or generate an address for a specific currency. If one does not exist, the call will fail and return ADDRESS_GENERATING until one is available. $bittrex->getDepositAddress('BTC'); // Used to withdraw funds from your account. note: please account for txfee. $bittrex->withdraw('BTC', 1, 'BTC-ADDRESS'); // Used to retrieve all balances from your account $bittrex->getBalances(); // Used to retrieve a single order by uuid. $bittrex->getOrder('0cb4c4e4-bdc7-4e13-8c13-430e587d2cc1'); // Used to retrieve your order history. $bittrex->getOrderHistory('BTC-LTC'); // Used to retrieve your withdrawal history. $bittrex->getWithdrawalHistory('BTC'); // Used to retrieve your deposit history. $bittrex->getDepositHistory('BTC');
The returned JSON data is decoded as a PHP object., (*11)
If you have PHPUnit installed in your environment, run:, (*12)
$ phpunit
Please see CONTRIBUTING for details., (*13)
The MIT License (MIT). Please see License File for more information., (*14)
Laravel Bittrex API wrapper / facade
MIT
laravel crypto bitcoin cryptocurrency bittrex