//public static Market CreateYieldCurveConfiguration(string curveId, string[] assetIdentifiers) //{ // var market = new Market {id = curveId}; // //Create the quotedAssetSet. // var qas = QuotedAssetSetFactory.Parse(assetIdentifiers); // //Create the curve information. // var curve = new YieldCurve {id = curveId}; // //reate the valuation structure that contains qas. // var curveValuation = new YieldCurveValuation {id = curveId, inputs = qas}; // //Set the market. // market.Items = new[] { (PricingStructure)curve }; // market.Items1 = new[] { (PricingStructureValuation)curveValuation }; // return market; //} public static Market CreateFxCurveConfiguration(string curveId, string currency1, string currency2, string quoteBasis, FxRateSet quotedAssetSet) { //<QuoteBasisEnum> var basis = EnumHelper.Parse <QuoteBasisEnum>(quoteBasis, true); var quotedCurrencyPair = QuotedCurrencyPair.Create(currency1, currency2, basis); var currency = CurrencyHelper.Parse(currency1); var market = new Market { id = curveId }; //Create the curve information. var curve = new FxCurve { id = curveId, name = curveId, currency = currency, quotedCurrencyPair = quotedCurrencyPair }; //reate the valuation structure that contains qas. var curveValuation = new FxCurveValuation { id = curveId, spotRate = quotedAssetSet }; //Set the market. market.Items = new[] { (PricingStructure)curve }; market.Items1 = new[] { (PricingStructureValuation)curveValuation }; return(market); }
public static Money Normalise(string currency, decimal amount, bool isPayerBase) { var money = new Money { currency = CurrencyHelper.Parse(currency) }; money.amount = System.Math.Abs(money.amount); if (isPayerBase) { money.amount = -1 * money.amount; } money.amountSpecified = true; return(money); }
public static Quotation Create(decimal value, DateTime valuationDate, string businessCenter, string currency, string rateSourceProvider, string rateSource, string rateSourcePage, string assetMeasureType, string quoteUnits) { var quotation = new Quotation { businessCenter = BusinessCentersHelper.Parse(businessCenter).businessCenter[0], currency = CurrencyHelper.Parse(currency), informationSource = InformationSourceHelper.Create( InformationSourceHelper.Create(rateSourceProvider, rateSource, rateSourcePage)), measureType = AssetMeasureTypeHelper.Parse(assetMeasureType), quoteUnits = PriceQuoteUnitsHelper.Create(quoteUnits), valuationDate = valuationDate, valuationDateSpecified = true, value = value, valueSpecified = true }; return(quotation); }
public static Quotation Copy(Quotation baseQuotation) { Quotation quotation = null; if (baseQuotation != null) { quotation = new Quotation(); if (baseQuotation.businessCenter != null) { quotation.businessCenter = BusinessCentersHelper.Parse(baseQuotation.businessCenter.Value).businessCenter[0]; } if (baseQuotation.currency != null) { quotation.currency = CurrencyHelper.Parse(baseQuotation.currency.Value); } if (baseQuotation.valueSpecified) { quotation.value = baseQuotation.value; quotation.valueSpecified = true; } if (baseQuotation.valuationDateSpecified) { quotation.valuationDate = baseQuotation.valuationDate; quotation.valuationDateSpecified = true; } if (baseQuotation.expiryTimeSpecified) { quotation.expiryTime = baseQuotation.expiryTime; quotation.expiryTimeSpecified = true; } if (baseQuotation.sideSpecified) { quotation.side = baseQuotation.side; quotation.sideSpecified = true; } if (baseQuotation.timeSpecified) { quotation.time = baseQuotation.time; quotation.timeSpecified = true; } if (baseQuotation.sensitivitySet != null) { quotation.sensitivitySet = SensitivitySetHelper.Copy(baseQuotation.sensitivitySet); } if (baseQuotation.measureType != null) { quotation.measureType = AssetMeasureTypeHelper.Copy(baseQuotation.measureType); } if (baseQuotation.quoteUnits != null) { quotation.quoteUnits = PriceQuoteUnitsHelper.Copy(baseQuotation.quoteUnits); } if (baseQuotation.informationSource != null) { quotation.informationSource = InformationSourceHelper.Copy(baseQuotation.informationSource).ToArray(); } if (baseQuotation.exchangeId != null) { quotation.exchangeId = ExchangeIdHelper.Copy(baseQuotation.exchangeId); } } return(quotation); }