This commit is contained in:
jl777
2019-04-02 01:54:47 -11:00
parent a18d49991b
commit 0cf34a56f9
2 changed files with 5 additions and 5 deletions

View File

@@ -2230,13 +2230,13 @@ int64_t komodo_pricesmoothed(int64_t *correlated,int32_t numprices)
int64_t komodo_pricecorrelated(uint32_t *rawprices,int32_t numprices) int64_t komodo_pricecorrelated(uint32_t *rawprices,int32_t numprices)
{ {
int32_t i; uint32_t price; int64_t sum = 0; int32_t i; int64_t price,sum = 0;
for (i=0; i<numprices; i++) for (i=0; i<numprices; i++)
{ {
if ( (price= rawprices[i]) == 0 ) if ( (price= rawprices[i]) == 0 )
return(0); return(0);
//fprintf(stderr,"%.0f ",(double)price/10000); //fprintf(stderr,"%.0f ",(double)price/10000);
sum += (int64_t)price * 10000; sum += price * 10000;
} }
//fprintf(stderr," ave %.8f [%d]\n",((double)sum/numprices)/COIN,numprices); //fprintf(stderr," ave %.8f [%d]\n",((double)sum/numprices)/COIN,numprices);
return(sum / numprices); return(sum / numprices);

View File

@@ -1245,9 +1245,9 @@ UniValue prices(const UniValue& params, bool fHelp)
offset = j*width + i; offset = j*width + i;
smoothed = komodo_pricesmoothed(&correlated[i],daywindow); smoothed = komodo_pricesmoothed(&correlated[i],daywindow);
UniValue parr(UniValue::VARR); UniValue parr(UniValue::VARR);
parr.push_back(ValueFromAmount((int64_t)prices[offset]*10000)); parr.push_back(((int64_t)prices[offset]*10000));
parr.push_back(ValueFromAmount(correlated[i])); parr.push_back((correlated[i]));
parr.push_back(ValueFromAmount(smoothed)); parr.push_back((smoothed));
p.push_back(parr); p.push_back(parr);
} }
item.push_back(Pair("prices",p)); item.push_back(Pair("prices",p));