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

---
 iguana/exchanges/LP_portfolio.c | 4 ++--
 iguana/exchanges/LP_prices.c    | 4 ++--
 iguana/exchanges/stats.c        | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c
index 5d5574b4a..b9e01c775 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);
@@ -591,7 +591,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
                 LP_mypriceset(&changed,rel,base,newprice);
                 LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice);
                 //printf("price %.8f margin %.8f/%.8f newprice %.8f %.8f\n",price,buymargin,sellmargin,newprice,(1. / price) * (1. + buymargin));
-                newprice = (1. / price) * (1. + sellmargin);
+                newprice = (1. / (price * (1. + sellmargin)));
                 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);
diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c
index d4b59fd8d..8553537ec 100644
--- a/iguana/exchanges/LP_prices.c
+++ b/iguana/exchanges/LP_prices.c
@@ -513,8 +513,8 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
 {
     struct LP_priceinfo *basepp,*relpp; struct LP_pubkey_info *pubp;
     *changedp = 0;
-    if ( strcmp("DEX",base) == 0 || strcmp("DEX",rel) == 0 )
-        printf("%s/%s setprice %.8f\n",base,rel,price);
+    //if ( strcmp("DEX",base) == 0 || strcmp("DEX",rel) == 0 )
+    //    printf("%s/%s setprice %.8f\n",base,rel,price);
     if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 )
     {
         
diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c
index c93fa5a37..e20bfa284 100644
--- a/iguana/exchanges/stats.c
+++ b/iguana/exchanges/stats.c
@@ -221,7 +221,7 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
                 return(-1);
             }
         }
-        if ( listen(sock,512) != 0 )
+        if ( listen(sock,4096) != 0 )
         {
             printf("listen(%s) port.%d failed: %s sock.%d. errno.%d\n",hostname,port,strerror(errno),sock,errno);
             if ( sock >= 0 )