Open-source financial planning
See whether cash lasts until payday and what saving more could change in ten years. Use PlanFi in your terminal, automate it with JSON, or embed the engine in a Go app.
Will rent clear before payday?
January opens with $1,000. Rent of $1,200 posts on the 5th. One $1,500 paycheck comes in.
planfi demo budgetYour first session
PlanFi’s MIT-licensed CLI and Go library are in private preview. Collaborators can sign in to GitHub Releases for macOS, Linux and Windows binaries. Public downloads are pending.
Extract the ZIP and open a terminal in that folder. Start with ./planfi demo or ./planfi demo budget to try the sample household. In Windows PowerShell use .\planfi.exe demo.
PlanFi Invest
Compare retirement scenarios and backtest withdrawals. In the sample plan, investing $500 instead of $300 a month adds $30,873 to projected net worth over ten years, assuming 5% annual stock growth.
./planfi investPlanFi Budget
Schedule bills and paychecks by date, forecast closing cash, and reconcile the month against your actual balance. Use that balance in Invest whenever you choose.
./planfi budgetRun planfi guide start for an offline guide. After saving a scenario, planfi review shows the balances and assumptions behind a household check-in. Read the first-session guide.
Put a forecast in your app
Invest, the Go library, and the CLI’s JSON interface use the same plan. It can include individual stock holdings, debt, property, and Social Security. Choose how your app calls the engine.
Embed in Go
Import github.com/KameronKales/planfi-cli/planning. Your app calls an ordinary Go function in its own process and receives typed monthly balances. The engine ships inside your app’s binary.
rows, err := planning.Forecast(ctx, plan, 12)Call the CLI from any language
Ship the PlanFi executable alongside your app. Python, Node, or a shell script can send a plan on stdin, check the exit code, and read a JSON response from stdout.
planfi ops example |
planfi --json ops forecastThe sample opens at $30,000 and reaches $36,187.26 after twelve months. Each forecast balance includes its currency and a decimal amount. Run the same file through both forecast commands.
Check the arithmetic
Inspect six synthetic households. To reproduce a result with PlanFi, download the inputs into one directory and run the command there.
What is a financed car worth to the household?
At closing, $2,000 in brokerage buys the down payment on a $20,000 car. Brokerage falls to $0. Subtract the $18,000 loan from the car’s value and net worth is still $2,000.
planfi invest forecast -monthly -months 12 car.jsonCan a retiree afford the boat after the final withdrawal?
The retiree has $1,200, spends $100 per month and earns no return. The twelfth withdrawal uses the last $100 before the $100 boat purchase is evaluated. All twelve withdrawals clear and the closing boat value is $0.
planfi invest compare -decision boat.json boat.jsonWhere does the payment go after the first loan clears?
A $1,000 payment clears the interest-free loan in month one. A second $100 loan with a 12% APR grows to $101. In month two it accrues $1.01 more before the freed payment clears it. Total interest is $2.01.
planfi invest calculate debt-payoff debt.jsonWhen does a monthly deposit start earning interest?
Cash starts at zero and receives $100 at each month end. At a 12% effective annual growth rate, multiply the previous balance by 1.12 to the power of 1/12, then add $100. Cash closes month one at $100.00 and month twelve at $1,264.65.
planfi --json ops forecast < cash.jsonHow many historical windows fit the remaining retirement?
The sample contains twelve monthly returns of zero. One twelve-month window fits at retirement. After eleven $100 withdrawals from $40,000, $38,900 remains and any of the twelve observations can cover the final month.
planfi invest forecast -market flat.json -monthly -months 11 history.json
planfi invest backtest -market flat.json direct.jsonWhat happens when a car purchase and retirement coincide?
At retirement the household uses $2,000 of its $5,000 brokerage balance to buy a $10,000 car with an $8,000 zero-interest loan. Its $1,000 cash reserve stays intact. Next month $100 of spending comes from brokerage, and the first of 60 installments comes from cash. Cash closes at $866.67, brokerage at $2,900 and debt at $7,866.67. Net worth falls from $6,000 to $5,900.
planfi invest forecast -monthly -months 13 retire-and-buy.jsonWhere does my household data live?
By default, Invest and Budget share a SQLite file on your computer. Set PLANFI_DB to a PostgreSQL URL to save to a server you choose. Go apps can supply their own storage adapter. The sample demos run in memory.
Do I have to set up Budget to use Invest?
Invest works independently. You can copy one month’s Budget balance into a scenario or save a link that refreshes the cash balance when you project.
Which data comes with the engine?
PlanFi includes historical investment returns, cited U.S. tax rules and one fictional rental example. Import your own rental observations to model a real location. Enter individual security prices yourself, load a file, or opt in to a quote provider such as Alpaca.
Can I bring an existing backup?
Use planfi data migrate followed by the path to your PlanFi JSON backup. Run planfi guide storage for migration, backup and verification commands.