Skip to end of banner
Go to start of banner

Margin Service API - ALL-IN-ONE Call

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

‘ALL-IN-ONE’ margin call is an all-inclusive margin calculation request that allows a user to specify transactions and/or a portfolio id that was created using an earlier call. This call is limited to one portfolio at a time. This features allows a single asynchronous request to build a portfolio, add transactions, and request margin calculation.   

See the following topics on this page:

Supported Asset Classes

ALL-IN-ONE margin call supports all assets classes, including:

  • IRS - Interest Rate Swaps and Swaptions
  • DL - Delta Ladders
  • Futures and Options
  • FX - Foreign Exchange

Enabling ALL-IN-ONE Margin Call

To enable this feature, use the API version 1.1 schema or above or above and complete the following steps:

CME Margin

  1. Append a “?complete = true”  request parameter to the margin request, such as  /MarginServiceApi/margins?complete=true
  2. Include either transactions or a portfolio id in the ‘marginReq’ xml
Sample Request Message
POST /MarginServiceApi/margins?complete=true
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginReq xmlns:ns2="http://cmegroup.com/schema/core/1.2">
<margin>
<transactions>
<transaction type="TRADE">
<payload format="CSV" encoding="STRING">
<string>
Firm ID,Position Account ID,ClearedTradeId,Currency,Effective Date,Maturity Date,Notional,Direction,Fixed Rate,FloatingIndex,FloatingIndexTenor,FixedPayFrequency
TestA,1234A,3M USD,USD,09/06/2021,09/06/2031,"10,000,000",P,0.03123,USD-LIBOR-BBA,3M,6M
</string>
</payload>
</transaction>
</transactions>
</margin>
</ns2:marginReq>
Sample Response Message
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginRpt 
    xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="PROCESSING">
    <margin portfolioId="1234" id="123456"/>
</ns2:marginRpt>
Sample Request Formats
CSV All In One Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginReq xmlns:ns2="http://cmegroup.com/schema/core/1.2">
<margin>
<transactions>
<transaction type="TRADE">
<payload format="CSV" encoding="STRING">
<string>
Firm ID,Account ID,Product Type ,Currency,Effective Date,Maturity Date,Notional,Direction,Fixed Rate
TEST,1234,Vanilla,AUD,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,CAD,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,CHF,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,CZK,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,DKK,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,EUR,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,GBP,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,HKD,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,HUF,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,JPY,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,MXN,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,NOK,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,NZD,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,PLN,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,SEK,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,SGD,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,USD,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,ZAR,6/3/20,6/3/2025,10000000,R,0.05
</string>
</payload>
</transaction>
</transactions>
</margin>
</ns2:marginReq>
FIXML All in One Request 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" xmlns:ns4="http://www.fpml.org/FpML-5/confirmation" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns5="http://www.cmegroup.com/otc-clearing/confirmation" xmlns:ns6="www.cmegroup.com/fixml50/1">
    <margin>
        <transactions>
            <transaction type="TRADE">
                <payload encoding="STRING" format="FIXML"><string><![CDATA[<FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815">
<TrdCaptRpt LastQty="4500000" LastPx="3.75"><Instrmt ID="USDBRL" Src="H" SecTyp="FWD" MMY="20191210" /><RptSide Side="2" InptDev="API">
<Pty ID="234" R="4"/>
<Pty ID="TEST234" R="24"/>
</RptSide>
</TrdCaptRpt>
</FIXML>]]></string>
                </payload>
            </transaction>
        </transactions>
    </margin>
</ns2:marginReq>
FpML All in One Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" xmlns:ns4="http://www.fpml.org/FpML-5/confirmation" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns5="http://www.cmegroup.com/otc-clearing/confirmation" xmlns:ns6="www.cmegroup.com/fixml50/1">
    <margin>
        <transactions>
            <transaction type="TRADE">
                <payload encoding="STRING" format="FPML"><string>
<![CDATA[<ns3:FpML xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#"
          xmlns:ns3="http://www.cmegroup.com/otc-clearing/confirmation">
    <clearingConfirmed>
        <trade>
            <tradeHeader>
                <partyTradeIdentifier>
                    <partyReference href="clearing_service"/>
                    <tradeId tradeIdScheme="cme_trade_id"/>
                    <tradeId tradeIdScheme="remaining_trade_id"/>
                    <tradeId tradeIdScheme="platform_trade_id"/>
                    <tradeId tradeIdScheme="block_trade_id"/>
                    <tradeId tradeIdScheme="client_trade_id"/>
                </partyTradeIdentifier>
                <partyTradeInformation>
                    <partyReference href="clearing_firm"/>
                    <accountReference href="account1"/>
                    <relatedParty>
                        <partyReference href="trade_source"/>
                        <role>InputSource</role>
                    </relatedParty>
                    <category categoryScheme="cme_origin_code"/>
                </partyTradeInformation>
                <tradeDate>2011-09-06</tradeDate>
            </tradeHeader>
            <swap>
                <swapStream id="fixedLeg">
                    <payerPartyReference href="clearing_firm"/>
                    <payerAccountReference href="account1"/>
                    <receiverPartyReference href="clearing_service"/>
                    <calculationPeriodDates id="fixedLegCalcPeriodDates">
                        <effectiveDate>
                            <unadjustedDate>2011-09-06</unadjustedDate>
                            <dateAdjustments>
                                <businessDayConvention>NONE</businessDayConvention>
                            </dateAdjustments>
                            <adjustedDate>2011-09-06</adjustedDate>
                        </effectiveDate>
                        <terminationDate>
                            <unadjustedDate>2021-09-06</unadjustedDate>
                            <dateAdjustments>
                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                <businessCenters>
                                    <businessCenter>BRBD</businessCenter>
                                    <businessCenter>USNY</businessCenter>
                                </businessCenters>
                            </dateAdjustments>
                            <adjustedDate>2021-09-06</adjustedDate>
                        </terminationDate>
                        <calculationPeriodDatesAdjustments>
                            <businessDayConvention>MODFOLLOWING</businessDayConvention>
                            <businessCenters>
                                <businessCenter>BRBD</businessCenter>
                                <businessCenter>USNY</businessCenter>
                            </businessCenters>
                        </calculationPeriodDatesAdjustments>
                        <calculationPeriodFrequency>
                            <periodMultiplier>1</periodMultiplier>
                            <period>T</period>
                            <rollConvention>NONE</rollConvention>
                        </calculationPeriodFrequency>
                    </calculationPeriodDates>
                    <paymentDates>
                        <calculationPeriodDatesReference href="fixedLegCalcPeriodDates"/>
                        <paymentFrequency>
                            <periodMultiplier>1</periodMultiplier>
                            <period>T</period>
                        </paymentFrequency>
                        <payRelativeTo>CalculationPeriodEndDate</payRelativeTo>
                        <paymentDatesAdjustments>
                            <businessDayConvention>MODFOLLOWING</businessDayConvention>
                            <businessCenters>
                                <businessCenter>USNY</businessCenter>
                                <businessCenter>BRBD</businessCenter>
                            </businessCenters>
                        </paymentDatesAdjustments>
                    </paymentDates>
                    <calculationPeriodAmount>
                        <calculation>
                            <notionalSchedule>
                                <notionalStepSchedule>
                                    <currency>BRL</currency>
                                </notionalStepSchedule>
                            </notionalSchedule>
                            <futureValueNotional>
                                <amount>12345</amount>
                            </futureValueNotional>
                            <fixedRateSchedule>
                                <initialValue>0.03123</initialValue>
                            </fixedRateSchedule>
                            <dayCountFraction>BUS/252.FIXED</dayCountFraction>
                            <compoundingMethod>None</compoundingMethod>
                        </calculation>
                    </calculationPeriodAmount>
                    <cashflows>
                        <cashflowsMatchParameters>true</cashflowsMatchParameters>
                    </cashflows>
                </swapStream>
                <swapStream id="floatLeg">
                    <payerPartyReference href="clearing_service"/>
                   <receiverPartyReference href="clearing_firm"/>
                    <receiverAccountReference href="account1"/>
                    <calculationPeriodDates id="floatLegCalcPeriodDates">
                        <effectiveDate>
                            <unadjustedDate>2011-09-06</unadjustedDate>
                            <dateAdjustments>
                                <businessDayConvention>NONE</businessDayConvention>
                            </dateAdjustments>
                            <adjustedDate>2011-09-06</adjustedDate>
                        </effectiveDate>
                        <terminationDate>
                            <unadjustedDate>2021-09-06</unadjustedDate>
                            <dateAdjustments>
                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                <businessCenters>
                                    <businessCenter>BRBD</businessCenter>
                                    <businessCenter>USNY</businessCenter>
                                </businessCenters>
                            </dateAdjustments>
                            <adjustedDate>2021-09-06</adjustedDate>
                        </terminationDate>
                        <calculationPeriodDatesAdjustments>
                            <businessDayConvention>MODFOLLOWING</businessDayConvention>
                            <businessCenters>
                                <businessCenter>BRBD</businessCenter>
                                <businessCenter>USNY</businessCenter>
                            </businessCenters>
                        </calculationPeriodDatesAdjustments>
                        <calculationPeriodFrequency>
                            <periodMultiplier>1</periodMultiplier>
                            <period>T</period>
                            <rollConvention>NONE</rollConvention>
                        </calculationPeriodFrequency>
                    </calculationPeriodDates>
                   <paymentDates>
                        <calculationPeriodDatesReference href="floatLegCalcPeriodDates"/>
                        <paymentFrequency>
                            <periodMultiplier>1</periodMultiplier>
                            <period>T</period>
                        </paymentFrequency>
                        <payRelativeTo>CalculationPeriodEndDate</payRelativeTo>
                        <paymentDatesAdjustments>
                            <businessDayConvention>MODFOLLOWING</businessDayConvention>
                            <businessCenters>
                                <businessCenter>BRBD</businessCenter>
                                <businessCenter>USNY</businessCenter>
                            </businessCenters>
                        </paymentDatesAdjustments>
                    </paymentDates>
                    <resetDates id="floatLegResetDates">
                        <calculationPeriodDatesReference href="floatLegCalcPeriodDates"/>
                        <resetRelativeTo>CalculationPeriodStartDate</resetRelativeTo>
                        <fixingDates>
                            <periodMultiplier>-2</periodMultiplier>
                            <period>D</period>
                            <dayType>Business</dayType>
                            <businessDayConvention>MODFOLLOWING</businessDayConvention>
                            <businessCenters>
                                <businessCenter>BRBD</businessCenter>
                                <businessCenter>USNY</businessCenter>
                            </businessCenters>
                            <dateRelativeTo href="floatLegResetDates"/>
                        </fixingDates>
                        <resetFrequency>
                            <periodMultiplier>1</periodMultiplier>
                            <period>D</period>
                        </resetFrequency>
                        <resetDatesAdjustments>
                            <businessDayConvention>MODFOLLOWING</businessDayConvention>
                            <businessCenters>
                                <businessCenter>BRBD</businessCenter>
                                <businessCenter>USNY</businessCenter>
                            </businessCenters>
                        </resetDatesAdjustments>
                    </resetDates>
                    <calculationPeriodAmount>
                        <calculation>
                            <notionalSchedule>
                                <notionalStepSchedule>
                                    <currency>BRL</currency>
                                </notionalStepSchedule>
                            </notionalSchedule>
                            <floatingRateCalculation>
                                <floatingRateIndex>BRL-CDI</floatingRateIndex>
                                <indexTenor>
                                    <periodMultiplier>1</periodMultiplier>
                                    <period>D</period>
                                </indexTenor>
                            </floatingRateCalculation>
                            <dayCountFraction>BUS/252.FIXED</dayCountFraction>
                            <compoundingMethod>None</compoundingMethod>
                        </calculation>
                    </calculationPeriodAmount>
                    <cashflows>
                        <cashflowsMatchParameters>true</cashflowsMatchParameters>
                    </cashflows>
                </swapStream>
            </swap>
        </trade>
        <party id="clearing_firm">
            <partyId partyIdScheme="clearing_member_firms">Test</partyId>
        </party>
        <party id="clearing_service">
            <partyId/>
        </party>
        <party id="trade_source">
            <partyId/>
        </party>
        <account id="account1">
            <accountId accountIdScheme="clearing_firm_accounts">1234</accountId>
            <servicingParty href="clearing_firm"/>
        </account>
    </clearingConfirmed>
</ns3:FpML>]]>
</string>
                </payload>
            </transaction>
        </transactions>
    </margin>
</ns2:marginReq>

Cross Margin IRS and Futures All In One Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginReq xmlns:ns2="http://cmegroup.com/schema/core/1.2">
<margin>
<transactions>
<transaction type="TRADE">
                              <payload encoding="STRING" format="CSV"><string>Firm ID,Account ID,Product Type ,Currency,Effective Date,Maturity Date,Notional,Direction,Fixed Rate
TEST,1234,Vanilla,AUD,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,CAD,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,CHF,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,CZK,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,DKK,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,EUR,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,GBP,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,HKD,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,HUF,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,JPY,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,MXN,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,NOK,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,NZD,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,PLN,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,SEK,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,SGD,6/3/2021,6/3/2025,10000000,R,0.05
TEST,1234,Vanilla,USD,6/3/2021,6/3/2025,10000000,P,0.05
TEST,1234,Vanilla,ZAR,6/3/2021,6/3/2025,10000000,R,0.05</string>
                              </payload>
               </transaction>
               <transaction type="TRADE">
                              <payload encoding="STRING" format="CSV"><string>Firm Id,Acct Id,Exchange,Ticker Symbol,Product Name,CC Code,Period Code,Put / Call,Strike,Underlying Period Code,Net Positions,Margin Type
Test,123,CME,GEZ9,EURODOLLAR FUTURES,ED,202306,,,,1000,OTC
                        </string>
                              </payload>
               </transaction>
</transactions>
</margin>
</ns2:marginReq>


JSON All In One Request

Risk API JSON or CSV format are the expected SPAN 2 input payload formats. These formats are supported for futures and options only and are also compatible with the deployable margin software program. 

Additional details around building a Risk API format payload can be found here.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginReq xmlns:ns2="http://cmegroup.com/schema/core/1.12" xmlns:ns4="http://www.fpml.org/FpML-5/confirmation" xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns5="http://www.cmegroup.com/otc-clearing/confirmation" xmlns:ns6="www.cmegroup.com/fixml50/1">
    <margin riskFramework="NEXT">
        <transactions>
            <transaction type="TRADE">
                <payload format="RISK_API_JSON" encoding="STRING">
                    <string>
{
  "header": {
    "requestId": "TEST",
    "sentTime": "2021-06-21T09:26:49Z",
    "version": "1"
  },
  "payload": {
    "pointInTime": {
      "cycleCode": "EOD",
      "businessDt": "2021-06-18",
      "runNumber": 1
    },
    "portfolios": [
      {
        "positions": [
          {
            "instrument": {
              "clearingOrganizationId": "CME",
              "exchangeId": "CME",
              "periodCode": "202309",
              "productCode": "ED",
              "productType": "FUT"
            },
            "netQty": 5
          },
          {
            "instrument": {
              "clearingOrganizationId": "CME",
              "exchangeId": "NYMEX",
              "periodCode": "202206",
              "productCode": "CL",
              "productType": "FUT"
            },
            "netQty":-5
          }
        ],
        "currency": "USD",
        "customerAccountType": "SPECULATOR",
        "entities": {
          "accountId": "ACCOUNT1",
          "accountName": "ACCOUNT1",
          "firmId": "1234",
          "originType": "CUSTOMER"
        },
        "id": "TEST",
        "memo": "memo-1",
        "omnibusInd": "NO"
      }
    ]
  }
}
					</string>
                </payload>
            </transaction>
        </transactions>
    </margin>
</ns2:marginReq>
Polling For Your Results

Use the Id (e.g.="123456") and use it to poll for your margin results.

  • No labels