Skip to content
neumanndev, Home

Own venture · simulator and portfolio tracker

Obligacje.tech

A profit simulator for Polish retail treasury bonds. Six series, compound interest, Belka tax, IKE/IKZE, inflation scenarios and a personal portfolio tracker. The financial logic is checked by automated tests.

obligacjetech.vercel.app
Screenshot of the Obligacje.tech website (obligacjetech.vercel.app)
bond series in the calculator
6
logic tests in Vitest
50
lines across 75 TS/TSX files
≈10,200
routes, fully static
11
  • Finance
  • Business logic
  • Testing
  • SEO

Context

Obligacje.tech is a profit simulator of its own for Polish retail treasury bonds. It contains a calculator for the EDO, COI, TOS, ROR, DOR and OTS series, tracking of a personal portfolio, interest rate history, currency and gold rates from NBP data, and a market section with a blog, an FAQ and a changelog.

The site has no backend. Market data comes from the public NBP API, and the user's portfolio is stored in their browser (localStorage). All pages are generated statically.

Scale: 75 TS/TSX files, about 10,200 lines of code, 11 routes and 58 commits.

Problem

Each series has its own rules: the capitalisation period, the interest rate in successive periods and the link to inflation or to the reference rate. The Belka tax is collected once at redemption in some series and on an ongoing basis in others. The Ministry of Finance's offer also changes every month.

A mistake in such a place is not cosmetic: the user sees the wrong amount and may base a decision about their money on it.

Technical decisions

  • Calculations separated from the interface. The maths is in lib/bond-math.ts and lib/portfolio-math.ts. The calculator and the portfolio use the same functions, and each of them can be checked separately. The whole is covered by 50 tests in Vitest.
  • Actual rules instead of simplifications. Capitalisation periods are defined for each series, inflation-linked series count inflation plus a margin from the second year, and the Belka tax is collected once at redemption in capitalising series and on an ongoing basis in the others. IKE and IKZE, inflation scenarios and a comparison of series are also included.
  • Portfolio value calculated for the given day. Initially the portfolio's value grew in jumps, only at the end of an interest period. Linear accrual of interest day by day was introduced, so the portfolio shows its current value.
  • Terms from the day of purchase. The offer changes every month, but a bond that has been bought keeps its terms, so the terms from that day are saved when a bond is added to the portfolio.
  • A backup of the portfolio. Because the portfolio is stored only in the browser, export and import to a JSON file were added.
  • One convention for amounts. Amounts before and after tax were mixed on one screen, so net amounts are shown everywhere.
  • Errors detected. One function modified in place a date passed as an argument (setHours), which could distort dates in other parts of the application. The second case was a regression in mobile navigation: after an icon was added, the page on a 320 px screen was 7 px too wide.
  • Visibility in search engines. Full static generation with generateStaticParams, a sitemap, robots, JSON-LD structured data, dynamic OG images via next/og and canonical addresses.
  • Checks before every commit. Type checking, tests and a build, as well as manual verification of numerical scenarios.

Result

The site calculates the profit for six series according to their actual rules, taking into account tax and interest accrued to the current day. The logic is covered by tests and does not depend on the interface, so changes in appearance do not affect the results.

The number of users and traffic are not yet given. They will be added once data from a longer period has been gathered.

A product that is hard to price over the phone?

A description of the business and its current way of quoting orders is enough. On that basis we assess whether and how it can be moved to a website.