← Back to API Ninjas
Get historical gold futures price data
Returns historical gold futures price data in OHLCV (Open, High, Low, Close, Volume) format. The data is returned in descending order (most recent first), and all prices are in USD.
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/goldpricehistorical"
});
console.log(output);Query parameters
period
string
Time interval between data points. Valid values are: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Default is 1h. (Allowed: 1m, 5m, 15m, 30m, 1h, 4h, 1d) (Default: 1h)
start
number
Start timestamp in Unix format. If not provided, defaults to 24 hours ago.
end
number
End timestamp in Unix format. If not provided, defaults to current time.