mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-06 02:29:45 +00:00
yobit: add auto withdraw BTC
fixed (tpruvot)
This commit is contained in:
parent
1692a47570
commit
c3f2e90c26
1 changed files with 24 additions and 0 deletions
|
@ -215,6 +215,30 @@ function doYobitTrading($quick=false)
|
|||
$db_order->uuid = $res['return']['order_id'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
|
||||
if(floatval(EXCH_AUTO_WITHDRAW) > 0 && $savebalance->balance >= (EXCH_AUTO_WITHDRAW + 0.0002))
|
||||
{
|
||||
$btcaddr = YAAMP_BTCADDRESS;
|
||||
$amount = $savebalance->balance + 0.0002;
|
||||
debuglog("[yobit] - withdraw $amount to $btcaddr");
|
||||
|
||||
sleep(1);
|
||||
$res = yobit_api_query2('WithdrawCoinsToAddress', array('coinName' => 'BTC', 'amount' => $amount, 'address' => $btcaddr));
|
||||
if($res && $res['success'])
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'yobit';
|
||||
$withdraw->address = $btcaddr;
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
$withdraw->save();
|
||||
|
||||
$savebalance->balance = 0;
|
||||
$savebalance->save();
|
||||
} else {
|
||||
debuglog("yobit: withdraw error ".json_encode($res));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue