Utility to convert Currencies

I am trying to use Epicor’s currency logic to convert a value from a Price list in one currency to the customer’s currency. Ideally, I would give it the “from” and “to” currency and it would provide an exchange rate.
Erp.Internal.Lib.Shared has Erp.Internal.Lib.GetCurrencyRatesEF. This looks very close:
public void searchrate(string pRateGrpCode, string pFromCode, string pToCode, DateTime? searchDate, out decimal pRate, string company = "")
However, it only returns rates that are directly defined. Otherwise, it returns 1.

For example:
I have a rate for EUR > GBP and a rate for USD > GBP. The system can calulate the EUR > USD from this, but the code above does not do that (or I’m using it wrong).

Here is my code:

var convList = new Dictionary<string, decimal>();
using (var rateLib = new Erp.Internal.Lib.GetCurrencyRatesEF(Db))
  decimal rate = 0;
  foreach (var conv in result.Results.Select(conv => new {conv.PriceLst_CurrencyCode, conv.Customer_CurrencyCode, conv.Customer_Company}).Distinct())
    rateLib.searchrate("MAIN",conv.PriceLst_CurrencyCode,conv.Customer_CurrencyCode,DateTime.Today, out rate, conv.Customer_Company);
    convList[conv.PriceLst_CurrencyCode + ">" + conv.Customer_CurrencyCode] = rate;
    PublishInfoMessage(conv.PriceLst_CurrencyCode + ">" + conv.Customer_CurrencyCode + ": " + convList[conv.PriceLst_CurrencyCode + ">" + conv.Customer_CurrencyCode],0,0,"","");

I’m sure you know all this, but in case you do not…

Is this for a report or for a transaction? Asking only because we set up the Reporting Currency matrix and most transactions have a Rpt1/Rpt2/Rpt3 set of fields that carries the alternate currency’s value based on the most recent exchange rate. (We also load rates every day…) We use these fields in our reports when combining our international company data.

Plus, some transactions also have the document currency in addition to the base/converted currencies. The values are stored, but it depends on your setup if this will work for you.

This is for a BAQ, but ideally the logic can be used in any location. Yes, the reporting fields are great for transactions though.