curl --request GET \
--url https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/{drawdownId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/{drawdownId}"
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}/hedges/{hedgeId}/drawdown/{drawdownId}', 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}/hedges/{hedgeId}/drawdown/{drawdownId}",
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}/hedges/{hedgeId}/drawdown/{drawdownId}"
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}/hedges/{hedgeId}/drawdown/{drawdownId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/{drawdownId}")
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": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"hedgeId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"status": "Active",
"fromCurrency": "MXN",
"toCurrency": "USD",
"fromCurrencyAmount": 8040.43,
"toCurrencyAmount": 390,
"collateralAmountReleased": 402.02,
"quote": 20.6165,
"endAt": "2023-01-25",
"settlementAt": "2023-01-26",
"beforeHedgeState": {
"fromCurrencyAmount": 32161.8,
"toCurrencyAmount": 1560,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1608.09
},
"afterHedgeState": {
"fromCurrencyAmount": 24121.37,
"toCurrencyAmount": 1170,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1206.07
}
}{
"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 Drawdown
Retrieves details of a specific drawdown.
curl --request GET \
--url https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/{drawdownId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/{drawdownId}"
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}/hedges/{hedgeId}/drawdown/{drawdownId}', 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}/hedges/{hedgeId}/drawdown/{drawdownId}",
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}/hedges/{hedgeId}/drawdown/{drawdownId}"
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}/hedges/{hedgeId}/drawdown/{drawdownId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/hedges/{hedgeId}/drawdown/{drawdownId}")
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": "4d78ac65-2c3f-47e2-8bf3-3f76124e9d27",
"hedgeId": "8173b9a7-ee61-413e-b9e3-7c04b2a067c5",
"status": "Active",
"fromCurrency": "MXN",
"toCurrency": "USD",
"fromCurrencyAmount": 8040.43,
"toCurrencyAmount": 390,
"collateralAmountReleased": 402.02,
"quote": 20.6165,
"endAt": "2023-01-25",
"settlementAt": "2023-01-26",
"beforeHedgeState": {
"fromCurrencyAmount": 32161.8,
"toCurrencyAmount": 1560,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1608.09
},
"afterHedgeState": {
"fromCurrencyAmount": 24121.37,
"toCurrencyAmount": 1170,
"quote": 20.6165,
"endAt": "2023-02-23",
"settlementAt": "2023-02-24",
"collateralAmount": 1206.07
}
}{
"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 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}The id of the drawdown 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
Drawdown Retrieved
The response body when fetching a single drawdown.
The id of the drawdown 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}"4d78ac65-2c3f-47e2-8bf3-3f76124e9d27"
The id of the hedge this drawdown belongs to.
[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}"8173b9a7-ee61-413e-b9e3-7c04b2a067c5"
The status of the drawdown.
Active, InProcess, Completed, Overdue "Active"
The currency in which the transaction should be paid at by your customer.
"MXN"
The currency in which the inventory item is listed at on your platform.
"USD"
The amount to draw down in the fromCurrency.
If toCurrencyAmount is provided, then fromCurrencyAmount calculated as:
fromCurrencyAmount = toCurrencyAmount * quote
8040.43
The amount to draw down in the toCurrency.
If fromCurrencyAmount is provided, then toCurrencyAmount calculated as:
toCurrencyAmount = fromCurrencyAmount / quote
390
The collateral amount released back to the customer as a result of this drawdown, in the fromCurrency.
402.02
The rate at which this drawdown settles - the rate locked by the hedge.
20.6165
The date in which this drawdown executes, denoted in YYYY-MM-DD format.
\d{4}-\d{2}-\d{2}"2023-01-25"
The date in which this drawdown settles (next business day after endAt), denoted in YYYY-MM-DD format.
\d{4}-\d{2}-\d{2}"2023-01-26"
The hedge's state immediately before this drawdown.
Show child attributes
Show child attributes
The hedge's remaining state immediately after this drawdown.
Show child attributes
Show child attributes