Browse Source

Test

etomic
jl777 7 years ago
parent
commit
1d11d9a78f
  1. 12
      iguana/exchanges/LP_tradebots.c

12
iguana/exchanges/LP_tradebots.c

@ -476,13 +476,14 @@ char *LP_tradebot_buy(int32_t dispdir,char *base,char *rel,double maxprice,doubl
free(retstr);
txfee = LP_txfeecalc(relcoin,0,0);
txfees = 10 * txfee;
printf("%s inventory balance %.8f, relvolume %.8f + txfees %.8f\n",rel,dstr(abalance),relvolume,dstr(txfees));
if ( dstr(abalance) < relvolume + dstr(txfees) )
if ( relcoin->electrum != 0 )
balance = LP_unspents_load(relcoin->symbol,relcoin->smartaddr);
else balance = LP_RTsmartbalance(relcoin);
sum = (relvolume+2*dstr(txfees)) + 3 * ((relvolume+2*dstr(txfees))/777);
printf("%s inventory balance %.8f, relvolume %.8f + txfees %.8f, utxobal %.8f sum %.8f\n",rel,dstr(abalance),relvolume,dstr(txfees),dstr(balance),dstr(sum));
if ( dstr(abalance) < relvolume + dstr(txfees) && balance > sum+txfee )
{
retjson = cJSON_CreateObject();
if ( relcoin->electrum != 0 )
balance = LP_unspents_load(relcoin->symbol,relcoin->smartaddr);
else balance = LP_RTsmartbalance(relcoin);
jaddstr(retjson,"error","not enough funds");
jaddstr(retjson,"coin",rel);
jaddnum(retjson,"abalance",dstr(abalance));
@ -491,7 +492,6 @@ char *LP_tradebot_buy(int32_t dispdir,char *base,char *rel,double maxprice,doubl
jaddnum(retjson,"txfees",dstr(txfees));
shortfall = (relvolume + dstr(txfees)) - dstr(balance);
jaddnum(retjson,"shortfall",shortfall);
sum = (relvolume+2*dstr(txfees)) + 3 * ((relvolume+2*dstr(txfees))/777);
if ( balance >= sum+txfee )
{
char *withdrawstr; cJSON *outputjson,*withdrawjson,*outputs,*item;

Loading…
Cancel
Save