Example #1
0
 public TO_FxMatrix GetTransportObject() =>
 new TO_FxMatrix
 {
     BaseCurrency      = BaseCurrency.Ccy,
     BuildDate         = BuildDate,
     DiscountCurveMap  = DiscountCurveMap.ToDictionary(x => x.Key.Ccy, x => x.Value),
     SpotRates         = SpotRates.ToDictionary(x => x.Key.Ccy, x => x.Value),
     FxPairDefinitions = FxPairDefinitions.Select(x => x.GetTransportObject()).ToList()
 };
Example #2
0
        public FxPair GetFxPair(Currency domesticCcy, Currency foreignCcy)
        {
            if (domesticCcy == foreignCcy)
            {
                return new FxPair {
                           Domestic = domesticCcy, Foreign = foreignCcy, PrimaryCalendar = new Calendar(), SpotLag = 0.Day()
                }
            }
            ;

            var pair = FxPairDefinitions.SingleOrDefault(x => x.Domestic == domesticCcy && x.Foreign == foreignCcy);

            return(pair ??
                   FxPairDefinitions.SingleOrDefault(x => x.Foreign == domesticCcy && x.Domestic == foreignCcy) ??
                   new FxPair {
                Domestic = domesticCcy, Foreign = foreignCcy, PrimaryCalendar = foreignCcy.SettlementCalendar.Merge(domesticCcy.SettlementCalendar), SpotLag = 2.Bd()
            });
        }
Example #3
0
 public FxPair GetFxPair(Currency domesticCcy, Currency foreignCcy) => FxPairDefinitions.SingleOrDefault(x => x.Domestic == domesticCcy && x.Foreign == foreignCcy);