Skip to end of banner
Go to start of banner

Margin Service API - REST

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 »

  See the following Representation State Transfer (REST) methods and error codes:  

Portfolio

Use CasePathMethodRequest HeadersPost Data
Add Portfolio/MarginServiceApi/portfoliosPOST'username' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:portfolioReq xmlns:ns2="http://cmegroup.com/schema/core/1.2">
<portfolio desc="My Desc" name="My Name" rptCcy="AUD" id="0">
<entities clrMbrFirmId="My Firm" custAcctId="My Account"/>
</portfolio>
</ns2:portfolioReq>
Get Portfolio/MarginServiceApi/portfolios/{portfolioId}GET'username' AND 'password'
Update Portfolio/MarginServiceApi/portfolios/{portfolioId}PUT'username' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:portfolioReq xmlns:ns2="http://cmegroup.com/schema/core/1.2">
<portfolio id="{portfolioId}" desc="My New Desc" name="My New Name" rptCcy="AUD">
<entities clrMbrFirmId="My New Firm" custAcctId="My New Account"/>
</portfolio>
</ns2:portfolioReq>
Delete Portfolio/MarginServiceApi/portfolios/{portfolioId}DELETE'username' AND 'password'
List All Portfolios/MarginServiceApi/portfolios/GET'username' AND 'password'

Margin

Use CasePathMethodRequest HeadersPost Data
Request Margin Calculation/MarginServiceApi/marginsPOST'username' AND 'password'
<?xml version="1.1" encoding="UTF-8"?>
<core:marginReq xmlns:core="http://cmegroup.com/schema/core/1.2">
<margin portfolioId="{portfolioId}">
<amounts ccy="AUD" conc="0.0" init="0.0" maint="0.0" nonOptVal="0.0" optVal="0.0"/>
</margin>
</core:marginReq>
Get Margin Status/Result/MarginServiceApi/margins/{marginId}GET'username' AND 'password'

Transaction

Use CasePathMethodRequest HeadersPost Data
Get Transaction/MarginServiceApi/transactions/{transactionId}GET'username' AND 'password'
Delete Transaction/MarginServiceApi/transactions/{transactionId}DELETE'username' AND 'password'

Delta Ladders

Use CasePathMethodRequest HeadersPost Data
Add Transaction/MarginServiceApi/transactionsPOST'username' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="{portfolioId}" type="DELTA_LADDER" id="{transactionid}">
<payload encoding="STRING" format="CSV">
<string>
Value Date,CMF,PB Account,Curve Name,Currency,91D,183D,274D,365D,457D,548D,639D,731D,1096D,1461D,1826D,2192D,2557D,2922D,3287D,3653D,4383D,5479D,7305D,9131D,10958D,14610D,18263D
10/24/2013,test1,999,AUD_BBSW_6M_ERS,,32.0105455,64.58305936,31.13621844,20.35769193,15.41416217,96.80729233,75.32927274,25.67151709,24.23397357,0.687566587,9.694415416,58.80629205,31.95172325,15.3822619,79.15949202,32.98592737,94.26023515,17.7372275,20.18054008,15.11060597,42.29062295,33,44
</string>
</payload>
</transaction>
</ns2:transactionReq>
Update Transaction/MarginServiceApi/transactions/{transactionId}PUT'username' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="0" type="DELTA_LADDER" id="{transactionId}">
<payload encoding="STRING" format="CSV">
<string>
Value Date,CMF,PB Account,Curve Name,Currency,91D,183D,274D,365D,457D,548D,639D,731D,1096D,1461D,1826D,2192D,2557D,2922D,3287D,3653D,4383D,5479D,7305D,9131D,10958D,14610D,18263D
01/01/2011,UPDATE,UPDATE,AUD_BBSW_6M_ERS,,32.0105455,64.58305936,31.13621844,20.35769193,15.41416217,96.80729233,75.32927274,25.67151709,24.23397357,0.687566587,9.694415416,58.80629205,31.95172325,15.3822619,79.15949202,32.98592737,94.26023515,17.7372275,20.18054008,15.11060597,42.29062295,33,44
</string>
</payload>
</transaction>
</ns2:transactionReq>


Futures

Use CasePathMethodRequest HeadersPost Data
Add Transaction/MarginServiceApi/transactionsPOSTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="{portfolioId}" type="TRADE" id="{transactionId}">
<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
TED,1234,CME,,,ED,201906,,,,100,FUT
TED,1234,CME,,,ED,201909,,,,100,FUT
TED,1234,CME,,,ED,201912,,,,100,FUT
TED,1234,CME,,,ED,202003,,,,100,FUT
</string>
</payload>
</transaction></ns2:transactionReq>
Update Transaction/MarginServiceApi/transactions/{transactionId}PUTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="0" type="TRADE" id="{transactionId}">
<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,UPDATE,CME,,,ED,201906,,,,100,FUT
</string>
</payload>
</transaction>
</ns2:transactionReq>

Options

Use CasePathMethodRequest HeadersPost Data
Add Transaction/MarginServiceApi/transactionsPOSTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="{portfolioId}" type="TRADE" id="{transactionId}">
<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,GEH7 C9200,,ED,201703,CALL,92,201703,10,
Test,123,NYMEX,LM1M6 P6200,,LM1,201606,PUT,62,201706,25,
</string>
</payload>
</transaction>
</ns2:transactionReq>
Update Transaction/MarginServiceApi/transactions/{transactionId}PUTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="0" type="TRADE" id="{transactionId}">
<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,UPDATE,CME,GEH7 C9200,,ED,201703,CALL,92,201703,10,
</string>
</payload>
</transaction>
</ns2:transactionReq>

Interest Rate Swaps

Use CasePathMethodRequest HeadersPost Data
Add Transaction/MarginServiceApi/transactionsPOSTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="{portfolioId}" type="TRADE" id="{transactionId}">
<payload encoding="STRING" format="CSV">
<string>
Firm ID,Account ID,Product Type ,Currency,Effective Date,Maturity Date,Notional,Direction,Fixed Rate
TEST,1234,FRA,EUR,9/16/2016,12/16/2016,125000,R,0.05
TEST,1234,OIS,GBP,11/21/2017,7/22/2022,1000000,P,0.05
TEST,1234,Vanilla,CAD,6/18/2016,6/18/2045,20000,P,0.05
TEST,1234,Vanilla,USD,6/6/2017,6/6/2027,2050000,R,0.05
TEST,4567,ZERO_COUPON,EUR,9/17/2017,9/17/2037,25000,P,0.05
TEST,4567,ZERO_COUPON,USD,12/15/2017,12/15/2027,50000,R,0.05
</string>
</payload>
</transaction>
</ns2:transactionReq>
Update Transaction/MarginServiceApi/transactions/{transactionId}PUTusername' AND 'password'
<?xml version="1.1." encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2" reqUserId="ak">
<transaction portfolioId="0" type="TRADE" id="{transactionId}">
<payload encoding="STRING" format="CSV">
<string>
Firm ID,Account ID,Product Type ,Currency,Effective Date,Maturity Date,Notional,Direction,Fixed Rate
TEST,UPDATE,FRA,USD,9/16/2016,12/16/2016,125000,R,0.05
</string>
</payload>
</transaction>
</ns2:transactionReq>

Forwards

Use CasePathMethodRequest HeadersPost Data
Add Transaction/MarginServiceApi/transactionsPOSTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.0" reqUserId="ak">
<transaction portfolioId="{portfolioId}" type="TRADE" id="">
<payload encoding="STRING" format="FIXML">
<string>
&lt;FIXML xmlns=&quot;www.cmegroup.com/fixml50/1&quot;&gt;  &lt;TrdCaptRpt LastQty=&quot;4&quot;&gt;   
&lt;Instrmt Exch=&quot;CME&quot; SecTyp=&quot;FWD&quot; ID=&quot;USDCAD&quot; MMY=&quot;20130508&quot; /&gt;   
&lt;RptSide Side=&quot;2&quot;&gt;      &lt;Pty R=&quot;4&quot; ID=&quot;123&quot; /&gt;&lt;Pty R=&quot;24&quot; ID=&quot;CUSTACCT1&quot; /&gt;    &lt;/RptSide&gt;  &lt;/TrdCaptRpt&gt;&lt;/FIXML&gt;
</string>
</payload>
</transaction>
</ns2:transactionReq>
Update Transaction/MarginServiceApi/transactions/{transactionId}PUTusername' AND 'password'
<?xml version="1.1" encoding="UTF-8" standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.0" reqUserId="ak">
<transaction portfolioId="{portfolioId}" type="TRADE" id="{transactionId}">
<payload encoding="STRING" format="FIXML">
<string>
&lt;FIXML xmlns=&quot;www.cmegroup.com/fixml50/1&quot;&gt;  &lt;TrdCaptRpt LastQty=&quot;4&quot;&gt;   
&lt;Instrmt Exch=&quot;CME&quot; SecTyp=&quot;FWD&quot; ID=&quot;USDCAD&quot; MMY=&quot;20130508&quot; /&gt;   
&lt;RptSide Side=&quot;2&quot;&gt;      &lt;Pty R=&quot;4&quot; ID=&quot;123&quot; /&gt;&lt;Pty R=&quot;24&quot; ID=&quot;CUSTACCT1&quot; /&gt;    &lt;/RptSide&gt;  &lt;/TrdCaptRpt&gt;&lt;/FIXML&gt;
</string>
</payload>
</transaction>
</ns2:transactionReq>

Multiple Trades

Use CasePathMethodRequest HeadersPost Data
Add Transaction/MarginServiceApi/transactionsPOSTusername' AND 'password'
?xml version="1.1" encoding="UTF-8"
standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2"
reqUserId="ak">
<transaction portfolioId="10353741"
type="TRADE" id="{transactionId}">
<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
TED,1234,CME,,,ED,201906,,,,100,FUT
TED,1234,CME,,,ED,201909,,,,100,FUT
TED,1234,CME,,,ED,201912,,,,100,FUT
TED,1234,CME,,,ED,202003,,,,100,FUT
</string>
</payload>
</transaction>
<transaction portfolioId="10353741" type="TRADE"
id="{transactionId}">
<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
TED,1234,CME,,,ED,201906,,,,100,IRS
TED,1234,CME,,,ED,201909,,,,100,IRS
TED,1234,CME,,,ED,201912,,,,100,IRS
TED,1234,CME,,,ED,202003,,,,100,IRS
</string>
</payload>
</transaction>
</ns2:transactionReq>
Update Transaction/MarginServiceApi/transactions/{transactionId}PUTusername' AND 'password'
?xml version="1.1" encoding="UTF-8"
standalone="yes"?>
<ns2:transactionReq xmlns:ns2="http://cmegroup.com/schema/core/1.2"
reqUserId="ak">
<transaction portfolioId="10353741"
type="TRADE" id="{transactionId}">
<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
TED,UPDATE,CME,,,ED,201906,,,,100,FUT
TED,UPDATE,CME,,,ED,201909,,,,100,FUT
TED,UPDATE,CME,,,ED,201912,,,,100,FUT
TED,UPDATE,CME,,,ED,202003,,,,100,FUT
</string>
</payload>
</transaction>
<transaction portfolioId="10353741" type="TRADE"
id="{transactionId}">
<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
TED,1234,CME,,,ED,201906,,,,100,IRS
TED,1234,CME,,,ED,201909,,,,100,IRS
TED,1234,CME,,,ED,201912,,,,100,IRS
TED,1234,CME,,,ED,202003,,,,100,IRS
</string>
</payload>
</transaction>
</ns2:transactionReq>

Error Codes

CodeDescriptionRequestExample Message
400

Bad XML syntax or missing content

More information will be provided in the error message.

Calculate Margin
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginRpt 
    xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="ERROR">
    <error code="400" msg="Portfolio ID [123] was not found."/>
</ns2:marginRpt>
403The user does not have permission to perform calculations on the analyticAdd Transaction
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:transactionRpt 
    xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="ERROR">
    <error code="403" msg="Access denied. User does not have permission to execute action on the submitted trades."/>
</ns2:transactionRpt>
404The requested portfolio/transaction/margin could not be found.Get Portfolio
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:portfolioRpt 
    xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="ERROR">
    <error code="404" msg="Portfolio ID [123] was not found."/>
</ns2:portfolioRpt>
Get Margin
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:marginRpt 
    xmlns:ns2="http://cmegroup.com/schema/core/1.2" status="ERROR">
    <error code="404" msg="Margin ID was not found."/>
</ns2:marginRpt>
500 

The server was not able to process the request or if validation errors exist.

More information (if available) will be provided in the error message. 

Add Portfolio
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:portfolioRpt
xmlns:ns2="http://cmegroup.com/schema/core/1.2"
status="ERROR">
<error msg="Internal API error. Error ID:
MP52trfB3vvy" code="500"/>
</ns2:portfolioRpt>
Add Transaction
<?xml version="1.0"
encoding="UTF-8"
standalone="yes"?><ns2:transactionRpt
xmlns:ns2="http://cmegroup.com/schema/core/1.2"
status="ERROR"><error msg="Internal API error. Error ID:
k8jeBfA3nU4m" code="500"/></ns2:transactionRpt>
Calculate Margin
<?xml version="1.0"
encoding="UTF-8" standalone="yes"?><ns2:marginRpt
xmlns:ns2="http://cmegroup.com/schema/core/1.2"><error
msg="72013111: Error message text goes here"
code="500"/></ns2:marginRpt>

In the above example, 72013111 represents the transaction id that had the validation error.

Get Margin
<?xml version="1.0"
encoding="UTF-8" standalone="yes"?><ns2:marginRpt
xmlns:ns2="http://cmegroup.com/schema/core/1.2"><error
msg="marginRpt id=3970 Error: ErrorMsg Text"
code="500"/></ns2:marginRpt>
  • No labels