-
Notifications
You must be signed in to change notification settings - Fork 6
/
check_bnb.php
36 lines (29 loc) · 1.04 KB
/
check_bnb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* @author Ebo Eppenga
* @copyright 2022
*
* GoldStar Buy and Sell bot based on signals from for example TradeView
* or any other platform using PHP Binance API from JaggedSoft.
*
* check_bnb.php
* Checks if there is enough BNB for discount or orders to pay fees
*
*/
/** Check if we need more BNB for paying fees **/
if ($set_coin['balanceBNB'] < (0.5 * $bnb)) {
// Check if we have enough quote balance to buy
$quantityQuote = $set_coin['balanceQuote'];
if ($quantityQuote < (2 * $bnb)) {
$message = date("Y-m-d H:i:s") . "," . $id . ",Error: Insufficient " . $set_coin['quoteAsset'] . " to buy BNB!";
echo "<font color=\"red\"><b>" . $message . "</b></font><br /><br />";
logCommand($message, "error");
exit();
}
// Report
echo "<i>Owning " . $set_coin['balanceBNB'] . " BNB, buying an additional " . $bnb . " BNB to pay fees...</i><br /><br /><hr /><br />";
// Acquire BNB for paying fees
$order = $api->marketBuy("BNB" . $set_coin['quoteAsset'], $bnb);
logCommand($order, "binance");
}
?>