public override Func <IReadOnlyList <IGrammarTerm>, decimal> VisitFxRateFunc(MyGrammarParser.FxRateFuncContext context) { var termId = context.GetText(); var currencyPair = context.currencyPair().GetText(); var term = new FxRateTerm(termId, CurrencyPairIdentifier.ParseExact(currencyPair)); _terms.Add(term); return(x => x.First(t => t.TermId == term.TermId).Value); }
public void Visit(FxRateTerm fxRateTerm) { var priceStream = _fxRateRepository .GetPricesFor(fxRateTerm.Identifier) .Select(x => { fxRateTerm.SetValue(x.Rate); return(fxRateTerm); }); _terms.Add(priceStream); }