portfolio-performance / portfolio

Track and evaluate the performance of your investment portfolio across stocks, cryptocurrencies, and other assets.
http://www.portfolio-performance.info
Eclipse Public License 1.0
2.94k stars 604 forks source link

Feature Request: import key for combined dividend + buy #3159

Open tstenner opened 1 year ago

tstenner commented 1 year ago

Is your feature request related to a problem? Please describe. My broker (FFB) automatically buys shares from dividends. These are marked as a special type in the exported transactions ("ERTRAG"). At the moment, I map it to inbound deliveries, but I'd rather import it as a dividend payment + buy transaction.

Describe the solution you'd like Ideally, I could select something like "Re-invested dividend" in the import dialog. In the background, this would map to a dividend account transaction and a separate buy portfolio transaction.

Describe alternatives you've considered Mapping it as inbound delivery as described above or importing dividends twice (once as buy transactions, then once again as dividend depot transactions). On the other hand, this seems like something applicable to more users / brokers

tstenner commented 1 year ago

This is similar to #2031 but with the main difference that all details (date, price, amount, taxes) are known.

Nirus2000 commented 1 year ago

Hello FFB is the FlatEx? If this is a PDF document then....

Please create a PDF debug and post it here. The best way to see how this works is to watch the video tutorial.

Video tutorial: Extract PDF documents for debugging

Greetings Alex

tstenner commented 1 year ago

Hi,

FFB is the FIL FondsBank, but as a direct customer (rather than going through a reseller) I don't get the PDF documents PP can import. They do have an API, however, that exports all transactions as JSON:

{
    "active": {
      "transactionCount": "1504",
      "transactions": [
        {
          "accountId": "123456789",
          "depositAccount": "DE",
          "subAccount": "0",
          "bookingDate": "2023-01-10",
          "transactionType": "Entgeltbelastung",
          "transactionCategory": "ENTGELTVERKAUF",
          "wkn": "A14YPB",
          "isin": "IE00BZ0PKV06",
          "fundName": "iShares Edge MSCI Europe Multifactor UCITS ETF",
          "investmentCompany": "iShares",
          "billingDate": "2023-01-10",
          "billingShares": "0.842",
          "settlementPrice": "7.2630",
          "withdrawalPrice": "7.2630",
          "foreignExchange": "1.0000000",
          "settlementFundCurrency": "EUR",
          "settlementAmountInFundCurrency": "6.12",
          "settlementAmountInEuro": "6.12",
          "feeFundCurrency": "6.12",
          "remunerationInEuro": "0.00",
          "vatPercentage": "19",
          "vatOnFeeAmount": "0.98",
          "taxInformation": {
            "deductedTaxesTotal": "0.00",
            "offsettingLossOffsetAccount": "0.46",
            "vvtStandAfterwards": "0.46",
            "vvtStandBefore": "0.00",
            "offsetttingWithholdingTaxPot": "0.00",
            "qstStandAfter": "0.00",
            "qstStandBefore": "0.00"
          }
        },
        {
          "accountId": "5555",
          "depositAccount": "VL",
          "subAccount": "0",
          "bookingDate": "2023-01-03",
          "transactionType": "Erträgnis",
          "transactionCategory": "ERTRAG",
          "wkn": "A1JX52",
          "isin": "IE00B3RBWM25",
          "fundName": "Vanguard FTSE All-World UCITS ETF",
          "investmentCompany": "Vanguard",
          "billingDate": "2023-01-02",
          "billingShares": "0.017",
          "settlementPrice": "100.7400",
          "withdrawalPrice": "100.7400",
          "foreignExchange": "1.0618900",
          "settlementFundCurrency": "USD",
          "settlementAmountInFundCurrency": "1.67",
          "settlementAmountInEuro": "1.57",
          "salesChargePercent": "0.2000",
          "subscriptionPremiumFundCurrency": "0.00",
          "initialChargeInEuro": "0.00",
          "discountPercentage": "100.0000",
          "discountAmount": "0.05",
          "feeFundCurrency": "0.00",
          "remunerationInEuro": "0.00",
          "vatPercentage": "19",
          "vatOnFeeAmount": "0",
          "taxInformation": {
            "deductedTaxesTotal": "0.00",
            "offsettingLossOffsetAccount": "-1.10",
            "vvtStandAfterwards": "15.89",
            "vvtStandBefore": "16.99",
            "offsetttingWithholdingTaxPot": "0.00",
            "qstStandAfter": "0.00",
            "qstStandBefore": "0.00"
          }
        }
    ]
    },
    "passive": {}
  }

I'm running this through a small jq script to generate a CSV file I can import. The JSON above gives me the following CSV data:

Datum Konto Depot WKN Buchungswährung Währung Bruttobetrag Wechselkurs Stück Wert Gebühren Steuern Typ Notiz
2023-01-10 123456789 DE A14YPB EUR EUR 1 0.842 0 6.12 0 Auslieferung Entgeltbelastung 6.12 EUR
2023-01-03 5555 VL A1JX52 EUR USD 1.06189 0.017 1.5726676021056794 0 0 Kauf Erträgnis 1.67 USD

This works quite well, apart from some weird interactions with autocalculated fields / two currencies in one transaction and dividends.