Skip to main content

Beancount plugin to generate periodic transactions #Amortize #Depreciate #Recur

Project description

Beancount plugin to generate periodic transactions

Usage

Install

pip3 install beancount-periodic

Examples

recur

main.bean

plugin "beancount_periodic.recur"
2022-03-31 * "Provider" "Net Fee"
  recur: "1 Year /Monthly"
  Liababilies:CreditCard:0001    -50 USD
  Expenses:Home:CommunicationFee

Then this plugin will transform the transaction into:

2022-03-31 * "Provider" "Net Fee Recurring(1/12)"
  Liababilies:CreditCard:0001    -50 USD
  Expenses:Home:CommunicationFee

2022-04-30 * "Provider" "Net Fee Recurring(2/12)"
  Liababilies:CreditCard:0001    -50 USD
  Expenses:Home:CommunicationFee

2022-05-31 * "Provider" "Net Fee Recurring(3/12)"
  Liababilies:CreditCard:0001    -50 USD
  Expenses:Home:CommunicationFee

;...

2023-02-28 * "Provider" "Net Fee Recurring(12/12)"
  Liababilies:CreditCard:0001    -50 USD
  Expenses:Home:CommunicationFee

amortize

main.bean

plugin "beancount_periodic.amortize"
2022-03-31 * "Landlord" "2022-04 Rent"
  Liababilies:CreditCard:0001    -12000 USD
  Expenses:Home:Rent
    amortize: "1 Year @2022-04-01 /Monthly"

Then this plugin will transform the transaction into:

2022-03-31 * "Landlord" "2022-04 Rent"
  Liababilies:CreditCard:0001    -12000 USD
  Equity:Amortization:Home:Rent
    amortize: "1 Year @2022-04-01 /Monthly"

2022-04-01 * "Landlord" "2022-04 Rent Amortized(1/12)"
  Equity:Amortization:Home:Rent    -1000 USD
  Expenses:Home:CommunicationFee

2022-05-01 * "Landlord" "2022-04 Rent Amortized(2/12)"
  Equity:Amortization:Home:Rent    -1000 USD
  Expenses:Home:CommunicationFee

2022-06-01 * "Landlord" "2022-04 Rent Amortized(3/12)"
  Equity:Amortization:Home:Rent    -1000 USD
  Expenses:Home:CommunicationFee

;...

2023-03-01 * "Landlord" "2022-04 Rent Amortized(12/12)"
  Equity:Amortization:Home:Rent    -1000 USD
  Expenses:Home:CommunicationFee

depreciate

main.bean

plugin "beancount_periodic.depreciate"
2022-03-31 * "Tesla" "Model X"
  Liababilies:CreditCard:0001    -200000 USD
  Assets:Car:ModelX
    depreciate: "5 Year /Yearly =80000"

Then this plugin will transform the transaction into:

2022-03-31 * "Tesla" "Model X"
  Liababilies:CreditCard:0001    -200000 USD
  Assets:Car:ModelX
    depreciate: "5 Year /Yearly =80000"
  

2022-03-31 * "Tesla" "Model X Depreciated(1/5)"
  Assets:Car:ModelX    -24000 USD
  Expenses:Depreciation:Car:ModelX

2023-03-31 * "Tesla" "Model X Depreciated(2/5)"
  Assets:Car:ModelX    -24000 USD
  Expenses:Depreciation:Car:ModelX
;...

2026-03-31 * "Tesla" "Model X Depreciated(5/5)"
  Assets:Car:ModelX    -24000 USD
  Expenses:Depreciation:Car:ModelX

At last, the balance of the account Assets:Car:ModelX is 80000 USD.

Config string in meta

All settings follow the same rules. These are some examples:

"200000- 5 Years @2022-03-31 /Yearly *line =80000"
"200000- @2022-03-31~2027-03-30 /Year *line =80000"
"200000 - 5 Year @2022-03-31 /1 Year *line =80000"
"200000 - 5 Y @2022-03-31 /12 Months =80000"
"5Y @ 2022-03-31 / 12M = 80000"
"5Y / 12M =80000"
"5Y / 12M"

Total value

200000- means that the total value is 200000.

The default value of total is same as the account of posting if missing.

Duration & Start date

5 Years means the duration is 5 years, and @2022-03-31 means the first transformed transaction will start at 2022-03-31.

5 Years @2022-03-31 is same as @2022-03-31~2027-03-30. You can also use Day and others.

"6 Months @2022-03-31"
"6 M @2022-03-31"
"5 Y @2022-03-31"

And the start date is optional, using the entry date as default value if missing.

"6 Months"

The default value of duration is 1 month if missing.

Step

Yearly means one transformed transaction per year. You can also use Daily, Monthly, Day and others.

If step string ends with ! means that the amount of every step will be calculated with real days. For example:

2022-01-01 *
  Liababilies:CreditCard:0001    -365 USD
  Expenses:BlaBla
    amortize: "1 Year /Monthly!"

Then this plugin will transform the transaction into:

2022-01-01 *
  Liababilies:CreditCard:0001    -365 USD
  Expenses:BlaBla
    amortize: "1 Year /Monthly!"

2022-01-01 * "Amortized(1/12)"
  Equity:Amortization:BlaBla    -31 USD
  Expenses:BlaBla

2022-02-01 * "Amortized(2/12)"
  Equity:Amortization:BlaBla    -28 USD
  Expenses:BlaBla

2022-03-01 * "Amortized(3/12)"
  Equity:Amortization:BlaBla    -31 USD
  Expenses:BlaBla

;...

2022-12-01 * "Amortized(12/12)"
  Equity:Amortization:BlaBla    -31 USD
  Expenses:BlaBla

The default value of step is 1 day if missing.

Formula(not yet implemented)

*line means that the formula is line. You can also use linear, straight, line, load, work-load, accelerated-sum, sum, accelerated-declining.

The default value of formula is line.

Salvage value

=80000 means that the salvage value is 80000.

The default value of salvage value is 0 if missing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beancount-periodic-0.1.2.tar.gz (11.0 kB view details)

Uploaded Source

File details

Details for the file beancount-periodic-0.1.2.tar.gz.

File metadata

  • Download URL: beancount-periodic-0.1.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for beancount-periodic-0.1.2.tar.gz
Algorithm Hash digest
SHA256 352fc97be1ff17351d62273b00a41a1f454f3bc6b4b7e88d6d4b08854fe3a412
MD5 ead13818393be61d03dc0fee7d24d480
BLAKE2b-256 322425a8a75cd71373771352921a3cda9d47fd215c49d5c07da5df90e7c284e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page