Code Samples
Use the following samples to quickly integrate the SSCMFI Public API into your application. Each sample demonstrates how to build a calculation request and handle the JSON response.
PHP
<?php
/**
* SSCMFI Public API - PHP Sample Code
*
* This script demonstrates how to call the sscmfiPublicAPI using PHP's cURL extension.
* It uses a sample "Periodic" bond with a complex call schedule.
*/
// 1. Configuration
// --- Option A: Public API (No API Key required, rate limited) ---
$api_url = "https://api.sscmfi.com/api/sscmfiPublicAPI";
$api_key = "";
// --- Option B: Subscription API (Requires API Key) ---
// $api_url = "https://api.sscmfi.com/api/sscmfiAPICalculate";
// $api_key = "YOUR_API_KEY_HERE";
// 2. Prepare the Request Payload (based on Sample data for code examples)
$payload = [
'metadata' => [
'calculationID' => "ABC987"
],
'securityDefinition' => [
'securityID' => 'Testsec77',
'paymentType' => 'Periodic',
'securityType' => 'Corporate',
'maturityDate' => '3/31/2031',
'couponRate' => 8.75,
'redemption_value' => 100.0,
'dayCountBasis' => 'SSCM30/360',
'eomRule' => 'Adjust',
'periodsPerYear' => 'Monthly',
'callRedemptions' => [
'redemptionScheduleType' => 'Continuous with notification',
'notifyMinDays' => 30,
'notifyMaxDays' => 60,
'notifyStart' => 'Trade date',
'notifyCalendarBusiness' => 'Calendar days',
'redemptionList' => [
['date' => '03/31/2027', 'value' => 101.50],
['date' => '09/30/2027', 'value' => 101.25],
['date' => '03/31/2028', 'value' => 101.0],
['date' => '09/03/2028', 'value' => 100.75],
['date' => '03/31/2029', 'value' => 100.50],
['date' => '09/30/2029', 'value' => 100.25]
]
]
],
'tradeDefinition' => [
'tradeDate' => '7/22/2025',
'settlementDate' => '7/23/2025',
'givenType' => 'Price',
'givenValue' => 103.5
],
'calculationSelection' => [
'calcsToReturn' => [
'calcPY' => "Yes",
'calcPYAnalytics' => "Yes",
'calcCFS' => "No",
'calcCFSAnalytics' => "Yes",
'calcCouponPeriod' => "Yes"
],
'calculationsFor' => "All redemptions"
],
'settings' => [
'dateScheme' => [
'dateTwoOrFourYear' => "FOUR",
'dateFormat' => 'MDY',
'dateCutoffYear' => 2075
]
]
];
// 3. Initialize cURL
$ch = curl_init($api_url);
// 4. Set cURL Options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$headers = ['Content-Type: application/json'];
if (!empty($api_key)) {
$headers[] = 'X-API-KEY: ' . $api_key;
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// 5. Execute API Call
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// 6. Handle Response
$is_cli = (php_sapi_name() === 'cli');
if (!$is_cli) echo "<pre>";
if (curl_errno($ch)) {
echo "Curl Error: " . curl_error($ch) . "\n";
} else {
$decoded_response = json_decode($response, true);
echo "HTTP Status: $http_code\n";
if ($http_code === 200 && isset($decoded_response['success']) && $decoded_response['success']) {
echo "Status: SUCCESS\n\n";
print_r($decoded_response);
} else {
echo "Status: FAILED\n\n";
print_r($decoded_response);
}
}
if (!$is_cli) echo "</pre>";
// 7. Cleanup
curl_close($ch);
?>
Python
import requests
import json
"""
SSCMFI Public API - Python Sample Code
This script demonstrates how to call the sscmfiPublicAPI using the 'requests' library.
It uses a sample "Periodic" bond with a complex call schedule.
"""
# 1. Configuration
# --- Option A: Public API (No API Key required, rate limited) ---
api_url = "https://api.sscmfi.com/api/sscmfiPublicAPI"
api_key = ""
# --- Option B: Subscription API (Requires API Key) ---
# api_url = "https://api.sscmfi.com/api/sscmfiAPICalculate"
# api_key = "YOUR_API_KEY_HERE"
# 2. Prepare the Request Payload
payload = {
"metadata": {
"calculationID": "ABC987"
},
"securityDefinition": {
"securityID": "Testsec77",
"paymentType": "Periodic",
"securityType": "Corporate",
"maturityDate": "3/31/2031",
"couponRate": 8.75,
"redemption_value": 100.0,
"dayCountBasis": "SSCM30/360",
"eomRule": "Adjust",
"periodsPerYear": "Monthly",
"callRedemptions": {
"redemptionScheduleType": "Continuous with notification",
"notifyMinDays": 30,
"notifyMaxDays": 60,
"notifyStart": "Trade date",
"notifyCalendarBusiness": "Calendar days",
"redemptionList": [
{"date": "03/31/2027", "value": 101.50},
{"date": "09/30/2027", "value": 101.25},
{"date": "03/31/2028", "value": 101.0},
{"date": "09/03/2028", "value": 100.75},
{"date": "03/31/2029", "value": 100.50},
{"date": "09/30/2029", "value": 100.25}
]
}
},
"tradeDefinition": {
"tradeDate": "7/22/2025",
"settlementDate": "7/23/2025",
"givenType": "Price",
"givenValue": 103.5
},
"calculationSelection": {
"calcsToReturn": {
"calcPY": "Yes",
"calcPYAnalytics": "Yes",
"calcCFS": "No",
"calcCFSAnalytics": "Yes",
"calcCouponPeriod": "Yes"
},
"calculationsFor": "All redemptions"
},
"settings": {
"dateScheme": {
"dateTwoOrFourYear": "FOUR",
"dateFormat": "MDY",
"dateCutoffYear": 2075
}
}
}
# 3. Set Headers
headers = {
"Content-Type": "application/json"
}
if api_key:
headers["X-API-KEY"] = api_key
# 4. Execute API Call
try:
response = requests.post(api_url, json=payload, headers=headers)
response.raise_for_status() # Check for HTTP errors
# 5. Handle Response
decoded_response = response.json()
print(f"HTTP Status: {response.status_code}")
if decoded_response.get("success"):
print("Status: SUCCESS\n")
print(json.dumps(decoded_response, indent=4))
else:
print("Status: FAILED\n")
print(json.dumps(decoded_response, indent=4))
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
if hasattr(e.response, 'text'):
print(f"Response Body: {e.response.text}")
' SSCMFI Public API - VBA / Excel Sample Code
'
' Requirements:
' 1. Open Excel and press ALT + F11 to open the VBA Editor.
' 2. Go to Tools -> References.
' 3. Check "Microsoft XML, v6.0" (or latest version).
'
' This script demonstrates how to call the sscmfiPublicAPI using WinHTTP/XMLHTTP.
Sub CallSSCMFI_API()
Dim xmlHttp As Object
Dim apiURL As String
Dim apiKey As String
Dim payload As String
Dim response As String
' 1. Configuration
' --- Option A: Public API (No API Key required) ---
apiURL = "https://api.sscmfi.com/api/sscmfiPublicAPI"
apiKey = ""
' --- Option B: Subscription API (Requires API Key) ---
' apiURL = "https://api.sscmfi.com/api/sscmfiAPICalculate"
' apiKey = "YOUR_API_KEY_HERE"
' 2. Prepare the Request Payload (Minified JSON)
' We build the string in small chunks to avoid VBA's 25-line continuation limit.
payload = "{" & _
"""metadata"":{""calculationID"":""ABC987""}," & _
"""securityDefinition"":{" & _
"""securityID"":""Testsec77""," & _
"""paymentType"":""Periodic""," & _
"""securityType"":""Corporate""," & _
"""maturityDate"":""3/31/2031""," & _
"""couponRate"":8.75," & _
"""redemption_value"":100.0," & _
"""dayCountBasis"":""SSCM30/360""," & _
"""eomRule"":""Adjust""," & _
"""periodsPerYear"":""Monthly""," & _
"""callRedemptions"":{"
payload = payload & _
"""redemptionScheduleType"":""Continuous with notification""," & _
"""notifyMinDays"":30," & _
"""notifyMaxDays"":60," & _
"""notifyStart"":""Trade date""," & _
"""notifyCalendarBusiness"":""Calendar days""," & _
"""redemptionList"":[" & _
"{""date"":""03/31/2027"",""value"":101.50}," & _
"{""date"":""09/30/2027"",""value"":101.25}," & _
"{""date"":""03/31/2028"",""value"":101.0}," & _
"{""date"":""09/03/2028"",""value"":100.75}," & _
"{""date"":""03/31/2029"",""value"":100.50}," & _
"{""date"":""09/30/2029"",""value"":100.25}" & _
"]" & _
"}" & _
"}"
payload = payload & "," & _
"""tradeDefinition"":{" & _
"""tradeDate"":""7/22/2025""," & _
"""settlementDate"":""7/23/2025""," & _
"""givenType"":""Price""," & _
"""givenValue"":103.5" & _
"}"
payload = payload & "," & _
"""calculationSelection"":{" & _
"""calcsToReturn"":{" & _
"""calcPY"":""Yes""," & _
"""calcPYAnalytics"":""Yes""," & _
"""calcCFS"":""No""," & _
"""calcCFSAnalytics"":""Yes""," & _
"""calcCouponPeriod"":""Yes""" & _
"}," & _
"""calculationsFor"":""All redemptions""" & _
"}"
payload = payload & "," & _
"""settings"":{" & _
"""dateScheme"":{" & _
"""dateTwoOrFourYear"":""FOUR""," & _
"""dateFormat"":""MDY""," & _
"""dateCutoffYear"":2075" & _
"}" & _
"}" & _
"}"
' 3. Initialize HTTP Request
Set xmlHttp = CreateObject("MSXML2.XMLHTTP")
' 4. Configure and Send Request
xmlHttp.Open "POST", apiURL, False
xmlHttp.setRequestHeader "Content-Type", "application/json"
If apiKey <> "" Then
xmlHttp.setRequestHeader "X-API-KEY", apiKey
End If
On Error GoTo ErrorHandler
xmlHttp.Send payload
' 5. Handle Response
response = xmlHttp.responseText
Debug.Print "HTTP Status: " & xmlHttp.Status & " " & xmlHttp.statusText
Debug.Print "--------------------------------------------------"
Debug.Print "API Response:"
Debug.Print response
Debug.Print "--------------------------------------------------"
MsgBox "API Call Completed. Check the 'Immediate Window' (CTRL+G) for results.", vbInformation
Exit Sub
ErrorHandler:
MsgBox "An error occurred: " & Err.Description, vbCritical
End Sub
JavaScript
/**
* SSCMFI Public API - Node.js Sample Code
*
* Requirements:
* npm install axios
*/
const axios = require('axios');
// 1. Configuration
// --- Option A: Public API (No API Key required) ---
const apiURL = "https://api.sscmfi.com/api/sscmfiPublicAPI";
const apiKey = "";
// --- Option B: Subscription API (Requires API Key) ---
// const apiURL = "https://api.sscmfi.com/api/sscmfiAPICalculate";
// const apiKey = "YOUR_API_KEY_HERE";
// 2. Prepare the Request Payload
const payload = {
metadata: {
calculationID: "ABC987"
},
securityDefinition: {
securityID: "Testsec77",
paymentType: "Periodic",
securityType: "Corporate",
maturityDate: "3/31/2031",
couponRate: 8.75,
redemption_value: 100.0,
dayCountBasis: "SSCM30/360",
eomRule: "Adjust",
periodsPerYear: "Monthly",
callRedemptions: {
redemptionScheduleType: "Continuous with notification",
notifyMinDays: 30,
notifyMaxDays: 60,
notifyStart: "Trade date",
notifyCalendarBusiness: "Calendar days",
redemptionList: [
{ date: "03/31/2027", value: 101.50 },
{ date: "09/30/2027", value: 101.25 },
{ date: "03/31/2028", value: 101.0 },
{ date: "09/03/2028", value: 100.75 },
{ date: "03/31/2029", value: 100.50 },
{ date: "09/30/2029", value: 100.25 }
]
}
},
tradeDefinition: {
tradeDate: "7/22/2025",
settlementDate: "7/23/2025",
givenType: "Price",
givenValue: 103.5
},
calculationSelection: {
calcsToReturn: {
calcPY: "Yes",
calcPYAnalytics: "Yes",
calcCFS: "No",
calcCFSAnalytics: "Yes",
calcCouponPeriod: "Yes"
},
calculationsFor: "All redemptions"
},
settings: {
dateScheme: {
dateTwoOrFourYear: "FOUR",
dateFormat: "MDY",
dateCutoffYear: 2075
}
}
};
// 3. Set Headers
const headers = {
'Content-Type': 'application/json'
};
if (apiKey) {
headers['X-API-KEY'] = apiKey;
}
// 4. Execute API Call
async function calculateBond() {
try {
const response = await axios.post(apiURL, payload, { headers });
// 5. Handle Response
console.log(`HTTP Status: ${response.status} ${response.statusText}`);
if (response.data.success) {
console.log("Status: SUCCESS\n");
console.log(JSON.stringify(response.data, null, 4));
} else {
console.log("Status: FAILED\n");
console.log(JSON.stringify(response.data, null, 4));
}
} catch (error) {
if (error.response) {
// The request was made and the server responded with a status code
console.error(`HTTP Error: ${error.response.status}`);
console.error(error.response.data);
} else if (error.request) {
// The request was made but no response was received
console.error("No response received from server.");
} else {
// Something happened in setting up the request
console.error("Error:", error.message);
}
}
}
calculateBond();
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace SSCMFI.ApiSamples
{
/// <summary>
/// SSCMFI Public API - C# / .NET Sample Code
/// </summary>
class Program
{
// 1. Configuration
// --- Option A: Public API (No API Key required) ---
private static readonly string ApiUrl = "https://api.sscmfi.com/api/sscmfiPublicAPI";
private static readonly string ApiKey = "";
// --- Option B: Subscription API (Requires API Key) ---
// private static readonly string ApiUrl = "https://api.sscmfi.com/api/sscmfiAPICalculate";
// private static readonly string ApiKey = "YOUR_API_KEY_HERE";
static async Task Main(string[] args)
{
// 2. Prepare the Request Payload
var payload = new
{
metadata = new { calculationID = "ABC987" },
securityDefinition = new
{
securityID = "Testsec77",
paymentType = "Periodic",
securityType = "Corporate",
maturityDate = "3/31/2031",
couponRate = 8.75,
redemption_value = 100.0,
dayCountBasis = "SSCM30/360",
eomRule = "Adjust",
periodsPerYear = "Monthly",
callRedemptions = new
{
redemptionScheduleType = "Continuous with notification",
notifyMinDays = 30,
notifyMaxDays = 60,
notifyStart = "Trade date",
notifyCalendarBusiness = "Calendar days",
redemptionList = new[]
{
new { date = "03/31/2027", value = 101.50 },
new { date = "09/30/2027", value = 101.25 },
new { date = "03/31/2028", value = 101.0 },
new { date = "09/03/2028", value = 100.75 },
new { date = "03/31/2029", value = 100.50 },
new { date = "09/30/2029", value = 100.25 }
}
}
},
tradeDefinition = new
{
tradeDate = "7/22/2025",
settlementDate = "7/23/2025",
givenType = "Price",
givenValue = 103.5
},
calculationSelection = new
{
calcsToReturn = new
{
calcPY = "Yes",
calcPYAnalytics = "Yes",
calcCFS = "No",
calcCFSAnalytics = "Yes",
calcCouponPeriod = "Yes"
},
calculationsFor = "All redemptions"
},
settings = new
{
dateScheme = new
{
dateTwoOrFourYear = "FOUR",
dateFormat = "MDY",
dateCutoffYear = 2075
}
}
};
// 3. Initialize HttpClient
using (var client = new HttpClient())
{
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
if (!string.IsNullOrEmpty(ApiKey))
{
client.DefaultRequestHeaders.Add("X-API-KEY", ApiKey);
}
try
{
// 4. Execute API Call
var response = await client.PostAsync(ApiUrl, content);
var responseString = await response.Content.ReadAsStringAsync();
// 5. Handle Response
Console.WriteLine($"HTTP Status: {(int)response.StatusCode} {response.ReasonPhrase}");
using (var doc = JsonDocument.Parse(responseString))
{
var formattedJson = JsonSerializer.Serialize(doc, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine("--------------------------------------------------");
Console.WriteLine(formattedJson);
Console.WriteLine("--------------------------------------------------");
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
}
Rust
/*
SSCMFI Public API - Rust Sample Code
Requirements (add to Cargo.toml):
[dependencies]
reqwest = { version = "0.11", features = ["json", "blocking"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
*/
use std::collections::HashMap;
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Configuration
// --- Option A: Public API (No API Key required) ---
let api_url = "https://api.sscmfi.com/api/sscmfiPublicAPI";
let api_key = "";
// --- Option B: Subscription API (Requires API Key) ---
// let api_url = "https://api.sscmfi.com/api/sscmfiAPICalculate";
// let api_key = "YOUR_API_KEY_HERE";
// 2. Prepare the Request Payload
let payload = json!({
"metadata": {
"calculationID": "ABC987"
},
"securityDefinition": {
"securityID": "Testsec77",
"paymentType": "Periodic",
"securityType": "Corporate",
"maturityDate": "3/31/2031",
"couponRate": 8.75,
"redemption_value": 100.0,
"dayCountBasis": "SSCM30/360",
"eomRule": "Adjust",
"periodsPerYear": "Monthly",
"callRedemptions": {
"redemptionScheduleType": "Continuous with notification",
"notifyMinDays": 30,
"notifyMaxDays": 60,
"notifyStart": "Trade date",
"notifyCalendarBusiness": "Calendar days",
"redemptionList": [
{ "date": "03/31/2027", "value": 101.50 },
{ "date": "09/30/2027", "value": 101.25 },
{ "date": "03/31/2028", "value": 101.0 },
{ "date": "09/03/2028", "value": 100.75 },
{ "date": "03/31/2029", "value": 100.50 },
{ "date": "09/30/2029", "value": 100.25 }
]
}
},
"tradeDefinition": {
"tradeDate": "7/22/2025",
"settlementDate": "7/23/2025",
"givenType": "Price",
"givenValue": 103.5
},
"calculationSelection": {
"calcsToReturn": {
"calcPY": "Yes",
"calcPYAnalytics": "Yes",
"calcCFS": "No",
"calcCFSAnalytics": "Yes",
"calcCouponPeriod": "Yes"
},
"calculationsFor": "All redemptions"
},
"settings": {
"dateScheme": {
"dateTwoOrFourYear": "FOUR",
"dateFormat": "MDY",
"dateCutoffYear": 2075
}
}
});
// 3. Initialize HttpClient (Using blocking reqwest for simplicity)
let client = reqwest::blocking::Client::new();
let mut request = client.post(api_url)
.header("Content-Type", "application/json");
if !api_key.is_empty() {
request = request.header("X-API-KEY", api_key);
}
// 4. Execute API Call
let response = request.json(&payload).send()?;
// 5. Handle Response
println!("HTTP Status: {}", response.status());
let response_body: serde_json::Value = response.json()?;
println!("--------------------------------------------------");
println!("{}", serde_json::to_string_pretty(&response_body)?);
println!("--------------------------------------------------");
Ok(())
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
/*
SSCMFI Public API - Go Sample Code
*/
func main() {
// 1. Configuration
// --- Option A: Public API (No API Key required) ---
apiURL := "https://api.sscmfi.com/api/sscmfiPublicAPI"
apiKey := ""
// --- Option B: Subscription API (Requires API Key) ---
// apiURL := "https://api.sscmfi.com/api/sscmfiAPICalculate"
// apiKey := "YOUR_API_KEY_HERE"
// 2. Prepare the Request Payload
payload := map[string]interface{}{
"metadata": map[string]string{
"calculationID": "ABC987",
},
"securityDefinition": map[string]interface{}{
"securityID": "Testsec77",
"paymentType": "Periodic",
"securityType": "Corporate",
"maturityDate": "3/31/2031",
"couponRate": 8.75,
"redemption_value": 100.0,
"dayCountBasis": "SSCM30/360",
"eomRule": "Adjust",
"periodsPerYear": "Monthly",
"callRedemptions": map[string]interface{}{
"redemptionScheduleType": "Continuous with notification",
"notifyMinDays": 30,
"notifyMaxDays": 60,
"notifyStart": "Trade date",
"notifyCalendarBusiness": "Calendar days",
"redemptionList": []map[string]interface{}{
{"date": "03/31/2027", "value": 101.50},
{"date": "09/30/2027", "value": 101.25},
{"date": "03/31/2028", "value": 101.0},
{"date": "09/03/2028", "value": 100.75},
{"date": "03/31/2029", "value": 100.50},
{"date": "09/30/2029", "value": 100.25},
},
},
},
"tradeDefinition": map[string]interface{}{
"tradeDate": "7/22/2025",
"settlementDate": "7/23/2025",
"givenType": "Price",
"givenValue": 103.5,
},
"calculationSelection": map[string]interface{}{
"calcsToReturn": map[string]string{
"calcPY": "Yes",
"calcPYAnalytics": "Yes",
"calcCFS": "No",
"calcCFSAnalytics": "Yes",
"calcCouponPeriod": "Yes",
},
"calculationsFor": "All redemptions",
},
"settings": map[string]interface{}{
"dateScheme": map[string]interface{}{
"dateTwoOrFourYear": "FOUR",
"dateFormat": "MDY",
"dateCutoffYear": 2075,
},
},
}
// 3. Encode Payload to JSON
jsonPayload, _ := json.Marshal(payload)
// 4. Initialize and Configure Request
req, _ := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonPayload))
req.Header.Set("Content-Type", "application/json")
if apiKey != "" {
req.Header.Set("X-API-KEY", apiKey)
}
// 5. Execute API Call
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Error making request: %v\n", err)
return
}
defer resp.Body.Close()
// 6. Handle Response
body, _ := ioutil.ReadAll(resp.Body)
fmt.Printf("HTTP Status: %d %s\n", resp.StatusCode, resp.Status)
var result map[string]interface{}
json.Unmarshal(body, &result)
formattedJSON, _ := json.MarshalIndent(result, "", " ")
fmt.Println("--------------------------------------------------")
fmt.Println(string(formattedJSON))
fmt.Println("--------------------------------------------------")
}
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
/**
* SSCMFI Public API - Java Sample Code
* Uses the built-in HttpClient available in Java 11 and later.
*/
public class SscmfiApiSample {
public static void main(String[] args) {
try {
// 1. Configuration
// --- Option A: Public API (No API Key required) ---
String apiURL = "https://api.sscmfi.com/api/sscmfiPublicAPI";
String apiKey = "";
// --- Option B: Subscription API (Requires API Key) ---
// String apiURL = "https://api.sscmfi.com/api/sscmfiAPICalculate";
// String apiKey = "YOUR_API_KEY_HERE";
// 2. Prepare the Request Payload (Minified JSON)
// In professional projects, use a library like Jackson or Gson.
String payload = "{" +
"\"metadata\":{\"calculationID\":\"ABC987\"}," +
"\"securityDefinition\":{" +
"\"securityID\":\"Testsec77\"," +
"\"paymentType\":\"Periodic\"," +
"\"securityType\":\"Corporate\"," +
"\"maturityDate\":\"3/31/2031\"," +
"\"couponRate\":8.75," +
"\"redemption_value\":100.0," +
"\"dayCountBasis\":\"SSCM30/360\"," +
"\"eomRule\":\"Adjust\"," +
"\"periodsPerYear\":\"Monthly\"," +
"\"callRedemptions\":{" +
"\"redemptionScheduleType\":\"Continuous with notification\"," +
"\"notifyMinDays\":30," +
"\"notifyMaxDays\":60," +
"\"notifyStart\":\"Trade date\"," +
"\"notifyCalendarBusiness\":\"Calendar days\"," +
"\"redemptionList\":[" +
"{\"date\":\"03/31/2027\",\"value\":101.50}," +
"{\"date\":\"09/30/2027\",\"value\":101.25}," +
"{\"date\":\"03/31/2028\",\"value\":101.0}," +
"{\"date\":\"09/03/2028\",\"value\":100.75}," +
"{\"date\":\"03/31/2029\",\"value\":100.50}," +
"{\"date\":\"09/30/2029\",\"value\":100.25}" +
"]" +
"}" +
"}," +
"\"tradeDefinition\":{" +
"\"tradeDate\":\"7/22/2025\"," +
"\"settlementDate\":\"7/23/2025\"," +
"\"givenType\":\"Price\"," +
"\"givenValue\":103.5" +
"}," +
"\"calculationSelection\":{" +
"\"calcsToReturn\":{" +
"\"calcPY\":\"Yes\"," +
"\"calcPYAnalytics\":\"Yes\"," +
"\"calcCFS\":\"No\"," +
"\"calcCFSAnalytics\":\"Yes\"," +
"\"calcCouponPeriod\":\"Yes\"" +
"}," +
"\"calculationsFor\":\"All redemptions\"" +
"}," +
"\"settings\":{" +
"\"dateScheme\":{" +
"\"dateTwoOrFourYear\":\"FOUR\"," +
"\"dateFormat\":\"MDY\"," +
"\"dateCutoffYear\":2075" +
"}" +
"}" +
"}";
// 3. Initialize HttpClient and Build Request
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create(apiURL))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload));
if (!apiKey.isEmpty()) {
requestBuilder.header("X-API-KEY", apiKey);
}
HttpRequest request = requestBuilder.build();
// 4. Execute API Call
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
// 5. Handle Response
System.out.println("HTTP Status: " + response.statusCode());
System.out.println("--------------------------------------------------");
System.out.println(response.body());
System.out.println("--------------------------------------------------");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Bash
#!/bin/bash
# SSCMFI Public API - cURL Sample
# 1. Configuration
API_URL="https://api.sscmfi.com/api/sscmfiPublicAPI"
API_KEY="" # Leave empty for Public API
# 2. Execute API Call
curl -X POST "$API_URL" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $API_KEY" \
-d '{
"metadata": {
"calculationID": "ABC987"
},
"securityDefinition": {
"securityID": "Testsec77",
"paymentType": "Periodic",
"securityType": "Corporate",
"maturityDate": "3/31/2031",
"couponRate": 8.75,
"redemption_value": 100.0,
"dayCountBasis": "SSCM30/360",
"eomRule": "Adjust",
"periodsPerYear": "Monthly",
"callRedemptions": {
"redemptionScheduleType": "Continuous with notification",
"notifyMinDays": 30,
"notifyMaxDays": 60,
"notifyStart": "Trade date",
"notifyCalendarBusiness": "Calendar days",
"redemptionList": [
{ "date": "03/31/2027", "value": 101.50 },
{ "date": "09/30/2027", "value": 101.25 },
{ "date": "03/31/2028", "value": 101.0 },
{ "date": "09/03/2028", "value": 100.75 },
{ "date": "03/31/2029", "value": 100.50 },
{ "date": "09/30/2029", "value": 100.25 }
]
}
},
"tradeDefinition": {
"tradeDate": "7/22/2025",
"settlementDate": "7/23/2025",
"givenType": "Price",
"givenValue": 103.5
},
"calculationSelection": {
"calcsToReturn": {
"calcPY": "Yes",
"calcPYAnalytics": "Yes",
"calcCFS": "No",
"calcCFSAnalytics": "Yes",
"calcCouponPeriod": "Yes"
},
"calculationsFor": "All redemptions"
},
"settings": {
"dateScheme": {
"dateTwoOrFourYear": "FOUR",
"dateFormat": "MDY",
"dateCutoffYear": 2075
}
}
}'
