WealthsimpleLedgerMapper
public struct WealthsimpleLedgerMapper
Functions to transform downloaded Wealthsimple data into SwiftBeanCountModel types
-
Fallback account for payments if not account with the correct meta data could be found
Only used for certain transaction types
Declaration
Swift
public static let fallbackExpenseAccountName: AccountName
-
Downloaded Wealthsimple accounts
Need to be set before attempting to map positions or transactions
Declaration
Swift
public var accounts: [any Account]
-
Create a WealthsimpleLedgerMapper
Declaration
Swift
public init(ledger: Ledger)
Parameters
ledger
Ledger to look up accounts, commodities or duplicate entries in
-
Maps downloaded wealthsimple positions from one account to SwiftBeanCountModel prices and balances
It also removes prices and balances which are already existing in the ledger
Notes:
- Do not call with transactions from different accounts
- Make sure to set accounts on this class to the Wealthsimple accounts first
Do not assume that the count of input and balance output is the same
Throws
WealthsimpleConversionError
Declaration
Swift
public func mapPositionsToPriceAndBalance(_ positions: [Position]) throws -> ([Price], [Balance])
Parameters
positions
downloaded positions from one account
Return Value
Prices and Balances
-
Maps downloaded wealthsimple transactions from one account to SwiftBeanCountModel transactions and prices
It also removes transactions and prices which are already existing in the ledger
Notes:
- Do not call with transactions from different accounts
- Make sure to set accounts on this class to the Wealthsimple accounts first
Do not assume that the count of input and transaction output is the same, as this function consolidates transactions
Throws
WealthsimpleConversionError
Declaration
Swift
public func mapTransactionsToPriceAndTransactions(_ wealthsimpleTransactions: [Wealthsimple.Transaction]) throws -> ([Price], [SwiftBeanCountModel.Transaction])
Parameters
wealthsimpleTransactions
downloaded transactions from one account
Return Value
Prices and Transactions