Skip to end of banner
Go to start of banner

Margin Service API - Optimize - Get

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 »

The get optimize request returns the status and results of an optimize request by its identifier.

Description

The request allows the Client to get the optimized results of an already optimized portfolio which was added and optimized in the Margin API (Add Portfolio and Optimize Portfolio). The Client must submit the unique assigned optimize request identifier in the request URL. The server then returns the identifier along with the status and the result requested.   

Request

ParameterNameTypeRequiredNotes
reqUserIdRequesting User IDStringNo

The response for the Optimize get request includes the portfolio margin for three portfolio states:

  1. Current (futCurrAmt and otcCurrAmt): Margin of portfolio including the current allocation of futures in the OTC IRS account versus SEG account.
  2. Baseline (futPreAmt and otcPreAmt): Margin of portfolio where no futures are in the OTC IRS account.
  3. Post-Optimizer (futPostAmt and otcPostAmt): Margin of portfolio including the Optimizer's allocation of futures in the OTC IRS account versus SEG account.
EntityOptimize
ActionGet
URL/optimize/{id}
HTTP MethodGET
Parameter InputYes
XML InputNo
Multiple OutputNo
SynchronousYes

Response

XPathNameTypeRequiredNotes
/optimizerRpt@statusStatusAsync StatusYes
/optimizerRpt/error@codeError CodeStringNo
/optimizerRpt/error@msgError MessageStringNo
/optimizerRpt/margin@asOfTimeAs-of TimeDate/TimeNo
/optimizerRpt/margin@createTimeCreate TimeDate/TimeYes
/optimizerRpt/margin@idIDStringYes
/optimizerRpt/margin@portfolioIdPortfolio IDStringYes
/optimizerRpt/margin@settleQualSettlement QualiferSettlement QualiferNo
/optimizerRpt/margin@settleIndSettlement IndicatorSettlement IndicatorNo
/optimizerRpt/margin@updateTimeUpdate TimeDate/TimeYes
/optimizerRpt/margin/amounts@ccyAmount CurrencyCurrencyYes
/optimizerRpt/margin/amounts@ccyRateCurrency Exchange RateDecimalNoExchange rate used to convert base currency to USDE
/optimizerRpt/margin/amounts@concConcentration Margin AmountDecimalNoConcentration/liquidity margin requirement
/optimizerRpt/margin/amounts@initInitial Margin AmountDecimalYes

Initial margin requirement (Base + Concentration/liquidity + Skew)

/optimizerRpt/margin/amounts@maintMaintenance Margin AmountDecimalYes

Maintenance margin requirement (Base + Concentration/liquidity + Skew)

/optimizerRpt/margin/amounts@optValOption Value AmountDecimalYesNet Options Value (Long Options Value - Short Options Value). This only applies to portfolios with options. Negative if net short, positive if net long.
/optimizerRpt/margin/amounts/portfolio@futCurrAmtFutures margin current portfolioDecimalYesSPAN®margin for the current allocation of futures in the SEG account
/optimizerRpt/margin/amounts/portfolio@futPreAmtFutures margin baseline portfolioDecimalYesSPAN®margin for all futures (OTC and SEG futures) in account
/optimizerRpt/margin/amounts/portfolio@futPostAmtFutures margin post-optimized portfolioDecimalYesSPAN®margin for SEG futures allocation identified by the Optimizer
/optimizerRpt/margin/amounts/portfolio@otcCurrAmtOTC margin current portfolioDecimalYesOTC IRS margin for the current allocation of IRS+OTC futures in the account
/optimizerRpt/margin/amounts/portfolio@otcPreAmtOTC margin baseline portfolioDecimalYesOTC IRS margin for IRS positions only
/optimizerRpt/margin/amounts/portfolio@otcPostAmtOTC margin post-optimized portfolioDecimalYesOTC IRS margin for IRS + OTC futures identified by the Optimizer
/optimizerRpt/transation@portfolioIdPortfolio IDStringYes
/optimizerRpt/transation@typeTransaction TypeStringYes
/optimizerRpt/transation@idIDStringYes
/optimizerRpt/transation/payload@encodingEncodingStringYes
/optimizerRpt/transation/payload@formatFormatStringYes
/optimizerRpt/transation/payload/stringPayload StringFIXML Message PayloadNoReturned Optimizer offset and onset trade capture reports, FIXML format.


Examples

This assumes that margin request for portfolio has already been submitted. The id used (2345 should be the CME CORE generated unique id returned in response to a Margin Calculate request.

Like some list requests, Optimize Get response includes FIXML transactions which represent the onset and offset trades the Optimizer uses to describe which futures should move to or from the OTC IRS account to achieve margin offsets. Note the Optimizer Get response uses "TrdTyp = 22" to describe futures in the OTC IRS account.

Optimize Request
GET /MarginServiceApi/1.6/optimize/1234567

Response - Portfolio Optimized
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:optimizerRpt xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="SUCCESS">
	<margin portfolioId="12345678" id="1234567" createTime="2019-11-21T19:56:42+00:00" updateTime="2019-11-21T19:56:45+00:00">
		<amounts conc="3531.75158986107" init="1033754.24448408" maint="1037285.99607394" optVal="48125">
			<portfolio futCurrAmt="230415" futPreAmt="260000" futPostAmt="1300" otcCurrAmt="623627.825051428" otcPreAmt="1547449.14988385" otcPostAmt="1035985.99607394" diffAmt="770163.15380991"/>
		</amounts>
	</margin>
	<transaction portfolioId="12345678" type="TRADE" id="1234567">
		<payload encoding="STRING" format="FIXML">
			<string><?xml version="1.0" encoding="UTF-8" standalone="yes"?><FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815"><TrdCaptRpt LastQty="100" SettlCcy="USD"><Instrmt ID="21" Src="H" SecTyp="FUT" MMY="201912" MatDt="2019-12-19" Exch="CBT"/><RptSide Side="2" InptDev="API"><Pty ID="TEST" R="4"/><Pty ID="CME" R="21"/><Pty ID="1234" R="24"><Sub ID="2" Typ="26"/></Pty></RptSide></TrdCaptRpt></FIXML></string>
		</payload>
	</transaction>
	<transaction portfolioId="12345678" type="TRADE" id="1234568">
		<payload encoding="STRING" format="FIXML">
			<string><?xml version="1.0" encoding="UTF-8" standalone="yes"?><FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815"><TrdCaptRpt TrdTyp="22" LastQty="100" SettlCcy="USD"><Instrmt ID="21" Src="H" SecTyp="FUT" MMY="201912" MatDt="2019-12-19" Exch="CBT"/><RptSide Side="1" InptDev="API"><Pty ID="TEST" R="4"/><Pty ID="CME" R="21"/><Pty ID="1234" R="24"><Sub ID="2" Typ="26"/></Pty></RptSide></TrdCaptRpt></FIXML></string>
		</payload>
	</transaction>
	<transaction portfolioId="12345678" type="TRADE" id="1234569">
		<payload encoding="STRING" format="FIXML">
			<string><?xml version="1.0" encoding="UTF-8" standalone="yes"?><FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815"><TrdCaptRpt LastQty="99" SettlCcy="USD"><Instrmt ID="21" Src="H" SecTyp="FUT" MMY="201912" MatDt="2019-12-19" Exch="CBT"/><RptSide Side="2" InptDev="API"><Pty ID="TEST" R="4"/><Pty ID="CME" R="21"/><Pty ID="1234" R="24"><Sub ID="2" Typ="26"/></Pty></RptSide></TrdCaptRpt></FIXML></string>
		</payload>
	</transaction>
	<transaction portfolioId="12345678" type="TRADE" id="1234570">
		<payload encoding="STRING" format="FIXML">
			<string><?xml version="1.0" encoding="UTF-8" standalone="yes"?><FIXML xmlns="www.cmegroup.com/fixml50/1" v="5.0 SP2" xv="109" cv="CME.0001" s="20090815"><TrdCaptRpt TrdTyp="22" LastQty="99" SettlCcy="USD"><Instrmt ID="21" Src="H" SecTyp="FUT" MMY="201912" MatDt="2019-12-19" Exch="CBT"/><RptSide Side="1" InptDev="API"><Pty ID="TEST" R="4"/><Pty ID="CME" R="21"/><Pty ID="1234" R="24"><Sub ID="2" Typ="26"/></Pty></RptSide></TrdCaptRpt></FIXML></string>
		</payload>
	</transaction>
</ns2:optimizerRpt>
Response - Portfolio Could not be Optimized
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:optimizerRpt xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="SUCCESS">
    <margin portfolioId="12345679" id="1234568" createTime="2019-11-25T17:31:41+00:00" updateTime="2019-11-25T17:31:44+00:00">
        <amounts conc="0" init="271810.135066162" maint="271810.135066162">
            <portfolio futCurrAmt="0" futPreAmt="5200" futPostAmt="0" otcCurrAmt="271810.135066162" otcPreAmt="284884.360044503" otcPostAmt="271810.135066162" diffAmt="18274.224978341"/>
        </amounts>
    </margin>
</ns2:optimizerRpt>



Errors

CodeDescription
403Returned if the user does not have permission to access the specified optimize response.
404Returned if the requested optimizer calculation could not be found.
500The server was not able to process the request. More information (if available) will be provided in the error message.


  • No labels