jl777 7 years ago
parent
commit
a1bd02aacd
  1. 8
      iguana/exchanges/LP_ordermatch.c

8
iguana/exchanges/LP_ordermatch.c

@ -129,7 +129,7 @@ cJSON *LP_quotejson(struct LP_quoteinfo *qp)
jadd64bits(retjson,"destsatoshis",qp->destsatoshis);
if ( qp->satoshis != 0 )
{
price = (double)qp->destsatoshis / qp->satoshis;
price = (double)(qp->destsatoshis-qp->desttxfee) / (qp->satoshis - qp->txfee);
jaddnum(retjson,"price",price);
}
}
@ -205,7 +205,7 @@ char *LP_quotereceived(cJSON *argjson)
{
struct LP_cacheinfo *ptr; double price; struct LP_quoteinfo Q;
LP_quoteparse(&Q,argjson);
price = (double)Q.destsatoshis / Q.satoshis;
price = (double)(Q.destsatoshis-Q.desttxfee) / (Q.satoshis - Q.txfee);
if ( (ptr= LP_cacheadd(Q.srccoin,Q.destcoin,Q.txid,Q.vout,price,&Q)) != 0 )
{
ptr->Q = Q;
@ -305,7 +305,7 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str
return(-33);
}
if ( qp->satoshis != 0 )
qprice = ((double)qp->destsatoshis / qp->satoshis);
qprice = ((double)(qp->destsatoshis-qp->desttxfee) / (qp->satoshis-qp->txfee));
LP_txfees(&txfee,&desttxfee,qp->srccoin,qp->destcoin);
if ( txfee < qp->txfee )
txfee = qp->txfee;
@ -461,7 +461,7 @@ uint64_t LP_basesatoshis(double relvolume,double price,uint64_t txfee,uint64_t d
{
printf("basesatoshis %.8f (rel %.8f / price %.8f)\n",dstr(SATOSHIDEN * ((relvolume + dstr(desttxfee)) / price) + 2*txfee),relvolume,price);
if ( relvolume > dstr(desttxfee) && price > SMALLVAL )
return(SATOSHIDEN * ((relvolume - dstr(desttxfee)) / price));
return(SATOSHIDEN * ((relvolume + dstr(desttxfee)) / price) + txfee);
else return(0);
}

Loading…
Cancel
Save