Skip to content

Commit

Permalink
Add support for Foreign Tax Paid.
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Dec 17, 2020
1 parent bfc8a51 commit d925dc7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
12 changes: 12 additions & 0 deletions beancount_import/source/schwab_csv.py
Expand Up @@ -121,6 +121,7 @@ class SchwabAction(enum.Enum):
JOURNAL = "Journal"
STOCK_PLAN_ACTIVITY = "Stock Plan Activity"
ADR_MGMT_FEE = "ADR Mgmt Fee"
FOREIGN_TAX_PAID = "Foreign Tax Paid"


@dataclass(frozen=True)
Expand Down Expand Up @@ -212,6 +213,8 @@ def get_processed_entry(
fees_account=fees_account,
**shared_attrs,
)
if self.action == SchwabAction.FOREIGN_TAX_PAID:
return TaxPaid(**shared_attrs)
assert False, self.action


Expand Down Expand Up @@ -346,6 +349,15 @@ def get_narration_prefix(self) -> str:
return "INVBANKTRAN"


@dataclass(frozen=True)
class TaxPaid(TransactionEntry):
def get_sub_account(self) -> Optional[str]:
return "Cash"

def get_narration_prefix(self) -> str:
return "INVBANKTRAN"


@dataclass(frozen=True)
class StockPlanActivity(TransactionEntry):
symbol: str
Expand Down
20 changes: 20 additions & 0 deletions testdata/source/schwab_csv/test_basic/import_results.beancount
@@ -1,3 +1,23 @@
;; date: 2019-06-11
;; info: {"filename": "<testdata>/test_basic/transactions/Intelligent_Transactions_20201115-180120.CSV", "line": 15, "type": "text/csv"}

; features: [
; {
; "amount": "-1.05 USD",
; "date": "2019-06-11",
; "key_value_pairs": {
; "desc": "NOKIA CORP FSPONSORED ADR 1 ADR REPS 1 ORD SHS"
; },
; "source_account": "Assets:Schwab:Intelligent-4321:Cash"
; }
; ]
2019-06-11 * "INVBANKTRAN - NOKIA CORP FSPONSORED ADR 1 ADR REPS 1 ORD SHS"
Assets:Schwab:Intelligent-4321:Cash -1.05 USD
date: 2019-06-11
schwab_action: "Foreign Tax Paid"
source_desc: "NOKIA CORP FSPONSORED ADR 1 ADR REPS 1 ORD SHS"
Expenses:FIXME 1.05 USD

;; date: 2019-06-11
;; info: {"filename": "<testdata>/test_basic/transactions/Intelligent_Transactions_20201115-180120.CSV", "line": 14, "type": "text/csv"}

Expand Down
Expand Up @@ -13,4 +13,5 @@
"12/20/2019","Special Dividend","IEMG","ISHARES CORE MSCI EMERGING ETF","","","","$156.87",
"06/11/2019","Qualified Dividend","NOK","NOKIA CORP FSPONSORED ADR 1 ADR REPS 1 ORD SHS","","","","$6.32",
"06/11/2019","ADR Mgmt Fee","NOK","NOKIA CORP FSPONSORED ADR 1 ADR REPS 1 ORD SHS","","","","-$0.47",
Transactions Total,"","","","","","",-$8365.89
"06/11/2019","Foreign Tax Paid","NOK","NOKIA CORP FSPONSORED ADR 1 ADR REPS 1 ORD SHS","","","","-$1.05"
Transactions Total,"","","","","","",-$8366.94

0 comments on commit d925dc7

Please sign in to comment.