すべてのドキュメントを閲覧

金価格APIでスポット金属価格を取得

金価格APIで、金、銀、プラチナ、パラジウムのスポット価格と、WTI、ブレント、銅の参照価格を、単位とUTCタイムスタンプ付きで取得できます。リクエスト例も掲載しています。

認証とリクエスト

APIキーを Authorization ヘッダーに Bearer スキームで指定して送信します。 製品概要→

curl "https://api.narwhalapi.com/v1/commodities/spot/XAU/USD" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"

操作一覧

エンドポイント操作
GET /v1/commodities/spot/{commodity}/{currency}スポット価格または先物に基づく参照価格を取得します。
GET /v1/commodities/spot/{commodity}/{currency}/bars金、銀、プラチナ、パラジウム、銅、WTI、BRENTの始値・高値・安値・終値のバーを取得します。銅の履歴も利用できます。

パラメータ

フィールド意味
commodityパスパラメータ。XAU、XAG、XPT、XPD、WTI(WTI原油)、BRENT(ブレント原油)、XCU(銅)のいずれか。
currencyパスパラメータ、大文字。金:USD, AUD, BGN, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HKD, HUF, IDR, ILS, INR, ISK, JPY, KRW, MXN, MYR, NOK, NZD, PHP, PLN, RON, SEK, SGD, THB, TRY、またはZAR。銀、プラチナ、パラジウム、WTI、BRENT、XCU:USDのみ。
unitスポットとバー。任意です。troy_ounce、gram、kilogram、pound、metric_tonのいずれかを指定できます。価格は指定した単位あたりになり、レスポンスのunitとunit_keyにその単位が入ります。金、銀、プラチナ、パラジウム、銅(XCU)は5つすべてに対応します。WTIとBRENTはバレル単位で提供され、barrelのみ指定できます。それ以外の値は400 unit_not_supportedを返します。unitを指定しない場合は、これまでと同じレスポンスです。
intervalバーのみ。1m、5m、15m、1h、4h、1d(デフォルト)のいずれか。
start / endバーのみ。両方とも必須。UTC時刻をインターバルの境界に合わせます(4hは00、04、08時など、1dは午前0時)。開始を含み、終了を含みません。
limit / cursorバーのみ。デフォルトは100、最大500です。同じクエリでnext_cursorを再利用してください。

気配値のフィールド

フィールド意味
symbol, currency, unitシンボルと建値通貨。unitは貴金属ではtroy_ounce、WTIとBRENTではbarrel、XCUではpoundです。
commodity_keycommodity_key は、現物価格、先物価格、予測市場、実物価格のどれでも同じ名前で商品を示します(例: gold、crude-oil)。原油には benchmark(wti、brent、urals、dubai)も付き、先物には取引所の標準コードである exchange_mic も付きます。
unit_keyunit_key は単位を標準の綴りで示します(例: troy_ounce、barrel、tonne)。unit はソースの表記のままです。価格がセント単位で提示されている場合、price_scale は 0.01 です。価格にこの値を掛けると currency での金額になります。
price正の参考価格を1つ、十進数の文字列で表します。
timestamp, stale気配値の UTC タイムスタンプと、鮮度を明示するフラグ。
barsバーのみ。確定済みのバーを古い順に返します。各バーにはtimestamp(バーの開始時刻)と、10進文字列のopen、high、low、closeが含まれます。USD以外の金にはcloseだけが含まれます。
start, endstart と end は、Narwhal がリクエストされた範囲を変更した場合のみ返されます。
next_cursorバーのみ。続きの取得用カーソル。残りのバーがない場合はnullです。

レスポンスの例: GET /v1/commodities/spot/{commodity}/{currency}。

気配値のレスポンス
{
  "symbol": "XAU-USD",
  "commodity_key": "gold",
  "price": "3550.6320",
  "currency": "USD",
  "unit": "troy_ounce",
  "unit_key": "troy_ounce",
  "timestamp": "2026-11-20T05:54:00Z",
  "stale": false
}
WTI相場のレスポンス
{
  "symbol": "WTI-USD",
  "commodity_key": "crude-oil",
  "benchmark": "wti",
  "price": "82.5990",
  "currency": "USD",
  "unit": "barrel",
  "unit_key": "barrel",
  "timestamp": "2026-11-20T05:52:00Z",
  "stale": false
}

With unit=gram, a silver quote is priced per gram.

グラム単位の相場リクエスト
curl "https://api.narwhalapi.com/v1/commodities/spot/XAG/USD?unit=gram" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
グラム単位の相場レスポンス
{
  "symbol": "XAG-USD",
  "commodity_key": "silver",
  "price": "1.31824",
  "currency": "USD",
  "unit": "gram",
  "unit_key": "gram",
  "timestamp": "2026-11-21T18:11:00Z",
  "stale": false
}

A converted price is worked out in exact decimals from the price shown without unit, with 1 troy ounce = 31.1034768 g and 1 pound = 453.59237 g. It keeps as many significant figures as that price (trailing zeros of a whole number do not count), and a price under 10 keeps at least 4 decimals. Halves round up and zeros after the decimal point are dropped. Bars convert open, high, low and close the same way.

Bars response for GET /v1/commodities/spot/{commodity}/{currency}/bars. start and end are returned only when Narwhal changes the requested range.

バーレスポンス
{
  "symbol": "XAU-USD",
  "commodity_key": "gold",
  "currency": "USD",
  "unit": "troy_ounce",
  "unit_key": "troy_ounce",
  "bars": [
    {
      "timestamp": "2026-10-01T00:00:00Z",
      "open": "4156.8352",
      "high": "4192.5215",
      "low": "4139.7787",
      "close": "4177.4458"
    },
    {
      "timestamp": "2026-10-02T00:00:00Z",
      "open": "4177.2183",
      "high": "4225.6497",
      "low": "4125.9232",
      "close": "4141.5280"
    }
  ],
  "next_cursor": null
}

Gold in a currency other than USD has close only.

換算通貨でのバーレスポンス
{
  "symbol": "XAU-EUR",
  "commodity_key": "gold",
  "currency": "EUR",
  "unit": "troy_ounce",
  "unit_key": "troy_ounce",
  "bars": [
    {
      "timestamp": "2026-10-01T00:00:00Z",
      "close": "3715.66"
    },
    {
      "timestamp": "2026-10-02T00:00:00Z",
      "close": "3680.67"
    }
  ],
  "next_cursor": null
}

A request may span at most 3 days of 1m bars, 14 days of 5m bars, 60 days of 15m bars; a longer range returns 400 invalid_query. Wider intervals have no cap.

データの解釈

WTI, BRENT and XCU are reference prices derived from futures markets, not physical spot cargo prices. Display the unit and timestamp with the price. The timestamp is the start of the minute the price belongs to; during the daily 17:00 New York metals pause (21:00 UTC in summer, 22:00 UTC in winter), which is not a market closure, a quote can carry stale: true. A closed market never makes a quote stale: from Friday 17:00 to Sunday 17:00 New York time you get the last price with stale: false. A quote is stale when its price is more than 10 minutes old, counting only open-market time; do not present a stale quote as a fresh market price. An unknown commodity returns 404 commodity_not_supported. A known commodity with an unsupported currency returns 404 currency_not_supported. Price history is available for gold, silver, platinum, palladium, copper (XCU), WTI and BRENT. We never fill gaps: missing bars stay missing. We keep 1m and 5m bars for 30 days and 15m, 1h, 4h and 1d bars indefinitely. A range outside retention returns an empty bars list, not an error. WTI and BRENT have 15-minute and hourly history from 2020.

スポット価格は、無料クレジットのみを使用するアカウントを含め、すべてのアカウントでライブで利用できます。価格ストリームは終了しました。代わりにこのルートをポーリングしてください。 価格ストリームリファレンス →

エラー形式とクレジット →

エラー

  • パスの値が無効、開始または終了がインターバルの境界にない、バーのstartやendがない、またはバーの期間がインターバルごとの上限を超える場合は400 invalid_queryを返します。
  • Bearerキーがないか無効な場合は401 invalid_api_keyを返します。
  • 400 unit_not_supportedは、その商品を表示できないunitを指定した場合に返ります。エラーの詳細には、その商品で使える単位が一覧で示されます。
  • Narwhalが対応していない商品は404 commodity_not_supported、その商品で対応していない通貨は404 currency_not_supportedを返します。
  • 1分あたりの上限に達した場合は 429 rate_limit_exceeded、残高が呼び出しに足りない場合は 402 insufficient_credits を返します。
  • 価格データを読み取れない場合は503 upstream_unavailableを返します。

MCPツール

commodities_get_spot_pricecommodities_get_price_history

MCP経由で接続 →

このページは役に立ちましたか?