private static PartyReference CreatePartyReference(string href) { var partyOrTradeSideReference = new PartyReference { href = href }; return(partyOrTradeSideReference); }
public static PartyReference Parse(string href) { var result = new PartyReference { href = href }; return(result); }
public static PartyReference Create(string href) { PartyReference partyOrTradeSideReference = new PartyReference(); partyOrTradeSideReference.href = href; return(partyOrTradeSideReference); }
public static PartyReference Parse(string href) { PartyReference result = new PartyReference(); result.href = href; return(result); }
public static Trade CreateFraTrade(FraInputRange2 fraInputRange) { var trade = new Trade(); var fra = new Fra { adjustedEffectiveDate = DateTypesHelper.ToRequiredIdentifierDate(fraInputRange.AdjustedEffectiveDate), adjustedTerminationDate = fraInputRange.AdjustedTerminationDate, adjustedTerminationDateSpecified = true, paymentDate = DateTypesHelper.ToAdjustableDate(fraInputRange.UnadjustedPaymentDate, fraInputRange.PaymentDateBusinessDayConvention, fraInputRange.PaymentDateBusinessCenters), Items = new object[] { new ProductType { Value = ProductTypeSimpleEnum.FRA.ToString() } }, ItemsElementName = new[] { ItemsChoiceType2.productType } }; if ("resetDate" != fraInputRange.FixingDayOffsetDateRelativeTo) { throw new ArgumentException("The fixing date must be specified as 'resetDate'-relative!", nameof(fraInputRange)); } var fixingDayType = EnumHelper.Parse <DayTypeEnum>(fraInputRange.FixingDayOffsetDayType); fra.fixingDateOffset = RelativeDateOffsetHelper.Create(fraInputRange.FixingDayOffsetPeriod, fixingDayType, fraInputRange.FixingDayOffsetBusinessDayConvention, fraInputRange.FixingDayOffsetBusinessCenters, fraInputRange.FixingDayOffsetDateRelativeTo); fra.dayCountFraction = DayCountFractionHelper.Parse(fraInputRange.DayCountFraction); IDayCounter dayCounter = DayCounterHelper.Parse(fra.dayCountFraction.Value); fra.calculationPeriodNumberOfDays = dayCounter.DayCount(fra.adjustedEffectiveDate.Value, fra.adjustedTerminationDate).ToString(CultureInfo.InvariantCulture); fra.notional = MoneyHelper.GetAmount(fraInputRange.NotionalAmount, fraInputRange.NotionalCurrency); fra.fixedRate = (decimal)fraInputRange.FixedRate; fra.fixedRateSpecified = true; fra.floatingRateIndex = FloatingRateIndexHelper.Parse(fraInputRange.FloatingRateIndex); fra.indexTenor = new[] { PeriodHelper.Parse(fraInputRange.IndexTenor) }; fra.fraDiscounting = fraInputRange.FraDiscounting; fra.fraDiscountingSpecified = true; PartyReference party1 = PartyReferenceFactory.Create("party1"); PartyReference party2 = PartyReferenceFactory.Create("party2"); fra.sellerPartyReference = party1; fra.buyerPartyReference = party2; if (bool.Parse(fraInputRange.IsParty1Buyer)) { fra.sellerPartyReference = party2; fra.buyerPartyReference = party1; } XsdClassesFieldResolver.TradeSetFra(trade, fra); trade.id = fraInputRange.TradeId; return(trade); }
/// <summary> /// /// </summary> /// <param name="fraInputRange"></param> /// <returns></returns> public static Fra GetFpMLFra(FraInputRange fraInputRange) { var fra = new Fra { adjustedEffectiveDate = DateTypesHelper.ToRequiredIdentifierDate(fraInputRange.AdjustedEffectiveDate), adjustedTerminationDate = fraInputRange.AdjustedTerminationDate, paymentDate = DateTypesHelper.ToAdjustableDate(fraInputRange.UnadjustedPaymentDate, fraInputRange.PaymentDateBusinessDayConvention, fraInputRange.PaymentDateBusinessCenters) }; if ("resetDate" != fraInputRange.FixingDayOffsetDateRelativeTo) { throw new ArgumentException("The fixing date must be specified as 'resetDate'-relative!", nameof(fraInputRange)); } var fixingDayType = EnumHelper.Parse <DayTypeEnum>(fraInputRange.FixingDayOffsetDayType); fra.fixingDateOffset = RelativeDateOffsetHelper.Create(fraInputRange.FixingDayOffsetPeriod, fixingDayType, fraInputRange.FixingDayOffsetBusinessDayConvention, fraInputRange.FixingDayOffsetBusinessCenters, fraInputRange.FixingDayOffsetDateRelativeTo); fra.dayCountFraction = DayCountFractionHelper.Parse(fraInputRange.DayCountFraction); IDayCounter dayCounter = DayCounterHelper.Parse(fra.dayCountFraction.Value); fra.calculationPeriodNumberOfDays = dayCounter.DayCount(fra.adjustedEffectiveDate.Value, fra.adjustedTerminationDate).ToString(); fra.notional = MoneyHelper.GetAmount(fraInputRange.NotionalAmount, fraInputRange.NotionalCurrency); fra.fixedRate = (decimal)fraInputRange.FixedRate; fra.floatingRateIndex = FloatingRateIndexHelper.Parse(fraInputRange.FloatingRateIndex); fra.indexTenor = new[] { PeriodHelper.Parse(fraInputRange.IndexTenor) }; fra.fraDiscounting = fraInputRange.FraDiscounting; PartyReference nabParty = PartyReferenceFactory.Create("NAB"); PartyReference counterParty = PartyReferenceFactory.Create("COUNTERPARTY"); if (bool.Parse(fraInputRange.Sell)) { fra.sellerPartyReference = nabParty; fra.buyerPartyReference = counterParty; } else { fra.sellerPartyReference = counterParty; fra.buyerPartyReference = nabParty; } return(fra); }
/// <summary> /// Initializes a new instance of the <see cref="PriceablePayment"/> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="payerPartyReference">The payer.</param> /// <param name="receiverPartyReference">The receiver.</param> /// <param name="payerIsBase">The payer is base flag.</param> /// <param name="amount">The amount.</param> /// <param name="paymentDate">The payment date.</param> /// <param name="paymentCalendar">Type paymentCalendar.</param> public PriceablePayment ( string id , string payerPartyReference , string receiverPartyReference , bool payerIsBase , Money amount , AdjustableOrAdjustedDate paymentDate , IBusinessCalendar paymentCalendar) : base(id, "DiscountedCashflow", payerIsBase, amount, paymentDate, PaymentTypeHelper.Create("Certain"), CashflowTypeHelper.Create(CashflowTypeEnum.PrincipalExchange.ToString()), false, paymentCalendar) { PayerPartyReference = PartyReferenceFactory.Create(payerPartyReference); ReceiverPartyReference = PartyReferenceFactory.Create(receiverPartyReference); OrderedPartyNames.Add(PayerPartyReference.href); OrderedPartyNames.Add(ReceiverPartyReference.href); }
public static Trade CreateFraTrade(string tradeId, RequiredIdentifierDate adjustedEffectiveDate, DateTime adjustedTerminationDate, AdjustableDate paymentDate, RelativeDateOffset fixingDayOffset, DayCountFraction dayCountFraction, decimal notionalAmount, string notionalCurrency, decimal fixedRate, string floatingRateIndex, string indexTenor, FraDiscountingEnum fraDiscounting) { var trade = new Trade(); var fra = new Fra { adjustedEffectiveDate = adjustedEffectiveDate, adjustedTerminationDate = adjustedTerminationDate, adjustedTerminationDateSpecified = true, paymentDate = paymentDate, Items = new object[] { new ProductType { Value = ProductTypeSimpleEnum.FRA.ToString() } }, ItemsElementName = new[] { ItemsChoiceType2.productType } }; if ("resetDate" != fixingDayOffset.dateRelativeTo.href) { throw new ArgumentException("The fixing date must be specified as 'resetDate'-relative!", nameof(fixingDayOffset)); } fra.fixingDateOffset = fixingDayOffset; fra.dayCountFraction = dayCountFraction; IDayCounter dayCounter = DayCounterHelper.Parse(fra.dayCountFraction.Value); fra.calculationPeriodNumberOfDays = dayCounter.DayCount(fra.adjustedEffectiveDate.Value, fra.adjustedTerminationDate).ToString(CultureInfo.InvariantCulture); fra.notional = MoneyHelper.GetAmount(notionalAmount, notionalCurrency); fra.fixedRate = fixedRate; fra.fixedRateSpecified = true; fra.floatingRateIndex = FloatingRateIndexHelper.Parse(floatingRateIndex); fra.indexTenor = new[] { PeriodHelper.Parse(indexTenor) }; fra.fraDiscounting = fraDiscounting; fra.fraDiscountingSpecified = true; PartyReference party1 = PartyReferenceFactory.Create("party1"); PartyReference party2 = PartyReferenceFactory.Create("party2"); fra.sellerPartyReference = party2; fra.buyerPartyReference = party1; XsdClassesFieldResolver.TradeSetFra(trade, fra); trade.id = tradeId; return(trade); }
/// <summary> /// /// </summary> /// <param name="identifier"></param> /// <param name="payerPartyReference"></param> /// <param name="receiverPartyReference"></param> /// <param name="paymentAmount"></param> /// <param name="adjustablePaymentDate"></param> /// <param name="settlementInformation"></param> /// <param name="paymentType"></param> /// <param name="discountFactor"></param> /// <param name="presentValueAmount"></param> /// <returns></returns> public static Payment Create(string identifier, PartyReference payerPartyReference, PartyReference receiverPartyReference, NonNegativeMoney paymentAmount, AdjustableOrAdjustedDate adjustablePaymentDate, SettlementInformation settlementInformation, PaymentType paymentType, decimal discountFactor, Money presentValueAmount) { var payment = new Payment { paymentDate = adjustablePaymentDate, discountFactor = discountFactor, discountFactorSpecified = true, href = identifier, payerPartyReference = payerPartyReference, paymentAmount = paymentAmount, paymentType = paymentType, presentValueAmount = presentValueAmount, receiverPartyReference = receiverPartyReference, settlementInformation = settlementInformation }; return(payment); }
/// <summary> /// Creates a vanilla fx option. /// </summary> /// <param name="buyerPartyReference"></param> /// <param name="sellerPartyReference"></param> /// <param name="fxEuropeanExercise"></param> /// <param name="soldAs"></param> /// <param name="fxCashSettlement"></param> /// <param name="putCurrencyAmount"></param> /// <param name="callCurrencyAmount"></param> /// <param name="fxStrikePrice"></param> /// <param name="valueDate"></param> /// <param name="premia"></param> /// <returns></returns> public static FxOption CreateVanillaFXOption(PartyReference buyerPartyReference, PartyReference sellerPartyReference, FxEuropeanExercise fxEuropeanExercise, PutCallEnum soldAs, FxCashSettlement fxCashSettlement, //QuotedAs quotedAs, ExpiryDateTime expiryDate, ExerciseStyleEnum exerciseStyle, NonNegativeMoney putCurrencyAmount, NonNegativeMoney callCurrencyAmount, FxStrikePrice fxStrikePrice, DateTime valueDate, List <FxOptionPremium> premia) { var fxOption = new FxOption { putCurrencyAmount = putCurrencyAmount, callCurrencyAmount = callCurrencyAmount, strike = fxStrikePrice, buyerPartyReference = buyerPartyReference, sellerPartyReference = sellerPartyReference, premium = premia.ToArray(), soldAs = soldAs, cashSettlement = fxCashSettlement, Item = fxEuropeanExercise }; return(fxOption); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ProcessingActivityComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (PartyReference != null) { dest.PartyReference = new List <Hl7.Fhir.Model.ResourceReference>(PartyReference.DeepCopy()); } if (PartyCodeableConcept != null) { dest.PartyCodeableConcept = new List <Hl7.Fhir.Model.CodeableConcept>(PartyCodeableConcept.DeepCopy()); } if (Purpose != null) { dest.Purpose = new List <Hl7.Fhir.Model.CodeableConcept>(Purpose.DeepCopy()); } return(dest); }