Browse Source

Test

etomic
jl777 8 years ago
parent
commit
dbf22aebf8
  1. 8
      iguana/exchanges/LP_quotes.c

8
iguana/exchanges/LP_quotes.c

@ -332,7 +332,7 @@ int32_t LP_connectstartbob(int32_t pubsock,struct LP_utxoinfo *utxo,cJSON *argjs
}
else
{
printf("dest %.8f < required %.8f (%d %d %d %d %d %d) %.8f %.8f\n",dstr(Q.satoshis),dstr(price*(utxo->S.satoshis-Q.txfee)),bits256_nonz(privkey) != 0 ,Q.timestamp == utxo->T.swappending-LP_RESERVETIME ,Q.quotetime >= Q.timestamp ,Q.quotetime < utxo->T.swappending ,bits256_cmp(utxo->S.mypub,Q.srchash) == 0 , LP_txvalue(destaddr,rel,Q.desttxid,Q.destvout) >= price*Q.satoshis+Q.desttxfee,dstr(LP_txvalue(destaddr,rel,Q.desttxid,Q.destvout)),dstr(price*Q.satoshis+Q.desttxfee));
printf("dest %.8f < required %.8f (%d %d %d %d %d %d) %.8f %.8f\n",dstr(Q.destsatoshis),dstr(price*(utxo->S.satoshis-Q.txfee)),bits256_nonz(privkey) != 0 ,Q.timestamp == utxo->T.swappending-LP_RESERVETIME ,Q.quotetime >= Q.timestamp ,Q.quotetime < utxo->T.swappending ,bits256_cmp(utxo->S.mypub,Q.srchash) == 0 , LP_txvalue(destaddr,rel,Q.desttxid,Q.destvout) >= price*Q.satoshis+Q.desttxfee,dstr(LP_txvalue(destaddr,rel,Q.desttxid,Q.destvout)),dstr(price*Q.satoshis+Q.desttxfee));
}
} else printf("no price for %s/%s\n",base,rel);
if ( retval < 0 )
@ -405,7 +405,7 @@ int32_t LP_tradecommand(char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *d
}
if ( utxo->S.swap == 0 && time(NULL) > utxo->T.swappending )
utxo->T.swappending = 0;
if ( strcmp(method,"request") == 0 ) // bob
if ( strcmp(method,"request") == 0 ) // bob needs apayment + fee tx's
{
retval = 1;
if ( LP_isavailable(utxo) > 0 )
@ -520,10 +520,10 @@ char *LP_autotrade(char *myipaddr,int32_t mypubsock,double profitmargin,char *ba
}
if ( bestutxo == 0 || ordermatchprice == 0. )
return(clonestr("{\"error\":\"cant find ordermatch utxo\"}"));
asatoshis = bestutxo->payment.value * ordermatchprice;
if ( LP_quoteinfoinit(&Q,bestutxo,rel,ordermatchprice) < 0 )
return(clonestr("{\"error\":\"cant set ordermatch quote\"}"));
printf("asatoshis %.8f = bvalue %.8f * ordermatch %.8f\n",dstr(asatoshis),dstr(bestutxo->payment.value),ordermatchprice);
asatoshis = Q.satoshis * ordermatchprice + Q.desttxfee;
printf("asatoshis %.8f = bvalue %.8f * ordermatch %.8f\n",dstr(asatoshis),dstr(Q.satoshis),ordermatchprice);
if ( LP_quotedestinfo(&Q,Q.timestamp+1,asatoshis,autxo->payment.txid,autxo->payment.vout,autxo->fee.txid,autxo->fee.vout,LP_mypubkey,autxo->coinaddr) < 0 )
return(clonestr("{\"error\":\"cant set ordermatch quote info\"}"));
price = LP_query(myipaddr,mypubsock,profitmargin,"request",&Q);

Loading…
Cancel
Save