prebid-server
prebid-server copied to clipboard
Enhanced Currency Conversion
The Prebid.js currency module is able to convert any of the currencies in the file to any other currency using USD (or GBP) as an intermediate.
Apparently this feature was not implemented in PBS, at least PBS-Java. We're seeing this error:
Unable to convert from currency NOK to desired ad server currency SEK
Here's an example currency rates definition:
"rates": {
"USD": {
"USD": 1,
"JPY": 146.83324180853012,
"BGN": 1.7900421014094818,
"CZK": 23.175910671792053,
"DKK": 6.8233571297821705,
"GBP": 0.7798645432912319,
"HUF": 362.02635914332785,
"PLN": 3.917719201903716,
"RON": 4.543657331136738,
"SEK": 10.238422112392458,
"CHF": 0.8780889621087314,
"ISK": 136.28043199707122,
"NOK": 10.470895112575509,
"TRY": 32.001647446457994,
"AUD": 1.5143693941058027,
"BRL": 4.992586490939044,
"CAD": 1.3502654219293428,
"CNY": 7.182042833607908,
"HKD": 7.8198791872597475,
"IDR": 15486.847885777046,
"ILS": 3.6087314662273475,
"INR": 82.7471169686985,
"KRW": 1311.056196229178,
"MXN": 16.802947098663736,
"MYR": 4.683964854475563,
"NZD": 1.6204466410397218,
"PHP": 55.36976020501556,
"SGD": 1.3303130148270181,
"THB": 35.410031118433096,
"ZAR": 18.69641222771371,
"EUR": 0.9152480322167307
},
If desired destination currency is not present, PBS should:
- loop through the rate conversions available
- If source and destination currencies are present in a single object under an intermediate currency, use the first one available:
- destCurBidPrice=sourceCurBidPrice * (destCurRate/sourceCurRate)
- apply bid CPM adjustments as needed
e.g. a bid of 5 NOK would be 5 * (10.238422112392458 / 10.470895112575509) = 4.89 SEK
Done with PBS-Java 2.15