Quickstart

This guide will help you get started with the Cumulus9 API. We’ll cover how to authenticate using OAuth 2.0, submit a portfolio for margin calculations, and retrieve the results.

Get your access token

Before you can interact with the API, you need an access token. Use the OAuth 2.0 Client Credentials Flow to request an access token.

POST
/token
# please contact support@cumulus9.com to receive the below credentials
c9_api_endpoint="xxxxxxxxxxxxxxxxxx"
c9_api_auth_endpoint="xxxxxxxxxxxxxxxxxx"
c9_api_client_id="xxxxxxxxxxxxxxxxxx"
c9_api_client_secret="xxxxxxxxxxxxxxxxxx"

# retrieve access token
basic_authorization_base64=$(echo -n "$c9_api_client_id:$c9_api_client_secret" | base64)
headers=("Authorization: Basic $basic_authorization_base64" "Content-Type: application/x-www-form-urlencoded")
data="grant_type=client_credentials&scope=riskcalc%2Fget"
access_token=$(curl -s -X POST "$c9_api_auth_endpoint" -H "${headers[1]}" -H "${headers[2]}" -d "$data" | jq -r ".access_token")

Make your first API request

Use the access token to submit a portfolio for margin calculations.

POST
/portfolios
# example of portfolio payload
portfolio_payload='
{
    "vendor_symbology": "clearing",
    "calculation_type": "margins",
    "execution_mode": "sync",
    "portfolio": [
        {
            "account_code": "Account 001",
            "exchange_code": "ASX",
            "contract_code": "XT",
            "contract_type": "F",
            "contract_expiry": "DEC-25",
            "contract_strike": "",
            "net_position": "500"
        },
        {
            "account_code": "Account 001",
            "exchange_code": "ICE.EU",
            "contract_code": "B",
            "contract_type": "Future",
            "contract_expiry": "DEC-25",
            "contract_strike": "",
            "net_position": "500"
        },
        {
            "account_code": "Account 001",
            "exchange_code": "NYMEX",
            "contract_code": "LO",
            "contract_type": "CALL",
            "contract_expiry": "202512",
            "contract_strike": "50.1",
            "net_position": "-1000"
        },
        {
            "account_code": "Account 002",
            "exchange_code": "EUREX",
            "contract_code": "FDAX",
            "contract_type": "FUT",
            "contract_expiry": "202612",
            "contract_strike": "",
            "net_position": "-50"
        }
    ]
}'

# post portfolio
headers=("Content-Type: application/json" "Authorization: Bearer $access_token")
response=$(curl -s -X POST "$c9_api_endpoint/portfolios" -H "${headers[1]}" -H "${headers[2]}" -d "$portfolio_payload" | jq)

echo $response

What's next?

Great, you have now made your first request to the API. Here are a few links that might be handy for more details:

Was this page helpful?