Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5 from codeandbattle/master
Browse files Browse the repository at this point in the history
Update bot.php
  • Loading branch information
Andrei authored Oct 29, 2018
2 parents 9c45f80 + b57389b commit fc32a44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

$oldPrice_buy = $getOrderHistory[$last_buy_key]['PricePerUnit'];
$priceNow = $API_Results->Ask;
$priceNow = number_format((float)$API_Results->Bid,8,'.','');
$percentChange_sell = (1 - $oldPrice_buy / $priceNow) * 100;
$priceChange = number_format($percentChange_sell, 2);

Expand Down Expand Up @@ -71,7 +72,7 @@


$oldPrice_sell = $getOrderHistory[$last_sell_key]['PricePerUnit'];
$priceNow = $API_Results->Ask;
$priceNow = number_format((float)$API_Results->Ask,8,'.','');
$percentChange_sell = (1 - $oldPrice_sell / $priceNow) * 100;
$priceChange_sell = number_format($percentChange_sell, 2);

Expand All @@ -86,7 +87,7 @@
echo("No open orders, ready to set a buy order! \n");
$getbalance=json_decode(json_encode($API_Client->getbalance('BTC')),true);
echo("I have ".$getbalance['Available']." BTC to spend \n");
$API_ClientuyAmount = ($priceNow / $getbalance['Available']);
$API_ClientuyAmount = ($getbalance['Available'] / $priceNow);
echo("I can buy $API_ClientuyAmount $tradingCurrency for this \n");
$setBuyOrder = json_decode(json_encode($API_Client->buyLimit($tradingMarket, $API_ClientuyAmount, $priceNow)));
if(!(empty($setBuyOrder->uuid))){
Expand Down

0 comments on commit fc32a44

Please sign in to comment.