{
  "openapi": "3.0.1",
  "info": {
    "title": "Technical Stock Screener & Backtester (US / TW)",
    "description": "Rule-table stock screener with multi-timeframe and sequential conditions, plus a backtester with a holding-matched null baseline.",
    "version": "0.1",
    "x-build-id": "YCKcBy1KYXXM6Idq3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yzy001~technical-stock-screener/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yzy001-technical-stock-screener",
        "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/yzy001~technical-stock-screener/runs": {
      "post": {
        "operationId": "runs-sync-yzy001-technical-stock-screener",
        "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/yzy001~technical-stock-screener/run-sync": {
      "post": {
        "operationId": "run-sync-yzy001-technical-stock-screener",
        "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",
        "required": [
          "market",
          "rule"
        ],
        "properties": {
          "market": {
            "title": "Market",
            "enum": [
              "us",
              "tw"
            ],
            "type": "string",
            "description": "us = US stocks (Yahoo Finance); tw = Taiwan listed and OTC stocks (official TWSE and TPEx data).",
            "default": "us"
          },
          "symbols": {
            "title": "Symbols",
            "type": "array",
            "description": "Symbols to scan, for example AAPL, MSFT or 2330, 2317. At most 200. Required for market us; for market tw an empty list scans every listed and OTC stock.",
            "items": {
              "type": "string"
            }
          },
          "rule": {
            "title": "Rule (JSON)",
            "type": "object",
            "description": "Entry and exit conditions. entry is required; exit is optional (not needed for screening). See the README for the format. A fundamental condition looks like {\"ind\":\"fundamental\",\"a\":\"trailingPE\",\"event\":\"below\",\"value\":20} and works only in screen mode."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "screen",
              "backtest"
            ],
            "type": "string",
            "description": "screen lists the symbols that match now; backtest also backtests the rule (needs exit or maxHold).",
            "default": "screen"
          },
          "months": {
            "title": "Months of daily history",
            "minimum": 6,
            "maximum": 60,
            "type": "integer",
            "description": "Indicators need warm-up history. Weekly KD(9) needs at least 8 months; for backtests use 24 or more.",
            "default": 12
          },
          "minPrice": {
            "title": "Minimum close",
            "type": "integer",
            "description": "Drops low-priced stocks. 5 is the usual US convention.",
            "default": 5
          },
          "minAvgVolume": {
            "title": "Minimum 20-day average volume",
            "type": "integer",
            "description": "Drops illiquid stocks.",
            "default": 200000
          },
          "costBps": {
            "title": "Trading cost (basis points)",
            "type": "integer",
            "description": "Backtest only. 20 = 0.2% round trip.",
            "default": 20
          },
          "maxHold": {
            "title": "Maximum hold (daily bars)",
            "type": "integer",
            "description": "Backtest only. An exit condition may never fire, so a cap is required. The unit is daily bars even when the rule runs on weekly bars (tf W): 60 bars is about 12 weeks. Measured: weekly KD/MACD exit rules with maxHold=60 had 50% of trades end at the cap (their returns describe 'hold 60 bars', not your exit rule); with maxHold=400 all exits came from the rule. For weekly rules use 250 or more. SUMMARY.backtest.maxHoldSharePct reports how many trades hit the cap.",
            "default": 60
          },
          "fundamentalDelaySeconds": {
            "title": "Delay between fundamentals requests (seconds)",
            "minimum": 0,
            "maximum": 10,
            "type": "number",
            "description": "A rule that uses fundamental fields needs one extra request per symbol; this sets the gap between them. Fundamentals exist only as today's values, so backtest mode refuses them (no switch). Fields: beta, currentRatio, debtToEquity, dividendYield, earningsGrowth, enterpriseToEbitda, forwardEps, forwardPE, marketCap, payoutRatio, pegRatio, priceToBook, profitMargins, returnOnEquity, revenueGrowth, sharesShort, shortPercentOfFloat, shortRatio, trailingEps, trailingPE. The source mixes units: debtToEquity and dividendYield are percentages, the other ratios are fractions; conditions are evaluated on fractions and the output gives both the raw value and _asFraction.",
            "default": 0.3
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}