From 1711485099215c6f0c3156e781234b3246594c76 Mon Sep 17 00:00:00 2001
From: jl777 <jameslee777@yahoo.com>
Date: Thu, 18 Jan 2018 16:22:42 +0200
Subject: [PATCH] Test

---
 iguana/exchanges/LP_portfolio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c
index b9e01c775..5c0726bc3 100644
--- a/iguana/exchanges/LP_portfolio.c
+++ b/iguana/exchanges/LP_portfolio.c
@@ -541,7 +541,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
                         //printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundbid,price);
                         if ( tickerjson != 0 && LP_autorefs[i].count == 0 )
                             price = LP_tickered_price(0,base,rel,price,tickerjson);
-                        newprice = (1. / (price * (1. + buymargin)));
+                        newprice = (1. / (price * (1. - buymargin)));
                         if ( LP_autorefs[i].lastbid < SMALLVAL )
                             LP_autorefs[i].lastbid = newprice;
                         else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.9) + (0.1 *newprice);
@@ -583,7 +583,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
                 else continue;
                 if ( factor > 0. )
                     price = (price * factor) + offset;
-                newprice = (price * (1. + buymargin));
+                newprice = (price * (1. - buymargin));
                 if ( LP_autorefs[i].lastbid < SMALLVAL )
                     LP_autorefs[i].lastbid = newprice;
                 else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.9) + (0.1 *newprice);