服務網站 https://www.risksoft.com/

串接代碼

openapi: '3.0.0'
info:
  title: 市場指數與股票查詢 API
  description: 提供市場指數與股票清單查詢服務
  version: 1.0.0
servers:
  - url: <https://www.one10.com/rsapi>
    description: API 伺服器
paths:
  /gpt/indexlist:
    get:
      tags:
        - 市場資料
      summary: 查詢市場指數清單
      description: 取得所有可用的市場指數資訊
      operationId: getIndexList
      responses:
        '200':
          description: 成功取得指數清單
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Index'
        '400':
          description: 請求參數錯誤
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: 伺服器內部錯誤
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          
  /gpt/stocklist:
    get:
      tags:
        - 市場資料
      summary: 查詢股票與ETF清單
      description: 根據市場別取得股票與ETF清單
      operationId: getStockList
      parameters:
        - name: market
          in: query
          description: 市場代碼
          required: true
          schema:
            type: string
            enum: [tw, cn, hk, us]
            example: tw
      responses:
        '200':
          description: 成功取得股票清單
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Stock'
        '400':
          description: 請求參數錯誤
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: 伺服器內部錯誤
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

components:
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: 錯誤代碼
          example: 400
        message:
          type: string
          description: 錯誤訊息
          example: 無效的市場代碼
    Index:
      type: object
      required:
        - cname
        - code
        - ename
      properties:
        cname:
          type: string
          description: 指數中文名稱
          example: 宏觀全球市場指數
        code:
          type: string
          description: 指數代碼
          example: World Market
        ename:
          type: string
          description: 指數英文名稱
          example: World Market Index
    
    Stock:
      type: object
      required:
        - cname
        - code
      properties:
        cname:
          type: string
          description: 股票中文名稱
          example: 元大台灣50
        code:
          type: string
          description: 股票代碼
          example: 0050 TT Equity
        ename:
          type: string
          description: 股票英文名稱
          example: Yuanta/P-shares Taiwan Top 50 ETF
          nullable: true
        market:
          type: string
          description: 市場別
          example: tw
          enum: [tw, cn, hk, us]
        type:
          type: string
          description: 商品類型
          example: ETF
          enum: [STOCK, ETF, ADR]
        currency:
          type: string
          description: 交易幣別
          example: TWD
          enum: [TWD, CNY, HKD, USD]