Best way to track Treasury Bills (Spanish Letras del Tesoro) in Portfolio Performance?

Hi all,

I’m looking for a good way to track treasury bills in Portfolio Performance. In my case, these are Spanish Letras del Tesoro — zero-coupon instruments issued at a discount and redeemed at face value after 3, 6, 9, or 12 months.

They don’t pay periodic interest; instead, I pay less than the nominal value when buying them (e.g., €970 for a €1,000 bill), and at maturity I receive the full €1,000. I buy them directly through the Bank of Spain via non-competitive auctions.

Since they’re not listed daily on any exchange, I’m unsure how to model this in Portfolio Performance. I’d like to track:

  • the initial investment (at the discounted price),
  • the accrued gain over time,
  • and the final redemption at maturity.

Should I create them as custom securities with manual price updates? Or maybe model them as bonds or some other type of instrument?

If anyone has tracked similar investments (not necessarily from Spain), I’d love to hear how you’ve handled it. Thanks in advance for your advice!

1 Like

As I understand the ‘Letras del Tesoro’, it could be used as a fixed-term deposit account. Because you put something in there at the beginning, which then looks a bit yieldless over the term until the interest comes in one fell swoop at the end, it’s unpleasant for the psychology.

Would you like to see a slow but steady increase?

Then an investment as a security will be best.

Create an empty security, e.g. with the name ‘Letras del Tesoro <start date - end date>’, in which you have invested e.g. EUR 12,000. You book a purchase of 120 units of the security at EUR 97 on the start date and a sale of 120 units at EUR 100 on the end date.

In order to get the slow but steady increase, you need to generate courses using any script of your choice.

Datum;Kurs
2024-05-26;97,05
2024-05-27;97,05808217
2024-05-28;97,06616437
2024-05-29;97,07424655
2024-05-30;97,08232875
2024-05-31;97,09041095
2024-06-01;97,09849313
...
2025-05-23;99,97575341
2025-05-24;99,98383559
2025-05-25;99,99191779
2025-05-26;100

Import the quotes, everything’s fine.

This is the script I have used

#!/bin/bash

# Überprüfen, ob alle 3 Argumente übergeben wurden
if [ "$#" -ne 3 ]; then
    echo "Verwendung: $0 <Startdatum YYYY-MM-dd> <Enddatum YYYY-MM-dd> <Startwert>"
    echo "Beispiel: $0 2024-09-17 2024-10-09 97.05"
    exit 1
fi

START_DATE_STR="$1"
END_DATE_STR="$2"
START_VALUE="$3"
END_VALUE=100 # Endwert
OUTPUT_FILE="output.csv"


# Datum in Sekunden seit der Epoche umwandeln
START_SECONDS=$(date -d "$START_DATE_STR" +%s)
END_SECONDS=$(date -d "$END_DATE_STR" +%s)

# Anzahl der Tage zwischen Start- und Enddatum berechnen
# +1, um den Endtag mit einzuschließen (z.B. von Mo bis Di sind 2 Tage)
TOTAL_DAYS=$(( (END_SECONDS - START_SECONDS) / (60*60*24) ))

# CSV-Header schreiben
echo "Datum;Kurs" > "$OUTPUT_FILE"

# Schleife durch jeden Tag von Start- bis Enddatum
for (( i=0; i<=TOTAL_DAYS; i++ )); do
    CURRENT_SECONDS=$(( START_SECONDS + (i * 60*60*24) ))
    CURRENT_DATE=$(date -d "@$CURRENT_SECONDS" +%Y-%m-%d)

    if [ "$TOTAL_DAYS" -eq 0 ]; then
        # Wenn Start- und Enddatum gleich sind, bleibt der Wert Startwert
        PROGRESS_FACTOR=0
    else
        PROGRESS_FACTOR=$(echo "scale=8; $i / $TOTAL_DAYS" | bc)
    fi

    # Aktuellen Wert basierend auf dem Fortschritt berechnen
    # (Endwert - Startwert) * Fortschritt + Startwert
    CURRENT_CALCULATED_VALUE=$(echo "scale=8; (($END_VALUE - $START_VALUE) * $PROGRESS_FACTOR) + $START_VALUE" | bc)
echo $CURRENT_CALCULATED_VALUE
    # Sicherstellen, dass der letzte Wert genau END_VALUE ist
    if [ "$i" -eq "$TOTAL_DAYS" ]; then
        FORMATTED_VALUE="$END_VALUE"
    else
        FORMATTED_VALUE="$CURRENT_CALCULATED_VALUE"
    fi

    echo "$CURRENT_DATE;$FORMATTED_VALUE" | sed 's/\./,/g' >> "$OUTPUT_FILE"
done

If you have no bash, ask an AI to do the same in powershell or whatever you like.