Update services.php

Rejected speed no longer in API.

fixed check to enable Nicehash features, and order location to 0 (Nicehash)
This commit is contained in:
crackfoo 2015-12-17 16:04:32 -04:00 committed by Tanguy Pruvot
parent b8df948174
commit 908031d086

View file

@ -74,7 +74,6 @@ function BackendUpdateServices()
$renter->custom_balance += $stat->balance; $renter->custom_balance += $stat->balance;
$renter->custom_accept += $stat->accepted_speed*1000000000; $renter->custom_accept += $stat->accepted_speed*1000000000;
$renter->custom_reject += $stat->rejected_speed*1000000000;
} }
$renter->save(); $renter->save();
@ -83,7 +82,7 @@ function BackendUpdateServices()
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// renting from nicehash // renting from nicehash
if(!YAAMP_PRODUCTION) return; if (YAAMP_USE_NICEHASH_API != true)
return; return;
$apikey = NICEHASH_API_KEY; $apikey = NICEHASH_API_KEY;
@ -112,7 +111,7 @@ return;
{ {
if($nicehash->orderid) if($nicehash->orderid)
{ {
$res = fetch_url("https://www.nicehash.com/api?method=orders.remove&id=$apiid&key=$apikey&algo=$i&order=$nicehash->orderid"); $res = fetch_url("https://www.nicehash.com/api?method=orders.remove&id=$apiid&key=$apikey&location=0&algo=$i&order=$nicehash->orderid");
debuglog($res); debuglog($res);
$nicehash->orderid = null; $nicehash->orderid = null;
@ -133,7 +132,7 @@ return;
$maxprice = $price*0.9; $maxprice = $price*0.9;
$cancelprice = $price*1.1; $cancelprice = $price*1.1;
$res = fetch_url("https://www.nicehash.com/api?method=orders.get&my&id=$apiid&key=$apikey&algo=$i"); $res = fetch_url("https://www.nicehash.com/api?method=orders.get&my&id=$apiid&key=$apikey&location=0&algo=$i");
if(!$res) break; if(!$res) break;
$a = json_decode($res); $a = json_decode($res);
@ -142,7 +141,7 @@ return;
if($balance < $amount) continue; if($balance < $amount) continue;
$port = getAlgoPort($algo); $port = getAlgoPort($algo);
$res = fetch_url("https://www.nicehash.com/api?method=orders.create&id=$apiid&key=$apikey&algo=$i&amount=$amount&price=$setprice&limit=0&pool_host=yaamp.com&pool_port=$port&pool_user=$deposit&pool_pass=xx"); $res = fetch_url("https://www.nicehash.com/api?method=orders.create&id=$apiid&key=$apikey&location=0&algo=$i&amount=$amount&price=$setprice&limit=0&pool_host=yaamp.com&pool_port=$port&pool_user=$deposit&pool_pass=xx");
debuglog($res); debuglog($res);
$nicehash->last_decrease = time(); $nicehash->last_decrease = time();
@ -160,13 +159,12 @@ return;
$nicehash->price = $order->price; $nicehash->price = $order->price;
$nicehash->speed = $order->limit_speed; $nicehash->speed = $order->limit_speed;
$nicehash->accepted = $order->accepted_speed; $nicehash->accepted = $order->accepted_speed;
$nicehash->rejected = $order->rejected_speed;
if($order->price > $cancelprice && $order->workers > 0) if($order->price > $cancelprice && $order->workers > 0)
{ {
debuglog("* cancel order $algo"); debuglog("* cancel order $algo");
$res = fetch_url("https://www.nicehash.com/api?method=orders.remove&id=$apiid&key=$apikey&algo=$i&order=$order->id"); $res = fetch_url("https://www.nicehash.com/api?method=orders.remove&id=$apiid&key=$apikey&location=0&algo=$i&order=$order->id");
debuglog($res); debuglog($res);
} }
@ -174,7 +172,7 @@ return;
{ {
debuglog("* decrease speed $algo"); debuglog("* decrease speed $algo");
$res = fetch_url("https://www.nicehash.com/api?method=orders.set.limit&id=$apiid&key=$apikey&algo=$i&order=$order->id&limit=0.05"); $res = fetch_url("https://www.nicehash.com/api?method=orders.set.limit&id=$apiid&key=$apikey&location=0&algo=$i&order=$order->id&limit=0.05");
debuglog($res); debuglog($res);
} }
@ -182,7 +180,7 @@ return;
{ {
debuglog("* decrease price $algo"); debuglog("* decrease price $algo");
$res = fetch_url("https://www.nicehash.com/api?method=orders.set.price.decrease&id=$apiid&key=$apikey&algo=$i&order=$order->id"); $res = fetch_url("https://www.nicehash.com/api?method=orders.set.price.decrease&id=$apiid&key=$apikey&location=0&algo=$i&order=$order->id");
debuglog($res); debuglog($res);
$nicehash->last_decrease = time(); $nicehash->last_decrease = time();
@ -192,7 +190,7 @@ return;
{ {
debuglog("* increase price $algo"); debuglog("* increase price $algo");
$res = fetch_url("https://www.nicehash.com/api?method=orders.set.price&id=$apiid&key=$apikey&algo=$i&order=$order->id&price=$setprice"); $res = fetch_url("https://www.nicehash.com/api?method=orders.set.price&id=$apiid&key=$apikey&algo=$i&location=0&order=$order->id&price=$setprice");
debuglog($res); debuglog($res);
} }
@ -200,7 +198,7 @@ return;
{ {
debuglog("* increase speed $algo"); debuglog("* increase speed $algo");
$res = fetch_url("https://www.nicehash.com/api?method=orders.set.limit&id=$apiid&key=$apikey&algo=$i&order=$order->id&limit=0"); $res = fetch_url("https://www.nicehash.com/api?method=orders.set.limit&id=$apiid&key=$apikey&location=0&algo=$i&order=$order->id&limit=0");
debuglog($res); debuglog($res);
} }