Go to file
Sam Fredrickson 2d991880ce
All checks were successful
Build & Test / Main (push) Successful in 1m1s
Schedule refreshes more consistently.
Instead of returning the `scheduleRefresh` command only after receiving
an `update` message, do it while handling the `refresh` message. For
this not to cause weird behavior, the refresh deadline should be shorter
than the refresh interval.
2024-03-24 23:01:51 -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 Move Bitcoinity websocket capture, and test it. 2024-03-21 12:31:40 -07:00
coindesk Minor reformatting. 2024-03-21 00:17:29 -07:00
config Support multiple assets simultaneously. 2024-03-22 17:43:15 -07:00
moon Add config defaults for more assets. 2024-03-21 22:07:16 -07:00
tui Schedule refreshes more consistently. 2024-03-24 23:01:51 -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
go.mod Make it easier to use other assets. 2024-03-21 17:39:10 -07:00
go.sum Make it easier to use other assets. 2024-03-21 17:39:10 -07:00
LICENSE Initial public commit. 2024-03-17 02:10:05 -07:00
moonmath.go Write errors to log file. 2024-03-22 22:55:41 -07:00
README.md Support multiple assets simultaneously. 2024-03-22 17:43:15 -07:00
screenshot.png Update screenshot. 2024-03-21 17:45:27 -07:00

moonmath

Bullshit Crypto 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.

Installation

Go to the Releases page and download the archive for your operating system and architecture. (For the uninitiated, "Darwin" means macOS.)

Configuration

By default, the program will use Bitcoin along with various goals and bases of comparison. With the --asset flag, another asset supported by Coindesk can be chosen. These can even be chained, e.g. --asset BTC --asset ETH, to show projections for multiple assets simultaneously.

The builtin default config only has special goals a handful of the most popular assets. With the --config-file flag, however, one can specify a YAML file that overrides these defaults and adds goals for other assets.

Check out coindesk/assets.go for a full list of supported assets. Keep in mind these have not been exhaustively tested, and it's likely that many will fail with the default configuration settings.

"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.