From da49d43d499d8eae132a763b085aa6a1063bc99d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 12:19:48 +0200 Subject: [PATCH] Reset iterations to price if threes dominate --- iguana/exchanges/LP_ordermatch.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a313a3791..6ca66b1bd 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -965,9 +965,17 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru p = (double)qp->destsatoshis / (qp->satoshis - qp->txfee); if ( LP_trades_pricevalidate(qp,coin,p) < 0. ) return(0); - if ( qprice >= p ) - break; - price *= 0.995; + if ( i == 0 && p < myprice ) + { + price = qprice; + printf("reset price <- qprice %.8f\n",qprice); + } + else + { + if ( qprice >= p ) + break; + price *= 0.995; + } i++; } printf("i.%d qprice %.8f myprice %.8f price %.8f [%.8f]\n",i,qprice,myprice,price,p);