Kraken holdings resolve to wrong quote-currency pairs (BTC → BTCBRL, ETH → ETHBRL)
What happens
KrakenAccount::SecurityResolver resolves each Kraken asset through the generic
Security::Resolver without passing an exchange or country, so a close provider match
can win. With binance_public enabled as a securities provider, a EUR-denominated Kraken
account resolved to:
| Kraken asset | resolved security | quote currency |
|---|---|---|
| BTC | BTCBRL |
BRL |
| ETH | ETHBRL |
BRL |
| EIGEN | EIGENTRY |
TRY |
| EUR (cash) | EURIUSD |
USD |
| DOT | DOTEUR |
EUR |
Why
app/models/kraken_account/security_resolver.rb defines EXCHANGE_MIC = "XKRA" but only
uses it in the rescue path:
def self.resolve(ticker, symbol)
Security::Resolver.new(ticker).resolve # no exchange_operating_mic, no country_code
rescue StandardError => e
Security.find_or_initialize_by(ticker: ticker, exchange_operating_mic: EXCHANGE_MIC)Security::Resolver#resolve then falls through exact_match_from_db → exact_match_from_provider → close_match_from_provider, and the close match selects an
arbitrary quote pair.
Impact
Displayed values stay correct, because the price is converted from the quoted currency into the account currency — a bitcoin is a bitcoin whatever it is quoted in. But:
- holdings are labelled with instruments the user does not hold, which is alarming to see
- every crypto valuation gains an extra FX hop; the instance now stores 983 days of BRL→EUR and 722 of TRY→EUR rates maintained solely for this
- if those FX rates become unavailable or stale, crypto valuations drift silently
- resolution is inconsistent:
DOTmatchedDOTEURcorrectly, so some assets take the direct path and others do not
Prior art
#2692 (fix(provider): resolve Tiingo security currency from countryCode) fixed the same class of problem for another provider:
a security resolving to the wrong currency because the resolver was under-constrained.
Suggested fix
Prefer a pair quoted in the account's currency, and/or pass the EXCHANGE_MIC the class
already defines, so the resolver is constrained rather than taking any close match.
Version
Sure 0.7.4, self-hosted via the official Helm chart. Securities providers enabled:
binance_public, yahoo_finance. Still present on main as of 2026-09-23 —
app/models/kraken_account/security_resolver.rb is unchanged since #1759.
Source: we-promise/sure