Market Highlights

Use news.NewsClient to get stock news and market highlights. Follow this SDK's quickstart to configure the client. News queries use the main gateway and do not take over real-time quote device access.

GetMarketNews

func (c *NewsClient) GetMarketNews(req model.NewsHighlightListRequest) (*model.NewsPage, error)

Description

Gets market highlights using news_highlight_list. Omit the cursor to start with the latest articles. For the next page, pass the ID of the last article on the previous page. The request has no page number or page size; the response page number is always 1. An empty items list is a successful result.

Parameters

ParameterTypeRequiredDescription
req.LastIDstringNoThe last article's ID on the previous page; an empty string starts from the latest articles
req.LangstringNozh_CN / zh_TW / en_US; an empty string is omitted

Returns

*model.NewsPage, with an error on failure.

FieldTypeDescription
Items[]model.NewsItemArticles on the current page
PageCountintCurrent page number; always 1 for market highlights
PageSizeintPage size
TotalPageintTotal page count
TotalSizeintTotal item count

Each news item has the following fields:

FieldTypeDescription
IDstringArticle ID; can be used as the cursor for the next market-highlights page
TitlestringTitle
SummarystringSummary
PubTimestampint64Publication time, as a Unix timestamp in seconds
URLstringArticle URL

Example

package main

import (
    "fmt"
    "log"
    "github.com/tigerfintech/openapi-go-sdk/config"
    "github.com/tigerfintech/openapi-go-sdk/model"
    "github.com/tigerfintech/openapi-go-sdk/news"
)

func main() {
    cfg, err := config.NewClientConfig()
    if err != nil { log.Fatal(err) }
    newsClient := news.NewNewsClientFromConfig(cfg)
    page, err := newsClient.GetMarketNews(model.NewsHighlightListRequest{Lang: "en_US"})
    if err != nil { log.Fatal(err) }
    if len(page.Items) > 0 {
        cursor := page.Items[len(page.Items)-1].ID
        next, err := newsClient.GetMarketNews(model.NewsHighlightListRequest{Lang: "en_US", LastID: cursor})
        if err != nil { log.Fatal(err) }
        fmt.Println(next.Items)
    }
}

Response example

This JSON example is based on fixed SDK test fixtures and illustrates the response data structure. Actual calls return the SDK objects listed above.

{
  "items": [
    {
      "id": "123456",
      "title": "Apple Q2",
      "summary": "Earnings beat",
      "pubTimestamp": 1729413600,
      "url": "https://example.com/news/123456"
    }
  ],
  "pageCount": 1,
  "pageSize": 20,
  "totalPage": 1,
  "totalSize": 1
}

Request rate

Base limit: 60 requests/minute.


Did this page help you?