diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index ccc1e05ce..021abbd60 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -2213,14 +2213,18 @@ char *komodo_pricename(char *name,int32_t ind) return(0); } -uint32_t komodo_timestampset(uint32_t *correlatedp,uint32_t *rawtimestamps,int32_t numtimestamps) +int64_t komodo_timestampset(int64_t *correlatedp,uint32_t *rawtimestamps,int32_t numtimestamps) { *correlatedp = rawtimestamps[0]; - return(rawtimestamps[0]); // really to do this would need to do it on a per pricefeed and which prices were used in the correlation, but that is a lot of extra work for a field which is not critical + return(*correlatedp); // really to do this would need to do it on a per pricefeed and which prices were used in the correlation, but that is a lot of extra work for a field which is not critical } -uint32_t komodo_pricesmoothed(uint32_t *correlatedp,uint32_t *rawprices,int32_t numprices) +int64_t komodo_pricesmoothed(int64_t *correlated,int32_t numprices) { - + return(0); } +int64_t komodo_pricecorrelated(uint32_t *rawprices,int32_t numprices) +{ + return(0); +} diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 29979a489..01939bb7d 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1176,8 +1176,9 @@ UniValue paxprice(const UniValue& params, bool fHelp) int32_t komodo_heightpricebits(uint32_t *heightbits,int32_t nHeight); char *komodo_pricename(char *name,int32_t ind); -uint32_t komodo_pricesmoothed(uint32_t *correlatedp,uint32_t *rawprices,int32_t numprices); -uint32_t komodo_timestampset(uint32_t *correlatedp,uint32_t *rawprices,int32_t numprices); +int64_t komodo_pricesmoothed(int64_t *correlated,int32_t numprices); +int64_t komodo_pricecorrelated(uint32_t *rawprices,int32_t numprices); +int64_t komodo_timestampset(int64_t *correlatedp,uint32_t *rawprices,int32_t numprices); int32_t komodo_nextheight(); uint32_t komodo_heightstamp(int32_t height); @@ -1186,7 +1187,7 @@ UniValue prices(const UniValue& params, bool fHelp) if ( fHelp || params.size() != 1 ) throw runtime_error("prices maxsamples\n"); LOCK(cs_main); - UniValue ret(UniValue::VOBJ); char name[64],*str; uint32_t rawprices[2048],*prices,*correlated,*smoothed; uint32_t i,j,firstn=-1,n,nextheight,offset,ht,num=0,daywindow = (3600*24/ASSETCHAINS_BLOCKTIME) + 1; + UniValue ret(UniValue::VOBJ); int64_t smoothed,*correlated; char name[64],*str; uint32_t rawprices[2048],*prices; uint32_t i,width,j,firstn=-1,n,nextheight,offset,ht,num=0,daywindow = (3600*24/ASSETCHAINS_BLOCKTIME) + 1; int32_t maxsamples = atoi(params[0].get_str().c_str()); if ( maxsamples < 1 ) maxsamples = 1; @@ -1194,10 +1195,11 @@ UniValue prices(const UniValue& params, bool fHelp) UniValue a(UniValue::VARR); if ( daywindow < 7 ) daywindow = 7; - prices = (uint32_t *)calloc(sizeof(*prices),maxsamples+daywindow); - correlated = (uint32_t *)calloc(sizeof(*correlated),maxsamples+daywindow); - smoothed = (uint32_t *)calloc(sizeof(*smoothed),maxsamples+daywindow); - for (ht=nextheight-1,i=0; idaywindow+2; i++,ht--) + width = maxsamples+2*daywindow; + prices = (uint32_t *)calloc(sizeof(*prices),width); + correlated = (int64_t *)calloc(sizeof(*correlated),width); + //smoothed = (uint32_t *)calloc(sizeof(*smoothed),width); + for (ht=nextheight-1,i=0; i2*daywindow+2; i++,ht--) { if ( ht < 0 || ht > chainActive.Height() ) throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); @@ -1212,7 +1214,7 @@ UniValue prices(const UniValue& params, bool fHelp) else { for (j=0; j