Stock News

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.

GetStockNews

func (c *NewsClient) GetStockNews(req model.NewsStockListRequest) (*model.NewsPage, error)

Description

Gets news for one stock using news_stock_list. Only one symbol is supported. Paginate using the page number and page size; the first page starts with the latest articles.

Parameters

ParameterTypeRequiredDescription
req.SymbolstringYesOne stock symbol, such as AAPL
req.LangstringNozh_CN / zh_TW / en_US; an empty string is omitted
req.PageCountintNo0 is omitted; the server defaults to 1. Explicit values must be at least 1
req.PageSizeintNo0 is omitted; the server defaults to 20. Explicit values must be 1–50

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.GetStockNews(model.NewsStockListRequest{
        Symbol: "AAPL", Lang: "en_US", PageCount: 1, PageSize: 20,
    })
    if err != nil { log.Fatal(err) }
    for _, item := range page.Items { fmt.Println(item.PubTimestamp, item.Title, item.URL) }
}

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?