corr errors after rebase
added comments
This commit is contained in:
@@ -43,6 +43,9 @@
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include "cc/CCinclude.h"
|
||||
#include "cc/CCPrices.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
|
||||
@@ -1165,7 +1168,7 @@ UniValue paxprice(const UniValue& params, bool fHelp)
|
||||
return(-1);
|
||||
for (i=0; i<width; i++)
|
||||
{
|
||||
if ( (n= komodo_heightpricebits(&ignore,rawprices,firstheight + numblocks - 1 - i)) < 0 )
|
||||
if ( (n= komodo_heightpricebits(&ignore,rawprices,firstheight + numblocks - 1 - i)) < 0 ) // stores raw prices in backward order
|
||||
return(-1);
|
||||
if ( numpricefeeds < 0 )
|
||||
numpricefeeds = n;
|
||||
@@ -1176,16 +1179,18 @@ UniValue paxprice(const UniValue& params, bool fHelp)
|
||||
ptr[1] = rawprices[0]; // timestamp
|
||||
}
|
||||
rngval = seed;
|
||||
for (i=0; i<numblocks+PRICES_DAYWINDOW+PRICES_SMOOTHWIDTH; i++)
|
||||
for (i=0; i<numblocks+PRICES_DAYWINDOW+PRICES_SMOOTHWIDTH; i++) // calculates +PRICES_DAYWINDOW more correlated values
|
||||
{
|
||||
rngval = (rngval*11109 + 13849);
|
||||
ptr = (uint32_t *)&pricedata[i*3];
|
||||
if ( (pricedata[i*3+1]= komodo_pricecorrelated(rngval,ind,(uint32_t *)&pricedata[i*3],6,0,PRICES_SMOOTHWIDTH)) < 0 )
|
||||
// takes previous PRICES_DAYWINDOW raw prices and calculates correlated price value
|
||||
if ( (pricedata[i*3+1]= komodo_pricecorrelated(rngval,ind,(uint32_t *)&pricedata[i*3],6,0,PRICES_SMOOTHWIDTH)) < 0 ) // skip is 6 == sizeof(int64_t)/sizeof(int32_t)*3
|
||||
return(-3);
|
||||
}
|
||||
tmpbuf = (int64_t *)calloc(sizeof(int64_t),2*PRICES_DAYWINDOW);
|
||||
for (i=0; i<numblocks; i++)
|
||||
pricedata[i*3+2] = komodo_priceave(tmpbuf,&pricedata[i*3+1],3);
|
||||
// takes previous PRICES_DAYWINDOW correlated price values and calculates smoothed value
|
||||
pricedata[i*3+2] = komodo_priceave(tmpbuf,&pricedata[i*3+1],3);
|
||||
free(tmpbuf);
|
||||
return(0);
|
||||
}*/
|
||||
@@ -1315,21 +1320,20 @@ UniValue prices(const UniValue& params, bool fHelp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t komodo_d_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
// pricesbet rpc implementation
|
||||
UniValue pricesbet(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 3)
|
||||
throw runtime_error("pricesbet amount leverage \"synthetic-expression\"\n");
|
||||
LOCK(cs_main);
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
|
||||
if (ASSETCHAINS_CBOPRET == 0)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "only -ac_cbopret chains have prices");
|
||||
|
||||
CAmount txfee = 10000;
|
||||
CAmount amount = atoll(params[0].get_str().c_str());
|
||||
int16_t leverage = (int16_t) atoi(params[1].get_str().c_str());
|
||||
int16_t leverage = (int16_t)atoi(params[1].get_str().c_str());
|
||||
|
||||
std::string sexpr = params[2].get_str();
|
||||
std::vector<std::string> vexpr;
|
||||
@@ -1349,7 +1353,7 @@ UniValue pricesaddfunding(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 2)
|
||||
throw runtime_error("pricesaddfunding bettxid amount\n"
|
||||
"where amount is in satoshis\n");
|
||||
"where amount is in satoshis\n");
|
||||
LOCK(cs_main);
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
|
||||
@@ -1358,11 +1362,11 @@ UniValue pricesaddfunding(const UniValue& params, bool fHelp)
|
||||
|
||||
CAmount txfee = 10000;
|
||||
uint256 bettxid = Parseuint256(params[0].get_str().c_str());
|
||||
if( bettxid.IsNull() )
|
||||
if (bettxid.IsNull())
|
||||
throw runtime_error("invalid bettxid\n");
|
||||
|
||||
CAmount amount = atoll(params[1].get_str().c_str());
|
||||
if( amount <= 0 )
|
||||
if (amount <= 0)
|
||||
throw runtime_error("invalid amount\n");
|
||||
|
||||
return PricesAddFunding(txfee, bettxid, amount);
|
||||
@@ -1380,7 +1384,7 @@ UniValue pricessetcostbasis(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "only -ac_cbopret chains have prices");
|
||||
|
||||
uint256 bettxid = Parseuint256(params[0].get_str().c_str());
|
||||
if( bettxid.IsNull() )
|
||||
if (bettxid.IsNull())
|
||||
throw runtime_error("invalid bettxid\n");
|
||||
|
||||
int64_t txfee = 10000;
|
||||
@@ -1388,6 +1392,7 @@ UniValue pricessetcostbasis(const UniValue& params, bool fHelp)
|
||||
return PricesSetcostbasis(txfee, bettxid);
|
||||
}
|
||||
|
||||
// pricescashout rpc implementation
|
||||
UniValue pricescashout(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
@@ -1407,6 +1412,7 @@ UniValue pricescashout(const UniValue& params, bool fHelp)
|
||||
return PricesCashout(txfee, bettxid);
|
||||
}
|
||||
|
||||
// pricesrekt rpc implementation
|
||||
UniValue pricesrekt(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 2)
|
||||
@@ -1428,6 +1434,7 @@ UniValue pricesrekt(const UniValue& params, bool fHelp)
|
||||
return PricesRekt(txfee, bettxid, height);
|
||||
}
|
||||
|
||||
|
||||
UniValue gettxout(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 2 || params.size() > 3)
|
||||
@@ -2057,4 +2064,4 @@ void RegisterBlockchainRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user