Skip to main content

Update watched group

Update watched group

SDK Links

Python
longport.openapi.QuoteContext.update_watchlist_group
Rust
longport::quote::QuoteContext#update_watchlist_group
Go
QuoteContext.UpdateWatchlistGroup
Node.js
QuoteContext#updateWatchlistGroup

Request

HTTP MethodPUT
HTTP URL/v1/watchlist/groups

Parameters

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

NameTypeRequiredDescription
idintegerYESGroup ID, for example 10086.
namestringNOGroup name, for example Information Technology Group.
If this parameter is not passed, the group name will not be updated.
securitiesstring[]NOSecurity list, for example ["BABA.US", "AAPL.US"].
Combined with the mode parameter below, it can be used to add securities, remove securities, and sort the watchlist.
modestringNOOperation method
optional values:
add - Add securities
remove - Remove securities
replace - Update securities

When selecting add, the securities in the above list will be added to this group in order.

When selecting remove, the securities in the above list will be removed from this group.

When selecting update, the securities in the above list will completely replace the securities in this group.
For example, if the original group contains APPL.US, BABA.US, TSLA.US, and it is updated with ["BABA.US", "AAPL.US", "MSFT.US"], it will become BABA.US, AAPL.US, MSFT.US, removing TSLA.US and adding MSFT.US, while adjusting the order of BABA.US and AAPL.US.

Request Example

from longport.openapi import QuoteContext, Config, SecuritiesUpdateMode

config = Config.from_env()
ctx = QuoteContext(config)
ctx.update_watchlist_group(10086, name = "Watchlist2", securities = ["700.HK", "AAPL.US"], SecuritiesUpdateMode.Replace)

Response

Response Headers

  • Content-Type: application/json

Response Example

{
"code": 0
}

Response Status

StatusDescriptionSchema
200SuccessNone
500Internal errorNone