> ## 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 /zh-Hant/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。

````