{
  "openapi": "3.0.1",
  "info": {
    "title": "Taiwan Intraday 5-Second Stats — 每5秒委託成交與指數 API",
    "description": "Taiwan's stock market every five seconds since 2004-10-15: cumulative bid and ask orders, trade count, volume and turnover, joined on the same timestamp to the TAIEX and 37 more TWSE indices. 3,241 rows a session, reconciled against the exchange's own daily close and change.",
    "version": "0.1",
    "x-build-id": "NBvybgrZnbn5P8Tmb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/chamarix~taiwan-intraday-5sec-stats/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-chamarix-taiwan-intraday-5sec-stats",
        "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-intraday-5sec-stats/runs": {
      "post": {
        "operationId": "runs-sync-chamarix-taiwan-intraday-5sec-stats",
        "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-intraday-5sec-stats/run-sync": {
      "post": {
        "operationId": "run-sync-chamarix-taiwan-intraday-5sec-stats",
        "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 latest session. The archive begins 2004-10-15 and a range that starts earlier simply begins there — the exchange answers an earlier date with its own 'query date is earlier than 93/10/15' message rather than data.",
            "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. Each session costs two requests plus one per month for the exchange's trading calendar.",
            "default": ""
          },
          "includeOrderStats": {
            "title": "Include the order book and trade statistics",
            "type": "boolean",
            "description": "Cumulative bid orders and volume, ask orders and volume, and the trade count, volume and value — the 每5秒委託成交統計 report. Each row also carries the increment since the previous row, so the flow in any window can be read off directly.",
            "default": true
          },
          "includeIndices": {
            "title": "Include the index statistics",
            "type": "boolean",
            "description": "The TAIEX on the same timestamps — the 每5秒指數統計 report. The two reports have been published on an identical clock on every session back to 2004, which is what lets one row carry both; the run fails rather than guesses if that ever stops being true.",
            "default": true
          },
          "includeSectorIndices": {
            "title": "Include all sector indices, not just the TAIEX",
            "type": "boolean",
            "description": "Adds an `indices` object to every row carrying every index the report carried besides the TAIEX — 37 of them today, 23 in 2004. Turning it off keeps the TAIEX and makes each row roughly a quarter the size, which is worth doing on a long backfill. Only affects rows; the indices report is fetched either way.",
            "default": true
          },
          "includeSessionSummary": {
            "title": "Include one summary row per session",
            "type": "boolean",
            "description": "A SESSION_SUMMARY record per day: the sampling interval in force, the row count published against the row count the session needs, the closing totals, the exchange's own daily close, change and turnover for comparison, the round-lot share of each, and the list of index columns that day carried with their official English names.",
            "default": true
          },
          "timeFrom": {
            "title": "Window start (HH:MM:SS)",
            "pattern": "^(|\\d{1,2}:\\d{2}(:\\d{2})?)$",
            "type": "string",
            "description": "Only write rows stamped at or after this time. The session runs 09:00:00 to 13:30:00. Useful for the open or the close on their own, and the cheapest way to cut a run's output without losing resolution — increments are still measured against the previous row of the full session, so the first row in the window is not a partial one.",
            "default": ""
          },
          "timeTo": {
            "title": "Window end (HH:MM:SS)",
            "pattern": "^(|\\d{1,2}:\\d{2}(:\\d{2})?)$",
            "type": "string",
            "description": "Only write rows stamped at or before this time. Defaults to the 13:30:00 close.",
            "default": ""
          },
          "sampleEverySeconds": {
            "title": "Thin the grid to one row every N seconds",
            "minimum": 0,
            "maximum": 16200,
            "type": "integer",
            "description": "0 keeps the exchange's own resolution — 5 seconds since 2014-12-29, and 10, 15 or 60 before that. Set 60 for one row a minute, 300 for one every five. Increments are then measured across the thinned interval, so a sampled series still sums back to the session total. A value below the day's own resolution changes nothing.",
            "default": 0
          },
          "maxSessions": {
            "title": "Maximum sessions",
            "minimum": 0,
            "type": "integer",
            "description": "A safety cap, because one session is 3,241 rows at today's resolution — the largest per-day payload in this suite. When a range exceeds the cap the most recent sessions are kept and the rest skipped, with a warning. Set to 0 to lift it.",
            "default": 5
          },
          "useApifyProxy": {
            "title": "Route requests through Apify Proxy",
            "type": "boolean",
            "description": "Turn this on for a backfill of more than a few weeks. TWSE's firewall refuses by address and, once tripped, refuses every report for that address for minutes at a time; with this on, requests take a different exit address each time they are refused. It is off by default because a direct run is faster and cleaner for any ordinary range.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}