Update Watchlist 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 Method | PUT |
| HTTP URL | /v1/watchlist/groups |
Parameters
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | YES | Group ID, for example 10086. |
| name | string | NO | Group name, for example Information Technology Group. If this parameter is not passed, the group name will not be updated. |
| securities | string[] | NO | Security 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. |
| mode | string | NO | Operation method optional values: add - Add securitiesremove - Remove securitiesreplace - Update securitiesWhen 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
python
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
json
{
"code": 0
}Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | Success | None |
| 500 | Internal error | None |