{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Options Chains Analysis\n", "\n", "Version 3.1 of the OpenBB SDK provides a suite of enhancements to the Options module. This notebook will highlight the changes and demonstrate how to get started using the new tools.\n", "\n", "## What's Changed\n", "\n", "- There's a new way to `load`\n", " \n", " `openbb.stocks.options.load_options_chains()`\n", "\n", " The legacy method (`openbb.stocks.options.chains()`) remains in service, but some minor changes to existing scripts will be required to take advantage of the new functionality. Don't worry, it's nothing that `Find & Replace` can't easily handle. Let's compare below." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Select the `obb` Python environment as the session's kernel, then import the OpenBB SDK.\n", "\n", "from openbb_terminal.sdk import openbb\n", "import pandas as pd\n", "from openbb_terminal.economy.plot_view import show_plot" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
optionTypeexpirationstrikelastPricebidaskopenInterestvolume
0call2023-06-23275.0158.44159.31159.4502
1put2023-06-23275.00.010.000.0110071
\n", "
" ], "text/plain": [ " optionType expiration strike lastPrice bid ask openInterest \\\n", "0 call 2023-06-23 275.0 158.44 159.31 159.45 0 \n", "1 put 2023-06-23 275.0 0.01 0.00 0.01 1007 \n", "\n", " volume \n", "0 2 \n", "1 1 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The legacy method\n", "\n", "spy_chains = openbb.stocks.options.chains(\"SPY\")\n", "spy_chains.head(2)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
optionTypeexpirationstrikelastPricebidaskopenInterestvolumedte
0call2023-06-23275.0158.44159.31159.45020
1put2023-06-23275.00.010.000.01100710
\n", "
" ], "text/plain": [ " optionType expiration strike lastPrice bid ask openInterest \\\n", "0 call 2023-06-23 275.0 158.44 159.31 159.45 0 \n", "1 put 2023-06-23 275.0 0.01 0.00 0.01 1007 \n", "\n", " volume dte \n", "0 2 0 \n", "1 1 0 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The new method\n", "\n", "spy = openbb.stocks.options.load_options_chains(\"SPY\", \"Nasdaq\")\n", "spy.chains.head(2)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The same response (the options chains) is in both variables, but the new method contains more than just the chains data previously fetched." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dict_keys(['source', 'SYMBOLS', 'symbol', 'chains', 'expirations', 'strikes', 'underlying_price', 'last_price', 'underlying_name', 'hasIV', 'hasGreeks', 'get_available_greeks', 'date'])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "spy.__dict__.keys()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The new object eliminates the need to make an additional request for the price of the underlying asset, or the list of expirations and strikes." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "434.3" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Instead of:\n", "\n", "last_price = openbb.stocks.options.price(\"SPY\")\n", "\n", "last_price" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "434.3" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Use the Options data object:\n", "\n", "spy.last_price" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "- There are new sources of data\n", "\n", " Two additional data sources have been added, `CBOE` and `TMX`, with the latter covering the Canadian market. The new default source is `CBOE`. The DataFrame has been transposed below to better illustrate the additional columns available by default." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
186187456457636637
expiration2023-06-232023-06-232023-06-262023-06-262023-06-272023-06-27
strike435.0435.0435.0435.0435.0435.0
optionTypecallputcallputcallput
contractSymbolSPY230623C00435000SPY230623P00435000SPY230626C00435000SPY230626P00435000SPY230627C00435000SPY230627P00435000
bid0.280.890.951.511.361.86
bidSize8292111125897113
ask0.290.90.961.521.371.87
askSize38711201150168150
impliedVolatility0.1450.1480.07430.07480.08630.0862
openInterest27779249577187887218205341
volume23979357155669361126892325067
delta0.3365-0.66360.4295-0.57280.4534-0.5502
gamma0.25370.25370.13040.13140.09910.1004
theta-0.3203-0.3203-0.2032-0.2046-0.2018-0.2041
rho0.0007-0.00140.016-0.0180.0222-0.0227
vega0.03330.03330.1590.15870.18390.1834
theoretical0.32030.93030.94361.49491.35661.8531
change-1.450.275-1.220.515-1.1550.555
open0.292.020.712.721.032.96
high0.492.511.112.851.523.1
low0.110.660.541.310.871.67
tickno_changedownupno_changeno_changeno_change
lastTradePrice0.280.890.941.511.351.81
lastTradeTimestamp2023-06-23T12:41:182023-06-23T12:41:182023-06-23T12:40:592023-06-23T12:41:122023-06-23T12:41:072023-06-23T12:38:51
changePercent-83.8244.72-56.4851.76-46.1144.22
previousClose1.730.622.161.02.51.25
dte003344
\n", "
" ], "text/plain": [ " 186 187 \\\n", "expiration 2023-06-23 2023-06-23 \n", "strike 435.0 435.0 \n", "optionType call put \n", "contractSymbol SPY230623C00435000 SPY230623P00435000 \n", "bid 0.28 0.89 \n", "bidSize 829 211 \n", "ask 0.29 0.9 \n", "askSize 387 11 \n", "impliedVolatility 0.145 0.148 \n", "openInterest 27779 24957 \n", "volume 239793 57155 \n", "delta 0.3365 -0.6636 \n", "gamma 0.2537 0.2537 \n", "theta -0.3203 -0.3203 \n", "rho 0.0007 -0.0014 \n", "vega 0.0333 0.0333 \n", "theoretical 0.3203 0.9303 \n", "change -1.45 0.275 \n", "open 0.29 2.02 \n", "high 0.49 2.51 \n", "low 0.11 0.66 \n", "tick no_change down \n", "lastTradePrice 0.28 0.89 \n", "lastTradeTimestamp 2023-06-23T12:41:18 2023-06-23T12:41:18 \n", "changePercent -83.82 44.72 \n", "previousClose 1.73 0.62 \n", "dte 0 0 \n", "\n", " 456 457 \\\n", "expiration 2023-06-26 2023-06-26 \n", "strike 435.0 435.0 \n", "optionType call put \n", "contractSymbol SPY230626C00435000 SPY230626P00435000 \n", "bid 0.95 1.51 \n", "bidSize 112 58 \n", "ask 0.96 1.52 \n", "askSize 201 150 \n", "impliedVolatility 0.0743 0.0748 \n", "openInterest 7187 8872 \n", "volume 66936 11268 \n", "delta 0.4295 -0.5728 \n", "gamma 0.1304 0.1314 \n", "theta -0.2032 -0.2046 \n", "rho 0.016 -0.018 \n", "vega 0.159 0.1587 \n", "theoretical 0.9436 1.4949 \n", "change -1.22 0.515 \n", "open 0.71 2.72 \n", "high 1.11 2.85 \n", "low 0.54 1.31 \n", "tick up no_change \n", "lastTradePrice 0.94 1.51 \n", "lastTradeTimestamp 2023-06-23T12:40:59 2023-06-23T12:41:12 \n", "changePercent -56.48 51.76 \n", "previousClose 2.16 1.0 \n", "dte 3 3 \n", "\n", " 636 637 \n", "expiration 2023-06-27 2023-06-27 \n", "strike 435.0 435.0 \n", "optionType call put \n", "contractSymbol SPY230627C00435000 SPY230627P00435000 \n", "bid 1.36 1.86 \n", "bidSize 97 113 \n", "ask 1.37 1.87 \n", "askSize 168 150 \n", "impliedVolatility 0.0863 0.0862 \n", "openInterest 1820 5341 \n", "volume 9232 5067 \n", "delta 0.4534 -0.5502 \n", "gamma 0.0991 0.1004 \n", "theta -0.2018 -0.2041 \n", "rho 0.0222 -0.0227 \n", "vega 0.1839 0.1834 \n", "theoretical 1.3566 1.8531 \n", "change -1.155 0.555 \n", "open 1.03 2.96 \n", "high 1.52 3.1 \n", "low 0.87 1.67 \n", "tick no_change no_change \n", "lastTradePrice 1.35 1.81 \n", "lastTradeTimestamp 2023-06-23T12:41:07 2023-06-23T12:38:51 \n", "changePercent -46.11 44.22 \n", "previousClose 2.5 1.25 \n", "dte 4 4 " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "spy = openbb.stocks.options.load_options_chains(\"SPY\")\n", "\n", "spy.chains.query(\"`strike` == 435\").head(6).transpose()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "`TMX` provides historical EOD chains data, beginning in 2009. Notably, this data contains implied volatility, the current quotes do not." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The closing price of XIU on, 2009-07-02, was: $15.59\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
101130316465
expiration2009-07-17 00:00:002009-07-17 00:00:002009-08-21 00:00:002009-08-21 00:00:002009-09-18 00:00:002009-09-18 00:00:00
strike15.015.015.015.015.015.0
optionTypecallputcallputcallput
date2009-07-022009-07-022009-07-022009-07-022009-07-022009-07-02
bid0.680.10.940.341.140.56
ask0.770.151.050.431.260.63
bidSize510500510800510510
askSize522330300300300
lastPrice0.770.151.050.431.260.63
volume06000015
previousClose0.960.171.190.391.380.58
change-0.19-0.02-0.140.04-0.120.05
open0.00.090.00.00.00.62
high0.00.120.00.00.00.62
low0.00.090.00.00.00.62
totalValue050009
transactions020001
settlementPrice000000
openInterest59019786131476782173
impliedVolatility0.27820.27990.28080.28990.29780.3151
contractSymbolXIXG09C15.00XIXS09P15.00XIXH09C15.00XIXT09P15.00XIXI09C15.00XIXU09P15.00
dte151550507878
\n", "
" ], "text/plain": [ " 10 11 \\\n", "expiration 2009-07-17 00:00:00 2009-07-17 00:00:00 \n", "strike 15.0 15.0 \n", "optionType call put \n", "date 2009-07-02 2009-07-02 \n", "bid 0.68 0.1 \n", "ask 0.77 0.15 \n", "bidSize 510 500 \n", "askSize 52 2 \n", "lastPrice 0.77 0.15 \n", "volume 0 60 \n", "previousClose 0.96 0.17 \n", "change -0.19 -0.02 \n", "open 0.0 0.09 \n", "high 0.0 0.12 \n", "low 0.0 0.09 \n", "totalValue 0 5 \n", "transactions 0 2 \n", "settlementPrice 0 0 \n", "openInterest 590 19786 \n", "impliedVolatility 0.2782 0.2799 \n", "contractSymbol XIXG09C15.00 XIXS09P15.00 \n", "dte 15 15 \n", "\n", " 30 31 \\\n", "expiration 2009-08-21 00:00:00 2009-08-21 00:00:00 \n", "strike 15.0 15.0 \n", "optionType call put \n", "date 2009-07-02 2009-07-02 \n", "bid 0.94 0.34 \n", "ask 1.05 0.43 \n", "bidSize 510 800 \n", "askSize 330 300 \n", "lastPrice 1.05 0.43 \n", "volume 0 0 \n", "previousClose 1.19 0.39 \n", "change -0.14 0.04 \n", "open 0.0 0.0 \n", "high 0.0 0.0 \n", "low 0.0 0.0 \n", "totalValue 0 0 \n", "transactions 0 0 \n", "settlementPrice 0 0 \n", "openInterest 131 47 \n", "impliedVolatility 0.2808 0.2899 \n", "contractSymbol XIXH09C15.00 XIXT09P15.00 \n", "dte 50 50 \n", "\n", " 64 65 \n", "expiration 2009-09-18 00:00:00 2009-09-18 00:00:00 \n", "strike 15.0 15.0 \n", "optionType call put \n", "date 2009-07-02 2009-07-02 \n", "bid 1.14 0.56 \n", "ask 1.26 0.63 \n", "bidSize 510 510 \n", "askSize 300 300 \n", "lastPrice 1.26 0.63 \n", "volume 0 15 \n", "previousClose 1.38 0.58 \n", "change -0.12 0.05 \n", "open 0.0 0.62 \n", "high 0.0 0.62 \n", "low 0.0 0.62 \n", "totalValue 0 9 \n", "transactions 0 1 \n", "settlementPrice 0 0 \n", "openInterest 6782 173 \n", "impliedVolatility 0.2978 0.3151 \n", "contractSymbol XIXI09C15.00 XIXU09P15.00 \n", "dte 78 78 " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xiu = openbb.stocks.options.load_options_chains(\"XIU\", \"TMX\", \"2009-07-01\")\n", "print(\"The closing price of \", xiu.symbol, \" on, \", xiu.date, \", was: $\", xiu.last_price, sep =\"\")\n", "xiu.chains.query(\"`strike` == 15\").head(6).transpose()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
expirationstrikeoptionTypebidasklastPricechangeopenInterestvolumedte
142023-06-2330.00call0.000.050.070.03000
152023-06-2330.00put0.220.550.280.0400
162023-06-2330.25call0.000.050.050.0000
172023-06-2330.25put0.470.750.640.0000
182023-06-2330.50call0.000.050.050.04900
192023-06-2330.50put0.721.000.890.0000
202023-06-2330.75call0.000.050.050.05100
212023-06-2330.75put0.971.251.140.0000
222023-06-2331.00call0.000.050.050.0000
232023-06-2331.00put1.221.501.390.0000
\n", "
" ], "text/plain": [ " expiration strike optionType bid ask lastPrice change \\\n", "14 2023-06-23 30.00 call 0.00 0.05 0.07 0.0 \n", "15 2023-06-23 30.00 put 0.22 0.55 0.28 0.0 \n", "16 2023-06-23 30.25 call 0.00 0.05 0.05 0.0 \n", "17 2023-06-23 30.25 put 0.47 0.75 0.64 0.0 \n", "18 2023-06-23 30.50 call 0.00 0.05 0.05 0.0 \n", "19 2023-06-23 30.50 put 0.72 1.00 0.89 0.0 \n", "20 2023-06-23 30.75 call 0.00 0.05 0.05 0.0 \n", "21 2023-06-23 30.75 put 0.97 1.25 1.14 0.0 \n", "22 2023-06-23 31.00 call 0.00 0.05 0.05 0.0 \n", "23 2023-06-23 31.00 put 1.22 1.50 1.39 0.0 \n", "\n", " openInterest volume dte \n", "14 30 0 0 \n", "15 4 0 0 \n", "16 0 0 0 \n", "17 0 0 0 \n", "18 49 0 0 \n", "19 0 0 0 \n", "20 51 0 0 \n", "21 0 0 0 \n", "22 0 0 0 \n", "23 0 0 0 " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xiu = openbb.stocks.options.load_options_chains(\"XIU\", \"TMX\")\n", "xiu.chains.query(\"30 <= `strike` <= 31\").head(10)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "- Methods are bound to the returned object that sort and filter the data\n", " Along with attributes listed above - `spy.__dict__.keys()` - methods are provided for extracting key insights from the raw data.\n", "\n", " - `get_stats()`\n", " - `get_skew()`\n", " - `get_straddle()`\n", " - `get_strangle()`\n", " - `get_vertical_call_spread()`\n", " - `get_vertical_put_spread()`\n", " - `get_strategies()`\n", "\n", "`impliedVolatility` is a required field for `get_skew()`; therefore, only sources returning `hasIV` as `True` will work. All other callables are compatible with every source.\n" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Getting Started\n", "\n", "Assign a ticker to a new variable." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "INVESCO QQQ TR UNIT SER 1\n", "Symbol: QQQ\n", "Source: CBOE\n", "Last Price: 364.02\n" ] } ], "source": [ "ticker = openbb.stocks.options.load_options_chains(\"QQQ\")\n", "print(ticker.underlying_name, '\\n', \"Symbol: \", ticker.symbol, '\\n', \"Source: \", ticker.source, '\\n', \"Last Price: \" , ticker.last_price, sep = \"\")" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Let's look at volume and open interest, by expiration." ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "oi = ticker.get_stats()[[\"Puts OI\", \"Calls OI\"]]\n", "oi[\"Puts OI\"] = oi[\"Puts OI\"] * (-1)\n", "vol = ticker.get_stats()[[\"Puts Volume\", \"Calls Volume\"]]\n", "vol[\"Puts Volume\"] = vol[\"Puts Volume\"] * (-1)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Puts OI", "type": "scatter", "x": [ "2023-06-23", "2023-06-26", "2023-06-27", "2023-06-28", "2023-06-29", "2023-06-30", "2023-07-03", "2023-07-05", "2023-07-06", "2023-07-07", "2023-07-14", "2023-07-21", "2023-07-28", "2023-08-04", "2023-08-18", "2023-09-15", "2023-09-29", "2023-10-20", "2023-11-17", "2023-12-15", "2023-12-29", "2024-01-19", "2024-03-15", "2024-03-28", "2024-06-21", "2024-09-20", "2024-12-20", "2025-01-17", "2025-06-20" ], "y": [ -376642, -63549, -29383, -32543, -19868, -896364, -6245, -12376, -505, -366128, -69958, -1319320, -124591, -1073, -755713, -1856061, -209296, -160812, -72575, -1278699, -38141, -449126, -213891, -31603, -226111, -59, -188306, -101640, -12507 ] }, { "hovertemplate": "%{y}", "name": "Calls OI", "type": "scatter", "x": [ "2023-06-23", "2023-06-26", "2023-06-27", "2023-06-28", "2023-06-29", "2023-06-30", "2023-07-03", "2023-07-05", "2023-07-06", "2023-07-07", "2023-07-14", "2023-07-21", "2023-07-28", "2023-08-04", "2023-08-18", "2023-09-15", "2023-09-29", "2023-10-20", "2023-11-17", "2023-12-15", "2023-12-29", "2024-01-19", "2024-03-15", "2024-03-28", "2024-06-21", "2024-09-20", "2024-12-20", "2025-01-17", "2025-06-20" ], "y": [ 185337, 45749, 20902, 21110, 14294, 460201, 6066, 841, 673, 143338, 38137, 644266, 56458, 1103, 322757, 703815, 59394, 90198, 61159, 515607, 22556, 365046, 90841, 6848, 173515, 696, 82465, 50154, 8230 ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "openbb.forecast.plot(oi, oi.columns.to_list())" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Puts Volume", "type": "scatter", "x": [ "2023-06-23", "2023-06-26", "2023-06-27", "2023-06-28", "2023-06-29", "2023-06-30", "2023-07-03", "2023-07-05", "2023-07-06", "2023-07-07", "2023-07-14", "2023-07-21", "2023-07-28", "2023-08-04", "2023-08-18", "2023-09-15", "2023-09-29", "2023-10-20", "2023-11-17", "2023-12-15", "2023-12-29", "2024-01-19", "2024-03-15", "2024-03-28", "2024-06-21", "2024-09-20", "2024-12-20", "2025-01-17", "2025-06-20" ], "y": [ -448062, -145336, -18897, -34022, -9873, -98947, -10962, -1993, -912, -54842, -9654, -62940, -11117, -1476, -22711, -28846, -1777, -1760, -1202, -4000, -641, -3840, -613, -161, -9636, -475, -211, -209, -171 ] }, { "hovertemplate": "%{y}", "name": "Calls Volume", "type": "scatter", "x": [ "2023-06-23", "2023-06-26", "2023-06-27", "2023-06-28", "2023-06-29", "2023-06-30", "2023-07-03", "2023-07-05", "2023-07-06", "2023-07-07", "2023-07-14", "2023-07-21", "2023-07-28", "2023-08-04", "2023-08-18", "2023-09-15", "2023-09-29", "2023-10-20", "2023-11-17", "2023-12-15", "2023-12-29", "2024-01-19", "2024-03-15", "2024-03-28", "2024-06-21", "2024-09-20", "2024-12-20", "2025-01-17", "2025-06-20" ], "y": [ 382988, 121253, 27185, 11766, 13276, 59880, 5474, 1281, 1731, 12312, 7853, 33718, 2529, 2854, 9242, 11071, 532, 892, 404, 3044, 553, 3884, 1195, 6, 1047, 36, 107, 34, 225 ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "openbb.forecast.plot(vol, vol.columns.to_list())" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The concentration of volume is clearly at the front contract, while the open interest paints a different picture. The same analysis can be easily applied by strike.\n" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "strike_oi = ticker.get_stats(\"strike\")[[\"Puts OI\", \"Calls OI\"]]\n", "strike_oi[\"Puts OI\"] = strike_oi[\"Puts OI\"] * (-1)\n", "strike_vol = ticker.get_stats(\"strike\")[[\"Puts Volume\", \"Calls Volume\"]]\n", "strike_vol[\"Puts Volume\"] = strike_vol[\"Puts Volume\"] * (-1)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Puts OI", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 196, 197, 198, 199, 200, 205, 210, 215, 220, 225, 230, 235, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 302.5, 303, 304, 305, 306, 307, 307.5, 308, 309, 310, 311, 312, 312.5, 313, 314, 315, 316, 317, 317.5, 318, 319, 320, 321, 322, 322.5, 323, 324, 325, 326, 327, 327.5, 328, 329, 330, 331, 332, 332.5, 333, 334, 335, 336, 337, 337.5, 338, 339, 340, 341, 342, 342.5, 343, 344, 345, 346, 347, 347.5, 348, 349, 350, 351, 352, 352.5, 353, 354, 355, 356, 357, 357.5, 358, 359, 360, 361, 362, 362.5, 363, 364, 365, 366, 367, 367.5, 368, 369, 370, 371, 372, 372.5, 373, 374, 375, 376, 377, 377.5, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ -15748, -4727, -11395, -27399, -23789, -13383, -13385, -18574, -149890, -39382, -95546, -53225, -96137, -14063, -1446, -26656, -317, -467, -85800, -21583, -88090, -45538, -188945, -40800, -127494, -73795, -52, -48, -157863, -142, -148, -378, -311, -91768, -160, -92, -80, -224, -235393, -1953, -3497, -783, -466, -80030, -434, -496, -185, -510, -282812, -1106, -2318, -387, -337, -185392, -1196, -373, -3264, -983, -243952, -1154, -643, -1029, -776, -176646, -784, -1315, -696, -830, -231808, -1937, -748, -519, -1843, -343788, -7566, -9621, -10274, -6570, -217845, -20444, -37447, -9069, -8803, -113360, -10164, -32689, -18272, -7502, -372132, -11072, -11873, -110, -9516, -8613, -109301, -5761, -9372, -208, -20979, -9220, -253473, -9135, -88033, -124, -15136, -27899, -146644, -19347, -16726, -1329, -28586, -12010, -250907, -10442, -30797, -1243, -25589, -19107, -355138, -15732, -13883, -713, -27834, -19093, -291304, -13470, -121908, -2932, -20072, -64967, -162175, -30483, -19558, -1335, -35507, -16520, -282943, -14144, -38815, -1054, -29748, -21573, -143753, -13280, -57187, -960, -29568, -27906, -288335, -24055, -30980, -2774, -54312, -31997, -208975, -54666, -55464, -757, -34089, -33456, -234639, -26377, -46332, -1625, -65637, -27544, -127247, -27773, -28901, -33, -20121, -14272, -90586, -11689, -10084, 0, -25166, -6553, -22774, -3525, -2444, -4, -4411, -1640, -20499, -1108, -632, -1213, -399, -4677, -759, -448, -473, -93, -4842, -309, -41, -221, -175, -731, -147, -5, -7, -3, -3644, -1, 0, -1, 0, -3837, 0, 0, 0, -1, -340, 0, 0, 0, -1, -316, 0, 0, -1, -3, -166, -76, -144, -8, -1315, -3, -33, -14, -4, -2, -12, 0, 0, 0, -1, 0, -27, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, -2, 0, 0, -7, -3, -4, -3, 0, -2, 0, 0, -5 ] }, { "hovertemplate": "%{y}", "name": "Calls OI", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 196, 197, 198, 199, 200, 205, 210, 215, 220, 225, 230, 235, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 302.5, 303, 304, 305, 306, 307, 307.5, 308, 309, 310, 311, 312, 312.5, 313, 314, 315, 316, 317, 317.5, 318, 319, 320, 321, 322, 322.5, 323, 324, 325, 326, 327, 327.5, 328, 329, 330, 331, 332, 332.5, 333, 334, 335, 336, 337, 337.5, 338, 339, 340, 341, 342, 342.5, 343, 344, 345, 346, 347, 347.5, 348, 349, 350, 351, 352, 352.5, 353, 354, 355, 356, 357, 357.5, 358, 359, 360, 361, 362, 362.5, 363, 364, 365, 366, 367, 367.5, 368, 369, 370, 371, 372, 372.5, 373, 374, 375, 376, 377, 377.5, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ 1006, 160, 89, 70, 1051, 197, 336, 168, 427, 364, 589, 271, 833, 534, 0, 1, 0, 0, 1934, 719, 608, 401, 6628, 1227, 801, 715, 23, 3, 1804, 9, 2, 2, 31, 934, 18, 32, 3, 8, 4675, 17, 20, 11, 21, 1727, 15, 0, 10, 13, 10238, 72, 33, 76, 101, 16409, 208, 367, 575, 225, 30390, 253, 649, 41, 111, 18322, 197, 147, 573, 435, 52407, 371, 1733, 843, 154, 49540, 2337, 807, 2476, 200, 47399, 975, 1042, 1026, 798, 39854, 1329, 1069, 1471, 1921, 100595, 1159, 1264, 0, 1007, 1333, 53585, 1698, 1938, 0, 3572, 2246, 82908, 3213, 3668, 0, 5917, 2783, 61990, 3371, 4308, 3, 13673, 5108, 92687, 7880, 15356, 46, 9600, 12012, 60680, 8942, 9457, 4, 8702, 9300, 87888, 7162, 8693, 43, 9028, 9211, 66962, 10584, 8407, 117, 13070, 8357, 130874, 7696, 7084, 78, 5671, 5422, 39925, 5958, 10844, 27, 8366, 10382, 172908, 14525, 23228, 136, 37185, 18029, 119011, 16398, 24882, 504, 18910, 23563, 268564, 17881, 26309, 1619, 52659, 35748, 190309, 43941, 38493, 2, 37765, 27489, 231691, 28318, 50864, 40, 42681, 34360, 120593, 18785, 30470, 59, 23343, 8217, 158607, 7400, 17386, 5499, 19652, 144014, 6248, 4004, 9473, 2491, 51616, 1182, 6725, 2370, 4660, 64898, 3722, 750, 3425, 1231, 111397, 1962, 4125, 1084, 811, 28347, 607, 1975, 883, 224, 40328, 427, 507, 889, 518, 20623, 372, 1384, 129, 550, 41835, 26252, 22746, 7490, 11187, 12479, 23052, 6390, 21516, 2245, 15801, 3138, 7543, 14133, 7262, 3722, 18604, 4698, 1126, 815, 825, 6581, 6439, 388, 608, 624, 4842, 1349, 975, 1924, 1198, 974, 263, 1448, 1195, 865, 3528, 827, 5360 ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "openbb.forecast.plot(strike_oi, strike_oi.columns.to_list())" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Puts Volume", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 196, 197, 198, 199, 200, 205, 210, 215, 220, 225, 230, 235, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 302.5, 303, 304, 305, 306, 307, 307.5, 308, 309, 310, 311, 312, 312.5, 313, 314, 315, 316, 317, 317.5, 318, 319, 320, 321, 322, 322.5, 323, 324, 325, 326, 327, 327.5, 328, 329, 330, 331, 332, 332.5, 333, 334, 335, 336, 337, 337.5, 338, 339, 340, 341, 342, 342.5, 343, 344, 345, 346, 347, 347.5, 348, 349, 350, 351, 352, 352.5, 353, 354, 355, 356, 357, 357.5, 358, 359, 360, 361, 362, 362.5, 363, 364, 365, 366, 367, 367.5, 368, 369, 370, 371, 372, 372.5, 373, 374, 375, 376, 377, 377.5, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ -14, -60, 0, -8, 0, 0, 0, -2, -30, -4, -30, -84, -3, 0, 0, 0, 0, 0, -13, -25, -17, -282, -296, -93, -14, -21, 0, 0, -110, 0, 0, 0, 0, -132, 0, 0, 0, 0, -320, 0, 0, 0, 0, -20, 0, -5, 0, 0, -103, 0, 0, 0, 0, -267, 0, 0, 0, -1, -326, 0, 0, 0, 0, -415, -1, -4, 0, 0, -947, -5, 0, 0, 0, -870, -701, -164, -14, -170, -2322, -216, -492, -166, -139, -855, -4, -378, -204, -27, -5003, -37, -53, 0, -24, -64, -1240, -209, -82, 0, -23, -82, -1030, -98, -226, 0, -23, -186, -2407, -92, -153, 0, -63, -207, -12895, -189, -202, 0, -5389, -175, -3508, -154, -636, 0, -292, -75, -7030, -395, -946, -2, -2108, -367, -14498, -487, -143, -4, -933, -1192, -10780, -627, -2492, -61, -1872, -1324, -10142, -871, -2453, -85, -3098, -7296, -67541, -5608, -13408, -287, -11718, -7296, -35154, -16449, -28529, -478, -49333, -47505, -168211, -107267, -139633, -542, -76105, -25069, -44299, -11555, -3768, -5, -2294, -983, -2637, -487, -468, -5, -320, -325, -1098, -161, -43, -5, -161, -30, -501, 0, -4, 0, -1, -139, -5, -84, -3, -1, -159, -84, -1, -12, -2, -662, -1, -2, 0, 0, -212, -12, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, -163, 0, -2, 0, -4, 0, -51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, { "hovertemplate": "%{y}", "name": "Calls Volume", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 196, 197, 198, 199, 200, 205, 210, 215, 220, 225, 230, 235, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 302.5, 303, 304, 305, 306, 307, 307.5, 308, 309, 310, 311, 312, 312.5, 313, 314, 315, 316, 317, 317.5, 318, 319, 320, 321, 322, 322.5, 323, 324, 325, 326, 327, 327.5, 328, 329, 330, 331, 332, 332.5, 333, 334, 335, 336, 337, 337.5, 338, 339, 340, 341, 342, 342.5, 343, 344, 345, 346, 347, 347.5, 348, 349, 350, 351, 352, 352.5, 353, 354, 355, 356, 357, 357.5, 358, 359, 360, 361, 362, 362.5, 363, 364, 365, 366, 367, 367.5, 368, 369, 370, 371, 372, 372.5, 373, 374, 375, 376, 377, 377.5, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 16, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 30, 1, 0, 19, 0, 0, 1, 0, 80, 0, 0, 0, 0, 22, 0, 2, 0, 0, 7, 0, 0, 0, 1, 17, 7, 0, 3, 3, 0, 0, 5, 0, 0, 107, 5, 0, 0, 20, 0, 38, 1, 0, 0, 1, 39, 50, 0, 1, 0, 2, 0, 75, 1, 1, 0, 0, 12, 234, 36, 255, 0, 18, 5, 552, 9, 7, 0, 23, 25, 168, 4, 35, 0, 1, 7, 287, 38, 57, 0, 174, 41, 448, 12, 58, 1, 213, 69, 655, 112, 187, 2, 22, 172, 3620, 231, 344, 0, 946, 394, 3573, 856, 955, 25, 3145, 2439, 16178, 30235, 96101, 369, 135770, 93259, 92224, 41348, 24301, 10, 20676, 15903, 26576, 10099, 12916, 0, 7885, 9049, 15130, 3667, 2233, 2, 1915, 669, 4853, 542, 704, 2336, 1672, 3598, 807, 445, 1030, 1694, 1946, 603, 791, 201, 1610, 644, 586, 70, 325, 89, 3661, 88, 85, 2, 84, 509, 6, 50, 3, 56, 893, 10, 386, 13, 113, 1776, 33, 10, 0, 1, 795, 158, 1550, 189, 1126, 86, 136, 93, 26, 12, 3, 7, 0, 892, 16, 0, 372, 25, 3, 3, 0, 0, 481, 0, 2, 294, 1, 0, 1, 15, 0, 198, 0, 0, 1, 2, 0, 0, 2 ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "openbb.forecast.plot(strike_vol, strike_vol.columns.to_list())" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Delta exposure can easily be calculated by multiplying the delta value in the chains data by (OI * 100 * share price)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Call DEX", "type": "scatter", "x": [ "2023-06-23", "2023-06-26", "2023-06-27", "2023-06-28", "2023-06-29", "2023-06-30", "2023-07-03", "2023-07-05", "2023-07-06", "2023-07-07", "2023-07-14", "2023-07-21", "2023-07-28", "2023-08-04", "2023-08-18", "2023-09-15", "2023-09-29", "2023-10-20", "2023-11-17", "2023-12-15", "2023-12-29", "2024-01-19", "2024-03-15", "2024-03-28", "2024-06-21", "2024-09-20", "2024-12-20", "2025-01-17", "2025-06-20" ], "y": [ 2192511676.6158, 366902241.1962, 264048695.973, 208837997.3448, 181938601.1172, 9135425345.5896, 57969598.9278, 12113861.200199999, 10715587.5762, 1959414785.8379998, 457949263.66499996, 13542068596.5024, 790287834.9828, 15482942.7444, 5770994226.0534, 17470389611.0976, 1326150781.8641999, 1811519538.972, 886102995.2628, 11679972082.3284, 542120490.7236, 7378160279.3088, 1958264133.1787999, 173289005.41079998, 3839811076.8389997, 6938967.441, 1880329562.4947999, 1212958828.3878, 173368929.642 ] }, { "hovertemplate": "%{y}", "name": "Put DEX", "type": "scatter", "x": [ "2023-06-23", "2023-06-26", "2023-06-27", "2023-06-28", "2023-06-29", "2023-06-30", "2023-07-03", "2023-07-05", "2023-07-06", "2023-07-07", "2023-07-14", "2023-07-21", "2023-07-28", "2023-08-04", "2023-08-18", "2023-09-15", "2023-09-29", "2023-10-20", "2023-11-17", "2023-12-15", "2023-12-29", "2024-01-19", "2024-03-15", "2024-03-28", "2024-06-21", "2024-09-20", "2024-12-20", "2025-01-17", "2025-06-20" ], "y": [ -1893965937.3449998, -627862060.02, -274422425.0868, -401273016.87659997, -297826308.3438, -2561391496.5042, -65473055.823, -94032132.0768, -7077593.5374, -1133665771.4657998, -466864113.465, -6661804312.973399, -1207375667.9975998, -14489754.2166, -2973266217.2999997, -5337588581.3448, -605896219.572, -1062937169.6123999, -425949950.8776, -5849514865.297199, -187913902.0524, -1824929216.727, -953132189.2631999, -83286865.95, -1165621754.9526, -451086.3036, -1094572120.221, -612291883.5228, -88642415.55479999 ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df = ticker.chains[[\"expiration\", \"dte\", \"strike\", \"optionType\", \"openInterest\", \"delta\"]]\n", "df[\"Delta Exposure\"] = df[\"delta\"] * df[\"openInterest\"] * (100) * ticker.last_price\n", "dex = pd.DataFrame()\n", "dex[\"Call DEX\"] = df.query(\"`optionType` == 'call'\").set_index([\"expiration\",\"strike\"])[[\"Delta Exposure\"]]\n", "dex[\"Put DEX\"] = df.query(\"`optionType` == 'put'\").set_index([\"expiration\",\"strike\"])[[\"Delta Exposure\"]]\n", "\n", "# By expiration date\n", "\n", "dex_by_expiry = dex.reset_index().groupby(\"expiration\")[[\"Call DEX\", \"Put DEX\"]].sum()\n", "\n", "openbb.forecast.plot(dex_by_expiry, dex_by_expiry.columns.to_list())" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Call DEX", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 196, 197, 198, 199, 200, 205, 210, 215, 220, 225, 230, 235, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 302.5, 303, 304, 305, 306, 307, 307.5, 308, 309, 310, 311, 312, 312.5, 313, 314, 315, 316, 317, 317.5, 318, 319, 320, 321, 322, 322.5, 323, 324, 325, 326, 327, 327.5, 328, 329, 330, 331, 332, 332.5, 333, 334, 335, 336, 337, 337.5, 338, 339, 340, 341, 342, 342.5, 343, 344, 345, 346, 347, 347.5, 348, 349, 350, 351, 352, 352.5, 353, 354, 355, 356, 357, 357.5, 358, 359, 360, 361, 362, 362.5, 363, 364, 365, 366, 367, 367.5, 368, 369, 370, 371, 372, 372.5, 373, 374, 375, 376, 377, 377.5, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ 36468895.9554, 5805907.8684, 3215523.3474, 2532956.7257999997, 38022245.7396, 7112943.519599999, 12098430.3924, 6042648.2754, 15398016.8784, 13111225.0374, 21192356.1912, 9733720.0704, 29971324.6056, 19301880.2046, 0, 36260.0322, 0, 0, 68899423.1946, 25369030.666199997, 21762935.7, 14295356.616, 236587132.73879996, 43858629.362399995, 28247908.317599997, 25281927.9606, 812379.7938, 105886.13760000002, 63544758.1584, 317199.74759999994, 70430.5896, 70386.90719999999, 1111535.0699999998, 32753533.105799995, 644883.2712, 1144522.5624, 107382.2598, 285475.40459999995, 164738015.442, 616806.4086, 719212.5149999999, 391135.84979999997, 749458.9368, 60330450.6378, 535477.0602, 0, 353350.5738, 458515.95180000004, 353103032.91959995, 2619560.724, 1190370.8813999998, 2741234.409, 3658160.7467999994, 558615955.0979999, 7419586.6872, 13008007.1664, 20519894.764799997, 7955744.464799999, 1057695838.563, 8920710.521999998, 22916693.4498, 1455082.5851999999, 3937051.0296, 628645929.7674, 7143761.4528, 5288748.294600001, 20316786.1656, 15342347.299800001, 1780250490.3468, 13416346.601400001, 59475156.5262, 29855085.7392, 5584525.4651999995, 1668289142.8823998, 82444294.3374, 28678929.8388, 83715350.2518, 7170349.4736, 1607906724.7494, 34235127.2676, 37150891.0656, 36197704.6956, 28270954.4238, 1304545383.0995998, 46446873.4458, 37001264.2848, 51015364.488, 67222383.0546, 3324085374.1787996, 40548431.693399996, 44404131.5334, 0, 35160411.5046, 46670516.4132, 1756031355.1782, 58663941.5964, 67404706.1118, 0, 118755864.489, 77688540.4866, 2681277362.7978, 107335013.6442, 124999266.15419999, 0, 198614237.19059998, 94284172.2444, 2009560546.5881999, 113378320.7958, 144393545.55539998, 108514.362, 477391648.3091999, 169401901.5654, 2897641619.2506, 253570948.1442, 519407186.1684, 1653895.7484, 323180960.21999997, 402727564.3524, 1904720697.1133997, 293332430.481, 311349396.5298, 143103.5424, 284408796.87839997, 304318306.5474, 2656149819.3594, 231414852.64319995, 282899457.1122, 1528450.8161999998, 288825309.5706, 298214044.2468, 1980864591.534, 337752739.0632, 257722840.1376, 3871527.4295999995, 419230338.2484, 261251165.87099996, 3794253875.5536, 236953398.7422, 214986255.1026, 2589143.2128, 171132299.757, 163693048.7094, 1136830714.2342, 182701019.166, 310578464.0532, 804782.6963999999, 251087560.02179998, 306346800.71699995, 4708560375.9744, 423747353.2224, 672842275.0445999, 3837364.1525999997, 1102426674.4062, 525188111.3442, 3133190912.7684, 446934378.8448, 667654160.079, 12177462.774599997, 488104400.1696, 588359592.474, 6380908709.516999, 445088790.1644, 617965149.7836, 33927308.3154, 1115197995.7686, 703971663.7566, 3582750487.3668, 653602773.3072, 495827058.98819995, 35717.6424, 442483863.0444, 273241067.3406, 3705665618.8943996, 295289911.629, 504374849.2212, 585780.9839999999, 454638148.66559994, 274607678.505, 1405566983.112, 141094450.4964, 251052701.46659997, 679967.5188, 150826303.1442, 46031446.5414, 1866474739.2425997, 30133207.939799994, 110437010.0742, 17545571.069399998, 113855623.81979999, 1063549651.4634, 22423642.920599997, 16173991.031999998, 53608799.496599995, 8993350.713, 446187045.78479993, 7777301.8608, 20352350.9196, 14824434.204599999, 20452969.687799998, 340111057.194, 12754521.8394, 5505966.308999999, 15878366.749799998, 6069360.063, 907873236.8441999, 8142541.327799999, 27441050.7072, 5691485.4618, 4087962.801, 199887415.34159997, 2573555.8764, 6837587.870999999, 4289116.612799999, 845065.1496, 283952556.0516, 1989817.0446, 2258958.8718, 6481212.290999999, 2126928.8178, 110648312.76359999, 2202066.1859999998, 6063408.336, 576116.2529999999, 2983839.1782, 178868299.9086, 190090177.42139995, 133603494.048, 31621139.689799998, 61227279.4314, 69416488.1232, 96683038.563, 11070292.304399999, 86058790.8852, 8195560.840799999, 22106752.59, 7643007.6024, 12853076.6142, 38457355.2054, 9854287.134599999, 17826205.007999998, 27689534.3994, 4154673.1062000007, 1775278.2174, 425069.7942, 1259574.7236, 14937906.519, 2640804.9312, 158446.98539999998, 170805.4644, 120181.203, 3228573.4644, 183211.266, 140387.95319999996, 204069.61199999996, 116140.581, 104277.16919999999, 22918.699199999995, 128426.256, 89541.6396, 60645.731999999996, 198842.2848, 34101.393599999996, 250678.7328 ] }, { "hovertemplate": "%{y}", "name": "Put DEX", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 196, 197, 198, 199, 200, 205, 210, 215, 220, 225, 230, 235, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 302.5, 303, 304, 305, 306, 307, 307.5, 308, 309, 310, 311, 312, 312.5, 313, 314, 315, 316, 317, 317.5, 318, 319, 320, 321, 322, 322.5, 323, 324, 325, 326, 327, 327.5, 328, 329, 330, 331, 332, 332.5, 333, 334, 335, 336, 337, 337.5, 338, 339, 340, 341, 342, 342.5, 343, 344, 345, 346, 347, 347.5, 348, 349, 350, 351, 352, 352.5, 353, 354, 355, 356, 357, 357.5, 358, 359, 360, 361, 362, 362.5, 363, 364, 365, 366, 367, 367.5, 368, 369, 370, 371, 372, 372.5, 373, 374, 375, 376, 377, 377.5, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ -1915145.622, -541396.0253999999, -1661117.9052, -3432908.811, -4118678.8085999996, -3994657.1945999996, -4574708.5038, -6203468.671200001, -17989864.7598, -5837271.8316, -12282999.453, -6384939.9216, -26237666.110799998, -7336400.8368, -126984.73679999998, -3374727.4943999997, -40806.64199999999, -32368.6584, -49676189.511, -9252816.8886, -41891079.4212, -23486497.595999997, -117469767.26820001, -22644814.192199998, -89683927.7376, -55903202.9958, -57544.281599999995, -54340.9056, -147481476.25259998, -168512.1384, -179403.61680000002, -467838.504, -293884.2666, -65236420.9818, -98969.75759999998, -56015.397600000004, -88678.91219999999, -297564.5088, -208444790.2212, -346233.9828, -2179638.9138, -483003.5772, -190469.8248, -83711335.11119999, -143205.468, -136310.92919999998, -114484.29000000001, -130341.0012, -286899793.01879996, -246197.64659999998, -1504141.5605999997, -200509.4964, -195395.0154, -226616821.50959998, -792719.0735999999, -202904.748, -1076057.6808, -322394.31299999997, -437060187.0966, -326700.66959999996, -499832.2218, -476476.6986, -239350.4304, -222549513.2034, -527479.5408, -361464.57959999994, -721327.4712, -358530.5784, -422526277.254, -509089.25039999996, -701892.4434, -361650.2298, -629059.3217999999, -674219238.9377999, -7792707.187199999, -10812733.593600001, -7616725.3584, -7404956.7234000005, -522156738.4344, -12258246.093, -53766656.7696, -16326034.9056, -14324030.471399998, -266696814.06599998, -19784312.270400003, -62335982.425799996, -34787705.9874, -13436728.0812, -1156046332.6193998, -16920151.9476, -13864731.8766, -2002.11, -16094161.445999999, -15169827.3012, -250156305.8568, -9760235.287199998, -16397564.835599998, -4542.969599999999, -38859542.7024, -14902709.425199999, -701124390.3216, -17313249.865199998, -255999671.38319996, -3159.6935999999996, -57236728.3824, -73448384.56379999, -438582118.3146, -37458007.459199995, -42721398.1206, -61686.82920000001, -45281674.5474, -28815666.6714, -1010143028.6748, -32767606.119, -79814329.9218, -309740.97780000005, -59196521.057399996, -40347962.239199996, -2020065421.1873999, -49674638.785799995, -39501018.7464, -125838.0738, -59043042.945, -50660787.1668, -1064584334.6309999, -44499999.8406, -149476961.08859998, -2115407.5848000003, -68728479.40259999, -97092790.39559999, -665104094.4131999, -59686353.6498, -90416601.7122, -1274426.7396, -142380314.7444, -57742457.728199996, -1592783746.8221998, -62944936.923, -91814686.04579999, -3628107.2556, -150504411.1788, -96847240.70459999, -926116128.2658, -61536306.92999999, -157309404.699, -5916478.943399999, -148347421.5894, -151499569.0548, -2308620824.4888, -118124835.81899999, -151063738.8294, -24589285.265399996, -292021219.5204, -181758971.808, -1724635088.8434, -347018107.3614, -437928145.464, -8963006.0058, -251587286.67779997, -324351339.12299997, -2777967962.0562, -261934169.3166, -557660439, -25647207.4698, -960575371.7268, -479587857.41339993, -2405811303.2915998, -609840157.86, -657203138.5985999, -632346.4223999999, -476487488.15279996, -367065103.7442, -2042678427.3119998, -286221379.8654, -265567856.9988, 0, -600452791.8989999, -156285769.5384, -504973858.692, -81062241.4446, -56242003.6902, -104313.57119999999, -97043953.4724, -37766692.779, -433209816.50939995, -24484250.934599996, -15941910.080999998, -28108794.434399996, -9850745.219999999, -112867731.78299999, -18197978.634, -12407978.439599998, -15197197.964999998, -2658368.8962, -127286276.4072, -9911998.8654, -1139557.3295999998, -7394036.1234, -5884725.4788, -22094364.989400003, -5022449.4636, -157576.9776, -192417.33179999999, -82090.1502, -93712264.0626, -29441.937599999997, 0, -27061.246799999994, 0, -128785958.7228, 0, 0, 0, -34181.477999999996, -9065444.874, 0, 0, 0, -34731.148199999996, -9290627.646, 0, 0, -36249.1116, -109206, -5209206.2844, -2123157.5706, -4660599.022799999, -282221.0658, -47842919.2674, -106483.1304, -1130507.7924, -475169.86679999996, -145476.9528, -72804, -436824, 0, 0, 0, -36402, 0, -982854, 0, 0, 0, -36402, -36402, 0, 0, 0, 0, 0, -72804, 0, 0, -254814, -109206, -145608, -109206, 0, -72804, 0, 0, -182010 ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# By strike price\n", "\n", "dex_by_strike = dex.reset_index().groupby(\"strike\")[[\"Call DEX\", \"Put DEX\"]].sum()\n", "\n", "openbb.forecast.plot(dex_by_strike, dex_by_strike.columns.to_list())" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The Put/Call Ratios can be visualized using columns returned by, `get_stats()`" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "mode": "lines", "name": "ITM Percent", "type": "scatter", "x": [ "2023-06-23T00:00:00", "2023-06-26T00:00:00", "2023-06-27T00:00:00", "2023-06-28T00:00:00", "2023-06-29T00:00:00", "2023-06-30T00:00:00", "2023-07-03T00:00:00", "2023-07-05T00:00:00", "2023-07-06T00:00:00", "2023-07-07T00:00:00", "2023-07-14T00:00:00", "2023-07-21T00:00:00", "2023-07-28T00:00:00", "2023-08-04T00:00:00", "2023-08-18T00:00:00", "2023-09-15T00:00:00", "2023-09-29T00:00:00", "2023-10-20T00:00:00", "2023-11-17T00:00:00", "2023-12-15T00:00:00", "2023-12-29T00:00:00", "2024-01-19T00:00:00", "2024-03-15T00:00:00", "2024-03-28T00:00:00", "2024-06-21T00:00:00", "2024-09-20T00:00:00", "2024-12-20T00:00:00", "2025-01-17T00:00:00", "2025-06-20T00:00:00" ], "xaxis": "x", "y": [ 18.61, 21.35, 21.98, 21.67, 41.26, 21.12, 18.27, 9, 31.83, 12.24, 14.95, 22.42, 20.33, 19.21, 16, 21.85, 13.58, 19.08, 14.27, 19.76, 25.95, 24.86, 17.24, 15.01, 27.22, 1.72, 17.73, 29.57, 22.09 ], "yaxis": "y" }, { "hovertemplate": "%{y}", "mode": "lines", "name": "OI Ratio", "type": "scatter", "x": [ "2023-06-23T00:00:00", "2023-06-26T00:00:00", "2023-06-27T00:00:00", "2023-06-28T00:00:00", "2023-06-29T00:00:00", "2023-06-30T00:00:00", "2023-07-03T00:00:00", "2023-07-05T00:00:00", "2023-07-06T00:00:00", "2023-07-07T00:00:00", "2023-07-14T00:00:00", "2023-07-21T00:00:00", "2023-07-28T00:00:00", "2023-08-04T00:00:00", "2023-08-18T00:00:00", "2023-09-15T00:00:00", "2023-09-29T00:00:00", "2023-10-20T00:00:00", "2023-11-17T00:00:00", "2023-12-15T00:00:00", "2023-12-29T00:00:00", "2024-01-19T00:00:00", "2024-03-15T00:00:00", "2024-03-28T00:00:00", "2024-06-21T00:00:00", "2024-09-20T00:00:00", "2024-12-20T00:00:00", "2025-01-17T00:00:00", "2025-06-20T00:00:00" ], "xaxis": "x", "xhoverformat": "%Y-%m-%d", "y": [ 2.03, 1.39, 1.41, 1.54, 1.39, 1.95, 1.03, 14.72, 0.75, 2.55, 1.83, 2.05, 2.21, 0.97, 2.34, 2.64, 3.52, 1.78, 1.19, 2.48, 1.69, 1.23, 2.35, 4.61, 1.3, 0.08, 2.28, 2.03, 1.52 ], "yaxis": "y2" } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v", "x": 0.9, "xanchor": "right", "y": 1, "yanchor": "top" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "title": { "text": "QQQ - Put/Call Ratio vs % ITM", "x": 0.5, "y": 0.98 }, "xaxis": { "anchor": "y", "domain": [ 0, 0.94 ], "tick0": 0.5, "tickformatstops": [ { "dtickrange": [ null, 604800000 ], "value": "%Y-%m-%d" }, { "dtickrange": [ 604800000, "M1" ], "value": "%Y-%m-%d" }, { "dtickrange": [ "M1", null ], "value": "%Y-%m-%d" } ], "title": { "text": "Expiration Date" }, "type": "date" }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "side": "left", "title": { "text": "% of OI ITM" } }, "yaxis2": { "anchor": "x", "overlaying": "y", "side": "right", "title": { "text": "Put/Call Ratio" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "itm = ticker.get_stats()[[\"ITM Percent\"]]\n", "pcr = ticker.get_stats()[[\"OI Ratio\"]]\n", "pcr_fig = show_plot(itm, pcr, external_axes = True)\n", "pcr_fig.update_layout(\n", " xaxis = {'title': 'Expiration Date'},\n", " yaxis= {'title': '% of OI ITM'},\n", " yaxis2 = {'title': 'Put/Call Ratio'},\n", " title = f\"{ticker.symbol} - Put/Call Ratio vs % ITM\",\n", " title_y = 0.98,\n", " title_x = 0.5,\n", " legend=dict(\n", " yanchor=\"top\",\n", " y=1,\n", " xanchor=\"right\",\n", " x=0.9\n", " )\n", ")\n", "pcr_fig.show()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Make a chart of the term structure using the implied volatility skew, or the cost of an at-the-money straddle." ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "name": "Call Skew", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ 0.36029999999999995, 0.3498, 0.3386, 0.3247, 0.31689999999999996, 0.30269999999999997, 0.29200000000000004, 0.281, 0.27349999999999997, 0.26180000000000003, 0.252, 0.2428, 0.23479999999999998, 0.2246, 0.21630000000000002, 0.208, 0.19920000000000002, 0.19099999999999998, 0.1836, 0.1747, 0.167, 0.15940000000000001, 0.15280000000000002, 0.14509999999999998, 0.1338, 0.12760000000000002, 0.1212, 0.1142, 0.10800000000000001, 0.10200000000000001, 0.09569999999999998, 0.08930000000000002, 0.0829, 0.08199999999999999, 0.08059999999999998, 0.07949999999999999, 0.07830000000000001, 0.07680000000000001, 0.07570000000000002, 0.07449999999999998, 0.0733, 0.07210000000000003, 0.07099999999999998, 0.06970000000000001, 0.06839999999999999, 0.06720000000000001, 0.06610000000000002, 0.06460000000000002, 0.0638, 0.06260000000000002, 0.06139999999999998, 0.060100000000000015, 0.059000000000000025, 0.05789999999999998, 0.0567, 0.05539999999999998, 0.054399999999999976, 0.05310000000000001, 0.05210000000000001, 0.050799999999999984, 0.049699999999999994, 0.048400000000000026, 0.047400000000000025, 0.04619999999999999, 0.04500000000000001, 0.04400000000000001, 0.04300000000000001, 0.0416, 0.04050000000000001, 0.039599999999999996, 0.0383, 0.03720000000000001, 0.03609999999999999, 0.03509999999999999, 0.0338, 0.03270000000000001, 0.03159999999999999, 0.03059999999999999, 0.0295, 0.028099999999999986, 0.02729999999999999, 0.0262, 0.02529999999999999, 0.0242, 0.022999999999999993, 0.021999999999999992, 0.020900000000000002, 0.019800000000000012, 0.01880000000000001, 0.017699999999999994, 0.016600000000000004, 0.015399999999999997, 0.01419999999999999, 0.01319999999999999, 0.012500000000000011, 0.011399999999999993, 0.010399999999999993, 0.009000000000000008, 0.008300000000000002, 0.007099999999999995, 0.0058, 0.005099999999999993, 0.0040999999999999925, 0.002799999999999997, 0.0019000000000000128, 0.0009000000000000119, 0, -0.0010000000000000009, -0.0015999999999999903, -0.002700000000000008, -0.0033999999999999864, -0.004599999999999993, -0.005399999999999988, -0.006200000000000011, -0.00739999999999999, -0.008000000000000007, -0.008800000000000002, -0.009899999999999992, -0.010800000000000004, -0.01150000000000001, -0.012399999999999994, -0.01319999999999999, -0.014000000000000012, -0.014800000000000008, -0.015600000000000003, -0.016499999999999987, -0.017199999999999993, -0.017999999999999988, -0.01880000000000001, -0.019600000000000006, -0.020199999999999996, -0.02099999999999999, -0.021800000000000014, -0.022499999999999992, -0.0232, -0.0237, -0.024400000000000005, -0.02510000000000001, -0.0257, -0.02629999999999999, -0.026900000000000007, -0.027499999999999997, -0.028100000000000014, -0.028700000000000003, -0.029200000000000004, -0.029799999999999993, -0.030299999999999994, -0.030700000000000005, -0.031200000000000006, -0.031700000000000006, -0.03209999999999999, -0.03259999999999999, -0.033, -0.03340000000000001, -0.0338, -0.03420000000000001, -0.03459999999999999, -0.03489999999999999, -0.03520000000000001, -0.03559999999999999, -0.03589999999999999, -0.03609999999999999, -0.03639999999999999, -0.037599999999999995, -0.0383, -0.0388, -0.03900000000000001, -0.03870000000000001, -0.0383, -0.037500000000000006, -0.03639999999999999, -0.03539999999999999, -0.034, -0.03259999999999999, -0.031, -0.029599999999999987, -0.027700000000000002, -0.026400000000000007, -0.023799999999999988, -0.021900000000000003, -0.0199, -0.0184, -0.016699999999999993, -0.015199999999999991, -0.01319999999999999, -0.01150000000000001, -0.010300000000000004, -0.006099999999999994, -0.005899999999999989, -0.006399999999999989, -0.0024000000000000132, -0.004500000000000004, -0.0007000000000000062, 0.0030999999999999917, 0.007000000000000006, 0.001700000000000007, 0.005299999999999999, 0.008800000000000002, 0.012300000000000005, 0.015699999999999992, 0.012300000000000005 ] }, { "hovertemplate": "%{y}", "name": "Put Skew", "type": "scatter", "x": [ 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 590, 595, 600, 605, 610 ], "y": [ 0.3641, 0.35029999999999994, 0.3413999999999999, 0.32719999999999994, 0.31699999999999995, 0.3064, 0.2950999999999999, 0.28369999999999995, 0.2721, 0.26270000000000004, 0.25270000000000004, 0.24250000000000002, 0.2336, 0.22419999999999998, 0.21580000000000002, 0.2064, 0.19749999999999998, 0.18989999999999999, 0.1817, 0.1737, 0.16579999999999998, 0.1584, 0.15130000000000002, 0.1439, 0.13699999999999998, 0.1299, 0.12310000000000001, 0.11650000000000002, 0.10990000000000003, 0.10340000000000002, 0.097, 0.0905, 0.08420000000000002, 0.0829, 0.08159999999999998, 0.0804, 0.07909999999999998, 0.0779, 0.07659999999999997, 0.0754, 0.07420000000000002, 0.07299999999999998, 0.0718, 0.07049999999999998, 0.0693, 0.06810000000000002, 0.06689999999999999, 0.06570000000000001, 0.06449999999999997, 0.0633, 0.06200000000000003, 0.06079999999999999, 0.059600000000000014, 0.05839999999999998, 0.0572, 0.05600000000000002, 0.05479999999999999, 0.05360000000000001, 0.05250000000000002, 0.051199999999999996, 0.050100000000000006, 0.04890000000000003, 0.047500000000000014, 0.046500000000000014, 0.045400000000000024, 0.04419999999999999, 0.042800000000000005, 0.041800000000000004, 0.0406, 0.03939999999999999, 0.03820000000000001, 0.037099999999999994, 0.03609999999999999, 0.03489999999999999, 0.03359999999999999, 0.03240000000000001, 0.0315, 0.030299999999999994, 0.029200000000000004, 0.027999999999999997, 0.026900000000000007, 0.025900000000000006, 0.024900000000000005, 0.02360000000000001, 0.022699999999999998, 0.02149999999999999, 0.0204, 0.01930000000000001, 0.01830000000000001, 0.017199999999999993, 0.016199999999999992, 0.014899999999999997, 0.013899999999999996, 0.0131, 0.01200000000000001, 0.010899999999999993, 0.009899999999999992, 0.008700000000000013, 0.007700000000000012, 0.0068000000000000005, 0.0058, 0.004799999999999999, 0.003799999999999998, 0.0029000000000000137, 0.0019000000000000128, 0.0009000000000000119, 0, -0.0010000000000000009, -0.0020000000000000018, -0.0029000000000000137, -0.003799999999999998, -0.00470000000000001, -0.005700000000000011, -0.006599999999999995, -0.007500000000000007, -0.00839999999999999, -0.009399999999999992, -0.010300000000000004, -0.01100000000000001, -0.0121, -0.013000000000000012, -0.013899999999999996, -0.014600000000000002, -0.015500000000000014, -0.016199999999999992, -0.016999999999999987, -0.01780000000000001, -0.018600000000000005, -0.01949999999999999, -0.0204, -0.020600000000000007, -0.021400000000000002, -0.022299999999999986, -0.023299999999999987, -0.0237, -0.02479999999999999, -0.0252, -0.02579999999999999, -0.02629999999999999, -0.02679999999999999, -0.027600000000000013, -0.028299999999999992, -0.029299999999999993, -0.029700000000000004, -0.030099999999999988, -0.030799999999999994, -0.031200000000000006, -0.032, -0.032799999999999996, -0.03309999999999999, -0.03359999999999999, -0.034400000000000014, -0.03470000000000001, -0.0348, -0.03609999999999999, -0.03689999999999999, -0.03459999999999999, -0.0348, -0.0335, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ] } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "skew_df = pd.DataFrame()\n", "\n", "ticker = openbb.stocks.options.load_options_chains(\"QQQ\")\n", "skew = ticker.get_skew(\"2023-12-15\")\n", "call_skew = skew[skew[\"Option Type\"] == \"call\"].set_index(\"Strike\")[[\"Skew\"]]\n", "put_skew = skew[skew[\"Option Type\"] == \"put\"].set_index(\"Strike\")[[\"Skew\"]]\n", "skew_df[\"Call Skew\"] = call_skew[\"Skew\"]\n", "skew_df[\"Put Skew\"] = put_skew[\"Skew\"]\n", "\n", "openbb.forecast.plot(skew_df, columns = skew_df.columns.to_list())" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "mode": "lines", "name": "ATM Skew", "type": "scatter", "x": [ "2023-06-23T00:00:00", "2023-06-26T00:00:00", "2023-06-27T00:00:00", "2023-06-28T00:00:00", "2023-06-29T00:00:00", "2023-06-30T00:00:00", "2023-07-03T00:00:00", "2023-07-05T00:00:00", "2023-07-06T00:00:00", "2023-07-07T00:00:00", "2023-07-14T00:00:00", "2023-07-21T00:00:00", "2023-07-28T00:00:00", "2023-08-04T00:00:00", "2023-08-18T00:00:00", "2023-09-15T00:00:00", "2023-09-29T00:00:00", "2023-10-20T00:00:00", "2023-11-17T00:00:00", "2023-12-15T00:00:00", "2023-12-29T00:00:00", "2024-01-19T00:00:00", "2024-03-15T00:00:00", "2024-03-28T00:00:00", "2024-06-21T00:00:00", "2024-09-20T00:00:00", "2024-12-20T00:00:00", "2025-01-17T00:00:00", "2025-06-20T00:00:00" ], "xaxis": "x", "y": [ -0.003899999999999987, -0.0010999999999999899, 0.00009999999999998899, -0.0005000000000000004, -0.00020000000000000573, -0.0002999999999999947, -0.00040000000000001146, -0.00030000000000002247, -0.00040000000000001146, 0.00010000000000001674, 0.00020000000000000573, -0.00010000000000001674, -0.00009999999999998899, -0.00009999999999998899, 0.0002999999999999947, 0, -0.00010000000000001674, 0.0005999999999999894, -0.00009999999999998899, 0, 0.00020000000000000573, 0.0003999999999999837, 0.0002999999999999947, 0.0006000000000000172, 0.0008000000000000229, 0.00040000000000001146, 0.001899999999999985, 0.0007999999999999952, 0.0023999999999999855 ], "yaxis": "y" }, { "hovertemplate": "%{y}", "mode": "lines", "name": "10% OTM Skew", "type": "scatter", "x": [ "2023-06-23T00:00:00", "2023-06-26T00:00:00", "2023-06-27T00:00:00", "2023-06-28T00:00:00", "2023-06-29T00:00:00", "2023-06-30T00:00:00", "2023-07-03T00:00:00", "2023-07-05T00:00:00", "2023-07-06T00:00:00", "2023-07-07T00:00:00", "2023-07-14T00:00:00", "2023-07-21T00:00:00", "2023-07-28T00:00:00", "2023-08-04T00:00:00", "2023-08-18T00:00:00", "2023-09-15T00:00:00", "2023-09-29T00:00:00", "2023-10-20T00:00:00", "2023-11-17T00:00:00", "2023-12-15T00:00:00", "2023-12-29T00:00:00", "2024-01-19T00:00:00", "2024-03-15T00:00:00", "2024-03-28T00:00:00", "2024-06-21T00:00:00", "2024-09-20T00:00:00", "2024-12-20T00:00:00", "2025-01-17T00:00:00", "2025-06-20T00:00:00" ], "xaxis": "x", "xhoverformat": "%Y-%m-%d", "y": [ -0.18009999999999993, -0.04580000000000001, -0.04930000000000001, -0.032999999999999974, -0.04400000000000001, -0.06620000000000001, -0.031899999999999956, -0.04599999999999996, -0.045999999999999985, -0.05880000000000002, -0.07100000000000001, -0.0759, -0.07830000000000001, -0.08330000000000001, -0.0797, -0.07800000000000001, -0.0771, -0.07499999999999998, -0.07080000000000003, -0.0675, -0.06589999999999999, -0.06539999999999999, -0.05829999999999999, -0.05770000000000003, -0.053200000000000025, -0.0471, -0.04429999999999998, -0.04219999999999999, -0.04440000000000002 ], "yaxis": "y2" } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v", "x": 0.9, "xanchor": "right", "y": 0.1, "yanchor": "bottom" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "title": { "text": "QQQ - ATM Skew vs 10% OTM Skew", "x": 0.5, "y": 0.98 }, "xaxis": { "anchor": "y", "domain": [ 0, 0.94 ], "tick0": 0.5, "tickformatstops": [ { "dtickrange": [ null, 604800000 ], "value": "%Y-%m-%d" }, { "dtickrange": [ 604800000, "M1" ], "value": "%Y-%m-%d" }, { "dtickrange": [ "M1", null ], "value": "%Y-%m-%d" } ], "title": { "text": "Expiration Date" }, "type": "date" }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "side": "left", "tickfont": { "size": 12 }, "title": { "font": { "size": 20 }, "text": "ATM IV Skew" } }, "yaxis2": { "anchor": "x", "overlaying": "y", "side": "right", "tickfont": { "size": 12 }, "title": { "font": { "size": 20 }, "text": "10% OTM IV Skew" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "skew = ticker.get_skew(moneyness=10)[[\"ATM Skew\", \"IV Skew\"]].rename(columns = {\"IV Skew\": \"10% OTM Skew\"})\n", "y1 = pd.DataFrame(skew[\"ATM Skew\"])\n", "y2 = pd.DataFrame(skew[\"10% OTM Skew\"])\n", "skew_fig = show_plot(y1,y2, external_axes = True)\n", "skew_fig.update_layout(\n", " xaxis = {'title': 'Expiration Date'},\n", " yaxis= {'title': 'ATM IV Skew'},\n", " yaxis2 = {'title': '10% OTM IV Skew'},\n", " title = f\"{ticker.symbol} - ATM Skew vs 10% OTM Skew\",\n", " title_y = 0.98,\n", " title_x = 0.5,\n", " legend=dict(\n", " yanchor=\"bottom\",\n", " y=0.1,\n", " xanchor=\"right\",\n", " x=0.9\n", " )\n", ")\n", "skew_fig.update_yaxes(title_font=dict(size=20), tickfont=dict(size=12))\n", "skew_fig.show()" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "No strategy was selected, returning all ATM straddles.\n" ] }, { "data": { "application/vnd.plotly.v1+json": { "config": { "displaylogo": false, "plotlyServerURL": "https://plot.ly", "scrollZoom": true }, "data": [ { "hovertemplate": "%{y}", "mode": "lines", "name": "Cost Percent", "type": "scatter", "x": [ "2023-06-26T00:00:00", "2023-06-27T00:00:00", "2023-06-28T00:00:00", "2023-06-29T00:00:00", "2023-06-30T00:00:00", "2023-07-03T00:00:00", "2023-07-05T00:00:00", "2023-07-06T00:00:00", "2023-07-07T00:00:00", "2023-07-14T00:00:00", "2023-07-21T00:00:00", "2023-07-21T00:00:00", "2023-07-28T00:00:00", "2023-08-04T00:00:00", "2023-08-18T00:00:00", "2023-09-15T00:00:00", "2023-09-29T00:00:00", "2023-10-20T00:00:00", "2023-11-17T00:00:00", "2023-12-15T00:00:00", "2023-12-29T00:00:00", "2024-01-19T00:00:00", "2024-03-15T00:00:00", "2024-03-28T00:00:00", "2024-06-21T00:00:00", "2024-09-20T00:00:00", "2024-12-20T00:00:00", "2025-01-17T00:00:00", "2025-06-20T00:00:00" ], "xaxis": "x", "y": [ 0.9532, 1.2416, 1.4943, 1.6976, 1.9063, 2.0794, 2.2881, 2.4502, 2.6397, 3.3127, 3.8703, 3.8703, 4.6614, 5.1531, 5.9992, 7.5237, 8.2351, 9.2515, 10.559, 11.677, 12.1604, 12.8719, 14.9567, 15.3001, 17.9838, 20.4038, 22.5436, 23.049, 27.2792 ], "yaxis": "y" }, { "hovertemplate": "%{y}", "mode": "lines", "name": "10% OTM Skew", "type": "scatter", "x": [ "2023-06-23T00:00:00", "2023-06-26T00:00:00", "2023-06-27T00:00:00", "2023-06-28T00:00:00", "2023-06-29T00:00:00", "2023-06-30T00:00:00", "2023-07-03T00:00:00", "2023-07-05T00:00:00", "2023-07-06T00:00:00", "2023-07-07T00:00:00", "2023-07-14T00:00:00", "2023-07-21T00:00:00", "2023-07-28T00:00:00", "2023-08-04T00:00:00", "2023-08-18T00:00:00", "2023-09-15T00:00:00", "2023-09-29T00:00:00", "2023-10-20T00:00:00", "2023-11-17T00:00:00", "2023-12-15T00:00:00", "2023-12-29T00:00:00", "2024-01-19T00:00:00", "2024-03-15T00:00:00", "2024-03-28T00:00:00", "2024-06-21T00:00:00", "2024-09-20T00:00:00", "2024-12-20T00:00:00", "2025-01-17T00:00:00", "2025-06-20T00:00:00" ], "xaxis": "x", "xhoverformat": "%Y-%m-%d", "y": [ -0.18009999999999993, -0.04580000000000001, -0.04930000000000001, -0.032999999999999974, -0.04400000000000001, -0.06620000000000001, -0.031899999999999956, -0.04599999999999996, -0.045999999999999985, -0.05880000000000002, -0.07100000000000001, -0.0759, -0.07830000000000001, -0.08330000000000001, -0.0797, -0.07800000000000001, -0.0771, -0.07499999999999998, -0.07080000000000003, -0.0675, -0.06589999999999999, -0.06539999999999999, -0.05829999999999999, -0.05770000000000003, -0.053200000000000025, -0.0471, -0.04429999999999998, -0.04219999999999999, -0.04440000000000002 ], "yaxis": "y2" } ], "layout": { "annotations": [ { "font": { "color": "gray", "size": 17 }, "opacity": 0.5, "showarrow": false, "text": "OpenBB Terminal", "x": 1, "xanchor": "right", "xref": "paper", "xshift": 40, "y": 0, "yanchor": "bottom", "yref": "paper", "yshift": -80 } ], "bargap": 0, "bargroupgap": 0, "barmode": "overlay", "legend": { "orientation": "v", "x": 0.9, "xanchor": "right", "y": 0.1, "yanchor": "bottom" }, "margin": { "b": 80, "l": 40, "r": 50, "t": 50 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "candlestick": [ { "decreasing": { "fillcolor": "#e4003a", "line": { "color": "#e4003a" } }, "increasing": { "fillcolor": "#00ACFF", "line": { "color": "#00ACFF" } }, "type": "candlestick" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1, "showarrow": false }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#ffed00", "#ef7d00", "#e4003a", "#c13246", "#822661", "#48277c", "#005ca9", "#00aaff", "#9b30d9", "#af005f", "#5f00af", "#af87ff" ], "dragmode": "pan", "font": { "color": "#f2f5fa", "family": "Fira Code", "size": 18 }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "x", "legend": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 }, "x": 0.01, "xanchor": "left", "y": 0.99, "yanchor": "top" }, "legend2": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend3": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend4": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "legend5": { "bgcolor": "rgba(0, 0, 0, 0.5)", "font": { "size": 15 } }, "mapbox": { "style": "dark" }, "paper_bgcolor": "#000000", "plot_bgcolor": "#000000", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "autorange": true, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "rangeslider": { "visible": false }, "showgrid": true, "showline": true, "tick0": 1, "tickfont": { "size": 14 }, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "anchor": "x", "automargin": true, "fixedrange": false, "gridcolor": "#283442", "linecolor": "#F5EFF3", "mirror": true, "showgrid": true, "showline": true, "side": "right", "tick0": 0.5, "ticks": "outside", "title": { "standoff": 20 }, "zeroline": false, "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "title": { "text": "QQQ - Cost of ATM Straddle vs 10% OTM Skew", "x": 0.5, "y": 0.98 }, "xaxis": { "anchor": "y", "domain": [ 0, 0.94 ], "tick0": 0.5, "tickformatstops": [ { "dtickrange": [ null, 604800000 ], "value": "%Y-%m-%d" }, { "dtickrange": [ 604800000, "M1" ], "value": "%Y-%m-%d" }, { "dtickrange": [ "M1", null ], "value": "%Y-%m-%d" } ], "title": { "text": "Expiration Date" }, "type": "date" }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "side": "left", "title": { "font": { "size": 16 }, "text": "Cost as % of Stock Price" } }, "yaxis2": { "anchor": "x", "overlaying": "y", "side": "right", "title": { "font": { "size": 16 }, "text": "10% OTM IV Skew" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "y1 = pd.DataFrame(ticker.get_strategies().set_index(\"Expiration\")[\"Cost Percent\"])\n", "y2 = pd.DataFrame(skew[[\"10% OTM Skew\"]])\n", "skew_fig2 = show_plot(y1,y2, external_axes = True)\n", "skew_fig2.update_layout(\n", " xaxis = {'title': 'Expiration Date'},\n", " yaxis= {'title': 'Cost as % of Stock Price'},\n", " yaxis2 = {'title': '10% OTM IV Skew'},\n", " title = f\"{ticker.symbol} - Cost of ATM Straddle vs 10% OTM Skew\",\n", " title_y = 0.98,\n", " title_x = 0.5,\n", " legend=dict(\n", " yanchor=\"bottom\",\n", " y=0.1,\n", " xanchor=\"right\",\n", " x=0.9\n", " )\n", ")\n", "skew_fig2.update_yaxes(title_font=dict(size=16))\n", "skew_fig2.show()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Basic single-leg strategies can be screened via `get_strategies()`. Values entered for each argument return the closest match. With no parameters specified, all ATM straddles are returned." ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ExpirationDTEStrategyUnderlying PriceStrike 1Strike 2Strike 1 PremiumStrike 2 PremiumCostCost PercentBreakeven UpperBreakeven Upper PercentBreakeven LowerBreakeven Lower PercentMax ProfitMax LossPayoff Ratio
02023-06-285Long Straddle364.05364.0364.02.792.655.441.4943369.441.4806358.56-1.508inf-5.44inf
12023-06-285Long Strangle364.05400.0330.00.020.030.050.0137400.059.8888329.95-9.3668inf-0.05inf
22023-06-285Bear Call Spread364.05365.0367.02.281.51-0.77-0.2115365.770.5988NaNNaN0.77-1.230.626
32023-06-285Bull Put Spread364.05360.0358.01.20.8-0.40.1099359.61.2224NaNNaN0.4-1.60.25
42023-07-2128Long Straddle364.05364.0364.07.726.3714.093.8703378.093.8566349.91-3.8841inf-14.09inf
52023-07-2128Long Strangle364.05400.0327.00.190.510.70.1923400.710.0673326.3-10.3695inf-0.7inf
62023-07-2128Short Strangle364.05435.0291.00.010.07-0.080.022435.0819.5111290.92-20.08790.08inf0.0
72023-07-2128Bear Call Spread364.05365.0367.07.146.12-1.02-0.2802366.020.5301NaNNaN1.02-0.981.0408
82023-07-2128Bull Put Spread364.05360.0358.04.84.18-0.620.1703359.381.2828NaNNaN0.62-1.380.4493
\n", "
" ], "text/plain": [ " Expiration DTE Strategy Underlying Price Strike 1 Strike 2 \\\n", "0 2023-06-28 5 Long Straddle 364.05 364.0 364.0 \n", "1 2023-06-28 5 Long Strangle 364.05 400.0 330.0 \n", "2 2023-06-28 5 Bear Call Spread 364.05 365.0 367.0 \n", "3 2023-06-28 5 Bull Put Spread 364.05 360.0 358.0 \n", "4 2023-07-21 28 Long Straddle 364.05 364.0 364.0 \n", "5 2023-07-21 28 Long Strangle 364.05 400.0 327.0 \n", "6 2023-07-21 28 Short Strangle 364.05 435.0 291.0 \n", "7 2023-07-21 28 Bear Call Spread 364.05 365.0 367.0 \n", "8 2023-07-21 28 Bull Put Spread 364.05 360.0 358.0 \n", "\n", " Strike 1 Premium Strike 2 Premium Cost Cost Percent Breakeven Upper \\\n", "0 2.79 2.65 5.44 1.4943 369.44 \n", "1 0.02 0.03 0.05 0.0137 400.05 \n", "2 2.28 1.51 -0.77 -0.2115 365.77 \n", "3 1.2 0.8 -0.4 0.1099 359.6 \n", "4 7.72 6.37 14.09 3.8703 378.09 \n", "5 0.19 0.51 0.7 0.1923 400.7 \n", "6 0.01 0.07 -0.08 0.022 435.08 \n", "7 7.14 6.12 -1.02 -0.2802 366.02 \n", "8 4.8 4.18 -0.62 0.1703 359.38 \n", "\n", " Breakeven Upper Percent Breakeven Lower Breakeven Lower Percent Max Profit \\\n", "0 1.4806 358.56 -1.508 inf \n", "1 9.8888 329.95 -9.3668 inf \n", "2 0.5988 NaN NaN 0.77 \n", "3 1.2224 NaN NaN 0.4 \n", "4 3.8566 349.91 -3.8841 inf \n", "5 10.0673 326.3 -10.3695 inf \n", "6 19.5111 290.92 -20.0879 0.08 \n", "7 0.5301 NaN NaN 1.02 \n", "8 1.2828 NaN NaN 0.62 \n", "\n", " Max Loss Payoff Ratio \n", "0 -5.44 inf \n", "1 -0.05 inf \n", "2 -1.23 0.626 \n", "3 -1.6 0.25 \n", "4 -14.09 inf \n", "5 -0.7 inf \n", "6 inf 0.0 \n", "7 -0.98 1.0408 \n", "8 -1.38 0.4493 " ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ticker.get_strategies(days = [5,30], straddle_strike = ticker.last_price, strangle_moneyness = [10,-20] , vertical_calls = [365,367], vertical_puts = [360,358])" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "No strategy was selected, returning all ATM straddles.\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ExpirationDTEStrategyUnderlying PriceStrike 1Strike 2Strike 1 PremiumStrike 2 PremiumCostCost PercentBreakeven UpperBreakeven Upper PercentBreakeven LowerBreakeven Lower PercentMax ProfitMax LossPayoff Ratio
02023-06-263Long Straddle364.05364.0364.01.761.713.470.9532367.470.9394360.53-0.9669inf-3.47inf
12023-06-274Long Straddle364.05364.0364.02.312.214.521.2416368.521.2279359.48-1.2553inf-4.52inf
22023-06-285Long Straddle364.05364.0364.02.792.655.441.4943369.441.4806358.56-1.508inf-5.44inf
32023-06-296Long Straddle364.05364.0364.03.232.956.181.6976370.181.6838357.82-1.7113inf-6.18inf
42023-06-307Long Straddle364.05364.0364.03.663.286.941.9063370.941.8926357.06-1.9201inf-6.94inf
52023-07-0310Long Straddle364.05364.0364.04.03.577.572.0794371.572.0657356.43-2.0931inf-7.57inf
62023-07-0512Long Straddle364.05364.0364.04.413.928.332.2881372.332.2744355.67-2.3019inf-8.33inf
72023-07-0613Long Straddle364.05364.0364.04.774.158.922.4502372.922.4365355.08-2.4639inf-8.92inf
82023-07-0714Long Straddle364.05364.0364.05.154.469.612.6397373.612.626354.39-2.6535inf-9.61inf
92023-07-1421Long Straddle364.05364.0364.06.545.5212.063.3127376.063.299351.94-3.3265inf-12.06inf
102023-07-2128Long Straddle364.05364.0364.07.726.3714.093.8703378.093.8566349.91-3.8841inf-14.09inf
112023-07-2128Long Straddle364.05364.0364.07.726.3714.093.8703378.093.8566349.91-3.8841inf-14.09inf
122023-07-2835Long Straddle364.05364.0364.09.357.6216.974.6614380.974.6477347.03-4.6752inf-16.97inf
132023-08-0442Long Straddle364.05364.0364.010.418.3518.765.1531382.765.1394345.24-5.1669inf-18.76inf
142023-08-1856Long Straddle364.05364.0364.012.289.5621.845.9992385.845.9854342.16-6.0129inf-21.84inf
152023-09-1584Long Straddle364.05364.0364.015.7311.6627.397.5237391.397.51336.61-7.5374inf-27.39inf
162023-09-2998Long Straddle364.05364.0364.017.1712.8129.988.2351393.988.2214334.02-8.2489inf-29.98inf
172023-10-20119Long Straddle364.05364.0364.019.5314.1533.689.2515397.689.2377330.32-9.2652inf-33.68inf
182023-11-17147Long Straddle364.05364.0364.022.5815.8638.4410.559402.4410.5453325.56-10.5727inf-38.44inf
192023-12-15175Long Straddle364.05364.0364.025.2517.2642.5111.677406.5111.6632321.49-11.6907inf-42.51inf
202023-12-29189Long Straddle364.05364.0364.026.2917.9844.2712.1604408.2712.1467319.73-12.1742inf-44.27inf
212024-01-19210Long Straddle364.05364.0364.028.0718.7946.8612.8719410.8612.8581317.14-12.8856inf-46.86inf
222024-03-15266Long Straddle364.05364.0364.033.1921.2654.4514.9567418.4514.943309.55-14.9705inf-54.45inf
232024-03-28279Long Straddle364.05365.0365.033.4322.2755.715.3001420.715.561309.3-15.0391inf-55.7inf
242024-06-21364Long Straddle364.05364.0364.040.7324.7465.4717.9838429.4717.9701298.53-17.9975inf-65.47inf
252024-09-20455Long Straddle364.05365.0365.046.3927.8974.2820.4038439.2820.6647290.72-20.1428inf-74.28inf
262024-12-20546Long Straddle364.05365.0365.051.7330.3482.0722.5436447.0722.8046282.93-22.2827inf-82.07inf
272025-01-17574Long Straddle364.05365.0365.052.9530.9683.9123.049448.9123.31281.09-22.7881inf-83.91inf
282025-06-20728Long Straddle364.05365.0365.062.8136.599.3127.2792464.3127.5402265.69-27.0183inf-99.31inf
\n", "
" ], "text/plain": [ " Expiration DTE Strategy Underlying Price Strike 1 Strike 2 \\\n", "0 2023-06-26 3 Long Straddle 364.05 364.0 364.0 \n", "1 2023-06-27 4 Long Straddle 364.05 364.0 364.0 \n", "2 2023-06-28 5 Long Straddle 364.05 364.0 364.0 \n", "3 2023-06-29 6 Long Straddle 364.05 364.0 364.0 \n", "4 2023-06-30 7 Long Straddle 364.05 364.0 364.0 \n", "5 2023-07-03 10 Long Straddle 364.05 364.0 364.0 \n", "6 2023-07-05 12 Long Straddle 364.05 364.0 364.0 \n", "7 2023-07-06 13 Long Straddle 364.05 364.0 364.0 \n", "8 2023-07-07 14 Long Straddle 364.05 364.0 364.0 \n", "9 2023-07-14 21 Long Straddle 364.05 364.0 364.0 \n", "10 2023-07-21 28 Long Straddle 364.05 364.0 364.0 \n", "11 2023-07-21 28 Long Straddle 364.05 364.0 364.0 \n", "12 2023-07-28 35 Long Straddle 364.05 364.0 364.0 \n", "13 2023-08-04 42 Long Straddle 364.05 364.0 364.0 \n", "14 2023-08-18 56 Long Straddle 364.05 364.0 364.0 \n", "15 2023-09-15 84 Long Straddle 364.05 364.0 364.0 \n", "16 2023-09-29 98 Long Straddle 364.05 364.0 364.0 \n", "17 2023-10-20 119 Long Straddle 364.05 364.0 364.0 \n", "18 2023-11-17 147 Long Straddle 364.05 364.0 364.0 \n", "19 2023-12-15 175 Long Straddle 364.05 364.0 364.0 \n", "20 2023-12-29 189 Long Straddle 364.05 364.0 364.0 \n", "21 2024-01-19 210 Long Straddle 364.05 364.0 364.0 \n", "22 2024-03-15 266 Long Straddle 364.05 364.0 364.0 \n", "23 2024-03-28 279 Long Straddle 364.05 365.0 365.0 \n", "24 2024-06-21 364 Long Straddle 364.05 364.0 364.0 \n", "25 2024-09-20 455 Long Straddle 364.05 365.0 365.0 \n", "26 2024-12-20 546 Long Straddle 364.05 365.0 365.0 \n", "27 2025-01-17 574 Long Straddle 364.05 365.0 365.0 \n", "28 2025-06-20 728 Long Straddle 364.05 365.0 365.0 \n", "\n", " Strike 1 Premium Strike 2 Premium Cost Cost Percent Breakeven Upper \\\n", "0 1.76 1.71 3.47 0.9532 367.47 \n", "1 2.31 2.21 4.52 1.2416 368.52 \n", "2 2.79 2.65 5.44 1.4943 369.44 \n", "3 3.23 2.95 6.18 1.6976 370.18 \n", "4 3.66 3.28 6.94 1.9063 370.94 \n", "5 4.0 3.57 7.57 2.0794 371.57 \n", "6 4.41 3.92 8.33 2.2881 372.33 \n", "7 4.77 4.15 8.92 2.4502 372.92 \n", "8 5.15 4.46 9.61 2.6397 373.61 \n", "9 6.54 5.52 12.06 3.3127 376.06 \n", "10 7.72 6.37 14.09 3.8703 378.09 \n", "11 7.72 6.37 14.09 3.8703 378.09 \n", "12 9.35 7.62 16.97 4.6614 380.97 \n", "13 10.41 8.35 18.76 5.1531 382.76 \n", "14 12.28 9.56 21.84 5.9992 385.84 \n", "15 15.73 11.66 27.39 7.5237 391.39 \n", "16 17.17 12.81 29.98 8.2351 393.98 \n", "17 19.53 14.15 33.68 9.2515 397.68 \n", "18 22.58 15.86 38.44 10.559 402.44 \n", "19 25.25 17.26 42.51 11.677 406.51 \n", "20 26.29 17.98 44.27 12.1604 408.27 \n", "21 28.07 18.79 46.86 12.8719 410.86 \n", "22 33.19 21.26 54.45 14.9567 418.45 \n", "23 33.43 22.27 55.7 15.3001 420.7 \n", "24 40.73 24.74 65.47 17.9838 429.47 \n", "25 46.39 27.89 74.28 20.4038 439.28 \n", "26 51.73 30.34 82.07 22.5436 447.07 \n", "27 52.95 30.96 83.91 23.049 448.91 \n", "28 62.81 36.5 99.31 27.2792 464.31 \n", "\n", " Breakeven Upper Percent Breakeven Lower Breakeven Lower Percent Max Profit \\\n", "0 0.9394 360.53 -0.9669 inf \n", "1 1.2279 359.48 -1.2553 inf \n", "2 1.4806 358.56 -1.508 inf \n", "3 1.6838 357.82 -1.7113 inf \n", "4 1.8926 357.06 -1.9201 inf \n", "5 2.0657 356.43 -2.0931 inf \n", "6 2.2744 355.67 -2.3019 inf \n", "7 2.4365 355.08 -2.4639 inf \n", "8 2.626 354.39 -2.6535 inf \n", "9 3.299 351.94 -3.3265 inf \n", "10 3.8566 349.91 -3.8841 inf \n", "11 3.8566 349.91 -3.8841 inf \n", "12 4.6477 347.03 -4.6752 inf \n", "13 5.1394 345.24 -5.1669 inf \n", "14 5.9854 342.16 -6.0129 inf \n", "15 7.51 336.61 -7.5374 inf \n", "16 8.2214 334.02 -8.2489 inf \n", "17 9.2377 330.32 -9.2652 inf \n", "18 10.5453 325.56 -10.5727 inf \n", "19 11.6632 321.49 -11.6907 inf \n", "20 12.1467 319.73 -12.1742 inf \n", "21 12.8581 317.14 -12.8856 inf \n", "22 14.943 309.55 -14.9705 inf \n", "23 15.561 309.3 -15.0391 inf \n", "24 17.9701 298.53 -17.9975 inf \n", "25 20.6647 290.72 -20.1428 inf \n", "26 22.8046 282.93 -22.2827 inf \n", "27 23.31 281.09 -22.7881 inf \n", "28 27.5402 265.69 -27.0183 inf \n", "\n", " Max Loss Payoff Ratio \n", "0 -3.47 inf \n", "1 -4.52 inf \n", "2 -5.44 inf \n", "3 -6.18 inf \n", "4 -6.94 inf \n", "5 -7.57 inf \n", "6 -8.33 inf \n", "7 -8.92 inf \n", "8 -9.61 inf \n", "9 -12.06 inf \n", "10 -14.09 inf \n", "11 -14.09 inf \n", "12 -16.97 inf \n", "13 -18.76 inf \n", "14 -21.84 inf \n", "15 -27.39 inf \n", "16 -29.98 inf \n", "17 -33.68 inf \n", "18 -38.44 inf \n", "19 -42.51 inf \n", "20 -44.27 inf \n", "21 -46.86 inf \n", "22 -54.45 inf \n", "23 -55.7 inf \n", "24 -65.47 inf \n", "25 -74.28 inf \n", "26 -82.07 inf \n", "27 -83.91 inf \n", "28 -99.31 inf " ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ticker.get_strategies()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "It's now easier than ever to analyze equity options. See the introduction guide [here](https://docs.openbb.co/sdk/usage/intros/stocks/options-chains) for more information on using these functions." ] } ], "metadata": { "kernelspec": { "display_name": "obb", "language": "python", "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.10.8" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }