创建股价提醒
为指定证券创建股价提醒,当价格高于或低于目标价时触发通知。
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 |