Quote
Quote the current bid and ask for a currency pair and size.
Reference/indicative quotes
Consider requesting an indicative/reference quote to understand the current currency trading rates before deciding to take action. Please be aware that market makers are not required to honor indicative quotes.
Paste this query to the API Playground to request an indicative quote.
const bodyJSON = {
variables: {
input: {
fromCurrency: "AUD",
toCurrency: "USD",
size: "10000",
currency: "AUD",
},
},
query: `
query ($input: QuoteInput!) {
quote(input: $input) {
bid ask symbol timestamp inverted
}
}`,
};Multiple reference/indicative quotes with a single HTTP request
If you send us too many API request - the system will automatically block you for a short period of time. To avoid that, we recommend sending multiple queries within a single HTTP request.
Typically, you want to collect several dozen FX prices with a sincle API call. The GraphQL allows sending multiple queries within one HTTP request. Below is an example of such query:
query {
AUDUSD: quote(input: { fromCurrency: AUD, toCurrency: USD, size: 1000 }) { bid ask symbol }
AUDEUR: quote(input: { fromCurrency: AUD, toCurrency: EUR, size: 1000 }) { bid ask symbol }
AUDGBP: quote(input: { fromCurrency: AUD, toCurrency: GBP, size: 1000 }) { bid ask symbol }
}Here is a JavaScript code to build and send the above query string:
const fromCurrencies = ["AUD"];
const toCurrencies = ["USD", "EUR", "GBP"];
const size = 1000;
let query = "";
for (const from of fromCurrencies)
for (const to of toCurrencies)
query += `${from}${to}: quote(input: { fromCurrency: ${from}, toCurrency: ${to}, size: ${size} }) { bid ask symbol }\n`;
query = "query {\n" + query + "\n}";
const response = await fetch("https://api.uat.flash-payments.com.au", {
method: "POST",
headers: {
authorization: "Bearer " + YOUR_TOKEN,
"content-type": "application/json",
},
body: JSON.stringify({ query }),
});
const { data } = await response.json();Please be mindful. Do not fetch the rates you do not need. If there will be hundreds of quote queries within one HTTP request - it might timeout (take longer than 60 seconds).
Tradable quote
In contrast to an indicative quote, a tradable quote is guaranteed by the market maker.
Paste this query to the GraphQL Playground to request a tradable quote. It is important to consider the expireAt date and time, and preserve the id of a tradable quote for future createPayment and createConversion calls.
const bodyJSON = {
variables: {
input: {
fromCurrency: "AUD",
toCurrency: "USD",
size: "10000",
currency: "AUD",
tradable: true,
},
},
query: `
query ($input: QuoteInput!) {
quote(input: $input) {
bid ask symbol timestamp inverted expireAt id
}
}`,
};Last updated
Was this helpful?