Swiftpack.co -  Nef10/SwiftBeanCountWealthsimpleMapper as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Nef10/SwiftBeanCountWealthsimpleMapper
Swift library to convert download Wealthsimple data to the SwiftBeanCount model
.package(url: "https://github.com/Nef10/SwiftBeanCountWealthsimpleMapper.git", from: "v1.2.4")

SwiftBeanCountWealthsimpleMapper

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 small library to convert downloaded data from Wealthsimple (via WealthsimpleDownloader) to the Beancount format (via SwiftBeanCountModel).

Beancount meta data

The library relies heavily on meta data in your Beancount file to find accounts and commodities. Please add these to your Beancount file:

Commodities

If the commodity in your ledger differs from the symbol used by Wealthsimple, simply add wealthsimple-symbol as meta data:

2011-10-18 commodity ACWVETF
  wealthsimple-symbol: "ACWV"

Accounts

For account you need to add two meta data entries:

  • First is the account type (wealthsimple-account-type), you can look up the possible values here
  • Second is a key (wealthsimple-key):
    • For holdings and cash assset accounts this is the symbol of the stock, ETF or currency
    • For dividend income accounts this is the symbol as well
    • For the assset account you are going to contribute from, use contribution
    • For the assset account you are going to deposit from, use deposit
    • Use fee on an expense account to track the wealthsimple fees
    • Use non resident withholding tax on an expense account for the tax
    • In case some transaction does not balance, we will look for an expense account with rounding
    • In case you get a refund, add refund to an income account
    • If you want to track contribution room, use contribution-room on an asset and expense account (optional)

Both keys and types can be space separated in case you have multiple Wealthsimple accounts and for example want to combine the fees into one expense account, or you contribute from the same account.

Full Example
2020-07-31 open Assets:Checking:Wealthsimple CAD
  wealthsimple-account-type: "ca_cash"
  wealthsimple-key: "CAD"

2020-07-31 open Assets:Investment:Wealthsimple:TFSA:Parking CAD
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "CAD"

2020-07-31 open Assets:Investment:Wealthsimple:TFSA:ACWV ACWV
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "ACWV"

2020-07-31 open Income:Capital:Dividend:ACWV USD
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "ACWV"

2020-07-31 open Assets:Checking:Bank CAD
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "contribution"

2020-07-31 open Assets:Investment:OtherComany:TFSA
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "deposit"

2020-07-31 open Expenses:FinancialInstitutions:Investment:Fees
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "fee"

2020-07-31 open Expenses:Tax:NRWT
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "non resident withholding tax"

2020-07-31 open Expenses:Rounding
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "rounding"

2020-07-31 open Income:FinancialInstitutions
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "refund"

2020-07-31 open Assets:TFSAContributionRoom TFSA.ROOM
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "contribution-room"

2020-07-31 open Expenses:TFSAContributionRoom TFSA.ROOM
  wealthsimple-account-type: "ca_tfsa"
  wealthsimple-key: "contribution-room"

How

Please check out the complete documentation here. You can also have a look at the SwiftBeanCountDownloaderApp which uses this library.

Usage

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

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

Limitations

Please note that I developed this library for my own needs and there may be bugs. It currently has some limitations:

  • Sell Gains are not calculated
  • If transactions do not balance, it will add a rounding posting. However, due to SwiftBeanCountModel not yet fully supporting Beancount rounding, the amount of this posting will likely be 0 and need to be adjusted manually.

Pull requests to extend the scope or remove limitations are very welcome.

GitHub

link
Stars: 0
Last commit: 1 minute ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

1.3.0 More Transaction Types
1 hour ago

Changes

Note: The keys are now all camelCase, which might require changes the beancount file

📈 Enhancements

  • Add support for paymentSpend and giveawayBonus transactions types @Nef10 (#70)

🧰 Maintenance

  • Bump WealthsimpleDownloader from 1.0.7 to 1.1.0 @swift-dependency-updater (#68)
  • Update SwiftLint config for 0.44.0 @Nef10 @file-sync-app (#67)
  • Bump fwal/setup-swift from 1.7.0 to 1.8.0 @Nef10 @file-sync-app (#66)
  • Improve label sync @Nef10 @file-sync-app (#65)
  • Add release drafter labels to label sync @Nef10 @file-sync-app (#64)
  • Add label sync @Nef10 @file-sync-app (#63)
  • Use ParserUtils instead of Parser @Nef10 (#62)
  • Update SwiftLint config for 0.43.1 @Nef10 @file-sync-app (#61)
  • Add more labels for release drafter @Nef10 @file-sync-app (#60)
  • Pin GitHub Actions dependency versions @Nef10 @file-sync-app (#59)
  • Bump GitHub Actions dependency versions @Nef10 @file-sync-app (#58)
  • Add auto merge @Nef10 @file-sync-app (#57)
  • Add CI option to test macOS only @Nef10 @file-sync-app (#56)
  • Synchronize common files between swift package repositories @Nef10 @file-sync-app (#54)
  • Create minimum_coverage.txt @Nef10 (#55)
  • Remove explicit version number from Readme @Nef10 (#51)
  • Bump actions/github-script from 4.0.2 to 4.1.0 @dependabot (#49)
  • Bump tibdex/github-app-token from 1.3.0 to 1.4.0 @dependabot (#50)
  • Bump WealthsimpleDownloader from 1.0.6 to 1.0.7 @swift-dependency-updater (#48)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics