moonmath/README.md

1.2 KiB

moonmath

Bullshit BTC Price Projections, Now in Your CLI!

screenshot

This is a re-implementation of Moon Math that runs locally as a CLI program. It's written in Go using the Bubble Tea library, and uses Coindesk to source price data.

"Theory"

Given a pair of quotes taken at the start and end of some period,

 (t_s, p_s), (t_e, p_e) 

we can derive the total gain for that period, and its length in days.

 g = p_e / p_s 
 d = t_e - t_s 

Combining these, we can calculate the compounding daily periodic rate (CDPR).

 r = g^{1/d} 

We can use this rate to project the price p_f at some x days in the future.

 p_f = p_e r^x 

If we instead make p_f a target price, we can solve this equation for x, telling us how many days it will take to reach that target.

 x = {{log(p_f) - log(p_e)} \over log(r)} 

Future Improvements

  • Support other assets available from Coindesk.
  • Configurable projection milestones.
  • Allow projection by date, e.g. use the CDPR to calculate what the price would be on a particular date.
  • Log errors to a file.