Skip to content

feat: add KRW (Korean Won) currency support via Upbit API#215

Merged
a1denvalu3 merged 2 commits intocashubtc:mainfrom
4xvgal:feature/krw-upbit-api
Mar 12, 2026
Merged

feat: add KRW (Korean Won) currency support via Upbit API#215
a1denvalu3 merged 2 commits intocashubtc:mainfrom
4xvgal:feature/krw-upbit-api

Conversation

@4xvgal
Copy link
Copy Markdown
Contributor

@4xvgal 4xvgal commented Mar 11, 2026

Add Korean Won (KRW) as a supported fiat currency, using Upbit API for BTC-KRW price data.

Changes

  • Price API: KRW uses Upbit API (api.upbit.com), other currencies remain on Coinbase
  • Currency support: Added KRW to Amount, CurrencyManager, BitcoinPriceWorker
  • Zero-decimal fix: Extracted isZeroDecimal() helper for KRW
  • UI: Added KRW option to currency settings screen (EN/ES/PT strings)
  • Tests: Added KRW validation, symbol, API URL, and isUpbitCurrency tests

@4xvgal
Copy link
Copy Markdown
Contributor Author

4xvgal commented Mar 11, 2026

Tested on Bitconize POS machine it self.

Input, Payment, Receipt , Printing works well

Comment on lines +110 to +116
/** Get the API URL for the current currency. Uses Upbit for KRW, Coinbase for others. */
fun getPriceApiUrl(): String {
return if (currentCurrency == CURRENCY_KRW) {
"https://api.upbit.com/v1/ticker?markets=KRW-BTC"
} else {
"https://api.coinbase.com/v2/prices/BTC-$currentCurrency/spot"
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to do this differently: we need a map from currency to api endpoint because we might add other currencies in the future only supported on their esoteric exchanges.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to use a map-based config instead of if-else branching.

  1. getPriceApiUrl() → looks up CUSTOM_APIS["KRW"] → returns Upbit URL
  2. HTTP GET → receives JSON response
  3. parsePriceResponse(response) → looks up CUSTOM_APIS["KRW"].parsePrice → extracts trade_price

If the currency is not in CUSTOM_APIS, both steps fall back to Coinbase defaults.

@a1denvalu3
Copy link
Copy Markdown
Collaborator

Thank you! Will do some testing soon

@4xvgal
Copy link
Copy Markdown
Contributor Author

4xvgal commented Mar 12, 2026

And Coinbase JPY rate seems Broken.
https://api.coinbase.com/v2/prices/BTC-JPY/spot
It returns {"data":{"amount":"35600000","base":"BTC","currency":"JPY"}}

but coinmarketcap shows 11052002.70
https://coinmarketcap.com/currencies/bitcoin/btc/jpy/

@a1denvalu3
Copy link
Copy Markdown
Collaborator

Yes i've noticed that we need to fix the JPY. Probably get it from somewhere else since the coinbase api is broken?

@a1denvalu3 a1denvalu3 merged commit 0a6e986 into cashubtc:main Mar 12, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Numo Mar 12, 2026
@4xvgal
Copy link
Copy Markdown
Contributor Author

4xvgal commented Mar 13, 2026

Maybe coingecko fit for numo
{"bitcoin":{"jpy":11410078}}

Delgado74 pushed a commit to Delgado74/Numo_internacionalizacion that referenced this pull request Mar 15, 2026
* feat: add KRW (Korean Won) currency support via Upbit API

* refactor: use map-based price API config to decouple exchange specific logic from BitcoinPriceWorker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants