Niyazi Keklik
TR

Daily exchange rates into IFS: straight from the TCMB and BNB, without errors

How to build a self-checking job that loads TCMB and Bulgarian National Bank (BNB) exchange rates into IFS when ready-made rate services stop working.

IFS ERP Niyazi Keklik 4 min read

  • IFS
  • Exchange rates
  • TCMB
  • BNB
  • .NET
  • Oracle

In an ERP, exchange rates are the quietest data until they stop. Without the morning rate, sales invoices cannot be issued, purchase orders are calculated inconsistently and the month-end exchange difference table has to be redone.

When the ready-made services that brought daily rates into IFS stopped working, there were two options: enter rates by hand every morning, or solve the problem for good. I chose the second. Rates from the Central Bank of the Republic of Türkiye (TCMB) for the Turkish companies and from the Bulgarian National Bank (BNB) for the subsidiary in Bulgaria are now entered automatically every day, through IFS’s own currency APIs.

The real cause: TLS

For years, rates were downloaded from inside the database. The trouble started when the TCMB made TLS 1.2 and above mandatory. The HTTP client of older Oracle versions cannot complete that handshake. The error message pointed at the rate service, but the real cause was in the connection layer.

In cases like this, moving the responsibility to the right layer is more robust than adding new certificates, wallets and patches to the database:

  • Downloading moved to .NET. A background worker downloads the bulletin over current TLS, validates it and parses it.
  • The database only receives the data. The IFS side never goes to the internet; it records the rate it is given with its own business rules.

This removed an outbound connection from the database that a security team would not want, and made sure the problem cannot come back from the same place.

The right rate on the right date

Downloading the rate is the easy part. The real work is writing it on the right date according to accounting rules.

The rule for the TCMB: today’s rate is the previous business day’s 15:30 bulletin. That is why the dated archive bulletin is used rather than the “today” file. The worker scans backwards from yesterday and takes the first bulletin it finds. On weekends and public holidays the empty response from the TCMB is not treated as an error; the worker simply goes back another day.

The rule for the BNB: accounting at the Bulgarian subsidiary wants each day’s rate written with the next day’s date. Friday’s bulletin is written for Saturday; Sunday and Monday use that rate. No record is created on holidays; IFS finds the latest valid rate itself.

There is one more detail specific to Bulgaria: the country adopted the euro in 2026. BNB rates for 2025 and earlier were published in lev, so they are converted to euro at the fixed parity (1 EUR = 1.95583 BGN). From 2026 the rate comes directly as the euro equivalent. Code that ignores this distinction when loading history silently writes four years of wrong data.

A worker that protects itself

A background job’s reliability is measured less by what it does on day one than by what it does on day one hundred:

  • Re-runs are safe. Even if the server restarts, the job exits without writing anything when that day’s record already exists.
  • It fills its own gaps. The BNB worker checks the last seven days every hour; a day missed during a network outage is entered on the next run.
  • It does not overload the source. When the BNB receives many requests in a short time, it blocks the client address entirely for a while and returns the block page as a successful response. That is why period queries are used instead of day-by-day queries; since the BNB returns about three months per query, history is fetched in calendar quarters. The block page is also recognized and treated as an error.
  • One number format. In Turkish regional settings the decimal separator is a comma, while the database session expects a dot. All numbers are written culture-invariant; otherwise the transfer stops at the first rate with decimals.

Fixing history without deleting

When the new rule went live, historical records also had to follow it. Since the date is a key field in rate records, deleting and rewriting looks like the shortest path; but deleting accounting records leaves a trace that has to be explained in an audit.

Instead, existing records were corrected with IFS’s own update API and missing days were added. A full backup was taken beforehand. Afterwards, 1,465 calendar days were compared one by one with the BNB, and the result was zero differences.

Conclusion

Loading exchange rates is no longer a morning chore. Rates are entered automatically at night, no day is missing, and the date rule is applied exactly as accounting requires. All of it goes through IFS’s standard APIs, without bypassing business rules.

If you are building something similar for another central bank or rate type, feel free to get in touch to compare notes.

contact

About this article

Write to me if you have a question, a comment or a similar experience.