Samples
Historical data applies only if your organization has access to historical data. You also need access to the prices you are querying:
- Spot history (symbols such as
bx-sgsin-mgo-spot-stable) requires access to spot prices. - Fixed forward history (symbols such as
bx-sgsin-mgo-ffp-stable) requires access to fixed forward prices.
Without the required access, queries for prices or historicalPrices return a Forbidden error. Contact team@tideform.io to request access.
The JavaScript and Python tabs assume you already have an access token (accessToken in JavaScript, access_token in Python) from the Authentication guide.
Price History
Every published price, from the prices field.
Spot Prices
The following query fetches every published Singapore MGO spot price over a date range:
- GraphQL
- JavaScript
- Python
query spotPriceHistory {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
prices(
first: 50
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31T23:59:59" }
) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
publishedDate
price
}
}
}
}
}
const response = await fetch("https://api.tideform.io/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query spotPriceHistory {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
prices(
first: 50
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31T23:59:59" }
) {
pageInfo { hasNextPage endCursor }
edges {
node { publishedDate price }
}
}
}
}`,
}),
});
const { data } = await response.json();
import requests
response = requests.post(
"https://api.tideform.io/graphql",
json={
"query": """
query spotPriceHistory {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
prices(
first: 50
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31T23:59:59" }
) {
pageInfo { hasNextPage endCursor }
edges {
node { publishedDate price }
}
}
}
}
"""
},
headers={"Authorization": f"Bearer {access_token}"},
)
data = response.json()["data"]
Fixed Forward Prices
For fixed forward prices, each publish returns 24 prices, one per forward month. first: 48 returns two publishes. This sample requires access to both historical data and fixed forward prices:
- GraphQL
- JavaScript
- Python
query forwardPriceHistory {
priceSymbol(symbolId: "bx-sgsin-mgo-ffp-stable") {
name
currency
prices(
first: 48
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31T23:59:59" }
) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
publishedDate
effectiveDate
relativeDate {
count
unit
}
price
}
}
}
}
}
const response = await fetch("https://api.tideform.io/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query forwardPriceHistory {
priceSymbol(symbolId: "bx-sgsin-mgo-ffp-stable") {
name
currency
prices(
first: 48
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31T23:59:59" }
) {
pageInfo { hasNextPage endCursor }
edges {
node { publishedDate effectiveDate relativeDate { count unit } price }
}
}
}
}`,
}),
});
const { data } = await response.json();
import requests
response = requests.post(
"https://api.tideform.io/graphql",
json={
"query": """
query forwardPriceHistory {
priceSymbol(symbolId: "bx-sgsin-mgo-ffp-stable") {
name
currency
prices(
first: 48
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31T23:59:59" }
) {
pageInfo { hasNextPage endCursor }
edges {
node { publishedDate effectiveDate relativeDate { count unit } price }
}
}
}
}
"""
},
headers={"Authorization": f"Bearer {access_token}"},
)
data = response.json()["data"]
Daily Candles
One summary per day, from the historicalPrices field.
Candlestick (OHLC) Data
The following query fetches daily OHLC data for Singapore MGO spot prices over a date range:
- GraphQL
- JavaScript
- Python
query historicalCandlestick {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
historicalPrices(
granularity: DAY
first: 31
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31" }
) {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
timeWindowStart
openPrice
highPrice
lowPrice
closePrice
finalized
}
}
}
}
}
const response = await fetch("https://api.tideform.io/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query historicalCandlestick {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
historicalPrices(
granularity: DAY
first: 31
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31" }
) {
totalCount
pageInfo { hasNextPage endCursor }
edges {
node { timeWindowStart openPrice highPrice lowPrice closePrice finalized }
}
}
}
}`,
}),
});
const { data } = await response.json();
import requests
response = requests.post(
"https://api.tideform.io/graphql",
json={
"query": """
query historicalCandlestick {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
historicalPrices(
granularity: DAY
first: 31
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31" }
) {
totalCount
pageInfo { hasNextPage endCursor }
edges {
node { timeWindowStart openPrice highPrice lowPrice closePrice finalized }
}
}
}
}
"""
},
headers={"Authorization": f"Bearer {access_token}"},
)
data = response.json()["data"]
Summary Statistics Data
The same query, but requesting the mean/median summary fields instead of OHLC - useful for a simple line chart or a single "price for the day" value:
- GraphQL
- JavaScript
- Python
query historicalSummary {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
historicalPrices(
granularity: DAY
first: 31
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31" }
) {
totalCount
edges {
node {
timeWindowStart
meanPrice
medianPrice
}
}
}
}
}
const response = await fetch("https://api.tideform.io/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query historicalSummary {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
historicalPrices(
granularity: DAY
first: 31
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31" }
) {
totalCount
edges {
node { timeWindowStart meanPrice medianPrice }
}
}
}
}`,
}),
});
const { data } = await response.json();
import requests
response = requests.post(
"https://api.tideform.io/graphql",
json={
"query": """
query historicalSummary {
priceSymbol(symbolId: "bx-sgsin-mgo-spot-stable") {
name
currency
historicalPrices(
granularity: DAY
first: 31
filter: { startDateTime: "2026-10-01", endDateTime: "2026-10-31" }
) {
totalCount
edges {
node { timeWindowStart meanPrice medianPrice }
}
}
}
}
"""
},
headers={"Authorization": f"Bearer {access_token}"},
)
data = response.json()["data"]
Pagination
To retrieve the next page of results for either field when hasNextPage is true, pass the previous query's endCursor in the after parameter.