poloniexBot is an unofficial extension of the poloniex PHP API wrapper by compcentral. poloniexBot is designed to perform basic trade actions (cryptocurrencies exchange), automated assets rebalancing and withdrawals on the poloniex digital exchange.
poloniexBot can use Telegram API to notify users about all completed trades and withdrawals.
Set
$_telegram_bot_token
and $_telegram_channel
properties if you want to receive notifications to a specified Telegram Messenger channel.
In order to use poloniexBot for trading and withdrawals you have to enable corresponding options at poloniex api keys management page.
Clone this repository or install it via composer. Insert your poloniex API credentials into poloniexBot.php.
include 'poloniexBot.php';
$bot = new poloniexBot();
$prices = $bot->get_prices();
print_r($prices);
include 'poloniexBot.php';
$bot = new poloniexBot();
$balances = $bot->get_available_balances();
print_r($balances);
include 'poloniexBot.php';
$bot = new poloniexBot();
$balance = $bot->get_coin_balance('ETH');
var_dump($balance);
$bot = new poloniexBot();
$price = $bot->get_viable_price('ETH', 1);
$result = $bot->buy('BTC_ETH', $price, 1);
$bot = new poloniexBot();
$price = $bot->get_viable_price('ETH', -1);
$result = $bot->sell('BTC_ETH', $price, 1);
include 'poloniexBot.php';
$bot = new poloniexBot();
$volume = $bot->get_volume();
print_r($volume);
include 'poloniexBot.php';
$bot = new poloniexBot();
$wealth = $bot->get_wealth();
var_dump($wealth);
include 'poloniexBot.php';
$bot = new poloniexBot(['ETH' => 1, 'BTC' => 0, 'LTC' => 0, 'XMR' => 0, 'ZEC' => 0]);
$bot->auto_exchange();
$bot->check_and_withdraw('ETH', '<your_address>');
include 'poloniexBot.php';
$bot = new poloniexBot();
$bot->check_and_rebalance();
By default ETH, BTC, LTC, XMR and ZEC deposits will be autoexchanged (rebalanced) to 50% ETH and 50% BTC.
You can adjust coins and their target proportions via $_pairs
property.
$_min_percent = 0.005
means that check_and_rebalance() method will initiate rebalance() or auto_exchange() if any of your asset coin rose or decline by at least 0.5%.
$_delay_next_round
is default delay between two consequent checks in seconds.
// currencies and their proportions to be kept / autoexchanged
// must be uppercase
private $_pairs = ['ETH' => 0.5, 'BTC' => 0.5, 'LTC' => 0, 'XMR' => 0, 'ZEC' => 0];
// poloniex API keys
// you have to keep them safe
// good idea is to set 600/700 permission on this file
private $_api_key = '<MY_API_KEY>';
private $_api_secret = '<LONG_LONG_LONG_API_SECRET>';
// minimal pct. change for start rebalance
private $_min_percent = 0.005;
// how many time to wait after each check, in sec.
private $_delay_next_round = 60;
$ php rebalance.php
$ php withdraw.php
poloniexBot supports all BTC_* pairs and only reverse pair USDT_BTC.
Join @poloniexExchangeBot channel for feedback. I use it as test channel for poloniexBot notifications.
BTC: 12S1fAvZt1GjoRmogGiVgb3p3u4Z52knov
ETH: 0x1F575fFB648a01e248c3AA2c37269835e18C38Ff
ZEC: t1ZSEie2vRrNFjtR374XxsmDooh4GeYwF2w