From 3d19e514fb24d80373f0d772c80aab35c86f9611 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 10 Feb 2018 23:09:14 +0200 Subject: [PATCH] Average fund value autoprice --- iguana/exchanges/LP_portfolio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index ead40b27c..14a60c5d5 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -540,7 +540,15 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { price = (bidprice + askprice) * 0.5; bidprice = (1. / price * (1. + buymargin)); + if ( LP_autorefs[i].lastbid < SMALLVAL ) + LP_autorefs[i].lastbid = bidprice; + else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.99) + (0.01 * bidprice); + bidprice = LP_autorefs[i].lastbid; askprice = price * (1. + sellmargin); + if ( LP_autorefs[i].lastask < SMALLVAL ) + LP_autorefs[i].lastask = askprice; + else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.99) + (0.01 * askprice); + askprice = LP_autorefs[i].lastask; LP_mypriceset(&changed,rel,base,bidprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,bidprice); LP_mypriceset(&changed,base,rel,askprice);