跳到主要內容

創建自選股分組

創建自選股分組

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