創建股價提醒
為指定證券創建股價提醒,當價格高於或低於目標價時觸發通知。
SDK Links
Python | longport.openapi.AlertContext.add |
Rust | longport::alert::AlertContext#add |
Go | AlertContext.Add |
Node.js | AlertContext#add |
Parameters
SDK 方法參數。
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | 是 | 證券代碼,例如 TSLA.US |
| trigger_value | string | 是 | 觸發閾值,如 "600"(價格)或 "5"(百分比) |
| condition | AlertCondition | 是 | 觸發條件:PriceRise、PriceFall、PercentRise、PercentFall |
| frequency | AlertFrequency | 是 | 觸發頻率:Daily、EveryTime、Once |
Request Example
Response
Response Example
json
{
"code": 0,
"message": "success",
"data": {
"id": 486469
}
}Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | 成功 | CreateAlertResponse |
| 400 | 請求錯誤 | None |
Schemas
CreateAlertResponse
| Name | Type | Required | Description |
|---|---|---|---|
| id | int64 | true | 新創建提醒的 ID |