/api/sd/basis/history
GET部分可用FRESH

基差歷史(小時級)

單一幣種的小時基差序列,依交易所提供,並附跨交易所彙總值(中位數、平均值、OI 加權)。

GET/api/sd/basis/history
部分覆蓋. 採集始於 2026-11-11。回應會回報 `history.available_from`、`n_hours` 與 `expected_hours` 的對照,以及 `complete`;沒有資料的小時會直接留空,不做內插。

請求

查詢參數

名稱型別必填預設值可用值說明
coinstring必填——幣種代號,不分大小寫(例如 `BTC`)。缺少或格式錯誤時回傳 400。 範例: BTC
kindstring選填perpperp, spot_perp`perp`:標記價格相對於同一交易所的指數價格。`spot_perp`:永續合約價格相對於同一交易所的現貨價格。
rangestring選填24h24h, 7d, 30d回溯範圍,每小時一個資料點。
exchangestring選填——單一交易所 ID。預設:所有交易所。未知的 ID 會回傳 400。

請求範例

curl -s "https://www.coinboss.com/api/sd/basis/history?coin=BTC"

回應欄位

欄位表由真實回應產生,因此列出的正是端點實際回傳的內容。路徑中的 a[] 代表陣列元素,{*} 代表以動態名稱(例如幣種或交易所)為鍵的物件。

欄位型別單位說明
successboolean—請求成功時為 true。失敗時回應內容為 `{ success: false, code, error, request_id }`。
schemastring—此回應的結構描述 ID。只有在既有欄位的意義或型別改變時才會變更。
nownumberms建立回應時的伺服器時間。
coinstring—幣種代號(大寫)。
kindstring—`perp` 或 `spot_perp`。
rangestring—實際套用的回溯範圍。
intervalstring—序列資料點的間隔。
exchangestring|null—交易所 ID(小寫)。
aggregatearray—此區段的跨交易所彙總值。
aggregate[]object—此區段的跨交易所彙總值。
aggregate[].tnumberms時間區間的起始時間。
aggregate[].median_pctnumber%每家交易所取一個主力合約所得的基差中位數。
aggregate[].mean_pctnumber%與中位數相同集合的簡單平均值。
aggregate[].oi_weighted_pctnumber%以持倉量加權的基差;沒有 OI 權重的資料列不計入。
aggregate[].n_exchangesnumber—計入彙總值的交易所。
seriesarray—每家交易所一條序列。
series[]object—每家交易所一條序列。
series[].exchangestring—交易所 ID(小寫)。
series[].symbolstring—CoinBoss 儲存格式的合約代號。
series[].primaryboolean—在中位數與平均值中代表其交易所的合約為 true。
series[].in_aggregateboolean—該列通過納入規則時為 true。
series[].pointsarray—`[hour start in ms, basis in %]` 數對,由舊到新排列。
series[].points[]array—`[hour start in ms, basis in %]` 數對,由舊到新排列。
series[].points[][]number—`[hour start in ms, basis in %]` 數對,由舊到新排列。
historyobject—請求範圍中有多少資料可用。
history.requested_fromnumberms請求範圍的起始時間。
history.available_fromnumberms已儲存的第一個小時。
history.available_tonumberms已儲存的最後一個小時。
history.n_hoursnumber—範圍內可用的小時數。
history.expected_hoursnumber—範圍完整時應有的小時數。
history.completeboolean—請求範圍內的每個小時皆已儲存時為 true。
coverageobject—數字中納入與未納入的內容。與其他來源比較合計值之前,請先比對這一項。
coverage.included_exchangesarray—新鮮資料已被納入的來源。
coverage.included_exchanges[]string—新鮮資料已被納入的來源。
coverage.unavailablearray—無法納入的來源,各附原因。它們絕不會以 0 計入。
coverage.unavailable[]object—無法納入的來源,各附原因。它們絕不會以 0 計入。
coverage.unavailable[].exchangestring—交易所 ID(小寫)。
coverage.unavailable[].reasonstring—機器可讀的原因代碼。
coverage.unavailable[].detailstring—供人閱讀的原因說明。
coverage.stale_excludedarray—因最近一次更新超出新鮮視窗而被排除的資料列。 在產生此表所用的樣本中為空
methodobject—此回應所用公式的純文字說明,每個欄位一項。
method.series.pointsstring—`series.points` 的公式說明,純文字。
method.aggregate.median_pctstring—`aggregate.median_pct` 的公式說明,純文字。
method.aggregate.oi_weighted_pctstring—`aggregate.oi_weighted_pct` 的公式說明,純文字。
method.intervalstring—`interval` 的公式說明,純文字。
metaobject—此回應的資料歷程與新鮮度。
meta.schemastring—此回應的結構描述 ID。只有在既有欄位的意義或型別改變時才會變更。
meta.sourcearray—資料採集所用的上游公開端點。
meta.source[]object—資料採集所用的上游公開端點。
meta.source[].exchangestring—交易所 ID(小寫)。
meta.source[].endpointstring—採集器讀取的來源公開端點(僅供說明資料歷程;用戶端不會直接呼叫它)。
meta.observed_atnull—來源為該資料提供的時間戳記。
meta.received_atnumbermsCoinBoss 採集器收到資料的時間。
meta.fetched_atnumberms此回應組裝完成的時間。
meta.windowstring—數字涵蓋的時間視窗。
meta.qualitystring—FRESH、PARTIAL、STALE、BROKEN 或 UNAVAILABLE,依資料時間戳記與覆蓋範圍判定。
meta.is_staleboolean—資料已超出其新鮮視窗時為 true。
meta.cache_ttl_snumbers此回應的快取存活時間。
meta.fallbackstring—採集器或來源發生故障時,此端點回傳的內容。

產生於 2026-11-11 23:00 UTC,依據 3 筆真實回應。

回應範例

/api/sd/basis/history?coin=BTC · 真實回應,擷取於 2026-11-13 04:02:46 UTC。 較長的陣列與對應表已截短顯示:series 原有 20 個項目; aggregate 原有 25 個項目; meta.source 原有 20 個項目; series[].points 原有 25 個項目; coverage.included_exchanges 原有 20 個項目。

  • {
    • "success": true,
    • "schema": "coinboss.sd.basis/1",
    • "now": 1794542288014,
    • "coin": "BTC",
    • "kind": "perp",
    • "range": "24h",
    • "interval": "1h",
    • "exchange": null,
    • "aggregate": [
      • { … 5 },
      • { … 5 }
      ],
    • "series": [
      • { … 5 },
      • { … 5 }
      ],
    • "history": {
      • "requested_from": 1794452400000,
      • "available_from": 1794452400000,
      • "available_to": 1794538800000,
      • "n_hours": 25,
      • "expected_hours": 24,
      • "complete": true
      },
    • "coverage": {
      • "included_exchanges": [ … 8 ],
      • "unavailable": [ … 2 ],
      • "stale_excluded": []
      },
    • "method": {
      • "series.points": "[hour_ts, (mark_price - index_price) / index_price * 100] from the first collector round after each full hour; hours where the two timestamps were more than 60 …",
      • "aggregate.median_pct": "median over one primary contract per exchange in that hour; excluded: |value| > 10, contracts with no trade in 24 h, exchanges whose index is not a comparable i…",
      • "aggregate.oi_weighted_pct": "sum(value * oi_usd) / sum(oi_usd) over all included contracts that have an OI snapshot for the same hour (oi_history / sd_contract_hourly, single-sided); null w…",
      • "interval": "fixed 1 h buckets, no interpolation; missing hours are simply absent"
      },
    • "meta": {
      • "schema": "coinboss.sd.basis/1",
      • "source": [ … 2 ],
      • "observed_at": null,
      • "received_at": 1794538827406,
      • "fetched_at": 1794542288014,
      • "window": "24h",
      • "quality": "FRESH",
      • "is_stale": false,
      • "cache_ttl_s": 300,
      • "fallback": "history is served as stored; hours without a snapshot are absent, never interpolated"
      }
    }

已驗證的樣本

除了上方的範例之外,探針還會以下列參數呼叫此端點,並在每次呼叫時檢查結構描述。

參數HTTP延遲結果
coin=ETH&kind=spot_perp20041 ms通過 FRESH
coin=BTC&exchange=binance20032 ms通過 FRESH
coin=BTC&range=1y4001 ms通過 回傳預期的錯誤

檢查於 2026-11-13 03:58:08 UTC

詳細資訊

身分驗證
無。公開端點。
速率限制
每個 IP 每分鐘 1200 次請求
伺服器快取
5m
邊緣微快取
10s
更新頻率
採集器每 60 秒執行一輪;資料列在 180 秒內視為新鮮。歷史資料由小時快照構成。
時間視窗
24h / 7d / 30d,小時區間。
資料來源
21 家衍生品交易所公布的標記價格、指數價格與最新成交價,加上同一交易所的現貨價格,由 CoinBoss 採集並儲存(sd_px_latest、sd_px_hourly)。
交易所覆蓋範圍
21 家交易所。未公布指數價格或標記價格的交易所列於 `coverage.unavailable`;兩端價格的時間相差超過 60 秒的資料列回傳 `null`。未計入彙總值的資料列列於 `coverage.excluded_from_aggregate`,並附原因。
分頁
不分頁;資料點數量由 `range` 決定。
排序
時間升冪。
單位
All basis values in percent. Prices in the quote currency of the contract (USDT / USDC / USD). `oi_usd` single-sided.
計算方法
Each point is the snapshot taken in the first ten minutes of the hour. The OI weight of a historical hour is the open interest recorded in that hour; without it `oi_weighted_pct` is `null`.
時間戳記
Unix epoch 毫秒(UTC),除非欄位說明另有註明
回應格式
json
穩定性
穩定版
上線時間
2026-11-11

即時狀態

部分可用檢查於 2026-11-13 04:02:46 UTCHTTP 2001 ms結構描述相符最新資料點距今 63m

採集始於 2026-11-11。回應會回報 `history.available_from`、`n_hours` 與 `expected_hours` 的對照,以及 `complete`;沒有資料的小時會直接留空,不做內插。

近 30 天可用率

408 次檢查中有 100% 通過

錯誤

所有端點的失敗回應都採用同一種結構。完整清單請見錯誤頁面。 錯誤與速率限制 →

錯誤碼HTTP意義處理方式
INVALID_PARAM400缺少必填參數,或某個值不被接受。已知時,`param` 會指出是哪個參數。請勿原樣重試;請修正請求。
UNAUTHORIZED401已送出 `CB-API-KEY` 標頭,但金鑰未知或已撤銷。公開資料不需要金鑰——請移除該標頭或改用有效的金鑰。請勿原樣重試。
FORBIDDEN403此路由不屬於公開 API(內部或僅限帳戶使用)。請勿重試。
NOT_FOUND404未知的路由,或所請求的幣種/交易所/基金不存在。請勿重試;請對照目錄檢查路徑與識別碼。
RATE_LIMITED429請求數超過每分鐘上限。`Retry-After` 會指出需等待的秒數。等待 `Retry-After` 指定的時間後,再以退避策略重試。
INTERNAL500非預期的伺服器錯誤。訊息刻意保持籠統;回報時請附上 `request_id`。幾秒後重試一次;若問題持續,請附上請求 ID 回報。
UPSTREAM_FAILED503此端點背後的資料來源未及時回應。不會以過期或替代的數字代替回傳。以退避策略重試;並查看狀態頁面。
UNAVAILABLE501 / 503資料集暫時尚未就緒(快取預熱中),或此端點目前尚無合法的公開來源。稍後重試;目錄會標示出設計上即無法使用的端點。
REQUEST_FAILED200部分舊版端點會以 HTTP 200 回應但帶有 `success: false`。請務必檢查 `success`,而不只是 HTTP 狀態碼。視訊息而定;請當作失敗的請求處理。

試用

GET/api/sd/basis/history部分可用
參數

string — Coin symbol, case-insensitive (for example `BTC`). Missing or malformed values return 400.

string · 預設 perp — `perp`: mark price against the index price of the same exchange. `spot_perp`: perpetual price against the spot price of the same exchange.

string · 預設 24h — Look-back range, one point per hour.

string — One exchange id. Default: all exchanges. An unknown id returns 400.

請求 URLhttps://www.coinboss.com/api/sd/basis/history?coin=BTC
選擇一個端點並按下「送出請求」。回應內容、標頭與耗時會顯示在這裡。