Hi,
I’m using Tryton 7.6 (server in Docker, PostgreSQL on Windows) and I would like to integrate exchange rates from the National Bank of Georgia (NBG) into Tryton.
What I want
My goal is to have official daily rates from NBG available in Tryton, ideally in a way similar to:
the existing source European Central Bank in Currencies → Scheduled Rate Updates, and/or
the official modules for other national banks (currency_ro, currency_rs).
Concretely, I would like:
either a new Source option in Scheduled Rate Updates like
NBG – National Bank of Georgia,
or a custom provider that Tryton can use to fetch daily rates automatically.
My company’s base currency is GEL, and I mainly need rates for USD/EUR against GEL.
What I have already tried
I’ve experimented in two directions:
Extending currency.rate.provider
I tried to add a custom provider for NBG and implement a method to fetch rates from the NBG JSON API.
This led to some confusion between get_providers / _get_providers depending on Tryton versions and internal implementation, and I got attribute errors around those methods.
I started to suspect that this is not the recommended or simplest way to do it in recent Tryton versions.
Following the pattern of currency_ro / currency_rs
I created a small custom module (let’s call it currency_ge) that extends currency.cron in the same conceptual way that currency_ro and currency_rs do:
add an extra source option for the national bank,
restrict the base currency to GEL when that source is selected,
implement a method that fetches data from NBG’s API and returns the rates in the format Tryton expects.
The module is installed and marked as Activated for my database (Tryton_new), and there are no obvious errors in the logs.
However, despite this, the new source does not appear in Currencies → Scheduled Rate Updates → Source – I only see the default European Central Bank entry.
In addition to this, I already have an external Python script (outside Tryton) that successfully:
calls the NBG JSON API,
converts the data,
and writes exchange rates into the database table currency.currency.rate.
So the technical part of reading NBG rates works, but right now I’m doing it externally, not through Tryton’s UI / built-in scheduling.
My question
Before I go deeper into debugging my custom module, I would like to understand the intended / recommended way in Tryton 7.6 for this use case:
Is it officially supported / recommended to add new national bank sources (like NBG) by extending currency.cron, similar to currency_ro and currency_rs?
Or is it better / expected to integrate new providers via currency.rate.provider instead?
Is there any existing example, guideline, or best practice for adding a custom national bank (for a new country) that I should follow?
From your point of view, is there any restriction or limitation that would prevent adding the National Bank of Georgia as a provider/source in a third-party module?
My ultimate goal is simply:
to have NBG as a selectable source/provider in Tryton,
so that scheduled updates can fetch rates from NBG automatically,
instead of maintaining a separate external script.
Any guidance on the correct approach and what is considered “Trytonic” for this kind of integration would be very helpful.