Browse Source

Test

etomic
jl777 8 years ago
parent
commit
800c69d0aa
  1. 7
      iguana/exchanges/LP_commands.c

7
iguana/exchanges/LP_commands.c

@ -145,8 +145,11 @@ double LP_query(char *method,struct LP_quoteinfo *qp,char *ipaddr,uint16_t port,
if ( (price= LP_pricecache(qp,base,rel,qp->txid,qp->vout)) != 0. )
{
if ( flag == 0 || bits256_nonz(qp->desthash) != 0 )
{
printf("break out of loop.%d price %.8f\n",i,price);
break;
}
}
usleep(250000);
}
} else printf("no pushsock for peer.%s:%u\n",ipaddr,port);
@ -231,9 +234,13 @@ cJSON *LP_bestprice(struct LP_utxoinfo *utxo,char *base)
LP_quoteparse(&Q[i],item);
char str[65]; printf("i.%d of %d: (%s) -> txid.%s\n",i,n,jprint(item,0),bits256_str(str,Q[i].txid));
price = LP_query("price",&Q[i],jstr(item,"ipaddr"),jint(item,"port"),base,utxo->coin,zero);
printf("price %.8f\n",price);
if ( Q[i].destsatoshis != 0 && (double)j64bits(item,"satoshis")/Q[i].destsatoshis > price )
{
printf("adjustprice %.8f -> %.8f\n",price,(double)j64bits(item,"satoshis")/Q[i].destsatoshis);
price = (double)j64bits(item,"satoshis")/Q[i].destsatoshis;
}
}
if ( (prices[i]= price) != 0. && (bestprice == 0. || price < bestprice) )
bestprice = price;
printf("i.%d price %.8f bestprice %.8f: (%s)\n",i,price,bestprice,jprint(item,0));

Loading…
Cancel
Save