diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index bd49771bb..361f53b9c 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -559,7 +559,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( LP_autorefs[i].lastask < SMALLVAL ) LP_autorefs[i].lastask = newprice; else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.9) + (0.1 *newprice); - if ( LP_autorefs[i].lastask > LP_autorefs[i].lastbid ) + if ( LP_autorefs[i].lastbid < SMALLVAL || LP_autorefs[i].lastask > LP_autorefs[i].lastbid ) newprice = LP_autorefs[i].lastask; else newprice = LP_autorefs[i].lastbid * (1. + sellmargin); LP_mypriceset(&changed,base,rel,newprice);