Skip to main content
curl --request POST \
  --url https://api.grainfinance.co/v1/customers/{customerId}/hedges/quote \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --header 'X-Customer-IP: <x-customer-ip>' \
  --data '
{
  "fromCurrency": "MXN",
  "toCurrency": "USD",
  "toCurrencyAmount": 1560,
  "externalMarkupPct": 1,
  "endAt": "2023-02-23"
}
'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "fromCurrency": "MXN",
  "toCurrency": "USD",
  "quote": 20.6165,
  "validUntilTs": 1659625098,
  "endAt": "2023-04-15",
  "initialCollateralPercentage": 5,
  "toCurrencyAmount": 1560,
  "fromCurrencyAmount": 32161.8,
  "fixedSide": "toCurrencyAmount",
  "externalMarkupPct": 1
}

Documentation Index

Fetch the complete documentation index at: https://docs.grainfinance.co/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Basic authentication using the partner API keys from https://console.grainfinance.co/api-keys

Headers

X-Customer-IP
string<IPv4>
required

The IPv4 address of the browser from which the customer contacts your platform.
example: 192.158.1.38

Pattern: ((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}

Path Parameters

customerId
string
required

The id of the customer within the Grain platform.

Body

application/json

The payload required in order to ask for a hedge quote

The payload required in order to ask for a hedge quote

fromCurrency
string
required

The currency in which the transaction should be paid at by your customer.

Example:

"MXN"

toCurrency
string
required

The currency in which the inventory item is listed at on your platform.

Example:

"USD"

endAt
string<YYYY-MM-DD>
required

The date in which the hedge will be settled, denoted in YYYY-MM-DD format.

Pattern: \d{4}-\d{2}-\d{2}
Example:

"2023-02-23"

toCurrencyAmount
number<double>

Specifies the amount to hedge in the toCurrency. When provided, this sets fixedSide to toCurrencyAmount, and the fromCurrencyAmount is derived as: fromCurrencyAmount = toCurrencyAmount × quote. Exactly one of toCurrencyAmount or fromCurrencyAmount may be provided. Alternatively, neither may be provided to defer amount specification to the Accept call.

Example:

1560

fromCurrencyAmount
number<double>

Specifies the amount to hedge in the fromCurrency. When provided, this sets fixedSide to fromCurrencyAmount, and the toCurrencyAmount is derived as: toCurrencyAmount = fromCurrencyAmount / quote. Exactly one of toCurrencyAmount or fromCurrencyAmount may be provided. Alternatively, neither may be provided to defer amount specification to the Accept call.

externalMarkupPct
number<double>

The external markup percentage that should be added to this quote on top of Grain’s internal pricing. For example, a value of 1.0 represents a 1.0% additional markup.

Example:

1

Response

Hedge Proposal Created

id
string<uuid>
required

The id of the hedge proposal within the Grain platform.

Pattern: [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}
Example:

"8173b9a7-ee61-413e-b9e3-7c04b2a067c5"

fromCurrency
string
required

The currency in which the transaction should be paid at by your customer.

Example:

"MXN"

toCurrency
string
required

The currency in which the inventory item is listed at on your platform.

Example:

"USD"

quote
number<double>
required

The rate locked by this hedge.

Example:

20.6165

validUntilTs
number<double>
required

The unix timestamp until which the hedge offer is valid.

Example:

1659625098

endAt
string<YYYY-MM-DD>
required

The date in which the hedge will be settled, denoted in YYYY-MM-DD format.

Pattern: \d{4}-\d{2}-\d{2}
Example:

"2023-02-23"

initialCollateralPercentage
number<double>
required

The percentage from the overall amount of collateral required to perform this hedge at inception.

Example:

5

externalMarkupPct
number<double> | null
required

The external markup percentage that should be added to this quote on top of Grain's internal pricing. For example, a value of 1.0 represents a 1.0% additional markup.

Example:

1

toCurrencyAmount
number<double>

The amount to hedge in the toCurrency. If fromCurrencyAmount is provided, then toCurrencyAmount calculated as: toCurrencyAmount = fromCurrencyAmount / quote Only present if an amount was provided at quote time.

Example:

1560

fromCurrencyAmount
number<double>

The amount to hedge in the fromCurrency. If toCurrencyAmount is provided, then fromCurrencyAmount calculated as: fromCurrencyAmount = toCurrencyAmount * quote Only present if an amount was provided at quote time.

Example:

32161.8

fixedSide
enum<string>

Indicates which currency amount was fixed (specified) when creating the quote. When fixedSide is toCurrencyAmount, the toCurrencyAmount was specified and fromCurrencyAmount was calculated. When fixedSide is fromCurrencyAmount, the fromCurrencyAmount was specified and toCurrencyAmount was calculated. Only present if an amount was provided at quote time.

Available options:
toCurrencyAmount,
fromCurrencyAmount
Example:

"toCurrencyAmount"