Introduce a scale factor

For the per confirmation number tracking of data, introduce a scale factor so that in the longer horizones confirmations are bucketed together at a resolution of the scale.  (instead of 1008 individual data points for each fee bucket, have 42 data points each covering 24 different confirmation values.. (1-24), (25-48), etc.. )
This commit is contained in:
Alex Morcos
2017-04-03 11:31:27 -04:00
parent 5f1f0c6490
commit 3ee76d6de5
4 changed files with 45 additions and 35 deletions

View File

@@ -895,6 +895,7 @@ UniValue estimaterawfee(const JSONRPCRequest& request)
"{\n"
" \"feerate\" : x.x, (numeric) estimate fee-per-kilobyte (in BTC)\n"
" \"decay\" : x.x, (numeric) exponential decay (per block) for historical moving average of confirmation data\n"
" \"scale\" : x, (numeric) The resolution of confirmation targets at this time horizon\n"
" \"pass.\" information about the lowest range of feerates to succeed in meeting the threshold\n"
" \"fail.\" information about the highest range of feerates to fail to meet the threshold\n"
" \"startrange\" : x.x, (numeric) start of feerate range\n"
@@ -932,6 +933,7 @@ UniValue estimaterawfee(const JSONRPCRequest& request)
result.push_back(Pair("feerate", feeRate == CFeeRate(0) ? -1.0 : ValueFromAmount(feeRate.GetFeePerK())));
result.push_back(Pair("decay", buckets.decay));
result.push_back(Pair("scale", (int)buckets.scale));
result.push_back(Pair("pass.startrange", round(buckets.pass.start)));
result.push_back(Pair("pass.endrange", round(buckets.pass.end)));
result.push_back(Pair("pass.withintarget", round(buckets.pass.withinTarget * 100.0) / 100.0));