本页面为机器翻译。英文版本为原文,可能更准确或更及时。 查看英文版

端点

在本页中,我们将深入介绍可用于以编程方式检索金融新闻文章的各个端点。我们将了解如何使用 finlight.me API 查询文章。


文章模型

响应中的文章模型包含有关文章的所有信息,例如链接、标题、发布日期和来源。它还包含情绪及其对该情绪的置信度。

  • Name
    link
    Type
    string
    Description

    指向完整文章的 URL。

  • Name
    source
    Type
    string
    Description

    来源网站。例如 www.reuters.com

  • Name
    title
    Type
    string
    Description

    文章标题。

  • Name
    summary
    Type
    string
    Description

    文章摘要(如果存在)。可为空。

  • Name
    publishDate
    Type
    Date
    Description

    发布日期,采用 ISO 日期格式。

  • Name
    createdAt
    Type
    Date
    Description

    文章首次被 finlight 系统索引的日期,采用 ISO 8601 日期字符串格式。

  • Name
    revisedDate
    Type
    Date | null
    Description

    文章在首次发布后最后一次修订的日期,采用 ISO 8601 日期字符串格式。当文章从未修订时为 null。在使用 orderBy=revisedDate 或通过 WebSocket/Webhook 启用 includeUpdates 时返回。

  • Name
    isUpdate
    Type
    boolean
    Description

    当本次文章负载是由发布后修订触发的重新投递时为 true。仅在 WebSocket 或 Webhook 订阅上启用 includeUpdates 时存在。

  • Name
    language
    Type
    string
    Description

    ISO 639-1 语言代码。例如 en | de | fr

  • Name
    sentiment
    Type
    string
    Description

    情绪分析结果。值可以是 positive | neutral |negative

  • Name
    confidence
    Type
    number
    Description

    情绪分析的置信度,从 0 到 1。

  • Name
    images
    Type
    string[]
    Description

    文章中的图片 URL 数组。

  • Name
    countries
    Type
    string[]
    Description

    表示与文章相关的国家/地区的代码数组,采用 ISO 3166-1 alpha-2 格式。例如 ["US", "GB", "DE"]。可为空。

  • Name
    categories
    Type
    string[]
    Description

    文章类别数组。可能的值:markets | economy | business | politics | geopolitics | regulation | technology | energy | commodities | crypto | health | climate | security。可为空。

  • Name
    companies
    Type
    Company[]
    Description

    文章中提及的公司数组。仅在特定订阅层级中显示/可用。可为空。

公司模型

响应中的公司模型包含有关文章中提及的某家公司的信息。它包括公司名称、股票代码、行业等详情。

  • Name
    companyId
    Type
    number
    Description

    公司的唯一标识符。

  • Name
    confidence
    Type
    string
    Description

    公司识别的置信度,从 0 到 1。

  • Name
    country
    Type
    string
    Description

    公司所在国家/地区,采用 ISO 3166-1 alpha-2 格式。例如 US | DE | GB

  • Name
    exchange
    Type
    string
    Description

    公司上市的证券交易所。

  • Name
    industry
    Type
    Date
    Description

    公司的细分行业。例如 Biotechnology, Technology

  • Name
    name
    Type
    string
    Description

    公司全称。例如 Apple Inc.

  • Name
    sector
    Type
    string
    Description

    公司的行业板块。例如 Technology | Health Care

  • Name
    ticker
    Type
    string
    Description

    公司的股票代码。例如 AAPL | GOOGL

  • Name
    isin
    Type
    string
    Description

    公司的国际证券识别码(ISIN)。例如 US0378331005

  • Name
    openfigi
    Type
    string
    Description

    公司的 OpenFIGI 标识符。例如 BBG000B9XRY4

  • Name
    primaryListing
    Type
    object
    Description

    公司的主要证券交易所上市信息。

  • Name
    primaryListing.ticker
    Type
    string
    Description

    主交易所上的主要股票代码。

  • Name
    primaryListing.exchangeCode
    Type
    string
    Description

    该股票上市的主要交易所的代码。

  • Name
    primaryListing.exchangeCountry
    Type
    string
    Description

    该股票上市的主要交易所所在国家/地区。

  • Name
    isins
    Type
    string[]
    Description

    公司的国际证券识别码(ISIN)数组。

  • Name
    otherListings
    Type
    object[]
    Description

    公司的其他证券交易所上市信息数组。

  • Name
    otherListings[].ticker
    Type
    string
    Description

    备选交易所上的股票代码。

  • Name
    otherListings[].exchangeCode
    Type
    string
    Description

    该股票上市的备选交易所的代码。

  • Name
    otherListings[].exchangeCountry
    Type
    string
    Description

    该股票上市的备选交易所所在国家/地区。


POST/v2/articles

获取文章

检索文章信息,包括详细分析、公司等。 请注意,某些字段需要特定的订阅层级才能访问。

可选的 BODY 参数

由于此端点使用 POST 请求,您可以在请求正文中传递参数。这支持更复杂的查询和过滤选项。

  • Name
    query
    Type
    string
    Description

    用于查找相关文章的搜索查询,支持简单或高级过滤器。高级查询

  • Name
    sources
    Type
    string[]
    Description

    针对单个或多个来源的简单过滤器(字符串数组)。有效值请参见“获取所有来源”端点。支持通配符 "*" 以包含所有来源。

  • Name
    excludeSources[]
    Type
    string[]
    Description

    排除单个或多个来源(字符串数组)。有效值请参见“获取所有来源”端点。

  • Name
    tickers
    Type
    string[]
    Description

    按股票代码过滤(字符串数组)。这将返回提及这些代码的文章。支持通配符 "*" 以包含所有代码。

  • Name
    countries
    Type
    string[]
    Description

    使用 ISO 3166-1 alpha-2 国家/地区代码按公司所在国家/地区过滤(字符串数组)。例如 ["US", "GB", "DE"]

  • Name
    includeEntities
    Type
    boolean
    Description

    包含文章中提及的公司。需要特定的订阅层级。

  • Name
    from
    Type
    string
    Description

    起始日期,采用 YYYY-MM-DD 格式或 ISO 日期字符串。

  • Name
    to
    Type
    string
    Description

    结束日期,采用 YYYY-MM-DD 格式或 ISO 日期字符串。

  • Name
    language
    Type
    string
    Description

    按语言过滤(ISO 639-1)。默认为 en,仅返回英语并排除其他语言 —— 参见语言与覆盖范围

  • Name
    orderBy
    Type
    string
    Description

    排序依据("publishDate""createdAt""revisedDate")—— 默认 "publishDate"publishDate 是文章在来源处的发布日期。createdAt 是文章首次被 finlight 索引的时间。revisedDate 按最近修订日期排序(从未修订的文章排在最后)。请注意,某些来源会以过去的发布日期发布文章。

  • Name
    order
    Type
    string
    Description

    排序方向("ASC""DESC")—— 默认 "DESC"

  • Name
    pageSize
    Type
    number
    Description

    每页结果数(1-100)。

  • Name
    page
    Type
    number
    Description

    页码。

Request

GET
/v2/articles
curl -X POST 'https://api.finlight.me/v2/articles' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -d '{ "query": "Nvidia", "countries": ["US", "GB"] }'

Response

{
  "status": "ok",
  "page": 1,
  "pageSize": 20,
  "articles": [
    {
      "link": "https://www.example.com/article1",
      "source": "www.example.com",
      "title": "Stock Market Hits New Highs",
      "summary": "A brief summary of the article...",
      "publishDate": "2023-10-01T12:34:56Z",
      "language": "en",
      "sentiment": "positive",
      "confidence": 0.95,
      "images": [
                  "https://www.example.com/image1.jpg",
                  "https://www.example.com/image2.jpg"
                ],
      "countries": ["US"],
      "categories": ["markets", "technology"],
      "companies": [
                {
                    "companyId": 41494,
                    "confidence": "0.9335401058197021",
                    "country": "US",
                    "exchange": "XNAS",
                    "industry": "Biotechnology: Pharmaceutical Preparations",
                    "name": "Summit Therapeutics Inc. Common Stock",
                    "sector": "Health Care",
                    "ticker": "SMMT",
                    "isin": "US86627T1088",
                    "openfigi": "BBG01PH11VP5",
                    "primaryListing": {
                        "ticker": "SMMT",
                        "exchangeCode": "XNAS",
                        "exchangeCountry": "US"
                    },
                    "isins": ["US86627T1088", "US86627T2088"],
                    "otherListings": [
                        {
                            "ticker": "SMMT.L",
                            "exchangeCode": "XLON",
                            "exchangeCountry": "GB"
                        }
                    ]
                },
                ...
              ]
    },
    // ...
  ]
}

GET/v2/articles/by-link

通过链接获取文章

通过 URL 检索单篇文章。返回带情绪分析的完整文章数据,并可选择性地包含内容和公司实体。

必需的查询参数

  • Name
    link
    Type
    string
    Description

    要获取的文章的 URL。

可选的查询参数

  • Name
    includeContent
    Type
    boolean
    Description

    在响应中包含完整的文章内容。

  • Name
    includeEntities
    Type
    boolean
    Description

    包含文章中提及的公司。需要特定的订阅层级。

Request

GET
/v2/articles/by-link
curl -X GET 'https://api.finlight.me/v2/articles/by-link?link=https%3A%2F%2Fwww.somepage.com%2Ftechnology%2Fexample-article&includeContent=true&includeEntities=true' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: YOUR_API_KEY'

Response

{
  "status": "ok",
  "article": {
      "link": "https://www.somepage.com/technology/example-article",
      "source": "www.reuters.com",
      "title": "Nvidia Announces New GPU Architecture",
      "summary": "A brief summary of the article...",
      "publishDate": "2023-10-01T12:34:56Z",
      "createdAt": "2023-10-01T12:35:10Z",
      "language": "en",
      "sentiment": "positive",
      "confidence": 0.95,
      "content": "Full article content here...",
      "images": [
                  "https://www.example.com/image1.jpg"
                ],
      "countries": ["US"],
      "categories": ["technology"],
      "companies": [
                {
                    "companyId": 4157,
                    "confidence": "0.97",
                    "country": "US",
                    "exchange": "XNAS",
                    "industry": "Semiconductors",
                    "name": "NVIDIA Corporation",
                    "sector": "Technology",
                    "ticker": "NVDA",
                    "isin": "US67066G1040",
                    "openfigi": "BBG000BBJQV0"
                }
              ]
  }
}

GET/v2/sources

获取所有来源

检索当前所有受支持文章来源的列表。

注意: 这些来源是尽力抓取的,未来可能会发生变化。

响应

一个由来源对象组成的 JSON 数组。示例:

  • Name
    array
    Type
    Source[]
    Description

    新闻来源数组。

来源模型

响应中的来源模型包含有关某个新闻来源的信息,包括其域名以及它是否为默认来源。

  • Name
    domain
    Type
    string
    Description

    来源网站的域名。

  • Name
    isDefaultSource
    Type
    boolean
    Description

    指示此来源是否为 API 的默认来源。

Request

GET
/v2/sources
curl -X GET 'https://api.finlight.me/v2/sources' \
  -H 'X-API-KEY: YOUR_API_KEY'

Response

[
  {
    "domain": "www.yahoo.com",
    "isDefaultSource": true
  },
  {
    "domain": "seekingalpha.com",
    "isDefaultSource": true
  },
  // ...
]