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

Commit

Permalink
Update bot.php
Browse files Browse the repository at this point in the history
* When selling, you want the latest bid, not ask, as that may create problems.
* With smaller numbers, PHP creates scientific notation. This changes it to a 8 digit floating number.
  • Loading branch information
codeandbattle committed Oct 29, 2018
1 parent d348ddb commit b57389b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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 Down

0 comments on commit b57389b

Please sign in to comment.