FpML® 4.0 XML Data Binding  - Nuget packge LiquidTechnologies.XmlObjects.FpML4-0 FpML® 4.0 XML Data Binding - Nuget packge LiquidTechnologies.XmlObjects.FpML4-0

Home > XML Data Binding Nuget Packages > FpML® 4.0

 

Financial products Markup Language (FpML®)

FpML® (Financial products Markup Language) is the industry-standard protocol for complex financial products. It is based on XML (eXtensible Markup Language), the standard meta-language for describing data shared between applications.

NuGet Package ID LiquidTechnologies.XmlObjects.FpML4-0
Description An object model for the FpML® 4.0 standard providing strongly typed classes that can be serialized/deserializsed to XML.
Documentation Liquid XML Objects API
Schema Documentation https://schemas.liquid-technologies.com/FpML/4.0/
Official Schema Site http://www.fpml.org/
License EULA
Supported Platforms
  • .Net Standard 2.0 and above
  • .Net Core 2.0 and above
  • .Net Framework 4.0 and above

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML40;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var dataDocumentCt = new Tns.DataDocumentCt();
            var trade = new Tns.TradeCt();
            {
                var partyTradeIdentifier = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier.PartyReference.Href = "partyA";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.swapswire.com/spec/2001/trade-id-1-0";
                        tradeId.Value = "37261";
                        partyTradeIdentifier.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier);
                }
                var partyTradeIdentifier1 = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier1.PartyReference.Href = "partyB";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.swapswire.com/spec/2001/trade-id-1-0";
                        tradeId.Value = "37261";
                        partyTradeIdentifier1.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier1);
                }
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2002, 7, 11, 0, 0, 0, 0, 0, 0, false);
                {
                    var product = new Tns.CreditDefaultSwapElm();
                    product.GeneralTerms.EffectiveDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2002, 7, 11, 0, 0, 0, 0, 0, 0, false);
                    {
                        var dateAdjustments = new Tns.BusinessDayAdjustmentsCt();
                        dateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                        product.GeneralTerms.EffectiveDate.DateAdjustments = dateAdjustments;
                    }
                    {
                        var adjustableDate = new Tns.AdjustableDate2Ct();
                        adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2006, 7, 11, 0, 0, 0, 0, 0, 0, false);
                        {
                            var dateAdjustments1 = new Tns.BusinessDayAdjustmentsCt();
                            dateAdjustments1.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.MODFOLLOWING;
                            {
                                var businessCenters = new Tns.BusinessCentersCt();
                                var businessCenter = new Tns.BusinessCenterCt();
                                {
                                    businessCenter.Value = "GBLO";
                                    businessCenters.BusinessCenter.Add(businessCenter);
                                }
                                var businessCenter1 = new Tns.BusinessCenterCt();
                                {
                                    businessCenter1.Value = "USNY";
                                    businessCenters.BusinessCenter.Add(businessCenter1);
                                }
                                dateAdjustments1.BusinessCenters = businessCenters;
                            }
                            adjustableDate.DateAdjustments = dateAdjustments1;
                        }
                        product.GeneralTerms.ScheduledTerminationDate.AdjustableDate = adjustableDate;
                    }
                    product.GeneralTerms.SellerPartyReference.Href = "partyA";
                    product.GeneralTerms.BuyerPartyReference.Href = "partyB";
                    {
                        var dateAdjustments1 = new Tns.BusinessDayAdjustmentsCt();
                        dateAdjustments1.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.MODFOLLOWING;
                        {
                            var businessCenters = new Tns.BusinessCentersCt();
                            var businessCenter = new Tns.BusinessCenterCt();
                            {
                                businessCenter.Value = "GBLO";
                                businessCenters.BusinessCenter.Add(businessCenter);
                            }
                            var businessCenter1 = new Tns.BusinessCenterCt();
                            {
                                businessCenter1.Value = "USNY";
                                businessCenters.BusinessCenter.Add(businessCenter1);
                            }
                            dateAdjustments1.BusinessCenters = businessCenters;
                        }
                        product.GeneralTerms.DateAdjustments = dateAdjustments1;
                    }
                    product.GeneralTerms.ReferenceInformation.ReferenceEntity.Id = "referenceEntity";
                    {
                        var entityName = new Tns.EntityNameCt();
                        entityName.Value = "Republic of Bulgaria";
                        product.GeneralTerms.ReferenceInformation.ReferenceEntity.EntityName = entityName;
                    }
                    var entityId = new Tns.EntityIdCt();
                    {
                        entityId.EntityIdScheme = "http://www.fpml.org/spec/2003/entity-id-RED-1-0";
                        entityId.Value = "1D216P";
                        product.GeneralTerms.ReferenceInformation.ReferenceEntity.EntityId.Add(entityId);
                    }
                    var referenceObligation = new Tns.ReferenceObligationCt();
                    {
                        {
                            var bond = new Tns.BondElm();
                            bond.CouponRate = BigDecimal.Parse("0.075");
                            bond.Maturity = new LxDateTime(LxDateTimeType.Date, 2013, 1, 15, 0, 0, 0, 0, 0, 0, false);
                            var instrumentId = new Tns.InstrumentIdCt();
                            {
                                instrumentId.InstrumentIdScheme = "http://www.fpml.org/spec/2002/instrument-id-ISIN-1-0";
                                instrumentId.Value = "XS0145624432";
                                bond.InstrumentId.Add(instrumentId);
                            }
                            referenceObligation.Bond = bond;
                        }
                        {
                            var primaryObligorReference = new Tns.LegalEntityReferenceCt();
                            primaryObligorReference.Href = "referenceEntity";
                            referenceObligation.PrimaryObligorReference = primaryObligorReference;
                        }
                        product.GeneralTerms.ReferenceInformation.ReferenceObligation.Add(referenceObligation);
                    }
                    product.GeneralTerms.ReferenceInformation.ReferencePrice = BigDecimal.Parse("1");
                    {
                        var periodicPayment = new Tns.PeriodicPaymentCt();
                        periodicPayment.PaymentFrequency.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                        periodicPayment.PaymentFrequency.Period = Tns.PeriodEnumEnum.M;
                        periodicPayment.FirstPaymentDate = new LxDateTime(LxDateTimeType.Date, 2002, 10, 11, 0, 0, 0, 0, 0, 0, false);
                        periodicPayment.RollConvention = Tns.RollConventionEnumEnum.N11;
                        {
                            var fixedAmountCalculation = new Tns.FixedAmountCalculationCt();
                            {
                                var calculationAmount = new Tns.MoneyCt();
                                calculationAmount.Currency.Value = "USD";
                                calculationAmount.Amount = BigDecimal.Parse("5000000");
                                fixedAmountCalculation.CalculationAmount = calculationAmount;
                            }
                            fixedAmountCalculation.FixedRate = BigDecimal.Parse("0.0027");
                            fixedAmountCalculation.DayCountFraction = Tns.DayCountFractionEnumEnum.ACT_360;
                            periodicPayment.FixedAmountCalculation = fixedAmountCalculation;
                        }
                        product.FeeLeg.PeriodicPayment = periodicPayment;
                    }
                    product.ProtectionTerms.CalculationAmount.Currency.Value = "USD";
                    product.ProtectionTerms.CalculationAmount.Amount = BigDecimal.Parse("5000000");
                    {
                        var creditEvents = new Tns.CreditEventsCt();
                        {
                            var failureToPay = new Tns.FailureToPayCt();
                            {
                                var paymentRequirement = new Tns.MoneyCt();
                                paymentRequirement.Currency.Value = "USD";
                                paymentRequirement.Amount = BigDecimal.Parse("1000000");
                                failureToPay.PaymentRequirement = paymentRequirement;
                            }
                            creditEvents.FailureToPay = failureToPay;
                        }
                        {
                            var obligationAcceleration = new Tns.EmptyCt();
                            creditEvents.ObligationAcceleration = obligationAcceleration;
                        }
                        {
                            var repudiationMoratorium = new Tns.EmptyCt();
                            creditEvents.RepudiationMoratorium = repudiationMoratorium;
                        }
                        {
                            var restructuring = new Tns.RestructuringCt();
                            {
                                var restructuringType = new Tns.RestructuringTypeCt();
                                restructuringType.Value = "R";
                                restructuring.RestructuringType = restructuringType;
                            }
                            creditEvents.Restructuring = restructuring;
                        }
                        {
                            var defaultRequirement = new Tns.MoneyCt();
                            defaultRequirement.Currency.Value = "USD";
                            defaultRequirement.Amount = BigDecimal.Parse("10000000");
                            creditEvents.DefaultRequirement = defaultRequirement;
                        }
                        {
                            var creditEventNotice = new Tns.CreditEventNoticeCt();
                            creditEventNotice.NotifyingParty.BuyerPartyReference.Href = "partyB";
                            {
                                var sellerPartyReference = new Tns.PartyReferenceCt();
                                sellerPartyReference.Href = "partyA";
                                creditEventNotice.NotifyingParty.SellerPartyReference = sellerPartyReference;
                            }
                            {
                                var publiclyAvailableInformation = new Tns.PubliclyAvailableInformationCt();
                                {
                                    var standardPublicSources = new Tns.EmptyCt();
                                    publiclyAvailableInformation.StandardPublicSources = standardPublicSources;
                                }
                                publiclyAvailableInformation.SpecifiedNumber = System.Numerics.BigInteger.Parse("2");
                                creditEventNotice.PubliclyAvailableInformation = publiclyAvailableInformation;
                            }
                            creditEvents.CreditEventNotice = creditEventNotice;
                        }
                        product.ProtectionTerms.CreditEvents = creditEvents;
                    }
                    {
                        var obligations = new Tns.ObligationsCt();
                        obligations.Category = Tns.ObligationCategoryEnumEnum.Bond;
                        {
                            var notSubordinated = new Tns.EmptyCt();
                            obligations.NotSubordinated = notSubordinated;
                        }
                        {
                            var notDomesticCurrency = new Tns.NotDomesticCurrencyCt();
                            obligations.NotDomesticCurrency = notDomesticCurrency;
                        }
                        {
                            var notDomesticLaw = new Tns.EmptyCt();
                            obligations.NotDomesticLaw = notDomesticLaw;
                        }
                        {
                            var notDomesticIssuance = new Tns.EmptyCt();
                            obligations.NotDomesticIssuance = notDomesticIssuance;
                        }
                        product.ProtectionTerms.Obligations = obligations;
                    }
                    {
                        var physicalSettlementTerms = new Tns.PhysicalSettlementTermsCt();
                        {
                            var physicalSettlementPeriod = new Tns.PhysicalSettlementPeriodCt();
                            {
                                var businessDaysNotSpecified = new Tns.EmptyCt();
                                physicalSettlementPeriod.BusinessDaysNotSpecified = businessDaysNotSpecified;
                            }
                            physicalSettlementTerms.PhysicalSettlementPeriod = physicalSettlementPeriod;
                        }
                        physicalSettlementTerms.DeliverableObligations.AccruedInterest = false;
                        physicalSettlementTerms.DeliverableObligations.Category = Tns.ObligationCategoryEnumEnum.Bond;
                        {
                            var notSubordinated = new Tns.EmptyCt();
                            physicalSettlementTerms.DeliverableObligations.NotSubordinated = notSubordinated;
                        }
                        {
                            var specifiedCurrency = new Tns.SpecifiedCurrencyCt();
                            physicalSettlementTerms.DeliverableObligations.SpecifiedCurrency = specifiedCurrency;
                        }
                        {
                            var notDomesticLaw = new Tns.EmptyCt();
                            physicalSettlementTerms.DeliverableObligations.NotDomesticLaw = notDomesticLaw;
                        }
                        {
                            var notContingent = new Tns.EmptyCt();
                            physicalSettlementTerms.DeliverableObligations.NotContingent = notContingent;
                        }
                        {
                            var notDomesticIssuance = new Tns.EmptyCt();
                            physicalSettlementTerms.DeliverableObligations.NotDomesticIssuance = notDomesticIssuance;
                        }
                        {
                            var transferable = new Tns.EmptyCt();
                            physicalSettlementTerms.DeliverableObligations.Transferable = transferable;
                        }
                        {
                            var notBearer = new Tns.EmptyCt();
                            physicalSettlementTerms.DeliverableObligations.NotBearer = notBearer;
                        }
                        physicalSettlementTerms.Escrow = true;
                        {
                            var settlementCurrency = new Tns.CurrencyCt();
                            settlementCurrency.Value = "USD";
                            physicalSettlementTerms.SettlementCurrency = settlementCurrency;
                        }
                        product.PhysicalSettlementTerms = physicalSettlementTerms;
                    }
                    trade.Product = product;
                }
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReference = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReference.Href = "partyA";
                        calculationAgent.CalculationAgentPartyReference.Add(calculationAgentPartyReference);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                {
                    var calculationAgentBusinessCenter = new Tns.BusinessCenterCt();
                    calculationAgentBusinessCenter.Value = "GBLO";
                    trade.CalculationAgentBusinessCenter = calculationAgentBusinessCenter;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterAgreement = new Tns.MasterAgreementCt();
                        masterAgreement.MasterAgreementType.Value = "ISDA1992";
                        documentation.MasterAgreement = masterAgreement;
                    }
                    var contractualDefinitions = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions.Value = "ISDA1999Credit";
                        documentation.ContractualDefinitions.Add(contractualDefinitions);
                    }
                    var contractualSupplement = new Tns.ContractualSupplementCt();
                    {
                        contractualSupplement.Value = "ISDA1999CreditConvertibleExchangeableAccretingObligations";
                        documentation.ContractualSupplement.Add(contractualSupplement);
                    }
                    trade.Documentation = documentation;
                }
                dataDocumentCt.Trade.Add(trade);
            }
            var party = new Tns.PartyCt();
            {
                party.Id = "partyA";
                party.PartyId.Value = "XYZBICXXX";
                party.PartyName = "XYZ Bank";
                dataDocumentCt.Party.Add(party);
            }
            var party1 = new Tns.PartyCt();
            {
                party1.Id = "partyB";
                party1.PartyId.Value = "ABCBICXXX";
                party1.PartyName = "ABC Bank";
                dataDocumentCt.Party.Add(party1);
            }
            dataDocumentCt.Version = Ns.VersionEnum.N4_0;


            var serializer = new LxSerializer<Tns.DataDocumentCt>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, dataDocumentCt);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<FpML version="4-0" xmlns="http://www.fpml.org/2003/FpML-4-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fpml.org/2003/FpML-4-0 ../fpml-main-4-0.xsd" xsi:type="DataDocument">
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="partyA" />
        <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">37261</tradeId>
      </partyTradeIdentifier>
      <partyTradeIdentifier>
        <partyReference href="partyB" />
        <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">37261</tradeId>
      </partyTradeIdentifier>
      <tradeDate>2002-07-11</tradeDate>
    </tradeHeader>
    <creditDefaultSwap>
      <generalTerms>
        <effectiveDate>
          <unadjustedDate>2002-07-11</unadjustedDate>
          <dateAdjustments>
            <businessDayConvention>NONE</businessDayConvention>
          </dateAdjustments>
        </effectiveDate>
        <scheduledTerminationDate>
          <adjustableDate>
            <unadjustedDate>2006-07-11</unadjustedDate>
            <dateAdjustments>
              <businessDayConvention>MODFOLLOWING</businessDayConvention>
              <businessCenters>
                <businessCenter>GBLO</businessCenter>
                <businessCenter>USNY</businessCenter>
              </businessCenters>
            </dateAdjustments>
          </adjustableDate>
        </scheduledTerminationDate>
        <sellerPartyReference href="partyA" />
        <buyerPartyReference href="partyB" />
        <dateAdjustments>
          <businessDayConvention>MODFOLLOWING</businessDayConvention>
          <businessCenters>
            <businessCenter>GBLO</businessCenter>
            <businessCenter>USNY</businessCenter>
          </businessCenters>
        </dateAdjustments>
        <referenceInformation>
          <referenceEntity id="referenceEntity">
            <entityName>Republic of Bulgaria</entityName>
            <entityId entityIdScheme="http://www.fpml.org/spec/2003/entity-id-RED-1-0">1D216P</entityId>
          </referenceEntity>
          <referenceObligation>
            <bond>
              <instrumentId instrumentIdScheme="http://www.fpml.org/spec/2002/instrument-id-ISIN-1-0">XS0145624432</instrumentId>
              <couponRate>0.075</couponRate>
              <maturity>2013-01-15</maturity>
            </bond>
            <primaryObligorReference href="referenceEntity" />
          </referenceObligation>
          <referencePrice>1.0</referencePrice>
        </referenceInformation>
      </generalTerms>
      <feeLeg>
        <periodicPayment>
          <paymentFrequency>
            <periodMultiplier>3</periodMultiplier>
            <period>M</period>
          </paymentFrequency>
          <firstPaymentDate>2002-10-11</firstPaymentDate>
          <rollConvention>11</rollConvention>
          <fixedAmountCalculation>
            <calculationAmount>
              <currency>USD</currency>
              <amount>5000000.0</amount>
            </calculationAmount>
            <fixedRate>0.0027</fixedRate>
            <dayCountFraction>ACT/360</dayCountFraction>
          </fixedAmountCalculation>
        </periodicPayment>
      </feeLeg>
      <protectionTerms>
        <calculationAmount>
          <currency>USD</currency>
          <amount>5000000.0</amount>
        </calculationAmount>
        <creditEvents>
          <failureToPay>
            <paymentRequirement>
              <currency>USD</currency>
              <amount>1000000.0</amount>
            </paymentRequirement>
          </failureToPay>
          <obligationAcceleration />
          <repudiationMoratorium />
          <restructuring>
            <restructuringType>R</restructuringType>
          </restructuring>
          <defaultRequirement>
            <currency>USD</currency>
            <amount>10000000.0</amount>
          </defaultRequirement>
          <creditEventNotice>
            <notifyingParty>
              <buyerPartyReference href="partyB" />
              <sellerPartyReference href="partyA" />
            </notifyingParty>
            <publiclyAvailableInformation>
              <standardPublicSources />
              <specifiedNumber>2</specifiedNumber>
            </publiclyAvailableInformation>
          </creditEventNotice>
        </creditEvents>
        <obligations>
          <category>Bond</category>
          <notSubordinated />
          <notDomesticCurrency />
          <notDomesticLaw />
          <notDomesticIssuance />
        </obligations>
      </protectionTerms>
      <physicalSettlementTerms>
        <settlementCurrency>USD</settlementCurrency>
        <physicalSettlementPeriod>
          <businessDaysNotSpecified />
        </physicalSettlementPeriod>
        <deliverableObligations>
          <accruedInterest>false</accruedInterest>
          <category>Bond</category>
          <notSubordinated />
          <specifiedCurrency />
          <notDomesticLaw />
          <notContingent />
          <notDomesticIssuance />
          <transferable />
          <notBearer />
        </deliverableObligations>
        <escrow>true</escrow>
      </physicalSettlementTerms>
    </creditDefaultSwap>
    <calculationAgent>
      <calculationAgentPartyReference href="partyA" />
    </calculationAgent>
    <calculationAgentBusinessCenter>GBLO</calculationAgentBusinessCenter>
    <documentation>
      <masterAgreement>
        <masterAgreementType>ISDA1992</masterAgreementType>
      </masterAgreement>
      <contractualDefinitions>ISDA1999Credit</contractualDefinitions>
      <contractualSupplement>ISDA1999CreditConvertibleExchangeableAccretingObligations</contractualSupplement>
    </documentation>
  </trade>
  <party id="partyA">
    <partyId>XYZBICXXX</partyId>
    <partyName>XYZ Bank</partyName>
  </party>
  <party id="partyB">
    <partyId>ABCBICXXX</partyId>
    <partyName>ABC Bank</partyName>
  </party>
</FpML>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML40;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var dataDocumentCt = new Tns.DataDocumentCt();
            var trade = new Tns.TradeCt();
            {
                var partyTradeIdentifier = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier.PartyReference.Href = "partyA";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.partyA.com/eqd-trade-id";
                        tradeId.Value = "1234";
                        partyTradeIdentifier.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier);
                }
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2000, 6, 28, 0, 0, 0, 0, 0, 0, false);
                {
                    var product = new Tns.EquityOptionElm();
                    product.BuyerPartyReference.Href = "partyB";
                    product.SellerPartyReference.Href = "partyA";
                    product.OptionType = Tns.OptionTypeEnumEnum.Call;
                    {
                        var singleUnderlyer = new Tns.SingleUnderlyerCt();
                        {
                            var underlyingAsset = new Tns.IndexElm();
                            var relatedExchangeId = new Tns.ExchangeIdCt();
                            {
                                relatedExchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                relatedExchangeId.Value = "OSE";
                                underlyingAsset.RelatedExchangeId.Add(relatedExchangeId);
                            }
                            var instrumentId = new Tns.InstrumentIdCt();
                            {
                                instrumentId.InstrumentIdScheme = "http://www.fpml.org/schemes/4.0/instrumentId";
                                instrumentId.Value = ".N225";
                                underlyingAsset.InstrumentId.Add(instrumentId);
                            }
                            underlyingAsset.Description = "NIKKEI 225 INDEX";
                            {
                                var exchangeId = new Tns.ExchangeIdCt();
                                exchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                exchangeId.Value = "TSE";
                                underlyingAsset.ExchangeId = exchangeId;
                            }
                            singleUnderlyer.UnderlyingAsset = underlyingAsset;
                        }
                        singleUnderlyer.OpenUnits = BigDecimal.Parse("1");
                        product.Underlyer.SingleUnderlyer = singleUnderlyer;
                    }
                    {
                        var strike = new Tns.EquityStrikeCt();
                        strike.StrikePrice = BigDecimal.Parse("17475.9");
                        product.Strike = strike;
                    }
                    product.NumberOfOptions = BigDecimal.Parse("79.099093");
                    product.OptionEntitlement = BigDecimal.Parse("1");
                    {
                        var equityEuropeanExercise = new Tns.EquityEuropeanExerciseCt();
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2002, 7, 1, 0, 0, 0, 0, 0, 0, false);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                            equityEuropeanExercise.ExpirationDate.AdjustableDate = adjustableDate;
                        }
                        equityEuropeanExercise.EquityExpirationTimeType = Tns.TimeTypeEnumEnum.Close;
                        product.EquityExercise.EquityEuropeanExercise = equityEuropeanExercise;
                    }
                    product.EquityExercise.AutomaticExerciseApplicable = true;
                    product.EquityExercise.EquityValuation.ValuationTimeType = Tns.TimeTypeEnumEnum.Close;
                    product.EquityExercise.SettlementCurrency.Value = "EUR";
                    product.EquityExercise.SettlementType = Tns.SettlementTypeEnumEnum.Cash;
                    product.EquityExercise.FailureToDeliverApplicable = true;
                    {
                        var fxFeature = new Tns.FXFeatureCt();
                        fxFeature.FxFeatureType.Value = "Composite";
                        product.FxFeature = fxFeature;
                    }
                    {
                        var equityOptionFeatures = new Tns.EquityOptionFeaturesCt();
                        {
                            var asian = new Tns.AsianCt();
                            asian.AveragingInOut = Tns.AveragingInOutEnumEnum.In_;
                            {
                                var averagingPeriodIn = new Tns.EquityAveragingPeriodCt();
                                {
                                    var averagingDateTimes = new Tns.DateTimeListCt();
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2000, 8, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2000, 9, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2000, 10, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2000, 11, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2000, 12, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2001, 1, 4, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2001, 2, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingDateTimes.DateTime.Add(new LxDateTime(LxDateTimeType.DateTime, 2001, 3, 1, 8, 57, 0, 0, 0, 0, 0, 0));
                                    averagingPeriodIn.AveragingDateTimes = averagingDateTimes;
                                }
                                averagingPeriodIn.MarketDisruption.Value = "ModifiedPostponement";
                                asian.AveragingPeriodIn = averagingPeriodIn;
                            }
                            equityOptionFeatures.Asian = asian;
                        }
                        product.EquityOptionFeatures = equityOptionFeatures;
                    }
                    product.EquityPremium.PayerPartyReference.Href = "partyB";
                    product.EquityPremium.ReceiverPartyReference.Href = "partyA";
                    {
                        var paymentAmount = new Tns.MoneyCt();
                        paymentAmount.Currency.Value = "EUR";
                        paymentAmount.Amount = BigDecimal.Parse("107821.57");
                        product.EquityPremium.PaymentAmount = paymentAmount;
                    }
                    {
                        var paymentDate = new Tns.AdjustableDateCt();
                        paymentDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2000, 7, 3, 0, 0, 0, 0, 0, 0, false);
                        paymentDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                        product.EquityPremium.PaymentDate = paymentDate;
                    }
                    product.EquityPremium.PricePerOption = BigDecimal.Parse("1363.1202");
                    product.MethodOfAdjustment = Tns.MethodOfAdjustmentEnumEnum.CalculationAgent;
                    {
                        var productType = new Tns.ProductTypeCt();
                        productType.Value = "europeanCallIndex";
                        product.ProductType = productType;
                    }
                    trade.Product = product;
                }
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReference = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReference.Href = "partyA";
                        calculationAgent.CalculationAgentPartyReference.Add(calculationAgentPartyReference);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterAgreement = new Tns.MasterAgreementCt();
                        masterAgreement.MasterAgreementType.Value = "ISDA2002";
                        documentation.MasterAgreement = masterAgreement;
                    }
                    var contractualDefinitions = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions.Value = "ISDA2000";
                        documentation.ContractualDefinitions.Add(contractualDefinitions);
                    }
                    var contractualDefinitions1 = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions1.Value = "ISDA1996Equity";
                        documentation.ContractualDefinitions.Add(contractualDefinitions1);
                    }
                    trade.Documentation = documentation;
                }
                {
                    var governingLaw = new Tns.GoverningLawCt();
                    governingLaw.Value = "GBEN";
                    trade.GoverningLaw = governingLaw;
                }
                dataDocumentCt.Trade.Add(trade);
            }
            var party = new Tns.PartyCt();
            {
                party.Id = "partyA";
                party.PartyId.Value = "Party A";
                dataDocumentCt.Party.Add(party);
            }
            var party1 = new Tns.PartyCt();
            {
                party1.Id = "partyB";
                party1.PartyId.Value = "Party B";
                dataDocumentCt.Party.Add(party1);
            }
            dataDocumentCt.Version = Ns.VersionEnum.N4_0;


            var serializer = new LxSerializer<Tns.DataDocumentCt>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, dataDocumentCt);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml
 version="1.0"
 encoding="utf-8"?>
<!--
  == Copyright (c) 2002-2003. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/documents/license
  -->
<FpML
 version="4-0"
 xmlns="http://www.fpml.org/2003/FpML-4-0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.fpml.org/2003/FpML-4-0 ../fpml-main-4-0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"
 xsi:type="DataDocument">
<!-- Version 0.12, 24 Jan 2002 -->
<!-- fpml-4-0-eqd-gs-european-call-index.xml -->
<!-- Version 0.13, 28 Jan 2002 -->
<!-- 1. revised following updates to eqd DTD on 24 Jan 2002 -->
<!-- 2. update using FpML 2.0 LCWD samples as a template -->
<!-- Version 0.14, 29 Jan 2002 -->
<!-- 1. Confirm data population prior to distribution -->
<!-- MSDW confirm -->
<!-- AP Version 0.30 30 October 2002 -->
<!-- AP Version 0.31 01 November 2002 -->
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference
         href="partyA" />
        <tradeId
         tradeIdScheme="http://www.partyA.com/eqd-trade-id">1234</tradeId>
      </partyTradeIdentifier>
      <tradeDate>2000-06-28</tradeDate>
    </tradeHeader>
    <equityOption>
      <productType>europeanCallIndex</productType>
      <buyerPartyReference
       href="partyB" />
      <sellerPartyReference
       href="partyA" />
      <optionType>Call</optionType>
<!-- AP 18 Nov 02 move to underlyer
                        <underlying>
                                <description>NIKKEI 225 INDEX</description>
                                <instrumentId instrumentIdScheme="">.N225</instrumentId>
                                <exchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/ExchangeID">Tokyo Stock Exchange</exchangeId>
                                <relatedExchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/ExchangeID">Osaka Securities Exchange</relatedExchangeId>
                        </underlying>
                        -->
      <underlyer>
        <singleUnderlyer>
          <index>
            <instrumentId
             instrumentIdScheme="http://www.fpml.org/schemes/4.0/instrumentId">.N225</instrumentId>
            <description>NIKKEI 225 INDEX</description>
            <exchangeId
             exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">TSE</exchangeId>
            <relatedExchangeId
             exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">OSE</relatedExchangeId>
          </index>
          <openUnits>1</openUnits>
        </singleUnderlyer>
      </underlyer>
      <strike>
        <strikePrice>17475.90</strikePrice>
      </strike>
      <numberOfOptions>79.099093</numberOfOptions>
      <optionEntitlement>1.00</optionEntitlement>
      <equityExercise>
        <equityEuropeanExercise>
          <expirationDate>
            <adjustableDate>
              <unadjustedDate>2002-07-01</unadjustedDate>
              <dateAdjustments>
                <businessDayConvention>NONE</businessDayConvention>
              </dateAdjustments>
            </adjustableDate>
          </expirationDate>
          <equityExpirationTimeType>Close</equityExpirationTimeType>
        </equityEuropeanExercise>
        <automaticExerciseApplicable>true</automaticExerciseApplicable>
        <equityValuation>
          <valuationTimeType>Close</valuationTimeType>
        </equityValuation>
        <settlementCurrency>EUR</settlementCurrency>
<!-- settlementPriceSource made optional in the case of Asians. JS. 17/5/02 SCB+++ -->
<!-- Verify scheme name JS 17/5/02 -->
        <settlementType>Cash</settlementType>
        <failureToDeliverApplicable>true</failureToDeliverApplicable>
      </equityExercise>
      <fxFeature>
        <fxFeatureType>Composite</fxFeatureType>
      </fxFeature>
      <equityOptionFeatures>
        <asian>
<!-- Scheme name needs verification JS 17/5/02 SCB+++ -->
          <averagingInOut>In</averagingInOut>
          <averagingPeriodIn>
            <averagingDateTimes>
              <dateTime>2000-08-01T08:57:00-00:00</dateTime>
              <dateTime>2000-09-01T08:57:00-00:00</dateTime>
              <dateTime>2000-10-01T08:57:00-00:00</dateTime>
              <dateTime>2000-11-01T08:57:00-00:00</dateTime>
              <dateTime>2000-12-01T08:57:00-00:00</dateTime>
              <dateTime>2001-01-04T08:57:00-00:00</dateTime>
              <dateTime>2001-02-01T08:57:00-00:00</dateTime>
              <dateTime>2001-03-01T08:57:00-00:00</dateTime>
            </averagingDateTimes>
            <marketDisruption>ModifiedPostponement</marketDisruption>
          </averagingPeriodIn>
        </asian>
      </equityOptionFeatures>
      <equityPremium>
        <payerPartyReference
         href="partyB" />
        <receiverPartyReference
         href="partyA" />
        <paymentAmount>
          <currency>EUR</currency>
          <amount>107821.57</amount>
        </paymentAmount>
        <paymentDate>
          <unadjustedDate>2000-07-03</unadjustedDate>
          <dateAdjustments>
            <businessDayConvention>NONE</businessDayConvention>
          </dateAdjustments>
        </paymentDate>
        <pricePerOption>1363.1202</pricePerOption>
      </equityPremium>
      <methodOfAdjustment>CalculationAgent</methodOfAdjustment>
    </equityOption>
    <calculationAgent>
      <calculationAgentPartyReference
       href="partyA" />
    </calculationAgent>
    <documentation>
      <masterAgreement>
        <masterAgreementType>ISDA2002</masterAgreementType>
      </masterAgreement>
      <contractualDefinitions>ISDA2000</contractualDefinitions>
      <contractualDefinitions>ISDA1996Equity</contractualDefinitions>
    </documentation>
    <governingLaw>GBEN</governingLaw>
  </trade>
  <party
   id="partyA">
    <partyId>Party A</partyId>
  </party>
  <party
   id="partyB">
    <partyId>Party B</partyId>
  </party>
</FpML>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML40;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var dataDocumentCt = new Tns.DataDocumentCt();
            var trade = new Tns.TradeCt();
            {
                var partyTradeIdentifier = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier.PartyReference.Href = "partyA";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.partyA.com/eqd-trade-id";
                        tradeId.Value = "1234";
                        partyTradeIdentifier.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier);
                }
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2000, 6, 28, 0, 0, 0, 0, 0, 0, false);
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReference = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReference.Href = "partyA";
                        calculationAgent.CalculationAgentPartyReference.Add(calculationAgentPartyReference);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterAgreement = new Tns.MasterAgreementCt();
                        masterAgreement.MasterAgreementType.Value = "ISDA2002";
                        documentation.MasterAgreement = masterAgreement;
                    }
                    var contractualDefinitions = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions.Value = "ISDA2000";
                        documentation.ContractualDefinitions.Add(contractualDefinitions);
                    }
                    var contractualDefinitions1 = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions1.Value = "ISDA1996Equity";
                        documentation.ContractualDefinitions.Add(contractualDefinitions1);
                    }
                    trade.Documentation = documentation;
                }
                {
                    var governingLaw = new Tns.GoverningLawCt();
                    governingLaw.Value = "GBEN";
                    trade.GoverningLaw = governingLaw;
                }
                dataDocumentCt.Trade.Add(trade);
            }
            var party = new Tns.PartyCt();
            {
                party.Id = "partyA";
                party.PartyId.Value = "Party A";
                dataDocumentCt.Party.Add(party);
            }
            var party1 = new Tns.PartyCt();
            {
                party1.Id = "partyB";
                party1.PartyId.Value = "Party B";
                dataDocumentCt.Party.Add(party1);
            }
            dataDocumentCt.Version = Ns.VersionEnum.N4_0;


            var serializer = new LxSerializer<Tns.DataDocumentCt>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, dataDocumentCt);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0"?>
<FpML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="DataDocument" version="4-0" xmlns="http://www.fpml.org/2003/FpML-4-0">
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="partyA" />
        <tradeId tradeIdScheme="http://www.partyA.com/eqd-trade-id">1234</tradeId>
      </partyTradeIdentifier>
      <tradeDate>2000-06-28</tradeDate>
    </tradeHeader>
    <calculationAgent>
      <calculationAgentPartyReference href="partyA" />
    </calculationAgent>
    <documentation>
      <masterAgreement>
        <masterAgreementType>ISDA2002</masterAgreementType>
      </masterAgreement>
      <contractualDefinitions>ISDA2000</contractualDefinitions>
      <contractualDefinitions>ISDA1996Equity</contractualDefinitions>
    </documentation>
    <governingLaw>GBEN</governingLaw>
  </trade>
  <party id="partyA">
    <partyId>Party A</partyId>
  </party>
  <party id="partyB">
    <partyId>Party B</partyId>
  </party>
</FpML>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML40;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var dataDocumentCt = new Tns.DataDocumentCt();
            var trade = new Tns.TradeCt();
            {
                var partyTradeIdentifier = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier.PartyReference.Href = "PartyA";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.partyA.com/eqs-trade-id";
                        tradeId.Value = "1734";
                        partyTradeIdentifier.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier);
                }
                var partyTradeIdentifier1 = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier1.PartyReference.Href = "PartyB";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.partyB.com/eqs-trade-id";
                        tradeId.Value = "5648";
                        partyTradeIdentifier1.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier1);
                }
                trade.TradeHeader.TradeDate.Id = "TradeDate";
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2002, 7, 19, 0, 0, 0, 0, 0, 0, false);
                {
                    var product = new Tns.EquitySwapElm();
                    var equityLeg = new Tns.EquityLegCt();
                    {
                        equityLeg.PayerPartyReference.Href = "PartyA";
                        equityLeg.ReceiverPartyReference.Href = "PartyB";
                        equityLeg.EffectiveDate.Id = "EffectiveDate";
                        {
                            var relativeDate = new Tns.RelativeDateOffsetCt();
                            relativeDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            relativeDate.DateRelativeTo.Href = "TradeDate";
                            relativeDate.DayType = Tns.DayTypeEnumEnum.ExchangeBusiness;
                            relativeDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                            relativeDate.Period = Tns.PeriodEnumEnum.D;
                            equityLeg.EffectiveDate.RelativeDate = relativeDate;
                        }
                        equityLeg.TerminationDate.Id = "TerminationDate";
                        {
                            var relativeDate1 = new Tns.RelativeDateOffsetCt();
                            relativeDate1.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            relativeDate1.DateRelativeTo.Href = "FinalEquityPaymentDate";
                            relativeDate1.PeriodMultiplier = System.Numerics.BigInteger.Parse("0");
                            relativeDate1.Period = Tns.PeriodEnumEnum.D;
                            equityLeg.TerminationDate.RelativeDate = relativeDate1;
                        }
                        {
                            var basket = new Tns.BasketCt();
                            basket.OpenUnits = BigDecimal.Parse("1");
                            var basketConstituent = new Tns.BasketConstituentCt();
                            {
                                {
                                    var underlyingAsset = new Tns.IndexElm();
                                    var relatedExchangeId = new Tns.ExchangeIdCt();
                                    {
                                        relatedExchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                        relatedExchangeId.Value = "MATIF";
                                        underlyingAsset.RelatedExchangeId.Add(relatedExchangeId);
                                    }
                                    var relatedExchangeId1 = new Tns.ExchangeIdCt();
                                    {
                                        relatedExchangeId1.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                        relatedExchangeId1.Value = "MONEP";
                                        underlyingAsset.RelatedExchangeId.Add(relatedExchangeId1);
                                    }
                                    var instrumentId = new Tns.InstrumentIdCt();
                                    {
                                        instrumentId.InstrumentIdScheme = "RIC";
                                        instrumentId.Value = ".FCHI";
                                        underlyingAsset.InstrumentId.Add(instrumentId);
                                    }
                                    underlyingAsset.Description = "France CAC 40 Index";
                                    {
                                        var currency = new Tns.CurrencyCt();
                                        currency.Value = "EUR";
                                        underlyingAsset.Currency = currency;
                                    }
                                    {
                                        var exchangeId = new Tns.ExchangeIdCt();
                                        exchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                        exchangeId.Value = "EuroNext";
                                        underlyingAsset.ExchangeId = exchangeId;
                                    }
                                    basketConstituent.UnderlyingAsset = underlyingAsset;
                                }
                                {
                                    var constituentWeight = new Tns.ConstituentWeightCt();
                                    constituentWeight.OpenUnits = BigDecimal.Parse("960");
                                    basketConstituent.ConstituentWeight = constituentWeight;
                                }
                                basket.BasketConstituent.Add(basketConstituent);
                            }
                            var basketConstituent1 = new Tns.BasketConstituentCt();
                            {
                                {
                                    var underlyingAsset = new Tns.IndexElm();
                                    var relatedExchangeId = new Tns.ExchangeIdCt();
                                    {
                                        relatedExchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                        relatedExchangeId.Value = "MEFF";
                                        underlyingAsset.RelatedExchangeId.Add(relatedExchangeId);
                                    }
                                    var instrumentId = new Tns.InstrumentIdCt();
                                    {
                                        instrumentId.InstrumentIdScheme = "http://www.fpml.org/spec/2003/instrument-id-Reuters-RIC-1-0";
                                        instrumentId.Value = ".IBEX";
                                        underlyingAsset.InstrumentId.Add(instrumentId);
                                    }
                                    underlyingAsset.Description = "IBEX 35";
                                    {
                                        var currency = new Tns.CurrencyCt();
                                        currency.Value = "EUR";
                                        underlyingAsset.Currency = currency;
                                    }
                                    basketConstituent1.UnderlyingAsset = underlyingAsset;
                                }
                                {
                                    var constituentWeight = new Tns.ConstituentWeightCt();
                                    constituentWeight.OpenUnits = BigDecimal.Parse("260");
                                    basketConstituent1.ConstituentWeight = constituentWeight;
                                }
                                basket.BasketConstituent.Add(basketConstituent1);
                            }
                            var basketConstituent2 = new Tns.BasketConstituentCt();
                            {
                                {
                                    var underlyingAsset = new Tns.IndexElm();
                                    var instrumentId = new Tns.InstrumentIdCt();
                                    {
                                        instrumentId.InstrumentIdScheme = "http://www.fpml.org/spec/2003/instrument-id-Reuters-RIC-1-0";
                                        instrumentId.Value = ".HSI";
                                        underlyingAsset.InstrumentId.Add(instrumentId);
                                    }
                                    underlyingAsset.Description = "Hong Kong Hang Seng Index";
                                    {
                                        var currency = new Tns.CurrencyCt();
                                        currency.Value = "HKD";
                                        underlyingAsset.Currency = currency;
                                    }
                                    {
                                        var exchangeId = new Tns.ExchangeIdCt();
                                        exchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.0/exchangeId";
                                        exchangeId.Value = "Hong Kong Stock Exchange";
                                        underlyingAsset.ExchangeId = exchangeId;
                                    }
                                    basketConstituent2.UnderlyingAsset = underlyingAsset;
                                }
                                {
                                    var constituentWeight = new Tns.ConstituentWeightCt();
                                    constituentWeight.OpenUnits = BigDecimal.Parse("580");
                                    basketConstituent2.ConstituentWeight = constituentWeight;
                                }
                                basket.BasketConstituent.Add(basketConstituent2);
                            }
                            equityLeg.Underlyer.Basket = basket;
                        }
                        {
                            var netPrice = new Tns.ActualPriceCt();
                            {
                                var currency = new Tns.CurrencyCt();
                                currency.Value = "USD";
                                netPrice.Currency = currency;
                            }
                            netPrice.Amount = BigDecimal.Parse("5591987.41");
                            netPrice.PriceExpression = Tns.PriceExpressionEnumEnum.AbsoluteTerms;
                            equityLeg.Valuation.InitialPrice.NetPrice = netPrice;
                        }
                        equityLeg.Valuation.EquityNotionalReset = true;
                        {
                            var valuationPriceInterim = new Tns.EquitySwapValuationCt.ValuationPriceInterimElm();
                            valuationPriceInterim.ValuationTimeType = Tns.TimeTypeEnumEnum.Close;
                            valuationPriceInterim.EquityValuationDates.Id = "InterimValuationDate";
                            {
                                var adjustableDates = new Tns.AdjustableDatesCt();
                                var unadjustedDate = new Tns.AdjustableDatesCt.UnadjustedDateElm();
                                {
                                    unadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2002, 10, 21, 0, 0, 0, 0, 0, 0, false);
                                    adjustableDates.UnadjustedDate.Add(unadjustedDate);
                                }
                                var unadjustedDate1 = new Tns.AdjustableDatesCt.UnadjustedDateElm();
                                {
                                    unadjustedDate1.Value = new LxDateTime(LxDateTimeType.Date, 2003, 1, 20, 0, 0, 0, 0, 0, 0, false);
                                    adjustableDates.UnadjustedDate.Add(unadjustedDate1);
                                }
                                var unadjustedDate2 = new Tns.AdjustableDatesCt.UnadjustedDateElm();
                                {
                                    unadjustedDate2.Value = new LxDateTime(LxDateTimeType.Date, 2003, 4, 22, 0, 0, 0, 0, 0, 0, false);
                                    adjustableDates.UnadjustedDate.Add(unadjustedDate2);
                                }
                                adjustableDates.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                                valuationPriceInterim.EquityValuationDates.AdjustableDates = adjustableDates;
                            }
                            valuationPriceInterim.DeterminationMethod = "PublishedIndexAtValuationTime";
                            equityLeg.Valuation.ValuationPriceInterim = valuationPriceInterim;
                        }
                        equityLeg.Valuation.ValuationPriceFinal.EquityValuationDate.Id = "FinalValuationDate";
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2003, 7, 21, 0, 0, 0, 0, 0, 0, false);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            equityLeg.Valuation.ValuationPriceFinal.EquityValuationDate.AdjustableDate = adjustableDate;
                        }
                        equityLeg.Valuation.ValuationPriceFinal.DeterminationMethod = "HedgeUnwind";
                        equityLeg.Valuation.EquityPaymentDates.Id = "EquityPaymentDate";
                        {
                            var equityPaymentDatesInterim = new Tns.AdjustableOrRelativeDatesCt();
                            equityPaymentDatesInterim.Id = "InterimEquityPaymentDate";
                            {
                                var relativeDates = new Tns.RelativeDatesCt();
                                relativeDates.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                                {
                                    var businessCenters = new Tns.BusinessCentersCt();
                                    businessCenters.Id = "PrimaryBusinessCenter";
                                    var businessCenter = new Tns.BusinessCenterCt();
                                    {
                                        businessCenter.Value = "EUTA";
                                        businessCenters.BusinessCenter.Add(businessCenter);
                                    }
                                    var businessCenter1 = new Tns.BusinessCenterCt();
                                    {
                                        businessCenter1.Value = "HKHK";
                                        businessCenters.BusinessCenter.Add(businessCenter1);
                                    }
                                    relativeDates.BusinessCenters = businessCenters;
                                }
                                relativeDates.DateRelativeTo.Href = "InterimValuationDate";
                                relativeDates.DayType = Tns.DayTypeEnumEnum.CurrencyBusiness;
                                relativeDates.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                                relativeDates.Period = Tns.PeriodEnumEnum.D;
                                equityPaymentDatesInterim.RelativeDates = relativeDates;
                            }
                            equityLeg.Valuation.EquityPaymentDates.EquityPaymentDatesInterim = equityPaymentDatesInterim;
                        }
                        equityLeg.Valuation.EquityPaymentDates.EquityPaymentDateFinal.Id = "FinalEquityPaymentDate";
                        {
                            var relativeDate2 = new Tns.RelativeDateOffsetCt();
                            relativeDate2.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCentersReference = new Tns.BusinessCentersReferenceCt();
                                businessCentersReference.Href = "PrimaryBusinessCenter";
                                relativeDate2.BusinessCentersReference = businessCentersReference;
                            }
                            relativeDate2.DateRelativeTo.Href = "FinalValuationDate";
                            relativeDate2.DayType = Tns.DayTypeEnumEnum.CurrencyBusiness;
                            relativeDate2.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                            relativeDate2.Period = Tns.PeriodEnumEnum.D;
                            equityLeg.Valuation.EquityPaymentDates.EquityPaymentDateFinal.RelativeDate = relativeDate2;
                        }
                        equityLeg.Notional.Id = "EquityNotionalAmount";
                        {
                            var notionalAmount = new Tns.MoneyCt();
                            notionalAmount.Currency.Value = "USD";
                            notionalAmount.Amount = BigDecimal.Parse("5591987.41");
                            equityLeg.Notional.NotionalAmount = notionalAmount;
                        }
                        equityLeg.EquityAmount.CashSettlement = true;
                        equityLeg.EquityAmount.PaymentCurrency.Href = "ReferenceCurrency";
                        {
                            var referenceAmount = new Tns.LegAmountCt.ReferenceAmountElm();
                            referenceAmount.Value = "Standard ISDA";
                            equityLeg.EquityAmount.ReferenceAmount = referenceAmount;
                        }
                        equityLeg.Return_.ReturnType = Tns.ReturnTypeEnumEnum.Price;
                        equityLeg.NotionalAdjustments = Tns.NotionalAdjustmentEnumEnum.Standard;
                        {
                            var fxTerms = new Tns.EquityLegCt.FxTermsElm();
                            {
                                var quanto = new Tns.EquityLegCt.FxTermsElm.QuantoElm();
                                quanto.ReferenceCurrency.Id = "ReferenceCurrency";
                                quanto.ReferenceCurrency.Value = "USD";
                                var fxRate = new Tns.FxRateCt();
                                {
                                    fxRate.QuotedCurrencyPair.Currency1.Value = "USD";
                                    fxRate.QuotedCurrencyPair.Currency2.Value = "EUR";
                                    fxRate.QuotedCurrencyPair.QuoteBasis = Tns.QuoteBasisEnumEnum.Currency2PerCurrency1;
                                    fxRate.Rate = BigDecimal.Parse("0.9914");
                                    quanto.FxRate.Add(fxRate);
                                }
                                var fxRate1 = new Tns.FxRateCt();
                                {
                                    fxRate1.QuotedCurrencyPair.Currency1.Value = "USD";
                                    fxRate1.QuotedCurrencyPair.Currency2.Value = "HKD";
                                    fxRate1.QuotedCurrencyPair.QuoteBasis = Tns.QuoteBasisEnumEnum.Currency2PerCurrency1;
                                    fxRate1.Rate = BigDecimal.Parse("7.8");
                                    quanto.FxRate.Add(fxRate1);
                                }
                                fxTerms.Quanto = quanto;
                            }
                            equityLeg.FxTerms = fxTerms;
                        }
                        product.EquityLeg.Add(equityLeg);
                    }
                    var interestLeg = new Tns.InterestLegCt();
                    {
                        interestLeg.PayerPartyReference.Href = "PartyB";
                        interestLeg.ReceiverPartyReference.Href = "PartyA";
                        interestLeg.InterestLegCalculationPeriodDates.Id = "InterestLegPeriodDates";
                        {
                            var relativeDate = new Tns.RelativeDateOffsetCt();
                            relativeDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            relativeDate.DateRelativeTo.Href = "TradeDate";
                            relativeDate.DayType = Tns.DayTypeEnumEnum.ExchangeBusiness;
                            relativeDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                            relativeDate.Period = Tns.PeriodEnumEnum.D;
                            interestLeg.InterestLegCalculationPeriodDates.EffectiveDate.RelativeDate = relativeDate;
                        }
                        {
                            var relativeDate1 = new Tns.RelativeDateOffsetCt();
                            relativeDate1.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            relativeDate1.DateRelativeTo.Href = "FinalEquityPaymentDate";
                            relativeDate1.PeriodMultiplier = System.Numerics.BigInteger.Parse("0");
                            relativeDate1.Period = Tns.PeriodEnumEnum.D;
                            interestLeg.InterestLegCalculationPeriodDates.TerminationDate.RelativeDate = relativeDate1;
                        }
                        interestLeg.InterestLegCalculationPeriodDates.InterestLegResetDates.CalculationPeriodDatesReference.Href = "InterestLegPeriodDates";
                        interestLeg.InterestLegCalculationPeriodDates.InterestLegResetDates.ResetRelativeTo = Tns.ResetRelativeToEnumEnum.CalculationPeriodStartDate;
                        {
                            var relativeDates = new Tns.RelativeDatesCt();
                            relativeDates.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            relativeDates.DateRelativeTo.Href = "EquityPaymentDate";
                            relativeDates.PeriodMultiplier = System.Numerics.BigInteger.Parse("0");
                            relativeDates.Period = Tns.PeriodEnumEnum.D;
                            interestLeg.InterestLegCalculationPeriodDates.InterestLegPaymentDates.RelativeDates = relativeDates;
                        }
                        {
                            var amountRelativeTo = new Tns.AmountRelativeToCt();
                            amountRelativeTo.Href = "EquityNotionalAmount";
                            amountRelativeTo.Value = "";
                            interestLeg.Notional.AmountRelativeTo = amountRelativeTo;
                        }
                        interestLeg.InterestAmount.PaymentCurrency.Href = "ReferenceCurrency";
                        {
                            var referenceAmount = new Tns.LegAmountCt.ReferenceAmountElm();
                            referenceAmount.Value = "Standard ISDA";
                            interestLeg.InterestAmount.ReferenceAmount = referenceAmount;
                        }
                        {
                            var floatingRateCalculation = new Tns.FloatingRateCalculationCt();
                            floatingRateCalculation.FloatingRateIndex.Value = "USD-LIBOR-Telerate";
                            {
                                var indexTenor = new Tns.IntervalCt();
                                indexTenor.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                                indexTenor.Period = Tns.PeriodEnumEnum.M;
                                floatingRateCalculation.IndexTenor = indexTenor;
                            }
                            {
                                var spreadSchedule = new Tns.ScheduleCt();
                                spreadSchedule.InitialValue = BigDecimal.Parse("-0.0022");
                                floatingRateCalculation.SpreadSchedule = spreadSchedule;
                            }
                            interestLeg.InterestCalculation.FloatingRateCalculation = floatingRateCalculation;
                        }
                        interestLeg.InterestCalculation.DayCountFraction = Tns.DayCountFractionEnumEnum.ACT_360;
                        product.InterestLeg.Add(interestLeg);
                    }
                    {
                        var productType = new Tns.ProductTypeCt();
                        productType.Value = "IndexQuantoSwap";
                        product.ProductType = productType;
                    }
                    trade.Product = product;
                }
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReference = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReference.Href = "PartyA";
                        calculationAgent.CalculationAgentPartyReference.Add(calculationAgentPartyReference);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterAgreement = new Tns.MasterAgreementCt();
                        masterAgreement.MasterAgreementType.Value = "ISDA2002";
                        documentation.MasterAgreement = masterAgreement;
                    }
                    var contractualDefinitions = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions.Value = "ISDA2000";
                        documentation.ContractualDefinitions.Add(contractualDefinitions);
                    }
                    var contractualDefinitions1 = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions1.Value = "ISDA1996Equity";
                        documentation.ContractualDefinitions.Add(contractualDefinitions1);
                    }
                    trade.Documentation = documentation;
                }
                {
                    var governingLaw = new Tns.GoverningLawCt();
                    governingLaw.Value = "GBEN";
                    trade.GoverningLaw = governingLaw;
                }
                dataDocumentCt.Trade.Add(trade);
            }
            var party = new Tns.PartyCt();
            {
                party.Id = "PartyA";
                party.PartyId.Value = "Party A";
                dataDocumentCt.Party.Add(party);
            }
            var party1 = new Tns.PartyCt();
            {
                party1.Id = "PartyB";
                party1.PartyId.Value = "Party B";
                dataDocumentCt.Party.Add(party1);
            }
            dataDocumentCt.Version = Ns.VersionEnum.N4_0;


            var serializer = new LxSerializer<Tns.DataDocumentCt>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, dataDocumentCt);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid XML Objects - Registered to 'Test20130115 ' - https://www.liquid-technologies.com/xml-objects -->
<FpML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="DataDocument" version="4-0" xmlns="http://www.fpml.org/2003/FpML-4-0">
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="PartyA" />
        <tradeId tradeIdScheme="http://www.partyA.com/eqs-trade-id">1734</tradeId>
      </partyTradeIdentifier>
      <partyTradeIdentifier>
        <partyReference href="PartyB" />
        <tradeId tradeIdScheme="http://www.partyB.com/eqs-trade-id">5648</tradeId>
      </partyTradeIdentifier>
      <tradeDate id="TradeDate">2002-07-19</tradeDate>
    </tradeHeader>
    <equitySwap>
      <productType>IndexQuantoSwap</productType>
      <equityLeg>
        <payerPartyReference href="PartyA" />
        <receiverPartyReference href="PartyB" />
        <effectiveDate id="EffectiveDate">
          <relativeDate>
            <periodMultiplier>3</periodMultiplier>
            <period>D</period>
            <dayType>ExchangeBusiness</dayType>
            <businessDayConvention>NotApplicable</businessDayConvention>
            <dateRelativeTo href="TradeDate" />
          </relativeDate>
        </effectiveDate>
        <terminationDate id="TerminationDate">
          <relativeDate>
            <periodMultiplier>0</periodMultiplier>
            <period>D</period>
            <businessDayConvention>NotApplicable</businessDayConvention>
            <dateRelativeTo href="FinalEquityPaymentDate" />
          </relativeDate>
        </terminationDate>
        <underlyer>
          <basket>
            <openUnits>1</openUnits>
            <basketConstituent>
              <index>
                <instrumentId instrumentIdScheme="RIC">.FCHI</instrumentId>
                <description>France CAC 40 Index</description>
                <currency>EUR</currency>
                <exchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">EuroNext</exchangeId>
                <relatedExchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">MATIF</relatedExchangeId>
                <relatedExchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">MONEP</relatedExchangeId>
              </index>
              <constituentWeight>
                <openUnits>960</openUnits>
              </constituentWeight>
            </basketConstituent>
            <basketConstituent>
              <index>
                <instrumentId instrumentIdScheme="http://www.fpml.org/spec/2003/instrument-id-Reuters-RIC-1-0">.IBEX</instrumentId>
                <description>IBEX 35</description>
                <currency>EUR</currency>
                <relatedExchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">MEFF</relatedExchangeId>
              </index>
              <constituentWeight>
                <openUnits>260</openUnits>
              </constituentWeight>
            </basketConstituent>
            <basketConstituent>
              <index>
                <instrumentId instrumentIdScheme="http://www.fpml.org/spec/2003/instrument-id-Reuters-RIC-1-0">.HSI</instrumentId>
                <description>Hong Kong Hang Seng Index</description>
                <currency>HKD</currency>
                <exchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.0/exchangeId">Hong Kong Stock Exchange</exchangeId>
              </index>
              <constituentWeight>
                <openUnits>580</openUnits>
              </constituentWeight>
            </basketConstituent>
          </basket>
        </underlyer>
        <valuation>
          <initialPrice>
            <netPrice>
              <currency>USD</currency>
              <amount>5591987.41</amount>
              <priceExpression>AbsoluteTerms</priceExpression>
            </netPrice>
          </initialPrice>
          <equityNotionalReset>true</equityNotionalReset>
          <valuationPriceInterim>
            <determinationMethod>PublishedIndexAtValuationTime</determinationMethod>
            <valuationTimeType>Close</valuationTimeType>
            <equityValuationDates id="InterimValuationDate">
              <adjustableDates>
                <unadjustedDate>2002-10-21</unadjustedDate>
                <unadjustedDate>2003-01-20</unadjustedDate>
                <unadjustedDate>2003-04-22</unadjustedDate>
                <dateAdjustments>
                  <businessDayConvention>NotApplicable</businessDayConvention>
                </dateAdjustments>
              </adjustableDates>
            </equityValuationDates>
          </valuationPriceInterim>
          <valuationPriceFinal>
            <determinationMethod>HedgeUnwind</determinationMethod>
            <equityValuationDate id="FinalValuationDate">
              <adjustableDate>
                <unadjustedDate>2003-07-21</unadjustedDate>
                <dateAdjustments>
                  <businessDayConvention>NotApplicable</businessDayConvention>
                </dateAdjustments>
              </adjustableDate>
            </equityValuationDate>
          </valuationPriceFinal>
          <equityPaymentDates id="EquityPaymentDate">
            <equityPaymentDatesInterim id="InterimEquityPaymentDate">
              <relativeDates>
                <periodMultiplier>3</periodMultiplier>
                <period>D</period>
                <dayType>CurrencyBusiness</dayType>
                <businessDayConvention>FOLLOWING</businessDayConvention>
                <businessCenters id="PrimaryBusinessCenter">
                  <businessCenter>EUTA</businessCenter>
                  <businessCenter>HKHK</businessCenter>
                </businessCenters>
                <dateRelativeTo href="InterimValuationDate" />
              </relativeDates>
            </equityPaymentDatesInterim>
            <equityPaymentDateFinal id="FinalEquityPaymentDate">
              <relativeDate>
                <periodMultiplier>3</periodMultiplier>
                <period>D</period>
                <dayType>CurrencyBusiness</dayType>
                <businessDayConvention>FOLLOWING</businessDayConvention>
                <businessCentersReference href="PrimaryBusinessCenter" />
                <dateRelativeTo href="FinalValuationDate" />
              </relativeDate>
            </equityPaymentDateFinal>
          </equityPaymentDates>
        </valuation>
        <notional id="EquityNotionalAmount">
          <notionalAmount>
            <currency>USD</currency>
            <amount>5591987.41</amount>
          </notionalAmount>
        </notional>
        <equityAmount>
          <paymentCurrency href="ReferenceCurrency" />
          <referenceAmount>Standard ISDA</referenceAmount>
          <cashSettlement>true</cashSettlement>
        </equityAmount>
        <return>
          <returnType>Price</returnType>
        </return>
        <notionalAdjustments>Standard</notionalAdjustments>
        <fxTerms>
          <quanto>
            <referenceCurrency id="ReferenceCurrency">USD</referenceCurrency>
            <fxRate>
              <quotedCurrencyPair>
                <currency1>USD</currency1>
                <currency2>EUR</currency2>
                <quoteBasis>Currency2PerCurrency1</quoteBasis>
              </quotedCurrencyPair>
              <rate>0.9914</rate>
            </fxRate>
            <fxRate>
              <quotedCurrencyPair>
                <currency1>USD</currency1>
                <currency2>HKD</currency2>
                <quoteBasis>Currency2PerCurrency1</quoteBasis>
              </quotedCurrencyPair>
              <rate>7.8</rate>
            </fxRate>
          </quanto>
        </fxTerms>
      </equityLeg>
      <interestLeg>
        <payerPartyReference href="PartyB" />
        <receiverPartyReference href="PartyA" />
        <interestLegCalculationPeriodDates id="InterestLegPeriodDates">
          <effectiveDate>
            <relativeDate>
              <periodMultiplier>3</periodMultiplier>
              <period>D</period>
              <dayType>ExchangeBusiness</dayType>
              <businessDayConvention>NotApplicable</businessDayConvention>
              <dateRelativeTo href="TradeDate" />
            </relativeDate>
          </effectiveDate>
          <terminationDate>
            <relativeDate>
              <periodMultiplier>0</periodMultiplier>
              <period>D</period>
              <businessDayConvention>NotApplicable</businessDayConvention>
              <dateRelativeTo href="FinalEquityPaymentDate" />
            </relativeDate>
          </terminationDate>
          <interestLegResetDates>
            <calculationPeriodDatesReference href="InterestLegPeriodDates" />
            <resetRelativeTo>CalculationPeriodStartDate</resetRelativeTo>
          </interestLegResetDates>
          <interestLegPaymentDates>
            <relativeDates>
              <periodMultiplier>0</periodMultiplier>
              <period>D</period>
              <businessDayConvention>NotApplicable</businessDayConvention>
              <dateRelativeTo href="EquityPaymentDate" />
            </relativeDates>
          </interestLegPaymentDates>
        </interestLegCalculationPeriodDates>
        <notional>
          <amountRelativeTo href="EquityNotionalAmount"></amountRelativeTo>
        </notional>
        <interestAmount>
          <paymentCurrency href="ReferenceCurrency" />
          <referenceAmount>Standard ISDA</referenceAmount>
        </interestAmount>
        <interestCalculation>
          <floatingRateCalculation>
            <floatingRateIndex>USD-LIBOR-Telerate</floatingRateIndex>
            <indexTenor>
              <periodMultiplier>3</periodMultiplier>
              <period>M</period>
            </indexTenor>
            <spreadSchedule>
              <initialValue>-0.0022</initialValue>
            </spreadSchedule>
          </floatingRateCalculation>
          <dayCountFraction>ACT/360</dayCountFraction>
        </interestCalculation>
      </interestLeg>
    </equitySwap>
    <calculationAgent>
      <calculationAgentPartyReference href="PartyA" />
    </calculationAgent>
    <documentation>
      <masterAgreement>
        <masterAgreementType>ISDA2002</masterAgreementType>
      </masterAgreement>
      <contractualDefinitions>ISDA2000</contractualDefinitions>
      <contractualDefinitions>ISDA1996Equity</contractualDefinitions>
    </documentation>
    <governingLaw>GBEN</governingLaw>
  </trade>
  <party id="PartyA">
    <partyId>Party A</partyId>
  </party>
  <party id="PartyB">
    <partyId>Party B</partyId>
  </party>
</FpML>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML40;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var dataDocumentCt = new Tns.DataDocumentCt();
            var trade = new Tns.TradeCt();
            {
                var partyTradeIdentifier = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier.PartyReference.Href = "CITI";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.citi.com/fx/trade-id";
                        tradeId.Value = "CITI10014";
                        partyTradeIdentifier.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier);
                }
                var partyTradeIdentifier1 = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifier1.PartyReference.Href = "UBSW";
                    var tradeId = new Tns.TradeIdCt();
                    {
                        tradeId.TradeIdScheme = "http://www.ubsw.com/fx/trade-id";
                        tradeId.Value = "UBSW20014";
                        partyTradeIdentifier1.TradeId.Add(tradeId);
                    }
                    trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier1);
                }
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2001, 11, 12, 0, 0, 0, 0, 0, 0, false);
                {
                    var product = new Tns.FxDigitalOptionElm();
                    product.BuyerPartyReference.Href = "UBSW";
                    product.SellerPartyReference.Href = "CITI";
                    product.ExpiryDateTime.ExpiryDate = new LxDateTime(LxDateTimeType.Date, 2001, 11, 26, 0, 0, 0, 0, 0, 0, false);
                    product.ExpiryDateTime.ExpiryTime.HourMinuteTime = new LxDateTime(LxDateTimeType.Time, 0, 0, 0, 14, 0, 0, 0, 0, 0, false);
                    product.ExpiryDateTime.ExpiryTime.BusinessCenter.Value = "GBLO";
                    {
                        var cutName = new Tns.CutNameCt();
                        cutName.Value = "LONDON";
                        product.ExpiryDateTime.CutName = cutName;
                    }
                    var fxOptionPremium = new Tns.FXOptionPremiumCt();
                    {
                        fxOptionPremium.PayerPartyReference.Href = "UBSW";
                        fxOptionPremium.ReceiverPartyReference.Href = "CITI";
                        fxOptionPremium.PremiumAmount.Currency.Value = "GBP";
                        fxOptionPremium.PremiumAmount.Amount = BigDecimal.Parse("53000");
                        fxOptionPremium.PremiumSettlementDate = new LxDateTime(LxDateTimeType.Date, 2001, 11, 14, 0, 0, 0, 0, 0, 0, false);
                        product.FxOptionPremium.Add(fxOptionPremium);
                    }
                    product.ValueDate = new LxDateTime(LxDateTimeType.Date, 2001, 11, 28, 0, 0, 0, 0, 0, 0, false);
                    product.QuotedCurrencyPair.Currency1.Value = "GBP";
                    product.QuotedCurrencyPair.Currency2.Value = "USD";
                    product.QuotedCurrencyPair.QuoteBasis = Tns.QuoteBasisEnumEnum.Currency2PerCurrency1;
                    product.SpotRate = BigDecimal.Parse("1.48");
                    var fxEuropeanTrigger = new Tns.FXEuropeanTriggerCt();
                    {
                        fxEuropeanTrigger.TriggerCondition = Tns.TriggerConditionEnumEnum.Above;
                        fxEuropeanTrigger.QuotedCurrencyPair.Currency1.Value = "GBP";
                        fxEuropeanTrigger.QuotedCurrencyPair.Currency2.Value = "USD";
                        fxEuropeanTrigger.QuotedCurrencyPair.QuoteBasis = Tns.QuoteBasisEnumEnum.Currency2PerCurrency1;
                        fxEuropeanTrigger.TriggerRate = BigDecimal.Parse("1.48");
                        var informationSource = new Tns.InformationSourceCt();
                        {
                            informationSource.RateSource.Value = "Reuters";
                            {
                                var rateSourcePage = new Tns.RateSourcePageCt();
                                rateSourcePage.Value = "GBP=";
                                informationSource.RateSourcePage = rateSourcePage;
                            }
                            fxEuropeanTrigger.InformationSource.Add(informationSource);
                        }
                        product.FxEuropeanTrigger.Add(fxEuropeanTrigger);
                    }
                    product.TriggerPayout.PayoutStyle = Tns.PayoutEnumEnum.Immediate;
                    product.TriggerPayout.Currency.Value = "GBP";
                    product.TriggerPayout.Amount = BigDecimal.Parse("750000");
                    {
                        var productType = new Tns.ProductTypeCt();
                        productType.Value = "Euro Binary";
                        product.ProductType = productType;
                    }
                    trade.Product = product;
                }
                dataDocumentCt.Trade.Add(trade);
            }
            var party = new Tns.PartyCt();
            {
                party.Id = "CITI";
                party.PartyId.Value = "CITIUS33";
                dataDocumentCt.Party.Add(party);
            }
            var party1 = new Tns.PartyCt();
            {
                party1.Id = "UBSW";
                party1.PartyId.Value = "UBSWGB2L";
                dataDocumentCt.Party.Add(party1);
            }
            dataDocumentCt.Version = Ns.VersionEnum.N4_0;


            var serializer = new LxSerializer<Tns.DataDocumentCt>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, dataDocumentCt);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml
 version="1.0"
 encoding="utf-8"?>
<!--
  == Copyright (c) 2002-2003. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/documents/license
  -->
<!-- This example is an FX OTC Euro Binary Option
  == UBS buys a two week GBP/USD European binary option and pays a premium.
  == At expiry, if the spot rate is above the trigger rate, UBS receives a payout.
  -->
<FpML
 version="4-0"
 xsi:type="DataDocument"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.fpml.org/2003/FpML-4-0 ../fpml-main-4-0.xsd"
 xmlns="http://www.fpml.org/2003/FpML-4-0"
>
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference
         href="CITI" />
        <tradeId
         tradeIdScheme="http://www.citi.com/fx/trade-id">CITI10014</tradeId>
      </partyTradeIdentifier>
      <partyTradeIdentifier>
        <partyReference
         href="UBSW" />
        <tradeId
         tradeIdScheme="http://www.ubsw.com/fx/trade-id">UBSW20014</tradeId>
      </partyTradeIdentifier>
      <tradeDate>2001-11-12</tradeDate>
    </tradeHeader>
    <fxDigitalOption>
      <productType>Euro Binary</productType>
      <buyerPartyReference
       href="UBSW" />
      <sellerPartyReference
       href="CITI" />
      <expiryDateTime>
        <expiryDate>2001-11-26</expiryDate>
        <expiryTime>
          <hourMinuteTime>14:00:00</hourMinuteTime>
          <businessCenter>GBLO</businessCenter>
        </expiryTime>
        <cutName>LONDON</cutName>
      </expiryDateTime>
      <fxOptionPremium>
        <payerPartyReference
         href="UBSW" />
        <receiverPartyReference
         href="CITI" />
        <premiumAmount>
          <currency>GBP</currency>
          <amount>53000</amount>
        </premiumAmount>
        <premiumSettlementDate>2001-11-14</premiumSettlementDate>
      </fxOptionPremium>
      <valueDate>2001-11-28</valueDate>
      <quotedCurrencyPair>
        <currency1>GBP</currency1>
        <currency2>USD</currency2>
        <quoteBasis>Currency2PerCurrency1</quoteBasis>
      </quotedCurrencyPair>
      <spotRate>1.4800</spotRate>
      <fxEuropeanTrigger>
        <triggerCondition>Above</triggerCondition>
        <quotedCurrencyPair>
          <currency1>GBP</currency1>
          <currency2>USD</currency2>
          <quoteBasis>Currency2PerCurrency1</quoteBasis>
        </quotedCurrencyPair>
        <triggerRate>1.4800</triggerRate>
        <informationSource>
          <rateSource>Reuters</rateSource>
          <rateSourcePage>GBP=</rateSourcePage>
        </informationSource>
      </fxEuropeanTrigger>
      <triggerPayout>
        <currency>GBP</currency>
        <amount>750000</amount>
        <payoutStyle>Immediate</payoutStyle>
      </triggerPayout>
    </fxDigitalOption>
  </trade>
  <party
   id="CITI">
    <partyId>CITIUS33</partyId>
  </party>
  <party
   id="UBSW">
    <partyId>UBSWGB2L</partyId>
  </party>
</FpML>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML40;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var tradeConfirmedCt = new Tns.TradeConfirmedCt();
            var partyTradeIdentifier = new Tns.PartyTradeIdentifierCt();
            {
                partyTradeIdentifier.PartyReference.Href = "JPMC";
                var tradeId = new Tns.TradeIdCt();
                {
                    tradeId.TradeIdScheme = "http://www.jpmorgan.com/fpmltid";
                    tradeId.Value = "XYZ789";
                    partyTradeIdentifier.TradeId.Add(tradeId);
                }
                tradeConfirmedCt.Trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier);
            }
            var partyTradeIdentifier1 = new Tns.PartyTradeIdentifierCt();
            {
                partyTradeIdentifier1.PartyReference.Href = "UBSW";
                var tradeId = new Tns.TradeIdCt();
                {
                    tradeId.TradeIdScheme = "http://www.ubsw.com/fpmltid";
                    tradeId.Value = "FX1234";
                    partyTradeIdentifier1.TradeId.Add(tradeId);
                }
                tradeConfirmedCt.Trade.TradeHeader.PartyTradeIdentifier.Add(partyTradeIdentifier1);
            }
            tradeConfirmedCt.Trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2003, 4, 2, 0, 0, 0, 0, 0, 0, false);
            {
                var product = new Tns.FxSingleLegElm();
                product.ExchangedCurrency1.PayerPartyReference.Href = "UBSW";
                product.ExchangedCurrency1.ReceiverPartyReference.Href = "JPMC";
                product.ExchangedCurrency1.PaymentAmount.Currency.Value = "GBP";
                product.ExchangedCurrency1.PaymentAmount.Amount = BigDecimal.Parse("1000000");
                product.ExchangedCurrency2.PayerPartyReference.Href = "JPMC";
                product.ExchangedCurrency2.ReceiverPartyReference.Href = "UBSW";
                product.ExchangedCurrency2.PaymentAmount.Currency.Value = "USD";
                product.ExchangedCurrency2.PaymentAmount.Amount = BigDecimal.Parse("1520000");
                product.ValueDate = new LxDateTime(LxDateTimeType.Date, 2004, 4, 4, 0, 0, 0, 0, 0, 0, false);
                product.ExchangeRate.QuotedCurrencyPair.Currency1.Value = "GBP";
                product.ExchangeRate.QuotedCurrencyPair.Currency2.Value = "USD";
                product.ExchangeRate.QuotedCurrencyPair.QuoteBasis = Tns.QuoteBasisEnumEnum.Currency2PerCurrency1;
                product.ExchangeRate.Rate = BigDecimal.Parse("1.52");
                tradeConfirmedCt.Trade.Product = product;
            }
            var party = new Tns.PartyCt();
            {
                party.Id = "UBSW";
                party.PartyId.Value = "UBSW";
                tradeConfirmedCt.Party.Add(party);
            }
            var party1 = new Tns.PartyCt();
            {
                party1.Id = "JPMC";
                party1.PartyId.Value = "JPMC";
                tradeConfirmedCt.Party.Add(party1);
            }
            tradeConfirmedCt.Header.MessageId.MessageIdScheme = "http://www.example.com/messageId";
            tradeConfirmedCt.Header.MessageId.Value = "MS/2003/04/02/15-38";
            tradeConfirmedCt.Header.SentBy.Value = "MATCHSRV";
            var sendTo = new Tns.PartyIdCt();
            {
                sendTo.Value = "UBSW";
                tradeConfirmedCt.Header.SendTo.Add(sendTo);
            }
            tradeConfirmedCt.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2003, 4, 2, 15, 38, 0, 0, 0, 0, 0, 0);
            tradeConfirmedCt.Version = Ns.VersionEnum.N4_0;


            var serializer = new LxSerializer<Tns.TradeConfirmedCt>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, tradeConfirmedCt);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version = "1.0" encoding = "utf-8"?>

<!--
  == Copyright (c) 2002-2003. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/documents/license
  -->

<!--
  == This examples shows how to use the RequestTradeConfirmation type to initiate a
  == confirmation process.
  -->
<FpML version = "4-0" xsi:type = "TradeConfirmed" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.fpml.org/2003/FpML-4-0 ../fpml-main-4-0.xsd" xmlns = "http://www.fpml.org/2003/FpML-4-0">
	<header>
		<messageId messageIdScheme="http://www.example.com/messageId">MS/2003/04/02/15-38</messageId>
		<sentBy>MATCHSRV</sentBy>
		<sendTo>UBSW</sendTo>
		<creationTimestamp>2003-04-02T15:38:00-00:00</creationTimestamp>
	</header>
	<trade>
		<tradeHeader>
			<partyTradeIdentifier>
				<partyReference href = "JPMC"/>
				<tradeId tradeIdScheme = "http://www.jpmorgan.com/fpmltid">XYZ789</tradeId>
			</partyTradeIdentifier>
			<partyTradeIdentifier>
				<partyReference href = "UBSW"/>
				<tradeId tradeIdScheme = "http://www.ubsw.com/fpmltid">FX1234</tradeId>
			</partyTradeIdentifier>
			<tradeDate>2003-04-02</tradeDate>
		</tradeHeader>
		<fxSingleLeg>
			<exchangedCurrency1>
				<payerPartyReference href = "UBSW"/>
				<receiverPartyReference href = "JPMC"/>
				<paymentAmount>
					<currency>GBP</currency>
					<amount>1000000</amount>
				</paymentAmount>
			</exchangedCurrency1>
			<exchangedCurrency2>
				<payerPartyReference href = "JPMC"/>
				<receiverPartyReference href = "UBSW"/>
				<paymentAmount>
					<currency>USD</currency>
					<amount>1520000</amount>
				</paymentAmount>
			</exchangedCurrency2>
			<valueDate>2004-04-04</valueDate>
			<exchangeRate>
				<quotedCurrencyPair>
					<currency1>GBP</currency1>
					<currency2>USD</currency2>
					<quoteBasis>Currency2PerCurrency1</quoteBasis>
				</quotedCurrencyPair>
				<rate>1.52</rate>
			</exchangeRate>
		</fxSingleLeg>
	</trade>
	<party id = "UBSW">
		<partyId>UBSW</partyId>
	</party>
	<party id = "JPMC">
		<partyId>JPMC</partyId>
	</party>
</FpML>

Video Tutorial

This video tutorial demonstrates the basic usage of the XML Objects tool. It shows how to generated the code from an XML Schema, how to deserialize an XML document and then Serialize it back out.

Try all the features of Liquid Studio Download Free Trial Now