From b5af10d99f56f11d17bb22dcef8ebab7e6502a8a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Apr 2019 02:05:27 -1100 Subject: [PATCH] Normalize all prices --- src/komodo_gateway.h | 7 ++++--- src/rpc/blockchain.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index bb67d1e8d..bbad94c51 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -2228,15 +2228,16 @@ int64_t komodo_pricesmoothed(int64_t *correlated,int32_t numprices) return(correlated[0]); } -int64_t komodo_pricecorrelated(uint32_t *rawprices,int32_t numprices) +int64_t komodo_pricecorrelated(int32_t ind,uint32_t *rawprices,int32_t numprices) { int32_t i; int64_t price,sum = 0; for (i=0; i= 36 ) + price *= 10000; + sum += price; } //fprintf(stderr," ave %.8f [%d]\n",((double)sum/numprices)/COIN,numprices); return(sum / numprices); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 2b0186f22..c628ab074 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1246,8 +1246,8 @@ UniValue prices(const UniValue& params, bool fHelp) smoothed = komodo_pricesmoothed(&correlated[i],daywindow); UniValue parr(UniValue::VARR); parr.push_back(ValueFromAmount((int64_t)prices[offset])); - parr.push_back(ValueFromAmount(correlated[i]/10000)); - parr.push_back(ValueFromAmount(smoothed/10000)); + parr.push_back(ValueFromAmount(correlated[i])); + parr.push_back(ValueFromAmount(smoothed)); p.push_back(parr); } item.push_back(Pair("prices",p));