190 likes | 525 Views
FpML. The Financial Product Markup Language. FpML. XML language for representing derivatives Sponsored by ISDA (for OTC derivatives) Intended to support - communications within firms - communications between firms A quote that says it all:
E N D
FpML The Financial Product Markup Language MSCF/CMU
FpML • XML language for representing derivatives • Sponsored by ISDA (for OTC derivatives) • Intended to support - communications within firms - communications between firms • A quote that says it all: “We can write code to price and hedge a triple currency rainbow barrier option but we can’t check that a clerk entered a trade the right way around.” From a slide presentation by Brian Lynn (CTO of GemSoup ) MSCF/CMU
FpML • Defines XML representations for • interest rate derivatives • credit default swaps • most equity derivatives • most vanilla and exotic FX products • energy derivatives (under development) MSCF/CMU
Adoption? • An outsider looking in • The FpML Working group members are an impressive bunch (see www.fpml.org) • Names of adopters usually include: Bank of America, JPMorgan, Goldman Sachs, Barclays, AIG • Probably an uphill fight MSCF/CMU
Example Document FX Spot <?xml version = "1.0" encoding = "UTF-8"?> <!DOCTYPE FpML PUBLIC "-//FpML//DTD Financial product Markup Language 3-0//EN" "" > <FpML version = "3-0" currencySchemeDefault = " http://www.fpml.org/ext/iso4217" partyIdSchemeDefault = " http://www.fpml.org/ext/iso9362" quoteBasisSchemeDefault = " http://www.fpml.org/spec/2001/quote-basis-1-0"> <trade> <tradeHeader> <partyTradeIdentifier> <partyReference href = "#CITI "/> <tradeId tradeIdScheme = "http://www.citi.com/fx/trade-id ">CITI123</tradeId> </partyTradeIdentifier>
<partyTradeIdentifier> <partyReference href = "#BARC"/> <tradeId tradeIdScheme = "http://www.barclays.com/fx/trade-id ">BARC987</tradeId> </partyTradeIdentifier> <tradeDate>2001-10-23</tradeDate> </tradeHeader> <fxSingleLeg> <exchangedCurrency1> <payerPartyReference href = "#BARC"/> <receiverPartyReference href = "#CITI"/> <paymentAmount> <currency>GBP</currency> <amount>10000000</amount> </paymentAmount> </exchangedCurrency1> MSCF/CMU
<exchangedCurrency2> <payerPartyReference href = "#CITI"/> <receiverPartyReference href = "#BARC"/> <paymentAmount> <currency>USD</currency> <amount>14800000</amount> </paymentAmount> </exchangedCurrency2> <valueDate>2001-10-25</valueDate> <exchangeRate> <quotedCurrencyPair> <currency1>GBP</currency1> <currency2>USD</currency2> <quoteBasis>CURRENCY2PERCURRENCY1</quoteBasis> </quotedCurrencyPair> <rate>1.48</rate> </exchangeRate> </fxSingleLeg> </trade> MSCF/CMU
<party id = "CITI"> <partyId>CITIUS33</partyId> </party> <party id = "BARC"> <partyId>BARCGB2L</partyId> </party> </FpML> MSCF/CMU
A C# Program that reads FpML // Reading an FpML file using System.Xml; using System.IO; using System; class XmlDemo { static void displayPayment(XmlElement pay) { Console.WriteLine("Payment"); XmlElement ccy = (XmlElement)pay.FirstChild; XmlText t = (XmlText)ccy.FirstChild; Console.WriteLine("Currency: " + t.Value); XmlElement val = (XmlElement)ccy.NextSibling; XmlText v = (XmlText)val.FirstChild; Console.WriteLine("Amount: " + v.Value); } MSCF/CMU
static void Main() { XmlTextReader reader = new XmlTextReader("fx_example_01.xml"); // build an empty DOM tree XmlDocument doc = new XmlDocument(); // load the tree from a string doc.Load(reader); // get the root of the xml XmlElement root = doc.DocumentElement; // write its value Console.WriteLine(root.Name); MSCF/CMU
XmlNodeList nl = root.GetElementsByTagName("paymentAmount"); XmlElement payment1 = (XmlElement)(nl[0]); XmlElement payment2 = (XmlElement)(nl[1]); displayPayment(payment1); displayPayment(payment2); } } MSCF/CMU
Output D:\McCarthy\www\46-690\examples\fpmlreader>XmlURLDemo.exe FpML Payment Currency: GBP Amount: 10000000 Payment Currency: USD Amount: 14800000 MSCF/CMU
An FpML Web Service using System; using System.Web.Services; using System.Xml; namespace handlefpml { [WebService(Namespace="http://localhost/AnFpMLService/")] public class FPMLWebService : System.Web.Services.WebService { [WebMethod] public double GetExchangeRate(XmlElement root) { XmlNodeList nl = root.GetElementsByTagName("paymentAmount"); XmlElement payment1 = (XmlElement)(nl[0]); XmlElement payment2 = (XmlElement)(nl[1]); // Server side code // Pass the document as a parameter MSCF/CMU
XmlElement ccy1 = (XmlElement)payment1.FirstChild; XmlElement val1 = (XmlElement)ccy1.NextSibling; XmlText v1 = (XmlText)val1.FirstChild; double amt1 = double.Parse(v1.Value); XmlElement ccy2 = (XmlElement)payment2.FirstChild; XmlElement val2 = (XmlElement)ccy2.NextSibling; XmlText v2 = (XmlText)val2.FirstChild; double amt2 = double.Parse(v2.Value); return amt2 / amt1; } } } MSCF/CMU
FpML Web Service Client // The FpML document is on the client. // It is passed to the web // service on the server. // Read an FpML file // Pass it to a web service using System.Xml; using System.IO; using System; class WebServiceClient { static void Main() { XmlTextReader reader = new XmlTextReader("fx_example_01.xml"); // build an empty DOM tree XmlDocument doc = new XmlDocument(); MSCF/CMU
// load the tree from a string doc.Load(reader); Console.WriteLine("Document loaded"); // get access to the proxy (generated from wsdl) FPMLWebService ws = new FPMLWebService(); Console.WriteLine("Making remote call"); Double d = ws.GetExchangeRate(doc.DocumentElement); Console.WriteLine("Rate = " + d); } } MSCF/CMU
Output D:\McCarthy\www\46-690\examples\fpmlwebservice\client>WebServiceClient.exe Document loaded Making remote call Rate = 1.48 MSCF/CMU
Some FpML Tools • GemScribe – FpML Editing and viewing • GemDelta is a tool for matching and comparing FpML documents • GemVault – for storing and retrieving FpML documents • Gem Soup Tools for FpML/Spreadsheet integration • The FpML Version 4 user’s guide (fpml.org) • SystemWire Validation tools MSCF/CMU