-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguto.php
339 lines (248 loc) · 9.5 KB
/
guto.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<?php
//Public URLs
$urlNegocie = 'https://broker.negociecoins.com.br/tradeapi/v1/';
$urlTem = 'https://broker.tembtc.com.br/tradeapi/v1/';
$keyNegocie = "";
$secretNegocie = "";
$keyTem = "";
$secretTem = "";
$negocie = getTickerNegocie();
$tem = getTickerTem();
$spread = ((($negocie*100)/$tem)-100);
if( isset($_GET["hash"]) )
{
$keyNegocie = $_GET["negocieAppId"];
$secretNegocie = $_GET["negocieSecret"];
$keyTem = $_GET["temAppId"];
$secretTem = $_GET["temSecret"];
$spreadBlock = $_GET["spread"];
echo "Ticker Negocie: R$ " . $negocie . "<br/>";
echo "Ticker TemBTC: R$ " . $tem . "<br/>";
echo "SPREAD: " . strval($spread) . "%<br/>";
echo "SPREAD-FEE: " . strval($spread-1.5) . "%<br/>";
if($spread < $spreadBlock )
{
echo "O spread atual não é compativel com o spread escolhido, vamos aguardar! Ou você pode ajustar o mesmo! Spread Atual " .$spread . ", spread limite " . $spreadBlock ;
return;
}
if($_GET["operation"] == "brl")
{
if(getBalanceNegocie("BTC") > 0)
{
echo "Vamos vender tudo imediatamente!";
$body = array("pair" => "BTCBRL", "type" => "sell", "price" => getTickerNegocie() , "volume" => number_format(getBalanceNegocie("BTC"),8)) ;
$json_data = json_encode($body);
echo $json_data;
echo post($urlNegocie,$keyNegocie,$secretNegocie,"user/order",$json_data);
}
}
if($_GET["operation"] == "btc")
{
if(getBalanceTem("BRL") > 10)
{
$totalbtcbuy = getBalanceTem("BRL") / (getTickerTem()+5);
if($totalbtcbuy > 0)
if($totalbtcbuy < 20)
{
$body = array("pair" => "BTCBRL", "type" => "buy", "price" => getTickerTem() , "volume" => $totalbtcbuy) ;
$json_data = json_encode($body);
echo post($urlTem,$keyTem,$secretTem,"user/order",$json_data);
}
}
}
echo "<hr>";
echo "<b>SALDOS</b><br/>";
echo "<b>Negocie Coins</b><br/>";
echo "BTC: " . getBalanceNegocie("BTC") . " BTC <br/>";
echo "BRL: R$ " . getBalanceNegocie("BRL") . " <br/>";
echo "<br/>";
echo "<b>TEMBTC<b><br/>";
echo "BTC: " . getBalanceTem("BTC") . " BTC <br/>";
echo "BRL: R$ " . getBalanceTem("BRL") . " <br/>";
echo "<br/>AVISOS<br/>";
if($_GET["operation"] == "brl")
{
if(getBalanceTem("BRL") > 10)
{
echo "<br><h1>ATENÇÃO SEU CICLO COMEÇOU! COMPRE NA TEMBTC E TRANSFIRA PARA A NEGOCIE COINS, O ROBÔ IRÁ VENDER AUTOMATICAMENTE QUANDO CHEGAR LÁ!</h1><iframe type='text/html' src='https://www.youtube.com/embed/-ePDPGXkvlw?autoplay=1' frameborder='0' allow='autoplay'></iframe>";
}
if(getBalanceNegocie("BRL") > 10)
{
echo "<br><h1>ATENÇÃO SEU CICLO FINALIZOU! TRANSFIRA O SEU SALDO DA NEGOCIE PARA A TEMBTC!</h1><iframe type='text/html' src='https://www.youtube.com/embed/-ePDPGXkvlw?autoplay=1' frameborder='0' allow='autoplay'></iframe>";
}
}
if($_GET["operation"] == "btc")
{
if(getBalanceTem("BTC") > 0)
{
echo "<br><h1>ATENÇÃO SEU CICLO FINALIZOU! TRANSFIRA O SEU SALDO DA TEMBTC PARA A NEGOCIE!</h1><iframe type='text/html' src='https://www.youtube.com/embed/-ePDPGXkvlw?autoplay=1' frameborder='0' allow='autoplay'></iframe>";
}
if(getBalanceNegocie("BTC") > 0)
{
echo "<br><h1>ATENÇÃO SEU CICLO COMEÇOU! VENDA NA NEGOCIE E TRANSFIRA PARA A TEMBTC, O ROBÔ IRÁ COMPRAR AUTOMATICAMENTE QUANDO CHEGAR LÁ!</h1><iframe type='text/html' src='https://www.youtube.com/embed/-ePDPGXkvlw?autoplay=1' frameborder='0' allow='autoplay'></iframe>";
}
}
return;
}
function getTickerNegocie()
{
$jsondata = file_get_contents("https://broker.negociecoins.com.br/api/v3/btcbrl/ticker");
$result = json_decode($jsondata,true);
return $result["last"];
}
function getTickerTem()
{
$jsondata = file_get_contents("https://broker.tembtc.com.br/api/v3/btcbrl/ticker");
$result = json_decode($jsondata,true);
return $result["last"];
}
function amx_authorization_header($url1,$id, $key, $function, $method, $body) {
$url1 = $url1 . $function; //URL + Função Ex: user/balance
date_default_timezone_set('America/Sao_Paulo'); //Setando Timezone para BR
$url = strtolower(urlencode($url1)); //Colocando a URL em Minusculo e fazendo o encode
$content = empty($body) ? '' : base64_encode(md5($body, true)); //se body está vazio, deixa ''(nulo, senão usa o base64_encode()
$time = time(); //Tempo
$nonce = uniqid(); //É gerado um número randonico aleatório, para compor o cabeçalho AMX.
$data = implode('', [$id, strtoupper($method), $url, $time, $nonce, $content]); //String sem separação com as variáveis que estão sendo mostradas
$secret = base64_decode($key); //decode no password vetor de byte
$signature = base64_encode(hash_hmac('sha256', $data, $secret, true)); //Encode na signature utilizando hash_hmac
return 'amx ' . implode(':', [$id, $signature, $nonce, $time]); //retorna a header
}
function get($url, $id, $key, $function, $body = null) {
$method = 'GET';
$result = amx_authorization_header($url,$id, $key, $function, 'GET', $body = null);
return request($url,$result, $function, $method, $body = null);
}
function post($url,$id, $key, $function, $body) {
$method = 'POST';
$result = amx_authorization_header($url,$id, $key, $function, $method, $body);
return request($url,$result, $function, $method, $body);
}
function request($url, $header, $function, $method, $data) {
$url = $url . $function;
if ($method == 'GET' || $method == 'DELETE') {
$context = stream_context_create(array(
'http' => array(
'header' => "Authorization: " . $header,
)));
} else {
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => "Authorization: " . $header . "\r\n" . 'content-length: ' . strlen($data) . "\r\n" . "content-type: application/json; charset=UTF-8" . "\r\n",
'content' => $data,
)));
}
$result = file_get_contents($url, false, $context);
return $result;
}
function getBalanceNegocie($coin)
{
global $urlNegocie,$keyNegocie,$secretNegocie;
$jsondata = get($urlNegocie,$keyNegocie,$secretNegocie,"user/balance");
$result = json_decode($jsondata,true);
foreach($result as $item) {
if($coin == "BRL")
return $item[0]["available"];
if($coin == "BTC")
return $item[1]["available"];
}
}
function getBalanceTem($coin)
{
global $urlTem,$keyTem,$secretTem;
$jsondata = get($urlTem,$keyTem,$secretTem,"user/balance");
$result = json_decode($jsondata,true);
foreach($result as $item) {
if($coin == "BRL")
return $item[0]["available"];
if($coin == "BTC")
return $item[1]["available"];
}
}
?>
<html>
<head>
<title>GutoSchiavon - BOT OPENSOURCE</title>
<meta charset="utf-8" />
<meta name="description" content="Bot de arbitragem semi automática entre a NegocieCoins e TemBTC" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="https://bitcao.notasdovitor.top/guto.php" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-52149749-9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-52149749-9');
</script>
<style type="text/css">
div#api {
font-size: 22px;
}
div#acumular {
font-size: 19px;
}
div#spread {
font-size: 19px;
}
div#ativar {
font-size: 30px;
}
</style>
<script
src="https://code.jquery.com/jquery-3.4.0.js"
integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo="
crossorigin="anonymous"></script>
</head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-52149749-8"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-52149749-8');
</script>
<body>
<form id="formGuto">
<h1>Painel de operação - GutoSchiavon v0.0.0.1</h1>
<b>Donate: 3FbzWqtR24kQck2FL1ts9DBV8E2541xoC7</b>
<br/> <a href="https://github.com/MatheusGrijo/ARBITRAGE_NEGOCIE_TEMBTC">GITHUB</a></b>
<div id="api">
<br/><b>::Configurações de api</b><br/>
Appid Negocie: <input type="text" id="negocieAppId" name="negocieAppId"><br/>
Secret Negocie: <input type="text" id="negocieSecret" name="negocieSecret"><br/>
Appid TemBTC: <input type="text" id="temAppId" name="temAppId"><br/>
Secret TemBTC: <input type="text" id="temSecret" name="temSecret"><br/>
</div>
<div id="acumular">
<br/><b>::Você pretende acumular?</b><br/>
<input type="radio" name="operation" value="brl" /> Acumular brl
<input type="radio" name="operation" value="btc"/>Acumular bitcoin
</div>
<div id="spread">
<br/><b>::Spread minimo para executar</b><br/>
Porcentagem minima: <input type="text" id="spread" name="spread" value="0.2"><br/>
</div>
<hr>
<div id="ativar">
<a href="javascript:magic();">ATIVAR BOT</a>
</div>
<div id="result"></div>
<script>
function magic()
{
$( "#ativar" ).hide();
$( "#result" ).html( "Por favor, aguarde alguns segundos...<br/><img src='http://2.bp.blogspot.com/-eyOStwXVIbQ/VRKwfeCXhOI/AAAAAAAAPE0/FuvOhM5_s9I/s1600/Minions%2B22.gif' />" );
window.setInterval('api()', 60000);
}
function api()
{
$.post( "guto.php?hash=1&negocieAppId=" + encodeURIComponent($("#negocieAppId").val()) + "&negocieSecret=" + encodeURIComponent($("#negocieSecret").val()) + "&temAppId=" + encodeURIComponent($("#temAppId").val()) + "&temSecret=" + encodeURIComponent($("#temSecret").val()) + "&operation=" + $( "input[type=radio][name=operation]:checked" ).val() + "&spread=" + $("#spread").val() , function( data ) {
$( "#result" ).html( data );
});
}
</script>
</form>
</body>
</html>