KapJI / capital-gains-calculator

UK capital gains tax calculator which supports transaction history from different brokers
MIT License
127 stars 48 forks source link

Unknown action: Dividend, Tax Withholding #553

Open tsuharesu opened 2 months ago

tsuharesu commented 2 months ago

Goog started paying dividends, the calculator breaks without knowing what to do.

Traceback (most recent call last):
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/bin/cgt-calc", line 8, in <module>
    sys.exit(init())
             ^^^^^^
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/lib/python3.12/site-packages/cgt_calc/main.py", line 877, in init
    sys.exit(main())
             ^^^^^^
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/lib/python3.12/site-packages/cgt_calc/main.py", line 830, in main
    broker_transactions = read_broker_transactions(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/lib/python3.12/site-packages/cgt_calc/parsers/__init__.py", line 65, in read_broker_transactions
    transactions += read_schwab_equity_award_json_transactions(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/lib/python3.12/site-packages/cgt_calc/parsers/schwab_equity_award_json.py", line 368, in read_schwab_equity_award_json_transactions
    SchwabTransaction(transac, transactions_file, fields)
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/lib/python3.12/site-packages/cgt_calc/parsers/schwab_equity_award_json.py", line 196, in __init__
    action = action_from_str(self.raw_action)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tsuharesu/Code/capital-gains-calculator/.venv/lib/python3.12/site-packages/cgt_calc/parsers/schwab_equity_award_json.py", line 151, in action_from_str
    raise ParsingError("schwab transactions", f"Unknown action: {label}")
cgt_calc.exceptions.ParsingError: While parsing schwab transactions, Unknown action: Dividend

Example of dividends and Tax Withholding:


      "Date": "06/17/2024",
      "Action": "Dividend",
      "Symbol": "GOOG",
      "Quantity": null,
      "Description": "Credit",
      "FeesAndCommissions": null,
      "DisbursementElection": null,
      "Amount": "$34.17",
      "TransactionDetails": []
    },
    {
      "Date": "06/17/2024",
      "Action": "Tax Withholding",
      "Symbol": "GOOG",
      "Quantity": null,
      "Description": "Debit",
      "FeesAndCommissions": null,
      "DisbursementElection": null,
      "Amount": "-$5.12",
      "TransactionDetails": []
    },
vmartinv commented 2 months ago

Is the dividend coming from the equity award file? What command are you using? If the dividend is coming from the stock you are holding they should show up in the usual transaction file, not from the equity awards.

tsuharesu commented 2 months ago

Is the dividend coming from the equity award file?

Yes, from the equity awards JSON export. Since some months ago, GSUs pay dividends.