{
  "openapi": "3.0.1",
  "info": {
    "title": "Taiwan Broker Rankings (TPEx) — Turnover & Market Share",
    "description": "Which securities firms traded Taiwan's OTC board and how much: each firm's daily turnover, rank and market share, by branch and by head office, plus the 15 most active firms in each of the day's 30 most active stocks, in lots and dollars. Back to 2007, reconciled against the exchange's own figures.",
    "version": "0.1",
    "x-build-id": "qzeBlP6VuR4yVifSO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/chamarix~taiwan-broker-rankings/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-chamarix-taiwan-broker-rankings",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/chamarix~taiwan-broker-rankings/runs": {
      "post": {
        "operationId": "runs-sync-chamarix-taiwan-broker-rankings",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/chamarix~taiwan-broker-rankings/run-sync": {
      "post": {
        "operationId": "run-sync-chamarix-taiwan-broker-rankings",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "startDate": {
            "title": "Start date (YYYY-MM-DD)",
            "pattern": "^(|\\d{4}[-/]?\\d{2}[-/]?\\d{2})$",
            "type": "string",
            "description": "First session to fetch. Leave both dates empty for the most recent session. The turnover tables and the lots ranking all begin on 2007-04-23; the ranking by turnover begins 2016-01-04 and earlier sessions carry its columns as null rather than zero.",
            "default": ""
          },
          "endDate": {
            "title": "End date (YYYY-MM-DD)",
            "pattern": "^(|\\d{4}[-/]?\\d{2}[-/]?\\d{2})$",
            "type": "string",
            "description": "Last session to fetch, inclusive. Defaults to today. Holidays cost nothing: the run reads the exchange's own trading calendar first and only asks for days the market actually held.",
            "default": ""
          },
          "datasets": {
            "title": "Reports",
            "type": "array",
            "description": "BROKER_TURNOVER is every firm's turnover for the day — about 900 rows a session. HOT_STOCK_FLOW is the fifteen most active firms in each of the thirty most active stocks, about 600 rows a session. BROKER_PROFILE is the exchange's register of firms — 881 rows that do not change between sessions, so it is off by default and worth asking for once.",
            "items": {
              "type": "string",
              "enum": [
                "HOT_STOCK_FLOW",
                "BROKER_TURNOVER",
                "BROKER_PROFILE"
              ],
              "enumTitles": [
                "HOT_STOCK_FLOW — top firms per hot stock (熱門股證券商進出排行)",
                "BROKER_TURNOVER — every firm's daily turnover (各券商當日營業金額)",
                "BROKER_PROFILE — the register of securities firms (證券商基本資料)"
              ]
            },
            "default": [
              "HOT_STOCK_FLOW",
              "BROKER_TURNOVER"
            ]
          },
          "turnoverScopes": {
            "title": "Turnover scope",
            "type": "array",
            "description": "BRANCH is the branch-by-branch table, about 854 rows a session. FIRM consolidates them to roughly 62 head offices and adds each one's branch count. The two are published as separate reports rather than one being summed from the other, so both are fetched by default.",
            "items": {
              "type": "string",
              "enum": [
                "BRANCH",
                "FIRM"
              ],
              "enumTitles": [
                "BRANCH — per branch (各券商)",
                "FIRM — per head office (總公司)"
              ]
            },
            "default": [
              "BRANCH",
              "FIRM"
            ]
          },
          "stockCodes": {
            "title": "Stock codes",
            "type": "array",
            "description": "Keep only these securities in the hot-stock rows, by OTC code. Leave empty for every stock the rankings named. Codes are not always numeric, so pass them as strings exactly as the exchange prints them. Sessions before 2013-01-02 printed stock names with no code at all and those rows can only be filtered by leaving this empty.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "brokerCodes": {
            "title": "Broker codes",
            "type": "array",
            "description": "Keep only these securities firms in the turnover rows, by the exchange's four-character code (9800 for 元大's head office, 9268 for 凱基台北). Leave empty for every firm. The code is not unique on its own — 8888 carried three different branches on 2026-09-18 — so a code can match more than one row.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "includeMarketSummary": {
            "title": "Add a market summary row per scope",
            "type": "boolean",
            "description": "One extra row per scope per session carrying the whole board's turnover, how many firms reported and traded, the market total the report's own percentages imply, and whether the rows it printed add up to that market. Two rows a session.",
            "default": true
          },
          "crossCheck": {
            "title": "Price the two hot-stock rankings against the closing quotes",
            "type": "boolean",
            "description": "The lots ranking and the turnover ranking are two queries over the same matches, so dividing one by the other gives a price per share that has to land inside the range the stock actually traded in. With this on the run fetches the closing-quotes report and checks every pair both rankings named, and checks that the ranked firms' lots come in under the board's own volume. Costs one extra request per session; a disagreement is published as identity_ok false and a systematic break fails the run.",
            "default": true
          },
          "maxSessions": {
            "title": "Maximum sessions",
            "minimum": 0,
            "type": "integer",
            "description": "A safety cap, because a session is about 1,500 rows and a year of both reports is over 350,000. When a range exceeds the cap the most recent sessions are kept and the rest skipped, with a warning saying which. Set to 0 to lift it.",
            "default": 60
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}