{
  "standard_id": "marketworld_external_strategy_submission_standard_v1",
  "version": "2026-06-29",
  "purpose": "Public standard for external strategy backtest and submission without exposing MarketWorld private feature extraction or slice rules.",
  "security_model": {
    "public_user_receives": [
      "official historical dataset packages",
      "MarketWorld offline backtest kit",
      "official manifest and cost model hashes",
      "strategy package schema",
      "hash commitment requirements",
      "preflight and submission API routes"
    ],
    "public_user_does_not_receive": [
      "MarketWorld internal feature names",
      "MarketWorld private slice definitions",
      "MarketWorld private acceptance thresholds beyond public risk minimums",
      "MarketWorld private review implementation"
    ],
    "hash_policy": "Hashes are commitments, not encrypted data to decode. MarketWorld recomputes private review features from official data and submitted artifacts, then matches the submitted hashes and commitment_id.",
    "compute_policy": "Backtests must be run with the MarketWorld offline backtest kit on submitter-controlled compute. MarketWorld servers do not run user historical backtests."
  },
  "download_and_api": {
    "submission_standard": "GET /external-strategies/submission-standard",
    "offline_backtest_kit": "GET /external-strategies/offline-kit",
    "backtest_requirements": "GET /external-strategies/backtest-requirements",
    "dataset_catalog": "GET /external-strategies/backtest-datasets",
    "dataset_manifest": "GET /external-strategies/backtest-datasets/{dataset_id}/manifest",
    "dataset_file": "GET /external-strategies/backtest-datasets/{dataset_id}/files/{file_name}",
    "preflight": "POST /external-strategies?dry_run=true&replace=false",
    "formal_submit": "POST /external-strategies?replace=false"
  },
  "public_scorer": {
    "script": "scripts/external_strategy_public_scorer.py",
    "example": "python scripts/external_strategy_public_scorer.py --summary summary.json --slices slice_report.json --out score_report.json --fail-below-threshold",
    "runs_on_submitter_compute": true
  },
    "offline_backtest_runner": {
    "kit": "output/marketworld_external_backtest_offline_kit.zip",
    "download": "GET /external-strategies/offline-kit",
    "script": "scripts/external_strategy_offline_backtest.py",
    "runner_id": "marketworld_external_strategy_offline_backtest_v1",
    "runner_sha256_required": true,
    "example": "python scripts/external_strategy_offline_backtest.py --dataset-id mw_okx_btc_spot_perp_daily_v1 --strategy-entrypoint external_strategies/python_strategy_template/strategy.py --strategy-id your_strategy_id --author your_name --out-dir runs/your_strategy_id",
    "server_backtest_compute": false,
    "policy": "Only packages generated by the MarketWorld offline runner and passing the public score threshold should be uploaded."
  },
  "required_backtest_evidence": {
    "schema": "BacktestEvidenceV2",
    "evidence_mode": "hash_commitment",
    "run_mode_allowed": ["client_side", "external_compute", "user_supplied"],
    "public_score": {
      "scorer_id": "marketworld_public_backtest_score_v1",
      "score_range": [0, 100],
      "minimum_upload_score": 70.0,
      "passed_required": true,
      "score_report_json_sha256_required": true,
      "policy": "The submitter must compute the public score locally through the MarketWorld offline backtest kit after backtesting MarketWorld official data. Packages below the minimum upload score are rejected before storage."
    },
    "runner": {
      "runner_id": "must equal marketworld_external_strategy_offline_backtest_v1",
      "runner_sha256": "must equal the current MarketWorld offline backtest runner script hash",
      "server_backtest_compute": false
    },
    "dataset": {
      "provider": "marketworld",
      "dataset_id": "must come from GET /external-strategies/backtest-datasets",
      "data_fingerprint": "must exactly match the official dataset data_fingerprint",
      "manifest_hash": "must exactly match the official manifest_hash",
      "source_policy_id": "must exactly match the official source_policy_id",
      "venue_policy_id": "must exactly match the official venue_policy_id",
      "venue_pair_id": "must exactly match one official venue_pairs[].venue_pair_id",
      "venue_scope_policy": "same_venue, same_brand, cross_venue, and spot_only are separate official package scopes; cross-exchange strategies must use an official cross_venue dataset package instead of mixing files from multiple packages",
      "timestamp_alignment": "cross_venue packages must declare the official alignment policy; current released cross_venue packages use UTC daily closed bars with zero timestamp lag and reject missing legs",
      "venue_bindings": "must exactly match official instrument_sources for every submitted leg",
      "granularity": "must be supported by the official dataset",
      "instruments": "must cover all instruments used by rules and signal legs"
    },
    "cost_model": {
      "model_id": "must exactly match the official dataset cost_model_id",
      "hash": "must exactly match the official dataset cost_model_hash"
    },
    "attestation_required_true": [
      "no_lookahead",
      "no_survivorship_bias",
      "costs_included",
      "client_side_compute",
      "marketworld_dataset_used",
      "venue_locked_data"
    ],
    "artifact_hashes_required": [
      "summary_json_sha256",
      "trades_csv_sha256",
      "equity_curve_csv_sha256",
      "slice_report_json_sha256",
      "score_report_json_sha256",
      "config_json_sha256",
      "artifact_manifest_sha256"
    ],
    "commitments_required": [
      "opaque_feature_commitment_hash",
      "strategy_source_sha256"
    ]
  },
  "artifact_contract": {
    "summary.json": "Submit SHA256 only. Keep the file available for private review if requested.",
    "trades.csv": "Submit SHA256 only. Must include every fill/order event used in the backtest.",
    "equity_curve.csv": "Submit SHA256 only. Must include timestamped equity or cumulative PnL series.",
    "slice_report.json": "Submit SHA256 only. Generated by the submitter's runner using the public runner contract; MarketWorld does not publish private slice definitions.",
    "score_report.json": "Submit SHA256 only. Contains the public 0-100 score, threshold, pass flag, scorer_id, component scores, and generic performance inputs.",
    "config.json": "Submit SHA256 only. Must include dataset_id, period, cost_model_id, strategy parameters, and runner version.",
    "artifact_manifest.json": "Submit SHA256 only. Lists artifact names, sizes, hashes, and canonicalization rules.",
    "strategy_source": "Submit SHA256 of the exact source/model/config bundle used for the submitted backtest."
  },
  "hash_format": {
    "pattern": "sha256:<64 lowercase hex characters>",
    "powershell_file_hash_example": "('sha256:' + (Get-FileHash .\\trades.csv -Algorithm SHA256).Hash.ToLower())",
    "python_file_hash_example": "hashlib.sha256(open(path, 'rb').read()).hexdigest()"
  },
  "submission_flow": [
    "Download this standard and the MarketWorld offline backtest kit.",
    "Generate or adapt a strategy so it outputs Strategy Package V2 / SignalIntentV1 without secrets.",
    "Run scripts/external_strategy_offline_backtest.py on submitter-controlled compute using the official dataset and cost model.",
    "Let the offline runner generate the required artifact files, public score, hashes, BacktestEvidenceV2, and commitment_id.",
    "Upload only strategy_package_ready_to_submit.json; failed score or failed validation packages must not be uploaded.",
    "Submit through dry_run first.",
    "Formal submit stores the package and audit trail.",
    "Hash commitment packages do not enter the simulation candidate pool until MarketWorld private review approves their commitment_id."
  ],
  "llm_instruction_prompt_zh": "你是策略接入工程师。请只根据本标准和我提供的策略说明，生成一个可离线回测、可提交到 MarketWorld 的 strategy_package_v2 JSON 和本地 runner 目录。要求：1）不要生成或猜测 MarketWorld 内部特征名、内部切片规则或私有阈值；2）回测只能读取 MarketWorld 官方数据包和成本模型；跨交易所策略必须使用官方 cross_venue 数据包，不能自行混用不同包；3）输出 BacktestEvidenceV2，evidence_mode=hash_commitment；4）生成 summary.json、trades.csv、equity_curve.csv、slice_report.json、score_report.json、config.json、artifact_manifest.json 的本地文件和 SHA256；5）本地公开评分器 scorer_id=marketworld_public_backtest_score_v1，score 必须 >=70 且 passed=true，否则不要上传；6）策略包不得包含 API key、token、密码或账户信息；7）默认 enabled=false、review_requested=true；8）提交前先调用 POST /external-strategies?dry_run=true&replace=false 预检。",
  "template_file": "external_strategies/strategy_package_template_v2.json"
}
