Skip to main content

Samples

note

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:

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
}
}
}
}
}

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:

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
}
}
}
}
}

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:

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
}
}
}
}
}

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:

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
}
}
}
}
}

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.