Zarathustra2 / TradeRepublicApi

Unofficial trade republic API
MIT License
277 stars 68 forks source link

Did TR swap the word positions in the body text for limit orders? #20

Open bufemc opened 2 years ago

bufemc commented 2 years ago

Since a while it seems TR changed the body texts.. the words "limit" plus "buy" or "sell" might have change positions.

        # Sell
        elif (
            (body.startswith("Verkauf") and not body.__contains__("Verkauf-Order abgelehnt"))
            or body.startswith("Limit Verkauf zu")
            or (body.startswith("Sell order") and not body.__contains__("Sell order declined"))
            or body.startswith("Limit Sell order")
        ):

does not (any longer?) match to:

            "body": "Sell Limit order executed for a price of 52.20 \u20ac per share\nProfit: \ufffc 2.15 %",                   

and the same for the other:

does not (any longer?) match to:

            "body": "Buy Limit order executed for a price of 50.00 \u20ac per share",

Quick Fix:

sell part: or body.startswith("Limit Sell order") or body.startswith("Sell Limit order")

buy part:

        # Savings plan execution or normal buy
        elif (
            body.startswith("Sparplan ausgeführt")
            or body.startswith("Kauf")
            or body.startswith("Limit Kauf zu")
            or body.startswith("Savings Plan executed")
            or body.startswith("Buy order")
            or body.startswith("Limit Buy order")
            or body.startswith("Buy Limit order")
        ):
            fee = 0
            if (
                body.startswith("Kauf") or body.startswith("Limit Kauf zu")
                or body.startswith("Buy order") or body.startswith("Limit Buy order") or body.startswith("Buy Limit order")
            ):

Unfortunately there seems also now an additional "per share" in the body, which breaks again this:

        profit = abs(float(re.findall("[-+]?\d.*\.\d+|\d+", body)[1].replace(",", "")) / 100) #as decimal (percentage)

To make it short: the instable "chaos TR API" seems to provide much more and endless fun ,-)