Skip to content

Minor issues with get_holdings #195

@KernSani

Description

@KernSani

I had some issues with get_holdings delivering not all required information. (not really bugs, more missing features ;-))

#1: Price date can also come in 98C as datetime.
change regex:
re_pricedate = re.compile(r"^:98[A,C]::PRIC\/\/(\d*)$")
and then
price_date = datetime.strptime(m.group(1)[:8], "%Y%m%d").date()

Ideally price date could always be returned as a datetime, but that might break the receiving side

#2: Currencies
we have 3 currencies in the dataframe:

  1. Total Value - would always be EUR (or at least the account currency)
  2. Market Price - can be any currency depending on the instrument, currency is returned in price_symbol
  3. Acquisition price - can either be EUR (account currency) or instrument currency. currently it's not returned. As it's already picked by the regex, it can simply be added to the Holding model.
                m = self.re_acquisitionprice.match(clause)
                if m:
                    acquisitionprice = float(m.group(1) + '.' + m.group(2)) 
                    acqprice_currency = m.group(3)

            # processed all clauses
            retval.append(
                Holding(
                    ISIN=isin, name=name, market_value=market_price,
                    value_symbol=price_symbol, valuation_date=price_date,
                    pieces=pieces, total_value=total_value,
                    acquisitionprice=acquisitionprice, 
                    acqprice_currency=acqprice_currency
                    ))

#3 EDIT: Issue with DKB
DKB returns like this:
:70E::HOLD//1STK++++20250818|240,5551139+EUR
can be fixed with
re_acquisitionprice = re.compile(r"^:70E::HOLD\/\/\d*STK.*\|2(\d*?),{1}(\d*?)\+([A-Z]{3})$")

*Bank I tested this with
Name of the bank: MLP, Deutsche Bank
FinTS URL: https://fints2.atruvia.de/cgi-bin/hbciservlet, https://fints.deutsche-bank.de/

Expected behavior
Values are returned as described above

Code required to reproduce

:90B::MRKT//ACTU/EUR60,544
:98C::PRIC//20250912000000
:70E::HOLD//1STK260,6094+USD

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions