> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fcontext.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 运行股票选股器

> 按策略 ID 或自定义条件运行选股器。



## OpenAPI

````yaml /cn/api-reference/openapi.json get /api/market-data/screener/search
openapi: 3.1.0
info:
  title: Financial Context
  version: 1.0.0
  description: >-
    Financial Context 提供经过认证、按量计费的只读美股市场数据访问。可通过 `/api/market-data/*` 端点，针对
    `.US` 标的和 `US` 市场筛选条件访问行情、K 线、市场日历、基本面、新闻、选股器和相关分析。
servers:
  - url: https://openapi.fcontext.com
    description: 生产环境
security:
  - ApiKeyHeader: []
  - BearerAuth: []
tags:
  - name: 行情
    description: 行情、K 线、交易日、深度、经纪队列和其他市场数据端点。
  - name: 内容
    description: 证券内容：新闻和话题。
  - name: 市场
    description: 市场状态、交易日历、异常活动和排行。
  - name: 日历
    description: 财务事件日历。
  - name: 基本面
    description: 基本面、分析师评级、估值、股东和交易披露。
  - name: 选股器
    description: 选股策略、筛选条件和指标。
paths:
  /api/market-data/screener/search:
    get:
      tags:
        - 选股器
      summary: 运行股票选股器
      description: 按策略 ID 或自定义条件运行选股器。
      parameters:
        - name: market
          in: query
          required: false
          description: 市场代码。自定义条件选股默认使用 `US`；按策略 ID 运行时可省略。
          schema:
            type: string
          example: US
        - name: strategy_id
          in: query
          required: false
          description: 策略 ID；提供后，选股器会运行该策略。
          schema:
            type: integer
            minimum: 1
          example: 19
        - name: strategyId
          in: query
          required: false
          description: '`strategy_id` 的兼容别名。'
          schema:
            type: integer
            minimum: 1
          example: 19
        - name: conditions
          in: query
          required: false
          description: 自定义筛选条件；支持 `KEY:MIN:MAX` 或 JSON 数组。
          schema:
            type: string
          example: 'pettm:10:50,roe:5:'
        - name: condition
          in: query
          required: false
          description: '`conditions` 的兼容别名。'
          schema:
            type: string
          example: 'pettm:10:50,roe:5:'
        - name: show
          in: query
          required: false
          description: 额外显示的指标，逗号分隔或 JSON 数组。
          schema:
            type: string
          example: roe,divyld
        - name: page
          in: query
          required: false
          description: 从 0 开始的页码，默认 0。
          schema:
            type: integer
            minimum: 0
            default: 0
          example: 0
        - name: size
          in: query
          required: false
          description: 每页项目数，默认 20，最大 100。
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 100
          example: 20
        - name: count
          in: query
          required: false
          description: '`size` 的兼容别名。'
          schema:
            type: integer
            minimum: 1
            maximum: 100
          example: 20
      responses:
        '200':
          description: 选股结果
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    $ref: '#/components/schemas/ScreenerSearch'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: 需要付费的 Financial Context 方案或剩余数据请求额度。
        '403':
          description: 该凭证无权访问 Financial Context 市场数据。
components:
  schemas:
    ScreenerSearch:
      oneOf:
        - $ref: '#/components/schemas/ScreenerData'
        - type: object
          additionalProperties: true
          properties:
            total:
              type: number
            page:
              type: number
            market:
              type: string
            items:
              type: array
              items:
                type: object
                additionalProperties: true
                properties:
                  symbol:
                    type: string
                  name:
                    type: string
    ScreenerData:
      type: object
      additionalProperties: true
      properties:
        data:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
            - type: array
              items: {}
    Error:
      type: object
      description: 标准错误响应。
      additionalProperties: true
      properties:
        error:
          type: string
          description: 可读错误消息。
  responses:
    BadRequest:
      description: 请求参数无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: 缺少或使用了无效的 Financial Context 凭证。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'Unauthorized: missing API key'
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: '在账户设置中生成的 Financial Context key。请以 `x-api-key: <key>` 形式发送。'
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: OAuth access token
      description: >-
        面向具有 `market_data` scope 的 Financial Context CLI、MCP 或 agent 客户端的 OAuth
        bearer token。

````