This is a simple DOGEBTC hitbtc auto trading bot. This bot place DOGE order on both (buy and sell ) side at same time.
Requirement :
php
hitbtc apikey and secret key
buy order place on ask price and sell order place on ask +0.6%
create index.php.
<?php
$url = "https://api.hitbtc.com/api/2/public/ticker/DOGEBTC";
$dataDOGEBTC = json_decode(file_get_contents($url), true);
$symbol=$dataDOGEBTC['symbol'];
$bid=$dataDOGEBTC['bid'];
$ask=$dataDOGEBTC['ask'];
?>
<? $price=$bid-+0.00000000050;?>
<?php
$awb = "$price";
$awb1=number_format($awb,10);
?>
//<? $price1=$bid+0.00000000150;?>
<?$ask06=$ask*0.6/100;
$price1=$ask+$ask06;?>
<?php
$awb2 = "$price1";
$awb3=number_format($awb2,10);
?>
<form action="hitorder.php" method="post">
<table><tr><td>
<b>symbol</b></td><td> </td> <td><input type="text" name="symbol" value="DOGEBTC" readonly/></td></tr>
<tr> <td> buy</td> </tr>
<tr><td><b>side</b></td><td> </td><td><input type="text" name="side" value="buy" required /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>price</b></td><td> </td><td><input type="text" name="price" value="<? echo $awb1; ?>" required /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>quantity</b></td><td> </td><td><input type="text" name="quantity" value="10" readonly/></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>type</b></td><td> </td><td><input type="text" name="type" value="limit" readonly /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>timeInForce</b></td><td> </td><td><input type="text" name="timeInForce" value="GTC" readonly /></td></tr>
*****
<tr> <td> sell</td> </tr>
<tr><td>
<b>symbol 1</b></td><td> </td> <td><input type="text" name="symbol1" value="DOGEBTC" readonly/></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>side 1</b></td><td> </td><td><input type="text" name="side1" value="sell" required /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>price 1</b></td><td> </td><td><input type="text" name="price1" value="<? echo $awb3; ?>" required /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>quantity 1</b></td><td> </td><td><input type="text" name="quantity1" value="10" readonly /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>type 1</b></td><td> </td><td><input type="text" name="type1" value="limit" readonly /></td></tr>
<tr> <td> </td> </tr>
<tr><td><b>timeInForce 1</b></td><td> </td><td><input type="text" name="timeInForce1" value="GTC" readonly /></td></tr>
<tr><td>
</td> <td> </td><td><input type="submit" name="submit" value="Create" /></td></tr>
</table>
</form>
****************************
create hitorder.php
<?php
if(isset($_POST['symbol'])) $symbol = $_POST['symbol'];
if(isset($_POST['side'])) $side=$_POST['side'];
if(isset($_POST['type'])) $type=$_POST['type'];
if(isset($_POST['price'])) $price=$_POST['price'];
if(isset($_POST['quantity'])) $quantity=$_POST['quantity'];
if(isset($_POST['timeInForce'])) $timeInForce=$_POST['timeInForce']; // GET EMAIL INTO VAR
$ch = curl_init();
//do a post
curl_setopt($ch,CURLOPT_URL,"https://api.hitbtc.com/api/2/order");
curl_setopt($ch, CURLOPT_USERPWD, ' yourhitbtc api key : your hitbtc secret key '); // API AND KEY
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"symbol=$symbol&side=$side&price=$price&quantity=$quantity&type=$type&timeInForce=$timeInForce");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
//return the result of curl_exec,instead
//of outputting it directly
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json'));
$result=curl_exec($ch);
curl_close($ch);
$result=json_decode($result);
echo"<pre>";
print_r($result);
?>
<?php
if(isset($_POST['symbol1'])) $symbol1 = $_POST['symbol1'];
if(isset($_POST['side1'])) $side1=$_POST['side1'];
if(isset($_POST['type1'])) $type1=$_POST['type1'];
if(isset($_POST['price1'])) $price1=$_POST['price1'];
if(isset($_POST['quantity1'])) $quantity1=$_POST['quantity1'];
if(isset($_POST['timeInForce1'])) $timeInForce1=$_POST['timeInForce1']; // GET EMAIL INTO VAR
$ch1 = curl_init();
//do a post
curl_setopt($ch1,CURLOPT_URL,"https://api.hitbtc.com/api/2/order");
curl_setopt($ch1, CURLOPT_USERPWD, ' yourhitbtc api key : your hitbtc secret key '); // API AND KEY
curl_setopt($ch1, CURLOPT_POST,1);
curl_setopt($ch1,CURLOPT_POSTFIELDS,"symbol=$symbol1&side=$side1&price=$price1&quantity=$quantity1&type=$type1&timeInForce=$timeInForce1");
curl_setopt($ch1, CURLOPT_RETURNTRANSFER,1);
//return the result of curl_exec,instead
//of outputting it directly
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('accept: application/json'));
$result1=curl_exec($ch1);
curl_close($ch1);
$result1=json_decode($result1);
echo"<pre>";
print_r($result1);
?>
'
I am not a finacial advisorise , I have created this bot for my personal use.You can use this bot at own risk
No comments:
Post a Comment
Note: only a member of this blog may post a comment.