curl --request GET \
--url https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}', 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.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"id": "bf77890b-17e2-48a1-9198-707df23eb127",
"issuedAt": "2023-01-18",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"functionalCurrency": "EUR",
"fromCurrency": "MXN",
"toCurrency": "USD",
"rate": 20.616512,
"hedges": [
{
"id": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"status": "Active",
"transactionId": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"externalTransactionId": "780231b3ae0d7e9e5097nd89",
"fromCurrency": "MXN",
"toCurrency": "EUR",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"toCurrencyAmount": 1000,
"fromCurrencyAmount": 22850,
"fixedSide": "fromCurrencyAmount",
"initialCollateralAmount": 1142.5,
"quote": 22.85,
"externalMarkupPct": null,
"acceptedAtTs": 1659625088,
"issuedAt": "2023-01-18",
"endAt": "2023-02-20",
"updatedAt": "2023-02-20",
"cancelledAt": null,
"initialCollateralReceivedAt": "2023-01-20",
"fundsReceivedAt": null,
"completedAt": null,
"completedAtTs": null,
"overdueAt": "2023-02-20",
"settlementAt": "2023-02-20",
"settlementType": "full",
"adjustedMtmChangePct": 1.25,
"adjustedMtmChangeTs": 1674057600,
"spotRate": 22.71
},
{
"id": "5e89bd76-3d4f-58e3-9cf4-4f87235e0e38",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"status": "Active",
"transactionId": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"externalTransactionId": "780231b3ae0d7e9e5097nd89",
"fromCurrency": "EUR",
"toCurrency": "USD",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"toCurrencyAmount": 1108.27,
"fromCurrencyAmount": 1000,
"fixedSide": "toCurrencyAmount",
"initialCollateralAmount": 50,
"quote": 0.9024,
"externalMarkupPct": null,
"acceptedAtTs": 1659625088,
"issuedAt": "2023-01-18",
"endAt": "2023-02-23",
"updatedAt": "2023-02-23",
"cancelledAt": null,
"initialCollateralReceivedAt": "2023-01-20",
"fundsReceivedAt": null,
"completedAt": null,
"completedAtTs": null,
"overdueAt": "2023-02-23",
"settlementAt": "2023-02-23",
"settlementType": "full",
"adjustedMtmChangePct": 0.85,
"adjustedMtmChangeTs": 1674057600,
"spotRate": 0.9091
}
]
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}Get Dual Hedge
Retrieves details of a specific dual hedge, including both underlying legs and their respective proposals.
curl --request GET \
--url https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}', 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.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/dual-hedges/{dualHedgeId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"id": "bf77890b-17e2-48a1-9198-707df23eb127",
"issuedAt": "2023-01-18",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"functionalCurrency": "EUR",
"fromCurrency": "MXN",
"toCurrency": "USD",
"rate": 20.616512,
"hedges": [
{
"id": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"status": "Active",
"transactionId": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"externalTransactionId": "780231b3ae0d7e9e5097nd89",
"fromCurrency": "MXN",
"toCurrency": "EUR",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"toCurrencyAmount": 1000,
"fromCurrencyAmount": 22850,
"fixedSide": "fromCurrencyAmount",
"initialCollateralAmount": 1142.5,
"quote": 22.85,
"externalMarkupPct": null,
"acceptedAtTs": 1659625088,
"issuedAt": "2023-01-18",
"endAt": "2023-02-20",
"updatedAt": "2023-02-20",
"cancelledAt": null,
"initialCollateralReceivedAt": "2023-01-20",
"fundsReceivedAt": null,
"completedAt": null,
"completedAtTs": null,
"overdueAt": "2023-02-20",
"settlementAt": "2023-02-20",
"settlementType": "full",
"adjustedMtmChangePct": 1.25,
"adjustedMtmChangeTs": 1674057600,
"spotRate": 22.71
},
{
"id": "5e89bd76-3d4f-58e3-9cf4-4f87235e0e38",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"status": "Active",
"transactionId": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"externalTransactionId": "780231b3ae0d7e9e5097nd89",
"fromCurrency": "EUR",
"toCurrency": "USD",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"toCurrencyAmount": 1108.27,
"fromCurrencyAmount": 1000,
"fixedSide": "toCurrencyAmount",
"initialCollateralAmount": 50,
"quote": 0.9024,
"externalMarkupPct": null,
"acceptedAtTs": 1659625088,
"issuedAt": "2023-01-18",
"endAt": "2023-02-23",
"updatedAt": "2023-02-23",
"cancelledAt": null,
"initialCollateralReceivedAt": "2023-01-20",
"fundsReceivedAt": null,
"completedAt": null,
"completedAtTs": null,
"overdueAt": "2023-02-23",
"settlementAt": "2023-02-23",
"settlementType": "full",
"adjustedMtmChangePct": 0.85,
"adjustedMtmChangeTs": 1674057600,
"spotRate": 0.9091
}
]
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}Authorizations
Basic authentication using the partner API keys from https://console.grainfinance.co/keys
Path Parameters
The id of the customer within the Grain platform.
[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}The id of the dual hedge within the Grain platform.
[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}Response
Dual Hedge Retrieved
The response for retrieving a dual hedge.
The id of the dual hedge within the Grain platform.
[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}"bf77890b-17e2-48a1-9198-707df23eb127"
The date in which the hedge was issued, denoted in YYYY-MM-DD format.
\d{4}-\d{2}-\d{2}"2023-01-18"
The id of the customer within the Grain platform.
[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}"87d8e330-2878-4742-a86f-dbbb3bf522ac"
The functional currency of the customer.
"EUR"
The currency in which the transaction should be paid by your customer.
"MXN"
The currency you want to buy.
"USD"
Represents the offline hedge rate determined by a two-dimensional lookup based on the vendor and customer tenors.
20.616512
The individual hedges that make up this dual hedge.
Hedge objects represent transactions which are currently hedged.
- Option 1
- Option 2
Show child attributes
Show child attributes
[
{
"id": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"status": "Active",
"transactionId": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"externalTransactionId": "780231b3ae0d7e9e5097nd89",
"fromCurrency": "MXN",
"toCurrency": "EUR",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"toCurrencyAmount": 1000,
"fromCurrencyAmount": 22850,
"fixedSide": "fromCurrencyAmount",
"initialCollateralAmount": 1142.5,
"quote": 22.85,
"externalMarkupPct": null,
"acceptedAtTs": 1659625088,
"issuedAt": "2023-01-18",
"endAt": "2023-02-20",
"updatedAt": "2023-02-20",
"cancelledAt": null,
"initialCollateralReceivedAt": "2023-01-20",
"fundsReceivedAt": null,
"completedAt": null,
"completedAtTs": null,
"overdueAt": "2023-02-20",
"settlementAt": "2023-02-20",
"settlementType": "full",
"adjustedMtmChangePct": 1.25,
"adjustedMtmChangeTs": 1674057600,
"spotRate": 22.71
},
{
"id": "5e89bd76-3d4f-58e3-9cf4-4f87235e0e38",
"customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
"status": "Active",
"transactionId": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"externalTransactionId": "780231b3ae0d7e9e5097nd89",
"fromCurrency": "EUR",
"toCurrency": "USD",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"toCurrencyAmount": 1108.27,
"fromCurrencyAmount": 1000,
"fixedSide": "toCurrencyAmount",
"initialCollateralAmount": 50,
"quote": 0.9024,
"externalMarkupPct": null,
"acceptedAtTs": 1659625088,
"issuedAt": "2023-01-18",
"endAt": "2023-02-23",
"updatedAt": "2023-02-23",
"cancelledAt": null,
"initialCollateralReceivedAt": "2023-01-20",
"fundsReceivedAt": null,
"completedAt": null,
"completedAtTs": null,
"overdueAt": "2023-02-23",
"settlementAt": "2023-02-23",
"settlementType": "full",
"adjustedMtmChangePct": 0.85,
"adjustedMtmChangeTs": 1674057600,
"spotRate": 0.9091
}
]