創建自選股分組
創建自選股分組
SDK Links
Python  | longport.openapi.QuoteContext.create_watchlist_group | 
Rust  | longport::quote::QuoteContext#create_watchlist_group | 
Go  | QuoteContext.CreateWatchlistGroup | 
Node.js  | QuoteContext#createWatchlistGroup | 
Request 
| HTTP Method | POST | 
| HTTP URL | /v1/watchlist/groups | 
Parameters 
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description | 
|---|---|---|---|
| name | string | YES | 分組名稱,例如 信息產業組 | 
| securities | string[] | NO | 股票列表,例如 ["BABA.US","AAPL.US"]分組下股票的展示順序,與此列表的順序壹致 如果不傳此參數,則創建壹個空的分組  | 
Request Example 
python
from longport.openapi import QuoteContext, Config
config = Config.from_env()
ctx = QuoteContext(config)
group_id = ctx.create_watchlist_group(name = "Watchlist1", securities = ["700.HK", "AAPL.US"])
print(group_id)Response 
Response Headers 
- Content-Type: application/json
 
Response Example 
json
{
  "code": 0,
  "data": {
    "id": 10086
  }
}Response Status 
| Status | Description | Schema | 
|---|---|---|
| 200 | 返回成功 | create_group_response | 
| 500 | 內部錯誤 | None | 
Schemas 
create_group_response 
| Name | Type | Required | Description | 
|---|---|---|---|
| id | integer | false | 分組 ID |