跳到主要內容

创建自选股分组

创建自选股分组

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 MethodPOST
HTTP URL/v1/watchlist/groups

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
namestringYES分组名称,例如 信息产业组
securitiesstring[]NO股票列表,例如 ["BABA.US","AAPL.US"]
分组下股票的展示顺序,与此列表的顺序一致
如果不传此参数,则创建一个空的分组

Request Example

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

{
"code": 0,
"data": {
"id": 10086
}
}

Response Status

StatusDescriptionSchema
200返回成功create_group_response
500内部错误None

Schemas

create_group_response

NameTypeRequiredDescription
idintegerfalse分组 ID