Systems that hand price and risk calculations to a pricing library need a link that passes trade and market data in and brings the results back. Systems staff deal with this link when they decide the format of the data passed in, how pricing engines are chosen, and how library versions are replaced.
Key points
- Converting trade data can introduce errors, such as swapped pay directions, that still pass format validation.
- Separating products from pricing engines and choosing the engine by configuration lets you change the model without changing the trade data.
- When the library is called as a service, processes are kept as stateless as possible, and state is managed by external databases or similar services.
- If failed trades are replaced with zero-value trades, the total value alone does not reveal the failures.
- Library versions and settings can change a trade's value, so change them under change control and, for material model changes, compare before-and-after outputs with actual outcomes.
What a pricing library covers
A pricing library is a program component that calculates the mark-to-market value, future cash flows, and sensitivities from the terms of a product and market data. Financial institutions use models and products bought from outside vendors as well as models they develop in house1. Publicly available libraries include QuantLib, Strata, and ORE234.
The inputs passed to a library are not limited to the trade terms. The documentation of publicly available libraries shows the following types of input536.
| Input type | Content |
|---|---|
| Trade terms | The dates, currencies, amounts, indexes, and other terms of each trade |
| Market data | A list of market values at a point in time |
| Rate fixing history | Past published values of indexes |
| Reference data | Holiday calendars and security information |
| Curve construction | Which market values are used to build which curves |
| Market conventions | The conventions for each market data point |
| Choice of pricing methods | The calculation method used for each product |
Values and sensitivities are calculated trade by trade, but some analyses, such as XVA, group trades by netting set before calculating7. For these analyses, the library also receives the netting set each trade belongs to, along with the trade terms.
How market data is collected and checked is covered on the Market Data Management page.
From trade data to a form for pricing
Trade data held in a trading system is converted into the form the library calculates with before it is passed in. Trade data can be thought of in two forms: one stored long term in a database, and one created temporarily for pricing3.
Common fields and product-specific terms
The CDM (Common Domain Model), a trade data format published by FINOS, places the product, the price and quantity, and the two counterparties as fields common to every trade. It keeps the other economic terms in the product8. The trade ID and trade date sit on the trade, and the trade's fields incorporate elements of the FpML confirmation format9.
In the CDM, product terms are expressed by combining components (Payouts) that represent promises of future payments, and an interest rate swap combines two interest rate Payouts. Every Payout carries a direction that shows which party pays and which receives10.
How libraries accept trades
Publicly available libraries differ in the form in which they accept trades and in how they convert them before pricing.
| Library | Form accepted | Conversion before pricing |
|---|---|---|
| QuantLib | Product objects | A component that calculates the price (a pricing engine) is set on the product object2 |
| Strata | Trade and product objects in storage form | Mainly holiday calendars and securities are looked up in reference data to create a temporary form for pricing (the "resolved" form)3 |
| ORE | Trade XML (which can be validated in advance against a schema for each product) | Trades are loaded, the curves needed for pricing are built, and models are calibrated to the market7 |
Mapping Bank O's interest rate swap
Consider a hypothetical example in which Bank O enters into a yen interest rate swap with a corporate client (notional amount 10 billion yen, 5-year term, fixed rate 1%), with Bank O paying the fixed rate. When the trading system's fields are moved into the library's input, they map as follows891011.
| Trading system field | Location in the library's input |
|---|---|
| Trade number | Trade ID on the trade |
| Counterparty | Counterparty in the common fields |
| Fixed leg and floating leg | Two legs in the product-specific terms |
| Pay or receive | Pay direction for each leg |
| Currency, notional, day count convention, payment dates | Currency, notional, day count convention, and schedule for each leg |
The pay direction of each leg takes one of two values, pay or receive1110. If the pay directions of Bank O's fixed and floating legs are swapped, both values are still valid in format, so the trade passes format validation. If the trade's value from Bank O's side is +20 million yen, the trade with swapped directions shows −20 million yen, a difference of 40 million yen.
Separating products and pricing engines
A pricing engine is the component that takes the terms of a product and calculates its price and other results. If the component that represents the product terms is kept separate from the pricing engine, you can pair the same product with a different engine and change the pricing method without changing the trade terms2. Which calculation method to use for which product can also be held as configuration separate from the trade data6.
Among publicly available libraries, QuantLib uses separate classes for products (Instrument) and pricing engines (PricingEngine)2. QuantLib's pricing engines share a common interface for receiving arguments, performing the calculation, and returning results12.
Strata's product classes hold only data, and separate components handle pricing and risk calculations3. Strata's calculation rules consist of three things: which calculation function to use, which currency to report in, and which market data to use6.
Three ways to call the library
Ways of calling a library fall into three types: embedded, where the library is used directly within the same program; batch, where a set of inputs is processed in one run; and service, where pricing is requested over a network.
| Style | How it is called | How state is held |
|---|---|---|
| Embedded | The calling program uses the library's product and pricing engine objects directly | State can be held inside the calling program. In QuantLib, objects keep the results of earlier calculations and recalculate when their inputs change2 |
| Batch | A set of inputs is passed in and run, and the results come back together | The design can read the inputs again on each run. In ORE, a file listing the locations of the inputs is passed in, and the results are written to report files5 |
| Service | Pricing is requested over a network | Processes are kept as stateless as possible13 |
In the service style, several copies of the same process run side by side, and each incoming request is routed to one of them. If a process keeps state locally, that state is not available when a follow-up request is routed to a different process14. Processes are built on the assumption that they will stop and recover, and state is managed by external services such as databases and caches13. Unlike the embedded style, a pricing service cannot assume that curves it has built stay in the process for the next request. It fetches the data each request needs from external stores.
Figure description
The figure shows the order in which a single pricing request is processed among four parties: the requesting system, the pricing service (Price service in the figure), the store of input data, and the store of result data. When the requester sends a request, the pricing service fetches the trades, market data, reference data, and configuration from the input data store, converts the trades into a form for pricing, and prices them. It sends the results to the result data store for storage, and finally the pricing service replies to the requester. The requester collects the results from the result data store. Because both inputs and results are exchanged with external stores, no state remains inside the pricing service from one request to the next. This is one example of a setup, not a standard sequence.
Passing results and handling failed trades
Results come back as a table by trade, and the handling of input errors and failed trades needs to be decided in advance. The table can have trades as rows and the requested measures as columns. Nested values, such as values by scenario or sensitivities to several curves, do not suit reports as they are. The design can convert them at the reporting stage into tables suited to on-screen lists or CSV files. Strata returns calculation results as a table with trades as rows and measures as columns, and in scenario calculations each cell holds one value per scenario6.
Finding errors in inputs and handoffs
If the step that builds market data is separated from the step that runs the calculations, you can examine the built market data and find errors before a long calculation. The design can also work out the required market data in advance from the trades, the requested measures, and the calculation rules. Strata separates these two steps6.
The handoff of trade data is also subject to checks. The 2011 US supervisory guidance on counterparty credit risk (revised in June 2026) lists the transfer of information from the systems that record trades to the systems that measure exposure as a subject of quality control. Another practice in the guidance is to reconcile the measured data with the institution's official books and records15.
Stopping, skipping, or replacing with zero
There are three possible policies for trades that fail conversion or pricing: stop the whole process, skip the failed trades and continue, or replace the failed trades with zero-value trades. ORE, a publicly available library, lets you choose any of the three by configuration and stops by default16.
Under the stop policy, a single error means no results for the whole run. Under the skip and zero-replacement policies, results come out, but the values of the failed trades are missing from the total. With zero replacement, the trade count stays complete while zeros enter the total, so the total value alone does not reveal the failures.
One of the practices in the same guidance is to include all trades at every stage of exposure aggregation17. When failed trades are skipped or replaced with zero, their values are left out of the aggregation.
For systems professionals: Finding failed trades and conversion errors
If the trades sent to the library are matched against the trades returned in the results by trade ID, trades with no result can be found. Under the policy that replaces failed trades with zero-value trades, the replacement trades can be marked so that they are identifiable as failures. That mark is then used to pick them out of the results and route them, together with the library's log, to the person responsible. Errors that pass format validation, such as swapped pay directions on the legs, are easier to find by comparing the direction and total of each leg's cash flows before and after conversion.
Library versions and change control
Model risk management also applies to libraries bought from outside vendors. The US SR 26-2 guidance of April 2026 notes that the code and data inside an outside product may not be available, and states that the principles of model risk management still apply. When an institution modifies such a product for its own business, the guidance treats documenting the changes, explaining the reasons, and assessing them in validation as sound practice1.
The UK PRA's SS1/23 (May 2023) also expects firms to validate how they use outside products and to monitor their performance against their own outcomes18.
Comparing outputs before changing versions or settings
Some publicly available libraries are distributed with the versions of the libraries they depend on bundled in, and in that case upgrading the library also changes the versions of those dependencies19. Changing a library version or calculation setting can change the value of the same trade. In QuantLib, a compile-time setting determines the default method for building floating rate coupons. Under some methods, the period behind the coupon rate differs from the index period, so the coupon rate of the same trade can change slightly2021.
PRA SS1/23 expects the information systems that run models to be sufficiently tested for their purpose and subject to rigorous quality control and change control22. For material model changes, one of the practices it lists is a test that compares outputs before and after the change with actual outcomes23.
Control over model changes
One of the practices in the 2003 US examination manual is to make model changes in a controlled environment. Changes are either made or verified by a control function, and the control function keeps copies of the models used by traders. When a spreadsheet model is moved to a mainframe model, the model is reviewed and the resulting changes in valuation are monitored24. Model validation and approval are covered on the Model Risk Management: SR 26-2 and the JFSA Principles page.
For systems professionals: Attaching versions to results
If each valuation result is stored with the library version, the version of the pricing engine configuration file, and the as-of date of the market data, the calculation can be rerun later under the same conditions. When upgrading the library, price the same list of trades with the old and new versions, list the trade-level differences in values and cash flows, and confirm the reasons for the differences before switching.
Notes
-
Board of Governors of the Federal Reserve System, FDIC, and OCC, "Revised Guidance on Model Risk Management" (external site) (attachment to SR 26-2, April 17, 2026), "VII. Vendor and Other Third-Party Products" (pages 11–12). ↩ ↩2
-
QuantLib, "Instrument Class Reference" (external site) (Reference manual version 1.44), Public Member Functions (NPV and setPricingEngine) and the description of calculate. ↩ ↩2 ↩3 ↩4 ↩5
-
OpenGamma, "Strata Documentation: Product Model" (external site), the opening section, "Concepts," and "Resolved form." ↩ ↩2 ↩3 ↩4 ↩5
-
LSEG, "ORE User Guide" (external site) (August 2026; the "ORE user guide"), chapter 1 "Introduction," page 9. ↩
-
The ORE user guide (external site), chapter 4 "Examples," Table 4 "ORE input files" and Table 5 "ORE output files" (page 25). ↩ ↩2
-
OpenGamma, "Strata Documentation: Calculation Flow" (external site), "Calculation setup," "Market data building," "Calculation runner," and "Report runner." ↩ ↩2 ↩3 ↩4 ↩5
-
The ORE user guide (external site), chapter 2 "ORE Data Flow," pages 14–15. ↩ ↩2
-
FINOS, "Product Model" (external site) (CDM 7.0.0; the "CDM Product Model"), "Tradable Product" and "Counterparty." ↩ ↩2
-
FINOS, "Event Model" (external site) (CDM 7.0.0), the definition of Trade and its notes. ↩ ↩2
-
The CDM Product Model (external site), the opening description and "Payout" (payerReceiver in PayoutBase). ↩ ↩2 ↩3
-
OpenGamma, "Strata Documentation: Swap" (external site), "Product model" (payReceive, accrualSchedule, paymentSchedule, notionalSchedule, and calculation in RateCalculationSwapLeg). ↩ ↩2
-
QuantLib, "PricingEngine Class Reference" (external site) (Reference manual version 1.44), Public Member Functions (getArguments, calculate, and getResults). ↩
-
National Institute of Standards and Technology, "Security Strategies for Microservices-based Application Systems" (external site) (NIST SP 800-204, August 2019), section 2.2 "Microservices: Design Principles" (pages 3–4). ↩ ↩2
-
The same document (external site), section 4.6 "Integrity Assurance Strategies," "Session persistence" (page 25). ↩
-
Office of the Comptroller of the Currency and others, "Interagency Supervisory Guidance on Counterparty Credit Risk Management" (external site) (June 2011, revised June 2026; the "US CCR Guidance"), section IV (pages 11–12). ↩
-
The ORE user guide (external site), section 5.1 "Analytics: ore.xml," "Setup" (page 91). ↩
-
The US CCR Guidance (external site), section III.2 "Aggregation of Exposures" (page 5). ↩
-
Prudential Regulation Authority, "Model risk management principles for banks" (external site) (SS1/23, May 2023; the "PRA SS1/23"), Principle 2.6 (page 19 of the PDF). ↩
-
The ORE user guide (external site), section 3.1 "ORE Releases," the note on page 16. ↩
-
QuantLib, "ql/cashflows/iborcoupon.hpp" (external site), the descriptions of IborCoupon::Settings, fixingEndDate, and spanningTime. ↩
-
The ORE user guide (external site), section 5.1.2 "Pricing, Cashflows, Curves," page 94 (the explanation after Table 13). ↩
-
The PRA SS1/23 (external site), Principle 3.6 (page 24 of the PDF). ↩
-
The PRA SS1/23 (external site), Principle 3.3 (c) (page 22 of the PDF). ↩
-
Board of Governors of the Federal Reserve System, "Trading and Capital-Markets Activities Manual" (external site), Section 2100.1 "Financial Performance" (April 2003), pages 5–6. ↩