supybot-bitcoin-marketmonitor
supybot-bitcoin-marketmonitor copied to clipboard
Update tblb to use correct theoretical formula
The tblb formula is sensitive to hashrate deviation from difficulty, which causes wild inaccuracy when <interval> is large, by assuming that the deviation will last the entire time.
Also, "time between blocks which take <interval> seconds to create" is ambiguous. Are the current and/or final block intervals included or excluded?
There is a simple closed-form theoretical formula for this quantity, which is analogous to the wait time required before a chicken that takes i seconds to cross the road, can cross a road with poisson traffic.
Theoretical expected time to start of next block interval >= <interval> seconds is 600(exp(interval/600)-interval/600-1)
It could be argued that the current deviation-sensitive formula is more likely to match reality for short intervals. But the current formula also lacks an adjustment for the upcoming retargeting, which happens inside 3 days more than 20% of the time.
Tie it all up with the fact that hashrate is quite variable and the next 3 days are not likely to match the last 3 days very closely, and the current formula just looks broken and should be replaced by the theoretical one.