function order_Add($type, $amount, $price, $prev, $prev_amount, $fake = false) { cli_beep(); $datetime = date("Y-m-d H:i:s"); echo "\n\$ {$type} " . $amount . " @ \$" . $price . " (prev: " . $prev . ") - " . $datetime; $order["type"] = $type; $order["amount"] = $amount; $order["price"] = $price; $order["datetime"] = $datetime; $amount = $amount / 1.0E-8; $price = $price / 1.0E-5; if ($fake == false) { global $mtGoxClient; $result = $mtGoxClient->orderAdd($type, $amount, $price); //echo "ERROR DIE!"; //die; } else { $result = localOrderAdd($type, $amount, $price); } $c = 0; while (!isset($result["result"]) and $c < 3) { if ($fake == false) { global $mtGoxClient; $result = $mtGoxClient->orderAdd($type, $amount, $price); //echo "ERROR DIE!"; //die; } else { $result = localOrderAdd($type, $amount, $price); } $c++; } if ($result["result"] == "error") { var_dump($result); return false; } echo "\n"; var_dump($result); $order["success"] = $result['data']; $order["status"] = $result['data']; if ($type == "ask") { if ($order["price"] >= $prev) { $order["prem"] = "profit"; } else { $order["prem"] = "loss"; } } if ($type == "bid") { if ($order["price"] <= $prev) { $order["prem"] = "profit"; } else { $order["prem"] = "loss"; } } return $order; }
var_dump($transa); $balancing = $info["balancing"]; if ($transa["prem"] == "profit") { cli_beep(); cli_beep(); cli_beep(); sleep(1); cli_beep(); cli_beep(); cli_beep(); } else { cli_beep(); sleep(1); cli_beep(); sleep(1); cli_beep(); } $log = "#transaction"; if ($sudden_mode == 1) { $log = "#suddenmode"; } if ($balancing == 1) { $log = "#unbalancing"; } $infodata = get_infodataf($fake); $info = get_infodata($infodata, $fake); $wallet_amount = "[btc:" . round($info["btc_balance"], 4) . "/usd:" . round($info["usd_balance"], 2) . "]"; $line = "\$" . $transa["type"] . " " . $wallet_amount . " @ \$" . $transa["price"] . " (" . $transa["prem"] . ") {$log}"; wfile($lastfile_clean, $line); if ($balancing != 1) { if ($enable_tweet) {