ynab

package module
v0.0.0-...-eb7461f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 5 Imported by: 0

README

ynab-go

This is a You Need a Budget client but it's incomplete. Right now the only supported endpoints are the ones necessary to do the Age of Money calculation.

Age of Money

This command will print out more information about how old your money is.

Download the ynab-age-of-money binary, following the instructions here: https://go.equinox.io/github.com/kevinburke/ynab-go/ynab-age-of-money

Set YNAB_TOKEN to your API token in your environment. You can find your token on the Settings page: https://app.youneedabudget.com/settings

Finally, run the binary:

ynab-age-of-money --budget='Personal Budget'

The output will look something like this:

 70 earned: 2019-02-07 spent: 2019-04-18     $25.00 Cash Exxon Mobil
 71 earned: 2019-02-07 spent: 2019-04-19      $3.00 Cash Shaska Cafe
 71 earned: 2019-02-07 spent: 2019-04-19      $2.00 Cash Shaska Cafe
 72 earned: 2019-02-07 spent: 2019-04-20      $4.00 Cash Aces
 75 earned: 2019-02-07 spent: 2019-04-23      $6.00 Cash Corner Store
 75 earned: 2019-02-07 spent: 2019-04-23      $3.00 Cash Lava Java
 76 earned: 2019-02-07 spent: 2019-04-24    $123.45 Shared Checking Transfer : Credit Card 1
 76 earned: 2019-02-07 spent: 2019-04-24    $456.78 Shared Checking Transfer : Credit Card 2
 77 earned: 2019-02-07 spent: 2019-04-25      $3.00 Cash Lava Java
 77 earned: 2019-02-07 spent: 2019-04-25      $2.00 Cash Corner Store

upcoming spending thresholds (and age if you spent today):
 78 2019-02-07   $1000.00 Personal Checking Employer 1
 74 2019-02-11   $2000.00 Shared Checking Employer 2
 73 2019-02-12   $2020.00 Personal Checking Venmo
 71 2019-02-14   $3020.00 Shared Checking Employer 2
 66 2019-02-19   $3060.00 Cash Laura Cash
 60 2019-02-25   $3065.00 Shared Checking Bank Interest
 60 2019-02-25   $3070.00 Personal Checking Bank Interest

The number in the far left hand column is the age of money, in days, for each transaction. The thresholds show the upcoming age of money when you spend it.

The flags are:

  -budget-name string
    	Name of the budget to compute AOM for
  -debug
    	Enable debug
  -file string
    	Filename to read txns from

You will need to specify --budget-name if you have more than one budget. --debug provides more information about all of the buckets you have as well as all of the accounts you have. --file is useful if you are making a lot of requests - save the JSON transaction data to a file and load it from there.

Errata

YNAB uses a weighted average to calculate age of money for a single transaction if it spans multiple buckets. I choose the date of the bucket the last penny was taken out of, so the numbers may be slightly lower here than in your dashboard.

YNAB averages the last ten transactions to get the Age of Money. I print accurate results for each transaction in your account.

Largest Inputs and Outputs

The ynab-largest-inputs-outputs command finds the largest inputs and outputs to your Net Worth, optionally filtered by a month argument. Any income or outflows that come into either your budget accounts or your tracking accounts will appear here. One exception is that credit card spending is accounted at the time of payment, not at the time the money is spent.

Pass the --month flag to filter by a given month. The flag accepts arguments in the form of 'Jan 2006', e.g. --month='Aug 2019'.

Disclaimer

I spot checked the results against my account, and they appeared to be accurate. They may not be correct for your account. This software is provided "as is" and I am not liable for any claim or damages arising from how you use this library.

License

MIT

Support

You can hire me: https://burke.services

I maintain this software in my free time. Donations free up time to make improvements to the library, and respond to bug reports. You can send donations via Paypal's "Send Money" feature to kev@inburke.com. Donations are not tax deductible in the USA.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID              string
	Name            string
	Type            string
	OnBudget        bool `json:"on_budget"`
	Closed          bool
	Note            string
	Balance         int64
	StartingBalance int64 `json:"starting_balance"`
	Deleted         bool
}

func (Account) CashBacked

func (a Account) CashBacked() bool

type AccountListResponse

type AccountListResponse struct {
	Data AccountListWrapper `json:"data"`
}

type AccountListWrapper

type AccountListWrapper struct {
	Accounts []*Account `json:"accounts"`
}

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

type Budget

type Budget struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type BudgetListResponse

type BudgetListResponse struct {
	Data BudgetListWrapper `json:"data"`
}

type BudgetListWrapper

type BudgetListWrapper struct {
	Budgets []*Budget `json:"budgets"`
}

type BudgetService

type BudgetService struct {
	// contains filtered or unexported fields
}

func (*BudgetService) GetAccounts

func (b *BudgetService) GetAccounts(ctx context.Context, budgetID string, data url.Values) (*AccountListResponse, error)

func (*BudgetService) GetCategories

func (b *BudgetService) GetCategories(ctx context.Context, budgetID string, data url.Values) (*CategoryListResponse, error)

func (*BudgetService) GetPage

func (b *BudgetService) GetPage(ctx context.Context, data url.Values) (*BudgetListResponse, error)

func (*BudgetService) GetScheduledTransactions

func (b *BudgetService) GetScheduledTransactions(ctx context.Context, budgetID string, data url.Values) (*ScheduledTransactionListResponse, error)

func (*BudgetService) GetTransactions

func (b *BudgetService) GetTransactions(ctx context.Context, budgetID string, data url.Values) (*TransactionListResponse, error)

type Category

type Category struct {
	ID              string
	Name            string
	CategoryGroupID string `json:"category_group_id"`
	Note            string
	Hidden          bool
	Budgeted        int64
	Activity        int64
}

type CategoryGroup

type CategoryGroup struct {
	ID         string
	Name       string
	Hidden     bool
	Deleted    bool
	Categories []*Category
}

type CategoryListResponse

type CategoryListResponse struct {
	Data CategoryListWrapper `json:"data"`
}

type CategoryListWrapper

type CategoryListWrapper struct {
	CategoryGroups []*CategoryGroup `json:"category_groups"`
}

type CategoryService

type CategoryService struct {
	// contains filtered or unexported fields
}

type Client

type Client struct {
	*rest.Client

	Accounts     *AccountService
	Budgets      *BudgetService
	Categories   *CategoryService
	Transactions *TransactionService
}

func NewClient

func NewClient(token string) *Client

type Date

type Date time.Time

func (Date) GoString

func (t Date) GoString() string

func (Date) String

func (t Date) String() string

func (*Date) UnmarshalJSON

func (t *Date) UnmarshalJSON(b []byte) error

type ScheduledTransaction

type ScheduledTransaction struct {
	AccountID         string `json:"account_id"`
	AccountName       string `json:"account_name"`
	Amount            int64
	Approved          bool
	CategoryName      types.NullString `json:"category_name"`
	Cleared           string
	DateFirst         Date `json:"date_first"`
	DateNext          Date `json:"date_next"`
	Deleted           bool
	Frequency         string
	ID                string `json:"id"`
	Memo              string
	PayeeName         string           `json:"payee_name"`
	TransferAccountID types.NullString `json:"transfer_account_id"`
	Subtransactions   []Transaction    `json:"subtransactions"`
}

type ScheduledTransactionListResponse

type ScheduledTransactionListResponse struct {
	Data ScheduledTransactionListWrapper `json:"data"`
}

type ScheduledTransactionListWrapper

type ScheduledTransactionListWrapper struct {
	ScheduledTransactions []*ScheduledTransaction `json:"scheduled_transactions"`
}

type Transaction

type Transaction struct {
	AccountID             string `json:"account_id"`
	AccountName           string `json:"account_name"`
	Amount                int64
	Approved              bool
	CategoryID            types.NullString `json:"category_id"`
	CategoryName          types.NullString `json:"category_name"`
	Cleared               string
	Date                  Date
	Deleted               bool
	ID                    string `json:"id"`
	Memo                  string
	PayeeName             string           `json:"payee_name"`
	TransferAccountID     types.NullString `json:"transfer_account_id"`
	TransferTransactionID types.NullString `json:"transfer_transaction_id"`
	MatchedTransactionID  types.NullString `json:"matched_transaction_id"`
	Subtransactions       []Transaction    `json:"subtransactions"`
}

type TransactionListResponse

type TransactionListResponse struct {
	Data TransactionListWrapper `json:"data"`
}

type TransactionListWrapper

type TransactionListWrapper struct {
	Transactions []*Transaction `json:"transactions"`
}

type TransactionService

type TransactionService struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
The ynab-export-transactions command retrieves transactions and prints them to stdout in CSV format.
The ynab-export-transactions command retrieves transactions and prints them to stdout in CSV format.
The ynab-largest-inputs-outputs function finds the largest inputs and outputs to your Net Worth, optionally filtered by a month argument.
The ynab-largest-inputs-outputs function finds the largest inputs and outputs to your Net Worth, optionally filtered by a month argument.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL