{
  "openapi": "3.0.1",
  "info": {
    "title": "Taiwan Stock Daily Quotes — 台股行情 OHLCV API",
    "description": "Daily OHLCV for every security on the Taiwan Stock Exchange and Taipei Exchange, with P/E, price-to-book and dividend yield joined on. TWSE reaches back to 2004-02-11, TPEX to 2007-07-02. Ex-rights sessions are flagged, not silently mispriced.",
    "version": "0.1",
    "x-build-id": "ygT3N2ko92qtvJIw1"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/chamarix~taiwan-stock-daily-quotes/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-chamarix-taiwan-stock-daily-quotes",
        "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-stock-daily-quotes/runs": {
      "post": {
        "operationId": "runs-sync-chamarix-taiwan-stock-daily-quotes",
        "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-stock-daily-quotes/run-sync": {
      "post": {
        "operationId": "run-sync-chamarix-taiwan-stock-daily-quotes",
        "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": {
          "markets": {
            "title": "Markets",
            "type": "array",
            "description": "TWSE is the main board (~1,380 securities a session, including ETFs and TDRs); TPEX is the over-the-counter board (~1,010). A security sits on exactly one of them, so naming both costs one wasted request per code that is not on the other board.",
            "items": {
              "type": "string",
              "enum": [
                "TWSE",
                "TPEX"
              ],
              "enumTitles": [
                "TWSE — listed (上市)",
                "TPEX — over the counter (上櫃)"
              ]
            },
            "default": [
              "TWSE",
              "TPEX"
            ]
          },
          "stockCodes": {
            "title": "Stock codes",
            "type": "array",
            "description": "Ticker codes such as 2330, 0050 or 5483. Leave empty for every security on the board. Naming codes also switches the Actor to the per-security reports, which return a whole month per request — that is the cheap way to pull years of history for a handful of names.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "Start date (YYYY-MM-DD)",
            "pattern": "^(|\\d{4}[-/]?\\d{2}[-/]?\\d{2})$",
            "type": "string",
            "description": "First trading day to fetch. Leave both dates empty for the latest session. Archive floors, each rejected up front rather than silently returning nothing: whole-board TWSE 2004-02-11, whole-board TPEX 2007-07-02, per-security TWSE 2010-01-04, per-security TPEX 2003-04-01.",
            "default": ""
          },
          "endDate": {
            "title": "End date (YYYY-MM-DD)",
            "pattern": "^(|\\d{4}[-/]?\\d{2}[-/]?\\d{2})$",
            "type": "string",
            "description": "Last trading day to fetch, inclusive. A whole-board session is about 2,400 records across both markets, so 90 calendar days is the ceiling for a whole-board run. Non-trading days cost one request and are skipped.",
            "default": ""
          },
          "includeValuation": {
            "title": "Include P/E, price-to-book and dividend yield",
            "type": "boolean",
            "description": "Joins the exchanges' valuation reports onto the quotes. It doubles the request count, so turn it off for a pure price-and-volume pull. TWSE publishes valuation from 2005-09-02 onward; earlier sessions come back with the ratios empty.",
            "default": true
          },
          "onlyTraded": {
            "title": "Only securities that traded",
            "type": "boolean",
            "description": "Drops rows with zero volume. Both boards list securities that go whole sessions without a trade; the exchange still prints a row for them, with dashes where the prices would be.",
            "default": false
          },
          "crossCheck": {
            "title": "Cross-check against the second official report",
            "type": "boolean",
            "description": "Each exchange publishes every session twice — once per security, once per day for the whole board. With this on, one session is read from the other report and compared column by column, and the result is written to the log. Costs one or two extra requests per run.",
            "default": true
          },
          "fetchStrategy": {
            "title": "Which report to read",
            "enum": [
              "AUTO",
              "BY_STOCK",
              "BY_DATE"
            ],
            "type": "string",
            "description": "AUTO picks per-security when stock codes are named and whole-board otherwise, which is the cheaper choice in almost every case. Override it only to compare the two reports yourself — they do not agree on TPEX volume.",
            "default": "AUTO"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}