價格提醒

價格警示監控單一市場中單一結果的價格。當價格首次達到你的門檻值時,PAX 會向你的 webhook 端點發送已簽章的 price.alert.triggered 事件。警示屬於 Builder 帳戶。

開始之前

警報會在該時刻是否已訂閱端點與否都會觸發,且只觸發一次。稍後新增的端點不會收到。

端點

方法與路徑權限範圍速率限制桶
POST /v1/price-alertsbuilder:apps:writewebhooks:manage
GET /v1/price-alertsbuilder:apps:readmarkets:read
GET /v1/price-alerts/{id}builder:apps:readmarkets:read
DELETE /v1/price-alerts/{id}builder:apps:writewebhooks:manage

桶與其每分鐘預算詳見 Rate Limits。

建立提醒

curl -sX POST "https://api.predictasiax.com/v1/price-alerts" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"market_id":"fed-cut-3x-2026","outcome":"yes","condition":"above","price":"0.6","label":"breakout"}'
欄位必要規則
market_id是市場的 id,格式與 GET /v1/markets 回傳的一致。市場必須是開放狀態。
結果否 (預設 yes)在二元結果市場中為 yes 或 no。在具有三個或更多結果的市場中,為該結果在市場結果清單中的 0 起始索引(0 到 31)。
條件是above:當價格等於或高於 price 時觸發。below:當價格等於或低於時觸發。
price是介於 0 與 1 之間(不含端點),最多 4 位小數。字串("0.6")或數字。
label否你自己的文字,最多 100 個字元。會隨警報和事件一起回傳。

任何其他欄位都會被拒絕,並回傳 400 VALIDATION_FAILED。回應為 201,包含該警示以及建立時的結果價格:

{
  "ok": true,
  "data": {
    "alert": {
      "id": "pa_x7Kq2mVb9TzR4wLs",
      "market_id": "fed-cut-3x-2026",
      "outcome": "yes",
      "condition": "above",
      "price": "0.6000",
      "label": "breakout",
      "status": "active",
      "created_at_ms": 1796020000000,
      "triggered_at_ms": null,
      "triggered_price": null,
      "ended_at_ms": null
    },
    "current_price": "0.5500"
  }
}

在具有三個或更多結果的市場中,outcome 會以數字回傳。當該市場尚未有該結果的價格時,current_price 為 null。

當警報觸發時

事件

送達的 data 是提醒,格式與 GET /v1/price-alerts/{id} 回傳的一致,但狀態為 triggered。event_id 在每次重試時都相同,請用它來去重。

{
  "event_id": "pa_trig_pa_x7Kq2mVb9TzR4wLs",
  "event_type": "price.alert.triggered",
  "is_test_event": false,
  "created_at_ms": 1796022000000,
  "data": {
    "alert": {
      "id": "pa_x7Kq2mVb9TzR4wLs", "market_id": "fed-cut-3x-2026", "outcome": "yes",
      "condition": "above", "price": "0.6000", "label": "breakout", "status": "triggered",
      "created_at_ms": 1796020000000, "triggered_at_ms": 1796022000000,
      "triggered_price": "0.6100", "ended_at_ms": 1796022000000
    }
  }
}

送達、重試與死信的工作方式與其他事件相同:參見 送達與重試.

列出並讀取警示

GET /v1/price-alerts 會傳回你的警示,依最新排序,格式為 data.alerts[]。查詢參數,皆為選填:

參數值
狀態active、triggered、cancelled 或 expired
market_id僅限此市場的提醒
limit1 到 200,預設 50

GET /v1/price-alerts/{id} 回傳一個警示為 data.alert。

取消提醒

DELETE /v1/price-alerts/{id} 會取消一個 active 警示。它會保留在你的清單中,狀態為 cancelled,並設定 ended_at_ms。已觸發、過期或已取消的警示會傳回 409 STATE_CONFLICT,警示內容位於 error.details.alert。

狀態

狀態意義
啟用正在檢查
已觸發條件成立;事件已發送
cancelled你已取消
expired市場先結束或結算;沒有事件

錯誤

HTTP代碼時間
400VALIDATION_FAILED欄位違反上述規則、未知欄位,或市場不存在的結果
403SCOPE_MISSING該金鑰缺少權限範圍,或不屬於 Builder 帳戶
404MARKET_NOT_FOUND不存在該 market_id 對應的市場
404NOT_FOUND你的帳戶中沒有該 id 的提醒
409STATE_CONFLICT取消未啟動的警報
422MARKET_CLOSED市場未開放
422PRICE_ALERT_LIMIT你已經有 100 個啟用中的提醒
429RATE_LIMITED速率限制桶已用完;請在 Retry-After 之後重試

所有代碼都列在 錯誤代碼 中。

規格版本 2.7.82 · 最後更新 2026-12-03