Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

The calculate margin request performs a margin calculation on an existing portfolio with optional additional transactions.


Table of Contents
maxLevel4

Description

The request allows the client to calculate the margin of an already existing portfolio which was added to CME CORE (Add Portfolio and Update Portfolio). The client must specify the margin type and must submit the unique CME CORE assigned portfolio identifier in the request URL. The URL may optionally include additional (transient) transactions by value or the transactions to exclude by identifier from the portfolio. Once the Client/ CMF (Clearing Member Firm) has submitted the above, the server will queue up the request for execution after which it is submitted to the risk engine for processing a request identifier and status that are returned. If the portfolio does not exist, referenced transactions do not exist, or there are other errors an error message/code will be returned.   


Align
alignright


EntityMargin
ActionCalculate
URL/margins
HTTP MethodPOST
Parameter InputNo
XML InputYes
Multiple OutputNo
SynchronousNo





Request

XPathNameTypeRequiredNotes
/marginReq@reqUserIdRequesting User IDStringNo
/marginReq/margin@portfolioIdPortfolio IDStringYes
/marginReq/margin@riskFrameworkRisk FrameworkStringNoSpecifies if the request should be margined in the SPAN or the SPAN 2 methodology. This is relevant to Futures & Options users only. 

Response

XPathNameTypeRequiredNotes
/marginRpt@statusStatusAsync StatusYes
/marginRpt/margin@createTimeCreate TimeDate/TimeYes
/marginRpt/margin@idIDStringYes
/marginRpt/margin@portfolioIdPortfolio IDStringYes
/marginRpt/margin@updateTimeUpdate TimeDate/TimeYes
/marginRpt/error@codeError MessageStringNo
/marginRpt/error@msgError MessageStringNo

Errors

CodeDescription
400Bad XML syntax or missing content. More information will be provided in the error message.
403Returned if the user does not have permission to perform calculations on the portfolio
500The server was not able to process the request. More information (if available) will be provided in the error message.

Examples

Basic

This example requests that a portfolio with ID 123 be margined.  The unique ID of the margin request is returned along with the portfolio identifier.

Calculating Margin for CME

Request - All Margin Methodologies
Code Block
POST {{API_URL}}/margins


Code Block
languagehtml/xml
linenumberstrue
<core:marginReq xmlns:core="http://cmegroup.com/schema/core/1.2">
  <margin portfolioId="123" />
</core:marginReq>
Request - SPAN 2 Margin

For the SPAN 2 project, the CORE API has been enhanced with a new attribute "riskFramework" which specifies if the request should be margined in the SPAN or the SPAN 2 methodology during the SPAN 2 transition. This is relevant to Futures & Options users only.

Expected values in riskFramework attribute:

  • CURRENT - current production margin framework
    • This will equate to SPAN methodology until the SPAN 2 project go live
  • NEXT - upcoming production margin framework, in production parallel
    • This will equate to SPAN 2 methodology for in-scope products

For Top day margin request in CORE ,please refer to the below table for approximate timings.

Code Block
languagehtml/xml
linenumberstrue
<core:marginReq xmlns:core="http://cmegroup.com/schema/core/1.12">
         <margin portfolioId="123" riskFramework="NEXT" />
</core:marginReq>

Response
Code Block
languagehtml/xml
linenumberstrue
<ns2:marginRpt 
    xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="PROCESSING">
    <margin portfolioId="123" id="321"/>
</ns2:marginRpt>
Request - Historical Margin

The CORE API now supports historical margin calculations and two new attributes "date" and "code" have been added to the request. This is relevant to Futures & Options users only.

New attributes:

Date: CME core allows user to margin portfolios in SPAN 2 framework as of late 2022 and in SPAN framework as of late 2021. Acceptable date format is yyyy-mm-dd.

Code: For last 5 business days, user can select from several daily cycles, please refer to the below table.  For margin request prior to 5 business days, .I, .s and .c cycles are available.


SPAN request

Code Block
<core:marginReq xmlns:core="http://www.cmegroup.com/schema/core/1.14">
    <cycle date="2023-03-31" code="ITD"/>
    <margin portfolioId="123" riskFramework="CURRENT"/>
</core:marginReq>

SPAN 2 Request

Code Block
<core:marginReq xmlns:core="http://www.cmegroup.com/schema/core/1.14">
    <cycle date="2023-03-31" code="EOD"/>
    <margin portfolioId="123" riskFramework="NEXT"/>
</core:marginReq>

Response

Code Block
<ns2:marginRpt xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="PROCESSING">
    <margin portfolioId="123" id="321"/>
</ns2:marginRpt>