|
|
@ -535,9 +535,9 @@ char *LP_autotrade(char *myipaddr,int32_t mypubsock,double profitmargin,char *ba |
|
|
|
if ( (autxo= LP_utxo_bestfit(rel,SATOSHIDEN * volume)) == 0 ) |
|
|
|
return(clonestr("{\"error\":\"cant find utxo that is big enough\"}")); |
|
|
|
bestmetric = ordermatchprice = 0.; |
|
|
|
if ( (desttxfee= LP_getestimatedrate(rel) * LP_AVETXSIZE) < LP_MINTXFEE ) |
|
|
|
if ( (desttxfee= LP_getestimatedrate(rel) * LP_AVETXSIZE) < LP_MIN_TXFEE ) |
|
|
|
desttxfee = LP_MIN_TXFEE; |
|
|
|
if ( (txfee= LP_getestimatedrate(base) * LP_AVETXSIZE) < LP_MINTXFEE ) |
|
|
|
if ( (txfee= LP_getestimatedrate(base) * LP_AVETXSIZE) < LP_MIN_TXFEE ) |
|
|
|
txfee = LP_MIN_TXFEE; |
|
|
|
if ( timeout == 0 ) |
|
|
|
timeout = LP_AUTOTRADE_TIMEOUT; |
|
|
@ -561,7 +561,7 @@ char *LP_autotrade(char *myipaddr,int32_t mypubsock,double profitmargin,char *ba |
|
|
|
vout = jint(item,"vout"); |
|
|
|
vol = jdouble(item,"volume"); |
|
|
|
metric = price / bestprice; |
|
|
|
if ( (butxo= LP_utxofind(1,txid,vout)) != 0 && metric < 1.2 && vol*SATOSHIDEN == butxo->payment.value && LP_isavailable(butxo) > 0 && LP_ismine(butxo) == 0 ) |
|
|
|
if ( (butxo= LP_utxofind(1,txid,vout)) != 0 && metric < 1.2 && vol*SATOSHIDEN == butxo->S.satoshis && LP_isavailable(butxo) > 0 && LP_ismine(butxo) == 0 ) |
|
|
|
{ |
|
|
|
destsatoshis = (butxo->S.satoshis * price); |
|
|
|
if ( destsatoshis > autxo->payment.value-desttxfee-1 ) |
|
|
@ -580,7 +580,7 @@ char *LP_autotrade(char *myipaddr,int32_t mypubsock,double profitmargin,char *ba |
|
|
|
printf("set best!\n"); |
|
|
|
} |
|
|
|
} else printf("skip.(%d %d) destsatoshis %.8f value %.8f destvalue %.8f txfees %.8f %.8f\n",destsatoshis > (autxo->payment.value >> 1) ,destsatoshis/price > (butxo->S.satoshis >> 1),dstr(destsatoshis),dstr(butxo->S.satoshis),dstr(autxo->payment.value),dstr(txfee),dstr(desttxfee)); |
|
|
|
} else printf("cant find butxo.%p or value mismatch %.8f != %.8f\n",butxo,vol,butxo!=0?dstr(butxo->payment.value):0); |
|
|
|
} else printf("cant find butxo.%p or value mismatch %.8f != %.8f\n",butxo,vol,butxo!=0?dstr(butxo->S.satoshis):0); |
|
|
|
} |
|
|
|
} else break; |
|
|
|
} |
|
|
|