{
  "nbformat": 4,
  "nbformat_minor": 5,
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "pygments_lexer": "ipython3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# 11 Inventory surprise proxy\n",
        "\n",
        "Is the holdout correlation between this mean-baseline stock surprise and the nominal EIA Wednesday RWTC return negative?\n",
        "\n",
        "Holdout starts 2020-01-01. Verdict: failed.\n",
        "\n",
        "Weekly change in EIA WCESTUS1, kept only when the week-ending dates are 7 days apart, minus the mean of the prior 52 kept changes. The mean uses weeks strictly before the current week. This is a trailing baseline, not an analyst survey."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {},
      "source": [
        "import json\n",
        "from pathlib import Path\n",
        "studies = json.loads(Path('data/studies.json').read_text())\n",
        "study = next(item for item in studies['studies'] if item['slug'] == 'inv-surprise')\n",
        "print(study['verdict'])\n",
        "print(study['verdict_line'])\n",
        "print(study['table']['caption'])\n",
        "for row in study['table']['rows']:\n",
        "    print(' | '.join(row))\n"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "failed\n",
            "Train correlation of the mean-baseline surprise with the release-day RWTC log return is -0.098. Holdout correlation is 0.022. The holdout correlation is not negative. The bar was missed.\n",
            "WCESTUS1 change minus the prior 52-week mean, versus the Wednesday RWTC log return\n",
            "Train | 1584 | -0.098\n",
            "Holdout | 348 | 0.022\n",
            "Skipped, no Wednesday RWTC print | 307 | \n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Method\n",
        "\n",
        "The EIA week ends Friday. The nominal release is the Wednesday five days later. If that Wednesday has no RWTC print, the week is skipped. A Thursday holiday release is not moved.\n",
        "\n",
        "## Result\n",
        "\n",
        "Train correlation of the mean-baseline surprise with the release-day RWTC log return is -0.098. Holdout correlation is 0.022. The holdout correlation is not negative. The bar was missed."
      ]
    }
  ]
}
