{
  "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": [
        "# 07 Crack spread\n",
        "\n",
        "Does a richer 3-2-1 crack line up with a higher five-print RWTC return, and does that sign survive 2020?\n",
        "\n",
        "Holdout starts 2020-01-01. Verdict: failed.\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'] == 'crack')\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 3-2-1 crack with the next five-print RWTC return is 0.036. Holdout correlation is -0.030. The holdout flipped the train sign.\n",
            "CRACK_321 level versus the next five RWTC prints\n",
            "Train | 3371 | 0.036\n",
            "Holdout | 1066 | -0.030\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Method\n",
        "\n",
        "The theory under test is simple: a wide crack pulls refinery demand for crude, so the next RWTC return should be positive when the crack is high. The score is the correlation of the crack level with the five-print RWTC log return.\n",
        "\n",
        "## Result\n",
        "\n",
        "Train correlation of the 3-2-1 crack with the next five-print RWTC return is 0.036. Holdout correlation is -0.030. The holdout flipped the train sign."
      ]
    }
  ]
}
