curl --request POST \
--url https://api.fincept.in/quantlib/solver/finance/oas \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"price": 102.5,
"scenario_cashflows": [
[
3,
3,
103
],
[
3,
3,
3,
103
],
[
3,
103
]
],
"times": [
1,
2,
3,
4
],
"probabilities": [
0.4,
0.4,
0.2
],
"base_rates": [
0.03,
0.035,
0.04,
0.042
],
"base_times": [
1,
2,
3,
4
]
}
'import requests
url = "https://api.fincept.in/quantlib/solver/finance/oas"
payload = {
"price": 102.5,
"scenario_cashflows": [[3, 3, 103], [3, 3, 3, 103], [3, 103]],
"times": [1, 2, 3, 4],
"probabilities": [0.4, 0.4, 0.2],
"base_rates": [0.03, 0.035, 0.04, 0.042],
"base_times": [1, 2, 3, 4]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
price: 102.5,
scenario_cashflows: [[3, 3, 103], [3, 3, 3, 103], [3, 103]],
times: [1, 2, 3, 4],
probabilities: [0.4, 0.4, 0.2],
base_rates: [0.03, 0.035, 0.04, 0.042],
base_times: [1, 2, 3, 4]
})
};
fetch('https://api.fincept.in/quantlib/solver/finance/oas', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fincept.in/quantlib/solver/finance/oas",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'price' => 102.5,
'scenario_cashflows' => [
[
3,
3,
103
],
[
3,
3,
3,
103
],
[
3,
103
]
],
'times' => [
1,
2,
3,
4
],
'probabilities' => [
0.4,
0.4,
0.2
],
'base_rates' => [
0.03,
0.035,
0.04,
0.042
],
'base_times' => [
1,
2,
3,
4
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fincept.in/quantlib/solver/finance/oas"
payload := strings.NewReader("{\n \"price\": 102.5,\n \"scenario_cashflows\": [\n [\n 3,\n 3,\n 103\n ],\n [\n 3,\n 3,\n 3,\n 103\n ],\n [\n 3,\n 103\n ]\n ],\n \"times\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"probabilities\": [\n 0.4,\n 0.4,\n 0.2\n ],\n \"base_rates\": [\n 0.03,\n 0.035,\n 0.04,\n 0.042\n ],\n \"base_times\": [\n 1,\n 2,\n 3,\n 4\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fincept.in/quantlib/solver/finance/oas")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"price\": 102.5,\n \"scenario_cashflows\": [\n [\n 3,\n 3,\n 103\n ],\n [\n 3,\n 3,\n 3,\n 103\n ],\n [\n 3,\n 103\n ]\n ],\n \"times\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"probabilities\": [\n 0.4,\n 0.4,\n 0.2\n ],\n \"base_rates\": [\n 0.03,\n 0.035,\n 0.04,\n 0.042\n ],\n \"base_times\": [\n 1,\n 2,\n 3,\n 4\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fincept.in/quantlib/solver/finance/oas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": 102.5,\n \"scenario_cashflows\": [\n [\n 3,\n 3,\n 103\n ],\n [\n 3,\n 3,\n 3,\n 103\n ],\n [\n 3,\n 103\n ]\n ],\n \"times\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"probabilities\": [\n 0.4,\n 0.4,\n 0.2\n ],\n \"base_rates\": [\n 0.03,\n 0.035,\n 0.04,\n 0.042\n ],\n \"base_times\": [\n 1,\n 2,\n 3,\n 4\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"oas": 0.0085
}
}{
"detail": "Invalid API key"
}{
"detail": "Endpoint requires Basic tier or higher"
}{
"detail": [
{}
]
}Calculate Option-Adjusted Spread (OAS)
Calculate the Option-Adjusted Spread - the constant spread over the risk-free curve that accounts for embedded options in a bond. OAS removes the value of embedded options (calls, puts, prepayment options) to isolate the pure credit spread. Calculated using Monte Carlo simulation or binomial trees to value the option component. Essential for MBS, callable bonds, and any security with embedded optionality. Provides a fair comparison between bonds with and without embedded options. [Tier: PRO, Credits: 5]
curl --request POST \
--url https://api.fincept.in/quantlib/solver/finance/oas \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"price": 102.5,
"scenario_cashflows": [
[
3,
3,
103
],
[
3,
3,
3,
103
],
[
3,
103
]
],
"times": [
1,
2,
3,
4
],
"probabilities": [
0.4,
0.4,
0.2
],
"base_rates": [
0.03,
0.035,
0.04,
0.042
],
"base_times": [
1,
2,
3,
4
]
}
'import requests
url = "https://api.fincept.in/quantlib/solver/finance/oas"
payload = {
"price": 102.5,
"scenario_cashflows": [[3, 3, 103], [3, 3, 3, 103], [3, 103]],
"times": [1, 2, 3, 4],
"probabilities": [0.4, 0.4, 0.2],
"base_rates": [0.03, 0.035, 0.04, 0.042],
"base_times": [1, 2, 3, 4]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
price: 102.5,
scenario_cashflows: [[3, 3, 103], [3, 3, 3, 103], [3, 103]],
times: [1, 2, 3, 4],
probabilities: [0.4, 0.4, 0.2],
base_rates: [0.03, 0.035, 0.04, 0.042],
base_times: [1, 2, 3, 4]
})
};
fetch('https://api.fincept.in/quantlib/solver/finance/oas', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fincept.in/quantlib/solver/finance/oas",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'price' => 102.5,
'scenario_cashflows' => [
[
3,
3,
103
],
[
3,
3,
3,
103
],
[
3,
103
]
],
'times' => [
1,
2,
3,
4
],
'probabilities' => [
0.4,
0.4,
0.2
],
'base_rates' => [
0.03,
0.035,
0.04,
0.042
],
'base_times' => [
1,
2,
3,
4
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fincept.in/quantlib/solver/finance/oas"
payload := strings.NewReader("{\n \"price\": 102.5,\n \"scenario_cashflows\": [\n [\n 3,\n 3,\n 103\n ],\n [\n 3,\n 3,\n 3,\n 103\n ],\n [\n 3,\n 103\n ]\n ],\n \"times\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"probabilities\": [\n 0.4,\n 0.4,\n 0.2\n ],\n \"base_rates\": [\n 0.03,\n 0.035,\n 0.04,\n 0.042\n ],\n \"base_times\": [\n 1,\n 2,\n 3,\n 4\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fincept.in/quantlib/solver/finance/oas")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"price\": 102.5,\n \"scenario_cashflows\": [\n [\n 3,\n 3,\n 103\n ],\n [\n 3,\n 3,\n 3,\n 103\n ],\n [\n 3,\n 103\n ]\n ],\n \"times\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"probabilities\": [\n 0.4,\n 0.4,\n 0.2\n ],\n \"base_rates\": [\n 0.03,\n 0.035,\n 0.04,\n 0.042\n ],\n \"base_times\": [\n 1,\n 2,\n 3,\n 4\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fincept.in/quantlib/solver/finance/oas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": 102.5,\n \"scenario_cashflows\": [\n [\n 3,\n 3,\n 103\n ],\n [\n 3,\n 3,\n 3,\n 103\n ],\n [\n 3,\n 103\n ]\n ],\n \"times\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"probabilities\": [\n 0.4,\n 0.4,\n 0.2\n ],\n \"base_rates\": [\n 0.03,\n 0.035,\n 0.04,\n 0.042\n ],\n \"base_times\": [\n 1,\n 2,\n 3,\n 4\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"oas": 0.0085
}
}{
"detail": "Invalid API key"
}{
"detail": "Endpoint requires Basic tier or higher"
}{
"detail": [
{}
]
}Authorizations
API key for authentication. Get your key at https://api.fincept.in/auth/register
Body
Current market price of the security
102.5
Array of cash flow arrays, one for each scenario
[[3, 3, 103], [3, 3, 3, 103], [3, 103]]
Array of payment times in years (same for all scenarios)
[1, 2, 3, 4]
Array of scenario probabilities (must sum to 1.0)
[0.4, 0.4, 0.2]
Array of zero rates for the base discount curve
[0.03, 0.035, 0.04, 0.042]
Array of times for the base discount curve
[1, 2, 3, 4]
