Margin Optimization Service Over API User Guide

Margin Optimization Service Over API User Guide

This topic provides guidance for firms participating in the CME Group portfolio margin of interest rate swaps/futures program to migrate to a CME-hosted Optimization model.

This topic covers high level impacts to assist users in understanding and scheduling system changes.

Contents

Portfolio Margin Program and Hosted Optimization

The portfolio margin program is designed to provide margin efficiencies across a single legal entity by identifying listed interest rate products that can offset cleared swap IRS market risk. The program aims to reduce the combined risk of the segregated and cleared swaps account.

Running the Optimizer software is the mechanism clearing firms use to optimize portfolio risk. Prior to 2025, all participating Clearing Members used the CME Group Optimizer software installed in their infrastructure. Optimizer software evaluates the ideal allocation of interest rate futures and options to transfer between segregated and OTC accounts to provide margin efficiencies. As an output, Optimizer generates transfers, each having two sides (buy and sell) which are booked at CME Group using standard Clearing Firm message queue setup.

Additional program details are available in https://cmegroupclientsite.atlassian.net/wiki/spaces/EPICSANDBOX/pages/457414974.

Hosted Optimization

To alleviate operational burdens and improve efficiency, CME Group offers an optimization mechanism that is hosted on CME Group infrastructure and available to users exclusively over the CME CORE API Service. This new service continues to leverage the capabilities available in the Optimizer software, but is available over the CME CORE API, a web-based API accessible over the internet.

Impacted Systems and Processes

The following changes are relevant to Clearing Members who choose to participate in the Portfolio Margin program.

System or Process

Changes in Scope?

Impact Details

System or Process

Changes in Scope?

Impact Details

Interface

Y

  • Decommission Optimizer software.

  • API interface mandatory for portfolio margin program participation in 2025. API interface details below.

Operational Workflow

Y

  • Users migrate from integrating with optimization software hosted on their infrastructure to an API where the optimization capabilities are hosted by CME Group.

  • Users can continue to process Optimization during their EOD process with upgrades to connect with new CORE endpoints to achieve Optimization. API interface workflow details below.

Input Files

Y

  • Positions and Configuration data continue to be required, but passed in an XML-wrapped request to hosted optimizer endpoints. Users should modify any processes that store or parse Optimizer software inputs to pass these to the hosted Optimization API.

  • Market data and IRS account data are no longer required and firms can decommission their file pull requests and storage mechanisms for those files. Input examples are below.

Data File Publication (from CME)

Y

  • Users are no longer required to pull down any data file from CME Group as part of the optimization process.

  • CME Group may decommission the secure FTP publication of some Optimizer input files following the successful migration of all users to hosted Optimizer service. This would be communicated via normal clearing advisory means.

Output Files

Y

  • FIXML and CSV transfer, and estimated savings data are produced and users interact with these via new optimize reports endpoints. Users should modify any processes that store or parse Optimizer software outputs and modify these to read results from the hosted Optimization API.

  • Furthermore, users may either leverage the optimizer API to accept or reject the optimization proposal and have CME Group update the clearing system. Alternatively, users can process the transfer records the same way they have historically to update the clearing system. 

  • The data format is changing to align with the API structure. Output report examples are below.

Post-trade Activities and Reports

N

  • Operational post-trade activities like exercise and assignment and deliveries are not impacted by the hosted Optimization service.

  • Reporting, like position change (PCS) and customer gross margin (CGM) are not impacted by the hosted Optimization service.

EOD Clearing timeline

N

User Entitlements and Onboarding

Hosted Optimization requires new entitlements to ensure only authorized users are able to interact with cleared Optimization workflows. Authorization occurs at the user, firm and margin account level. Users need to set up a service account with an API ID that are entitled to the new workflow.

Service Account Creation and Entitlement Process

  1. Create an Account (If Applicable): If you don’t already have an account, please register.

  2. Generate an API ID: Go to My Profile > My Account > APIs, then create and claim an API ID under Auth Type=”Basic Auth.”

    1. The API ID used for the Margin Optimization Service must be dedicated solely to the new workflow. Users with an existing API ID should create a new one for this purpose.

  3. Submit the Request Form: Complete the request form available here and enter your newly created API ID. Ensure you select “Submit” to initiate the entitlement workflow at CME Group.

  4. Verification Process: The Enterprise Application and System Entitlements (EASE) team contacts your firm’s designated CME ClearPort Verification Officer to confirm access authorization for clearing data usage in the service.

  5. Onboarding Completion: Upon successful verification, the CME Group post trade services team reaches out to finalize the onboarding process. As part of this process, they ensure the API ID is entitled to the CORE API, which is a mandatory general authorization step.

Non-authorized users receive an authorized error with the code 401 or 403 if attempting to interact with Optimization workflows. See Error Handling.

When testing, please note authentication and entitlement follows the same Basic Auth pattern as the CME CORE existing API, which is described in https://cmegroupclientsite.atlassian.net/wiki/spaces/EPICSANDBOX/pages/457417258.

API URL

The Optimization service utilizes the CME CORE post trade URLs. 

Test Environment:

https://posttrade.api.uat.cmegroup.com/MarginServiceApi/

After testing is completed, please contact the CME post trade service team for the production environment URL.

Service endpoints are described in the User Interface section.

Testing Expectations

  • UT environment testing (expected testing: functional):

    • Testing may be available for a limited set of available dates and cycles. Users can interact with the ‘status’ endpoint, described below, which provides detail on which dates and cycles are available for Optimization. Users may experience errors when submitting requests for dates and cycles that are not available.

    • The UT environment is not a production copy. This is important because the service performs account validation from UT environment data and flags accounts as invalid that are not set up in the test environment or have no IRS trades in the test environment. It is recommended that users build their positions data with test accounts matching CME Group test accounts. If that is not possible, please work with posttradeservices@cmegroup.com to ensure there are accounts enabled in the UT environment that match production identifiers and, as needed, contain IRS trades to limit account validation errors. Please request a maximum of five new test accounts.

    • The UT environment is not expected to be used for number matching against the deployable Optimizer software in production. Please see production environment testing below.

    • The UT environment is expected to be the sole environment for testing the ‘accept transfers’ endpoint (see below) since this workflow pushes live transfer records to the clearing system. All other upstream workflows prior to the transfers endpoint can also be tested in production--see production environment testing below.

  • Production environment testing (expected testing: number matching):

    • Users can interact with the production environment for testing by simply eliminating the ‘accept transfers’ endpoint portion of the workflow - all upstream endpoints can be used for informational or testing purposes and do not impact cleared trades. This is consistent with legacy testing of the deployable Optimizer software where it was recommended to test with a combination of test and production inputs, depending on the use case and scope of release.

    • The production environment should be used for number matching against the deployable Optimizer software. UT environment data is independently produced and not validated against production, making it an unsuitable alternative. If number matching is only allowable in the UT environment, please validate against the UT environment IRSMR3 margin report or a run of deployable Optimizer with only test environment data to ensure consistency.

Expected Inputs

Input File Name - Current State Workflow (Optimizer Software)

Business Description

Input - Future State Workflow (Hosted Optimizer service)

Required, Optional or Deprecated in Hosted Optimizer Service

Default Behavior, if Optional

Input File Name - Current State Workflow (Optimizer Software)

Business Description

Input - Future State Workflow (Hosted Optimizer service)

Required, Optional or Deprecated in Hosted Optimizer Service

Default Behavior, if Optional

configuration.json

Optimizer Configuration File

Configuration JSON payload

See Hosted Optimization User Workflow Examples.

Optional

Default Configuration is applied.

Positions.csv

Positions CSV file
Contains futures and options positions in users' futures and options (SEG) or Portfolio Margin (PM) account.

Positions CSV payload

See Hosted Optimization User Workflow Examples.

Please note a header is required in this payload in the API request.

Required

 

FICCPositions.csv

Positions CSV file
Contains futures and options positions in users' FICC Cross-margin account account.

See specifications for FICC Positions file.

See Hosted Optimization User Workflow Examples.

Conditional

Required if configuration.json file FICCEnabled config is “true.”

Else, file is not required.

 

XMFICCPOSN_EOD . . .csv

Equivalent Positions Report

N/A

Deprecated*

 

IRSPNL . . . *

IRS PNL File

N/A

Deprecated*

 

cust.spn*

SPAN(R) Risk Parameter file

N/A

Deprecated*

 

cme.optimizer**

Optimizer Market Data Archive (ZIP file)

N/A

Deprecated**

 

IRSGammaLadder**

IRS Gamma Ladder

N/A

Deprecated**

 

IRSVegaLadder**

IRS Vega Ladder

N/A

Deprecated**

 

IRSSkewSensitivity**

IRS Skew Sensitivity

N/A

Deprecated**

 

IRSTimeValue**

IRS Time Value

N/A

Deprecated**

 

IRSDL . . .*

IRS Delta Ladder File

N/A

Deprecated*

 

*These files continue to be produced but are not required to be passed as inputs to the hosted Optimizer service.

**These files are no longer produced by CME Group.

Clearing Members are expected to continue producing the Optimizer’s input Positions.csv and Configuration.json files and to maintain the state of portfolios in their books and records. No format changes are expected for these file payloads--please see Hosted Optimization User Workflow Examples.

Aside from Positions payload(s) and configuration data, Clearing firms are not expected to supply any other Optimizer inputs (i.e., marketdata_optimizer_cme, IRSDL, IRSPNL). Firms that are currently consuming these files can discontinue consuming these files when live with the new service.

Expected Outputs

Output File Name - Current State Workflow (Optimizer Software)

Business Description

Output - Future State Workflow (Hosted Optimizer Service)

Output File Name - Current State Workflow (Optimizer Software)

Business Description

Output - Future State Workflow (Hosted Optimizer Service)

Total Savings Estimateyyyymmdd_x.csv

Estimated savings report.

Describes margin before and after Optimization.

Estimated Savings Report Request Endpoint described below - output in FIXML format.

Enhanced to support IRS portfolio margin program and CME/FICC Cross-margin program.

MarginSummaryyyyymmdd_x.csv

Margin Summary report

Contains details found in Total Savings Estimate and additional optimized state margin results.

See Estimated Savings Report, which is enhanced with more data.

FundingImpactyyyymmdd_x.csv

Funding Impact report.

Describes change in funding based on margin difference, which is also available in the total savings estimate.

Not available.

OptimizeLogyyyymmdd_x.csv

Optimizer log file.

Describes program operations and debugging details as well as errors.

No log file available, API errors can be retrieved at other points in the workflow. See Error Handling.

fixmlTransfersyyyymmdd_x.txt

FIXML format transfer records file.

Used by firms to send transfers to CME Group via message queue.

FIXML Transfer Report Request Endpoint (see below).

csvTransfersyyyymmdd_x.csv

CSV format transfer records file.

CSV Transfers Report Endpoint (NEW)

See details below.

User Interface

The existing CME CORE API service has been expanded to support the hosted optimization process. The test URL can be found in the API URL section above. In conjunction with CME Group and wider industry standards, only secure communication channels are used. 

The following new API endpoints support hosted Optimization:

Endpoint

Request Type

Business Description/Use Case

Notes

Endpoint

Request Type

Business Description/Use Case

Notes

{margin api URL}/optimize?complete=true 

POST

User initiates Optimizer request.

Contains portfolio and configuration payloads.

See samples below.

Please note this is not to be confused with the existing (margin API URL)/MarginServiceApi/optimize endpoint, which processes hypothetical optimization calculation requests.

{margin api URL}/optimize/reports/fixmltransfers/(optimize id)

GET

FIXML transfer report

Retrieves FIXML transfers report for a given Optimize ID when Optimization is complete.

Users are expected to retry if the response is in ‘processing’ state.

See samples below.

 

{margin api URL}/optimize/reports/estimatedsavingsreport/(optimize id)

GET

Estimated Savings Report Endpoint

Retrieves estimated savings report for a given Optimize ID when Optimization is complete.

Users are expected to retry if the response is in ‘processing’ state.

See samples below.

 

{margin api URL}/optimize/reports/csvtransfers/(optimize id)

GET

CSV transfers report
Retrieves CSV transfers report for a given Optimize ID when Optimization is complete.

Users are expected to retry if the response is in ‘processing’ state.

See samples below.

 

{margin api URL}/optimize/reports/accepttransfers/(optimize id)

GET

Transfer Request Endpoint (Optional)

Submits a transfer request to the Front End Clearing system.

See samples below.

Results in live transfers in CME Clearing, see Testing Expectations above.

{margin api URL}/optimize/status

GET

Status endpoint (Optional)

Returns the available date and cycle for which optimization request can be submitted. In production, the date and cycle become top day when upstream data dependencies are satisfied and the Optimization window has opened for a given business date; see Operational Timeline below.

See samples below.

 

Hosted Optimization User Workflow Diagram

Hosted Optimization User Workflow Examples

  1. Submit Optimize Request

Request Endpoint

POST {{API_URL}}/optimize?complete=true

Sample Request

Note - The hosted optimizer workflow now supports ITD and EOD optimization cycles. Users must include the corresponding cycle code in the request to determine the data used for the run:

  • Specify the "ITD" cycle code to optimize using ITD positions.

  • Specify the "EOD" cycle code to optimize using EOD positions.

Sample Response

The report contains:

  • The Optimizer ID (ID in the 'portfolio' block). 

    • In the example below the ID is this string: 123456e1-12b3-123z-a0cf-12ee3ee5e56d

This id has a one-to-one relationship with the user input payload, not the Optimized account. There can be many accounts in a single Optimize request payload or one, depending on the users’ preference.

  • The FIXML trade capture for all positions in the payload.

  • Position-level errors, for instance validation errors.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:portfolioRpt xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="SUCCESS"> <portfolio id="123456e1-12b3-123z-a0cf-12ee3ee5e56d"> <cycle date="2025-03-27" code="EOD"/> <entities clrMbrFirmId="123" pbAcctId="Test123"/> <transactions> <transaction id="900000"> <payload encoding="STRING" format="FIXML"> <string>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815"&gt;&lt;TrdCaptRpt LastQty="50" SettlCcy="USD"&gt;&lt;Instrmt ID="SR3" Src="H" SecTyp="FUT" MMY="202512" Exch="CME"/&gt;&lt;RptSide Side="2" InptDev="API"&gt;&lt;Pty ID="123" R="4"/&gt;&lt;Pty ID="CME" R="21"/&gt;&lt;Pty ID="Test123" R="24"&gt;&lt;Sub ID="1" Typ="26"/&gt;&lt;/Pty&gt;&lt;/RptSide&gt;&lt;/TrdCaptRpt&gt;&lt;/FIXML&gt;</string> </payload> </transaction> <transaction id="900001"> <payload encoding="STRING" format="FIXML"> <string>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815"&gt;&lt;TrdCaptRpt LastQty="3000" SettlCcy="USD"&gt;&lt;Instrmt ID="SR3" Src="H" SecTyp="OOF" MMY="202512" StrkPx="95.0" PutCall="1" Exch="CME"/&gt;&lt;Undly Src="H" SecTyp="FUT" MMY="202512"/&gt;&lt;RptSide Side="1" InptDev="API"&gt;&lt;Pty ID="123" R="4"/&gt;&lt;Pty ID="CME" R="21"/&gt;&lt;Pty ID="Test123" R="24"&gt;&lt;Sub ID="1" Typ="26"/&gt;&lt;/Pty&gt;&lt;/RptSide&gt;&lt;/TrdCaptRpt&gt;&lt;/FIXML&gt;</string> </payload> </transaction> </transactions> </portfolio> </ns2:portfolioRpt>
  1. Optimized Reports

As part of the hosted optimizer service, two reports represent the most commonly used deployed Optimizer software reports.

All Optimizer reports are requested via GET messages to report endpoints containing the Optimize ID provided in the Optimize POST response above.

Report 1: FIXML Transfer Report Request Endpoint

Sample Request

GET {{API_URL}}/optimize/reports/fixmltransfers/(optimize id)

Sample Response

The report contains a header with the following information: 

  • Cycle date and cycle type.

  • Transfer records in FIXML format.

    • All transfer messages are single-sided to comply with standard CME Clearing transfer message processing.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:portfolioAsyncRpt xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="SUCCESS"> <portfolio id="12345678-1234-1234-1234-123456789"> <cycle date="2025-05-14" code="XXX"/> <entities clrMbrFirmId="123" pbAcctId="Test123"/> <transactions> <transaction> <payload encoding="STRING" format="FIXML"> <string>&lt;FIXML cv="CME.0001" s="20090815" v="5.0 SP2" xv="109"&gt;&lt;TrdCaptRpt LastPx="112.53125" LastQty="20" MLegRptTyp="1" MsgEvtSrc="API" OrigTrdDt="2025-03-28" RptID="900000" RptTyp="0" SettlCcy="USD" TransTyp="0" TrdDt="2025-05-14" TrdHandlInst="8" TrdID="900000" TrdTyp="3" TxnTm="2025-05-14T21:17:04.941858405Z"&gt;&lt;Hdr SID="123" SSub="CBT" Snt="2025-05-14T21:17:04.941858405Z" TID="CME" TSub="CBT"/&gt;&lt;Instrmt Exch="CBT" ID="21" MMY="202512" PxQteCcy="USD" SecTyp="FUT" Src="H"/&gt;&lt;RptSide ClOrdID="PM001" CustCpcty="4" InptDev="API" OrdTyp="M" SesId="RTH" SesSub="X" Side="1"&gt;&lt;Pty ID="123" R="1"/&gt;&lt;Pty ID="CME" R="21"/&gt;&lt;Pty ID="CBT" R="22"/&gt;&lt;Pty ID="123" R="24"&gt;&lt;Sub ID="1" Typ="26"/&gt;&lt;/Pty&gt;&lt;Pty ID="123" R="17"/&gt;&lt;Pty ID="123" R="48"&gt;&lt;Sub ID="1" Typ="26"/&gt;&lt;Sub ID="4" Typ="4000"/&gt;&lt;/Pty&gt;&lt;Pty ID="CBT" R="22"/&gt;&lt;/RptSide&gt;&lt;/TrdCaptRpt&gt;&lt;/FIXML&gt;</string> </payload> </transaction> <transaction> <payload encoding="STRING" format="FIXML"> <string>&lt;FIXML cv="CME.0001" s="20090815" v="5.0 SP2" xv="109"&gt;&lt;TrdCaptRpt LastPx="104.0859375" LastQty="30" MLegRptTyp="1" MsgEvtSrc="API" OrigTrdDt="2025-03-28" RptID="900002" RptTyp="0" SettlCcy="USD" TransTyp="0" TrdDt="2025-05-14" TrdHandlInst="8" TrdID="900002" TrdTyp="3" TxnTm="2025-05-14T21:17:04.941858405Z"&gt;&lt;Hdr SID="123" SSub="CBT" Snt="2025-05-14T21:17:04.941858405Z" TID="CME" TSub="CBT"/&gt;&lt;Instrmt Exch="CBT" ID="26" MMY="202512" PxQteCcy="USD" SecTyp="FUT" Src="H"/&gt;&lt;RptSide ClOrdID="PM001" CustCpcty="4" InptDev="API" OrdTyp="M" SesId="RTH" SesSub="X" Side="2"&gt;&lt;Pty ID="123" R="1"/&gt;&lt;Pty ID="CME" R="21"/&gt;&lt;Pty ID="CBT" R="22"/&gt;&lt;Pty ID="123" R="24"&gt;&lt;Sub ID="1" Typ="26"/&gt;&lt;/Pty&gt;&lt;Pty ID="123" R="17"/&gt;&lt;Pty ID="123" R="48"&gt;&lt;Sub ID="1" Typ="26"/&gt;&lt;Sub ID="4" Typ="4000"/&gt;&lt;/Pty&gt;&lt;Pty ID="CBT" R="22"/&gt;&lt;/RptSide&gt;&lt;/TrdCaptRpt&gt;&lt;/FIXML&gt;</string> </payload> </transaction> </transactions> </portfolio> </ns2:portfolioAsyncRpt>

 

Report 2: Estimated Savings Report Request Endpoint

Sample Request

GET {{API_URL}}/optimize/reports/estimatedsavingsreport/(optimize id)

Sample Response

The report contains:

  • Three margin states for each portfolio, expressed for both the F&O account and the IRS account:

    • Pre-optimization state (all futures and options positions in SEG).

    • Current state: before position netting.

    • Post-Optimization state.

  • Change in margin (savings), in dollar and percentage terms.

  • Margin account IDs (PbAcctId) for all optimized accounts

  • Clearing firm ID (clrMbrFirmId)

Mapping table of Optimizer software Estimated Savings Report to API estimated savings report.

Additional fields are present as compared to the csv version of the report and it is also, therefore, a suitable replacement for the Margin Summary csv report.

Field in Optimizer Software Estimated Savings Report

Mapped Field in Estimated Savings Report API Result

Business Description of Field

Field in Optimizer Software Estimated Savings Report

Mapped Field in Estimated Savings Report API Result

Business Description of Field

N/A

FutCurrAmt

Futures and options account (SEG) margin computed on the current state before position netting.

SPAN Before

FutPreAmt

Futures and options account (SEG) margin computed pre-optimization (all positions in SPAN).

SPAN After

FutPostAmt

Futures and options account (SEG) margin computed post-optimization.

N/A

OtcCurrAmt

OTC account margin computed on the current state (with existing F&O offsets).

Var Before

OtcPreAmt

OTC account margin computed pre-optimization (no F&O offsets).

Var After

OtcPostAmt

OTC account margin computed post-optimization.

Total Dollar Savings

DiffAmt

DiffAmt = TotalPreAmt - TotalPostAmt

N/A

FutNovCurrAmt

Futures and options account (SEG) net option value on the current state before position netting.

N/A

FutNovPreAmt

Futures and options account (SEG) net option value computed pre-optimization (all positions in SPAN).

N/A

FutNovPostAmt

Futures and options account (SEG) net option value computed post-optimization.

N/A

OctNovCurrAmt

OTC account net option value computed on the current state (with existing F&O offsets).

N/A

OctNovPreAmt

OTC account net option value computed pre-optimization (no F&O offsets).

N/A

OctNovPostAmt

OTC account net option value computed post-optimization.

Total Before

TotalPreAmt

TotalPreAmt = FutPreAmt + OtcPreAmt

Total After

TotalPostAmt

TotalPostAmt = FutPostAmt + OctNovPostAmt

Total Percent Savings

DiffPct

Percentage difference between TotalPreAmt and TotalPostAmt

 

Sample Response

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:marginRpt xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="SUCCESS"> <cycle date="2025-05-14" code="EOD"/> <margin portfolioId="123456e1-12b3-123z-a0cf-12ee3ee5e56d" settleInd="Y"> <entities clrMbrFirmId="123" pbAcctId="Test123"/> <amounts ccy="USD" init="471497443.52723697" maint="471497443.52723697"> <portfolio futCurrAmt="-5665000" futPreAmt="-5665000" futPostAmt="0" otcCurrAmt="475415991.04194366" otcPreAmt="475415991.04194366" otcPostAmt="471497443.52723697" diffAmt="1746452.48529331" futNovCurrAmt="8531250" futNovPreAmt="8531250" futNovPostAmt="0" otcNovCurrAmt="0" otcNovPreAmt="0" otcNovPostAmt="439844.82012504" totalPreAmt="469750991.04194366" totalPostAmt="471497443.52723697" diffPct="0.37"/> </amounts> </margin> </ns2:marginRpt>

 

Report 3: CSV Transfers Report Request Endpoint

This endpoint retrieves transfers record in CSV format.

Sample Request




How was your Client Systems Wiki Experience? Submit Feedback

Copyright © 2024 CME Group Inc. All rights reserved.