{
  "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": [
        "# 08 Inventory tails\n",
        "\n",
        "Do the outer deciles of the WCESTUS1 surprise, cut on the train window only, still separate five-print RWTC returns after 2019?\n",
        "\n",
        "Holdout starts 2020-01-01. Verdict: held.\n",
        "\n",
        "This study reads stored series. It does not add a derived column."
      ]
    },
    {
      "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'] == 'events')\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": [
            "held\n",
            "Frozen train tails are -5648 and 5678 thousand barrels. Train draw-minus-build five-print return is -0.348%. Holdout difference is -2.035%. A negative number means the draw tail was followed by a lower return than the build tail. The holdout kept the train sign.\n",
            "Five-print RWTC return by frozen WCESTUS1 surprise tail\n",
            "Train | draw | 159 | -0.169%\n",
            "Train | middle | 1266 | 0.181%\n",
            "Train | build | 159 | 0.179%\n",
            "Holdout | draw | 47 | -1.377%\n",
            "Holdout | middle | 255 | 0.319%\n",
            "Holdout | build | 45 | 0.658%\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Method\n",
        "\n",
        "The 10th and 90th percentiles are nearest ranks of the train surprises. Holdout weeks are labeled with those two numbers.\n",
        "\n",
        "## Result\n",
        "\n",
        "Frozen train tails are -5648 and 5678 thousand barrels. Train draw-minus-build five-print return is -0.348%. Holdout difference is -2.035%. A negative number means the draw tail was followed by a lower return than the build tail. The holdout kept the train sign."
      ]
    }
  ]
}
