{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e13dd6f1",
   "metadata": {},
   "source": [
    "# LMP Pricing Data\n",
    "\n",
    "## Support\n",
    "\n",
    "Below are the currently support LMP markets\n",
    "\n",
    "<!-- LMP AVAILABILITY TABLE START -->\n",
    "|                                       | Markets                                                    |\n",
    "|:--------------------------------------|:-----------------------------------------------------------|\n",
    "| Midcontinent ISO                      | `REAL_TIME_5_MIN`, `DAY_AHEAD_HOURLY`                      |\n",
    "| California ISO                        | `REAL_TIME_15_MIN`, `REAL_TIME_HOURLY`, `DAY_AHEAD_HOURLY` |\n",
    "| PJM                                   | `REAL_TIME_5_MIN`, `REAL_TIME_HOURLY`, `DAY_AHEAD_HOURLY`  |\n",
    "| Electric Reliability Council of Texas |                                                            |\n",
    "| Southwest Power Pool                  |                                                            |\n",
    "| New York ISO                          | `REAL_TIME_5_MIN`, `DAY_AHEAD_HOURLY`                      |\n",
    "| ISO New England                       | `REAL_TIME_5_MIN`, `REAL_TIME_HOURLY`, `DAY_AHEAD_HOURLY`  |\n",
    "<!-- LMP AVAILABILITY TABLE END -->\n",
    "\n",
    "\n",
    "## How to use\n",
    "\n",
    "We are currently adding Locational Marginal Price (LMP). Even though each BA offers different markets, but you can query them with a standardized API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "198be2a8",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'NYISO' object has no attribute 'get_lmp_today'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36m<cell line: 3>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgridstatus\u001b[39;00m\n\u001b[1;32m      2\u001b[0m nyiso \u001b[38;5;241m=\u001b[39m gridstatus\u001b[38;5;241m.\u001b[39mNYISO()\n\u001b[0;32m----> 3\u001b[0m \u001b[43mnyiso\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_lmp_today\u001b[49m(market\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mREAL_TIME_5_MIN\u001b[39m\u001b[38;5;124m\"\u001b[39m, locations\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mALL\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
      "\u001b[0;31mAttributeError\u001b[0m: 'NYISO' object has no attribute 'get_lmp_today'"
     ]
    }
   ],
   "source": [
    "import gridstatus\n",
    "nyiso = gridstatus.NYISO()\n",
    "nyiso.get_lmp_today(market=\"REAL_TIME_5_MIN\", locations=\"ALL\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2232ffcd",
   "metadata": {},
   "source": [
    "And here is querying CAISO"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4863b9cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import gridstatus\n",
    "caiso = gridstatus.CAISO()\n",
    "locations = [\"TH_NP15_GEN-APND\", \"TH_SP15_GEN-APND\", \"TH_ZP26_GEN-APND\"]\n",
    "caiso.get_lmp_today(market='DAY_AHEAD_HOURLY', locations=locations)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "226d14c5",
   "metadata": {},
   "source": [
    "You can see what markets are available by accessing the `markets` property of an iso. For, example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abc179c9",
   "metadata": {},
   "outputs": [],
   "source": [
    "caiso.markets"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3885937",
   "metadata": {},
   "source": [
    "The possible lmp query methods are `ISO.get_latest_lmp`, `ISO.get_lmp_today`, and `ISO.get_lmp`."
   ]
  }
 ],
 "metadata": {
  "file_format": "mystnb",
  "kernelspec": {
   "display_name": "python3",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  },
  "source_map": [
   5,
   30,
   34,
   38,
   43,
   47,
   49
  ]
 },
 "nbformat": 4,
 "nbformat_minor": 5
}