SwiftBeanCountTax

0.0.3

Nef10/SwiftBeanCountTax

What's New

0.0.3 Taxable Sales

2024-03-19T04:55:33Z

Changes

🚀 Features

  • Add function to get taxable sales @Nef10 (#44)

🧰 Maintenance

  • Add documentation to readme for taxable sales @Nef10 (#45)
  • Update coverage comment @file-sync-app (#35)
  • Update swiftlint config for 0.53.0 @file-sync-app (#20)
  • Update SwiftLint config for 0.52.2 @file-sync-app (#9)
  • SwiftLint: ignore Protocol Buffer files @file-sync-app (#8)
  • Update copyright year @file-sync-app (#5)
  • Fix comment typo @Nef10 (#4)
  • Release Drafter: Move dependencies to separate section @file-sync-app (#3)

📦 Dependencies

  • Bump setup-swift from 1.26.0 to 2.0.0 @file-sync-app (#43)
  • Bump very_good_coverage from 2.2.0 to 3.0.0 @file-sync-app (#41)
  • Bump release-drafter from 5.25.0 to 6.0.0 @file-sync-app (#39)
  • Bump sticky-pull-request-comment from 2.8.0 to 2.9.0 @file-sync-app (#38)
  • Bump setup-swift from 1.25.0 to 1.26.0 @file-sync-app (#34)
  • Bump actions/upload-artifact from 3 to 4 @file-sync-app (#32)
  • Bump very_good_coverage from 2.1.0 to 2.2.0 @file-sync-app (#30)
  • Bump github-script from 6.4.1 to 7.0.1 @file-sync-app (#29)
  • Bump SwiftLint to 0.54.0 @file-sync-app (#26)
  • Bump release-drafter from 5.24.0 to 5.25.0 @file-sync-app (#25)
  • Bump swift-actions/setup-swift from 1.24.0 to 1.25.0 @file-sync-app (#23)
  • Bump SwiftLint to 0.53.0 @file-sync-app (#21)
  • Bump tibdex/github-app-token from 2.0.0 to 2.1.0 @file-sync-app (#19)
  • Bump tibdex/github-app-token from 1.8.0 to 2.0.0 @file-sync-app (#18)
  • Bump actions/checkout from 3 to 4 @file-sync-app (#17)
  • Bump setup-swift from 1.23.0 to 1.24.0 @file-sync-app (#16)
  • Bump sticky-pull-request-comment to 2.8.0 @file-sync-app (#15)
  • Bump sticky-pull-request-comment to 2.7.0 @file-sync-app (#14)
  • Bump SwiftLint to 0.52.4 @file-sync-app (#13)
  • Bump Release Drafter to 5.24.0 @file-sync-app (#12)
  • Bump SwiftLint to 0.52.3 @file-sync-app (#11)
  • Bump SwiftLint to 0.52.2 @file-sync-app (#10)
  • Bump sticky-pull-request-comment to 2.6.2 @file-sync-app (#7)

SwiftBeanCountTax

CI Status Documentation percentage License: MIT Latest version platforms supported: linux | macOS | iOS | watchOS | tvOS SPM compatible

This project is part for SwiftBeanCount, please check out the main documentation here.

What

This is a library to help you during tax season. Right now it can list taxable sales and generate expected tax slips based on your beancount file. This allows you to easily verify your received tax slips to check for errors on either the providers side or your tracking.

Beancount meta data

The library relies on meta data and custom directives in your Beancount file for configuration.

Taxable Sales

On the account you are selling from, add the "tax-sale" meta data, specifing the name the sales should show be grouped by, usually the brokers name.

Tax Slips

Basic Configuration

  • You first must configure the names of the slips you want to generate, and set a currency for each one
  • Afterwards, add meta data to the account in the form of tax slip name: Box name + number
  • Optionally, you can add a tax slip issuer, e.g. if you receive the same slip from multiple institutions - if no issuer is set, all amounts for the same slip and box will be added together

Example:

2020-01-01 custom "tax-slip-settings" "slip-names" "t3" "t5"
2020-01-01 custom "tax-slip-settings" "slip-currency" "t3" "CAD"
2020-01-01 custom "tax-slip-settings" "slip-currency" "t5" "CAD"

2020-01-01 open Income:Interest:Taxable:BankABC CAD
  t5: "Interest from Canadian sources (Box 13)"
  tax-slip-issuer: "BankABC"

Split Slips by Symbol

Some tax slips are split up by individual stock / ETF. To configure this, either the last or second last part of the account name must match a configured commodity or you add tax-symbol meta-data to the account.

Aditionally to the symbol, you can add a description. For a commodity add name or on an account the tax-description meta data.

Example:

2020-01-01 commodity ETFABC
  name: "ETF ABC @ Exchange"

2020-01-01 open Income:Dividend:Taxable:ETFABC:ForeignNonBusinessIncome CAD
  t3: "Foreign Non-Business Income (Box 25)"

2020-01-01 open Income:Dividend:Taxable:Portfolio:Other CAD
  t3: "Other Income (Box 26)"
  tax-symbol: "StockTicker"
  tax-description: "Stock @ Exchange"

If your account has the name matching to a commodity, but you don't want to treat it as one, add tax-symbol: "" to it.

Split accounts

Sometimes, if you split up your slip by stock, you don't want to create a separate account for everything. E.g. you track the dividends via different income accounts, but don't want to create separate expense accounts per stock for tax paid. To do this:

  1. Configure the tax slip and box via a customs directive instead of account meta data, as shown below
  2. Make sure the transaction with the posting to this account has another posting from an account configured via meta data for the same tax slip
  3. Make sure the other account has a symbol configured

Example:

2020-01-01 custom "tax-slip-settings" "account" "t3" "Foreign Non-Business Income Tax paid (Box 34)" "Expenses:Tax:ForeignNonBusiness"

2020-01-01 * "" ""
  Income:Dividend:Taxable:ETFABC:ForeignNonBusinessIncome 10.00 CAD
  Expenses:Tax:ForeignNonBusiness -2.50 CAD
  Assets:Portfolio 7.50 CAD

If multiple custom directives for the same setting exist, the latest one up until the end of the tax year is used. E.g. when generating tax slips for 2021, the latest directive up until 2021-12-31 is used.

Dates

Sometimes income is earned in one year, but only paid in another; or a sale is performed in one year but only settled in the next. You can change the year a transaction should count towards via the tax-year meta data on a transaction, e.g. tax-year: "2022".

How

  1. Load your ledger, e.g. via SwiftBeanCountParser
  2. Call one of the public functions on TaxCalculator, for example:
    1. TaxCalculator.generateTaxSlips(from ledger: Ledger, for year: Int)
    2. TaxCalculator.getTaxableSales(from ledger: Ledger, for year: Int)

Please also check out the complete documentation here.

Usage

The library supports the Swift Package Manger, so simply add a dependency in your Package.swift:

.package(url: "https://github.com/Nef10/SwiftBeanCountTax.git", .exact(from: "X.Y.Z")),

Note: as per semantic versioning all versions changes < 1.0.0 can be breaking, so please use .exact for now

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Sat Dec 07 2024 21:46:40 GMT-1000 (Hawaii-Aleutian Standard Time)