Go to file
Sam Fredrickson 1c6d5e9917
All checks were successful
Build & Test / Main (push) Successful in 1m28s
Simplify projection table generation.
Instead of pre-allocating the grid and using tricky indexing to fill in
the cells, just fully regenerate it. But do it columnwise first, and
then transpose it.
2024-03-20 23:40:38 -07:00
.gitea/workflows Add starting price to table; add Gitea workflows. 2024-03-17 19:01:59 -07:00
.vscode Initial configuration support. 2024-03-19 21:44:11 -07:00
bitcoinity Fix module name. 2024-03-19 14:29:37 -07:00
coindesk Initial configuration support. 2024-03-19 21:44:11 -07:00
config Initial configuration support. 2024-03-19 21:44:11 -07:00
moon Simplify projection table generation. 2024-03-20 23:40:38 -07:00
tui Simplify projection table generation. 2024-03-20 23:40:38 -07:00
.gitignore Don't forget about the Windows peeps. 2024-03-17 19:12:39 -07:00
.goreleaser.yaml Don't forget about the Windows peeps. 2024-03-17 19:12:39 -07:00
example.json Initial public commit. 2024-03-17 02:10:05 -07:00
go.mod Initial configuration support. 2024-03-19 21:44:11 -07:00
go.sum Initial configuration support. 2024-03-19 21:44:11 -07:00
LICENSE Initial public commit. 2024-03-17 02:10:05 -07:00
moonmath.go Initial configuration support. 2024-03-19 21:44:11 -07:00
README.md Remarks on configuration in the README. 2024-03-19 21:47:47 -07:00
screenshot.png Initial public commit. 2024-03-17 02:10:05 -07:00

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.

Configuration

By default, the program will use Bitcoin along with various goals and bases of comparison. With the --config-file flag, however, one can specify a TOML file that overrides these defaults.

See this one for Ethereum for an example.

"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

  • Add more default configurations for various assets.
  • 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.