{"id":69894,"date":"2020-12-18T09:45:29","date_gmt":"2020-12-18T14:45:29","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=69894"},"modified":"2022-11-21T09:46:47","modified_gmt":"2022-11-21T14:46:47","slug":"working-with-tidy-financial-data-in-tidyr-part-iii","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/","title":{"rendered":"Working with Tidy Financial Data in tidyr \u2013 Part III"},"content":{"rendered":"\n<p><em>See&nbsp;<a href=\"\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr\/\">Part I<\/a>&nbsp;and <a href=\"\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-ii\/\">Part II<\/a> to get started with the necessary data and R packages.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-pivoting-from-wide-to-long\">Pivoting from wide to long<\/h3>\n\n\n\n<p>For pivoting from wide to long, we use&nbsp;<code>tidry::pivot_longer<\/code>.<\/p>\n\n\n\n<p>The most important arguments to the function are&nbsp;<code>cols<\/code>,&nbsp;<code>names_to<\/code>&nbsp;and&nbsp;<code>values_to<\/code>. You can probably guess at their relationship to the arguments to&nbsp;<code>pivot_wider<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>cols<\/code>&nbsp;specifies the columns that we want to take from wide to long.<\/li><li><code>names_to<\/code>&nbsp;specifies a name for the column in our long data frame that will hold the column names from the wide data frame.<\/li><li><code>values_to<\/code>&nbsp;specifies a name for the column in our long data frame that will hold the values in the cells of the wide data frame.<\/li><\/ul>\n\n\n\n<p>In our example:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>We want to take the columns holding the returns for each ticker from wide to long, so we want&nbsp;<code>cols<\/code>&nbsp;to take all the columns except date. We can do that by specifying&nbsp;<code>cols = -date<\/code><\/li><li>We want the names of the&nbsp;<code>cols<\/code>&nbsp;to be held in a long variable called&nbsp;<code>tickers<\/code>, so we specify&nbsp;<code>names_to = \"ticker\"<\/code>. Note that&nbsp;<code>\"ticker\"<\/code>&nbsp;here is a string variable.<\/li><li>We want to hold the values from our wide columns in a long column called&nbsp;<code>\"returns\"<\/code>&nbsp;so we specify&nbsp;<code>values_to = \"returns\"<\/code>. Again note the string variable.<\/li><\/ul>\n\n\n\n<p>Here\u2019s what that looks like:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\">\t\ndailyindex_df_wide %&gt;%<br>\n  pivot_longer(cols = -date, names_to = &#8216;ticker&#8217;, values_to= &#8216;returns&#8217;) %&gt;%<br>\n  kable() %&gt;%<br>\n  kable_styling(full_width = FALSE, position = &#8216;center&#8217;) %&gt;%<br>\n  scroll_box(width = &#8216;800px&#8217;, height = &#8216;300px&#8217;)\n\n<\/p>\n\n\n\n<p>\n<div style=\"border: 1px solid #ddd; padding: 0px; overflow-y: scroll; height: 300px; overflow-x: scroll; width: 800px;\">\n<table class=\"table\" style=\"margin-left: auto; margin-right: auto;\">\n<thead>\n<tr>\n<th style=\"text-align: left; position: sticky; top: 0; background-color: #ffffff;\">date<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">EQ_US<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">EQ_NONUS_DEV<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">EQ_EMER<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">TN_US<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">TB_US<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">BOND_EMER<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">GOLD<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">2020-03-02<\/td>\n<td style=\"text-align: right;\">0.0460048<\/td>\n<td style=\"text-align: right;\">0.0111621<\/td>\n<td style=\"text-align: right;\">0.0114468<\/td>\n<td style=\"text-align: right;\">-0.0008475<\/td>\n<td style=\"text-align: right;\">-0.0073579<\/td>\n<td style=\"text-align: right;\">0.0051502<\/td>\n<td style=\"text-align: right;\">0.0179376<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-03<\/td>\n<td style=\"text-align: right;\">-0.0280740<\/td>\n<td style=\"text-align: right;\">0.0097820<\/td>\n<td style=\"text-align: right;\">0.0106093<\/td>\n<td style=\"text-align: right;\">0.0093299<\/td>\n<td style=\"text-align: right;\">0.0154987<\/td>\n<td style=\"text-align: right;\">0.0093937<\/td>\n<td style=\"text-align: right;\">0.0311450<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-04<\/td>\n<td style=\"text-align: right;\">0.0422302<\/td>\n<td style=\"text-align: right;\">0.0062777<\/td>\n<td style=\"text-align: right;\">0.0097196<\/td>\n<td style=\"text-align: right;\">-0.0016807<\/td>\n<td style=\"text-align: right;\">-0.0099536<\/td>\n<td style=\"text-align: right;\">0.0059222<\/td>\n<td style=\"text-align: right;\">-0.0008743<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-05<\/td>\n<td style=\"text-align: right;\">-0.0336854<\/td>\n<td style=\"text-align: right;\">-0.0014521<\/td>\n<td style=\"text-align: right;\">0.0014743<\/td>\n<td style=\"text-align: right;\">0.0050505<\/td>\n<td style=\"text-align: right;\">0.0227882<\/td>\n<td style=\"text-align: right;\">-0.0067283<\/td>\n<td style=\"text-align: right;\">0.0151949<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-06<\/td>\n<td style=\"text-align: right;\">-0.0170369<\/td>\n<td style=\"text-align: right;\">-0.0232132<\/td>\n<td style=\"text-align: right;\">-0.0262282<\/td>\n<td style=\"text-align: right;\">0.0041876<\/td>\n<td style=\"text-align: right;\">0.0498034<\/td>\n<td style=\"text-align: right;\">-0.0076207<\/td>\n<td style=\"text-align: right;\">0.0026644<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-09<\/td>\n<td style=\"text-align: right;\">-0.0761665<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0041701<\/td>\n<td style=\"text-align: right;\">0.0262172<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0018757<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-10<\/td>\n<td style=\"text-align: right;\">0.0494037<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0091362<\/td>\n<td style=\"text-align: right;\">-0.0486618<\/td>\n<td style=\"text-align: right;\">-0.0477816<\/td>\n<td style=\"text-align: right;\">-0.0091271<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-11<\/td>\n<td style=\"text-align: right;\">-0.0487713<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0025147<\/td>\n<td style=\"text-align: right;\">-0.0108696<\/td>\n<td style=\"text-align: right;\">-0.0206093<\/td>\n<td style=\"text-align: right;\">-0.0107857<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-12<\/td>\n<td style=\"text-align: right;\">-0.0949084<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0008403<\/td>\n<td style=\"text-align: right;\">-0.0155139<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0317549<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-13<\/td>\n<td style=\"text-align: right;\">0.0931900<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0058774<\/td>\n<td style=\"text-align: right;\">-0.0216678<\/td>\n<td style=\"text-align: right;\">-0.0439158<\/td>\n<td style=\"text-align: right;\">-0.0462765<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-16<\/td>\n<td style=\"text-align: right;\">-0.1197921<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0126689<\/td>\n<td style=\"text-align: right;\">0.0510067<\/td>\n<td style=\"text-align: right;\">-0.0325359<\/td>\n<td style=\"text-align: right;\">-0.0203396<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-17<\/td>\n<td style=\"text-align: right;\">0.0597801<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0133445<\/td>\n<td style=\"text-align: right;\">-0.0587484<\/td>\n<td style=\"text-align: right;\">-0.0197824<\/td>\n<td style=\"text-align: right;\">0.0265681<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-18<\/td>\n<td style=\"text-align: right;\">-0.0517360<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0067625<\/td>\n<td style=\"text-align: right;\">-0.0434193<\/td>\n<td style=\"text-align: right;\">-0.0544904<\/td>\n<td style=\"text-align: right;\">-0.0311081<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-19<\/td>\n<td style=\"text-align: right;\">0.0047010<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0017021<\/td>\n<td style=\"text-align: right;\">0.0007092<\/td>\n<td style=\"text-align: right;\">-0.0234792<\/td>\n<td style=\"text-align: right;\">0.0011498<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-20<\/td>\n<td style=\"text-align: right;\">-0.0431907<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0144435<\/td>\n<td style=\"text-align: right;\">0.0652020<\/td>\n<td style=\"text-align: right;\">0.0142077<\/td>\n<td style=\"text-align: right;\">0.0039756<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-23<\/td>\n<td style=\"text-align: right;\">-0.0292942<\/td>\n<td style=\"text-align: right;\">-0.2532532<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0083752<\/td>\n<td style=\"text-align: right;\">0.0419162<\/td>\n<td style=\"text-align: right;\">-0.0215517<\/td>\n<td style=\"text-align: right;\">0.0568462<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-24<\/td>\n<td style=\"text-align: right;\">0.0939740<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0041528<\/td>\n<td style=\"text-align: right;\">-0.0051086<\/td>\n<td style=\"text-align: right;\">0.0121145<\/td>\n<td style=\"text-align: right;\">0.0575354<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-25<\/td>\n<td style=\"text-align: right;\">0.0115569<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0008340<\/td>\n<td style=\"text-align: right;\">-0.0064185<\/td>\n<td style=\"text-align: right;\">0.0315560<\/td>\n<td style=\"text-align: right;\">-0.0174002<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-26<\/td>\n<td style=\"text-align: right;\">0.0624207<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0016667<\/td>\n<td style=\"text-align: right;\">0.0064599<\/td>\n<td style=\"text-align: right;\">0.0295359<\/td>\n<td style=\"text-align: right;\">0.0159455<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-27<\/td>\n<td style=\"text-align: right;\">-0.0336616<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0049917<\/td>\n<td style=\"text-align: right;\">0.0237484<\/td>\n<td style=\"text-align: right;\">-0.0081967<\/td>\n<td style=\"text-align: right;\">-0.0037858<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-30<\/td>\n<td style=\"text-align: right;\">0.0336403<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0008278<\/td>\n<td style=\"text-align: right;\">-0.0050157<\/td>\n<td style=\"text-align: right;\">-0.0144628<\/td>\n<td style=\"text-align: right;\">-0.0065711<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-03-31<\/td>\n<td style=\"text-align: right;\">-0.0159221<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">-0.0016570<\/td>\n<td style=\"text-align: right;\">-0.0144928<\/td>\n<td style=\"text-align: right;\">0.0115304<\/td>\n<td style=\"text-align: right;\">-0.0283711<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-04-01<\/td>\n<td style=\"text-align: right;\">-0.0441380<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0008299<\/td>\n<td style=\"text-align: right;\">0.0147059<\/td>\n<td style=\"text-align: right;\">-0.0124352<\/td>\n<td style=\"text-align: right;\">-0.0032808<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2020-04-02<\/td>\n<td style=\"text-align: right;\">0.0230223<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0008292<\/td>\n<td style=\"text-align: right;\">0.0056711<\/td>\n<td style=\"text-align: right;\">0.0000000<\/td>\n<td style=\"text-align: right;\">0.0291310<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>And you can see that we\u2019ve recovered our original long form dataframe.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">An example<\/h2>\n\n\n\n<p>One example where you\u2019d be forced to pivot you long returns data frame to wide would be to calculate a correlation matrix:<\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\">\t\ndailyindex_df %&gt;%<br>\n  pivot_wider(names_from = ticker, values_from = returns) %&gt;%<br>\n  select(-date) %&gt;%<br>\n  cor(use = &#8220;pairwise.complete.obs&#8221;, method=&#8217;pearson&#8217;) %&gt;%<br>\n  kable() %&gt;%<br>\n  kable_styling(position = &#8216;center&#8217;) %&gt;%<br>\n  scroll_box(width = &#8216;800px&#8217;, height = &#8216;300px&#8217;)\n\n<\/p>\n\n\n\n<div style=\"border: 1px solid #ddd; padding: 0px; overflow-y: scroll; height: 300px; overflow-x: scroll; width: 600px;\">\n<table class=\"table\" style=\"margin-left: auto; margin-right: auto;\">\n<thead>\n<tr>\n<th style=\"text-align: left; position: sticky; top: 0; background-color: #ffffff;\"><\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">EQ_US<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">EQ_NONUS_DEV<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">EQ_EMER<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">TN_US<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">TB_US<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">BOND_EMER<\/th>\n<th style=\"text-align: right; position: sticky; top: 0; background-color: #ffffff;\">GOLD<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">EQ_US<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<td style=\"text-align: right;\">0.1045511<\/td>\n<td style=\"text-align: right;\">0.1219745<\/td>\n<td style=\"text-align: right;\">-0.5935488<\/td>\n<td style=\"text-align: right;\">-0.4827843<\/td>\n<td style=\"text-align: right;\">0.1064579<\/td>\n<td style=\"text-align: right;\">0.2741258<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">EQ_NONUS_DEV<\/td>\n<td style=\"text-align: right;\">0.1045511<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<td style=\"text-align: right;\">0.1216288<\/td>\n<td style=\"text-align: right;\">-0.2460011<\/td>\n<td style=\"text-align: right;\">-0.2961201<\/td>\n<td style=\"text-align: right;\">0.1418452<\/td>\n<td style=\"text-align: right;\">-0.4301298<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">EQ_EMER<\/td>\n<td style=\"text-align: right;\">0.1219745<\/td>\n<td style=\"text-align: right;\">0.1216288<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<td style=\"text-align: right;\">-0.0362846<\/td>\n<td style=\"text-align: right;\">-0.2751978<\/td>\n<td style=\"text-align: right;\">0.1345682<\/td>\n<td style=\"text-align: right;\">0.1158572<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">TN_US<\/td>\n<td style=\"text-align: right;\">-0.5935488<\/td>\n<td style=\"text-align: right;\">-0.2460011<\/td>\n<td style=\"text-align: right;\">-0.0362846<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<td style=\"text-align: right;\">0.9324163<\/td>\n<td style=\"text-align: right;\">0.3326693<\/td>\n<td style=\"text-align: right;\">0.1643955<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">TB_US<\/td>\n<td style=\"text-align: right;\">-0.4827843<\/td>\n<td style=\"text-align: right;\">-0.2961201<\/td>\n<td style=\"text-align: right;\">-0.2751978<\/td>\n<td style=\"text-align: right;\">0.9324163<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<td style=\"text-align: right;\">0.3107047<\/td>\n<td style=\"text-align: right;\">0.2451740<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">BOND_EMER<\/td>\n<td style=\"text-align: right;\">0.1064579<\/td>\n<td style=\"text-align: right;\">0.1418452<\/td>\n<td style=\"text-align: right;\">0.1345682<\/td>\n<td style=\"text-align: right;\">0.3326693<\/td>\n<td style=\"text-align: right;\">0.3107047<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<td style=\"text-align: right;\">0.3305851<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">GOLD<\/td>\n<td style=\"text-align: right;\">0.2741258<\/td>\n<td style=\"text-align: right;\">-0.4301298<\/td>\n<td style=\"text-align: right;\">0.1158572<\/td>\n<td style=\"text-align: right;\">0.1643955<\/td>\n<td style=\"text-align: right;\">0.2451740<\/td>\n<td style=\"text-align: right;\">0.3305851<\/td>\n<td style=\"text-align: right;\">1.0000000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<p>You can see that we\u2019ve also used the&nbsp;<code>select<\/code>&nbsp;function from&nbsp;<code>dplyr<\/code>&nbsp;to drop the date column before passing the wide data frame of returns to the&nbsp;<code>cor<\/code>&nbsp;function for calculating the correlation matrix.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plotting long format data<\/h2>\n\n\n\n<p>When you want to plot more than one variable on a single chart, long data is most definitely your friend:<\/p>\n\n\n\n<p class=\"has-background\">\t\ndailyindex_df %&gt;%<br>\n  ggplot(aes(x = date, y = returns, colour = ticker)) +<br>\n    geom_line()\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"648\" height=\"432\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2020\/12\/robot-wealth-stats-1.png\" alt=\"Working with Tidy Financial Data in tidyr\" class=\"wp-image-69938 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/12\/robot-wealth-stats-1.png 648w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/12\/robot-wealth-stats-1-300x200.png 300w\" data-sizes=\"(max-width: 648px) 100vw, 648px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 648px; aspect-ratio: 648\/432;\" \/><\/figure>\n\n\n\nPlotting each returns series in a grid is equally simple:\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\">\t\ndailyindex_df %&gt;%<br>\n  ggplot(aes(x = date, y = returns)) +<br>\n    geom_line() +<br>\n    facet_wrap(~ticker)\n<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"648\" height=\"432\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2020\/12\/robot-wealth-stats-2.png\" alt=\"Working with Tidy Financial Data in tidyr\" class=\"wp-image-69944 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/12\/robot-wealth-stats-2.png 648w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/12\/robot-wealth-stats-2-300x200.png 300w\" data-sizes=\"(max-width: 648px) 100vw, 648px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 648px; aspect-ratio: 648\/432;\" \/><\/figure>\n\n\n\n<p>Using wide-format data to make a similar plot would require repeated calls to&nbsp;<code>geom_line<\/code>&nbsp;for each variable, which is quite painstaking and brittle.<\/p>\n\n\n\n<p>For example, if something changes upstream, such as the addition of a new ticker to the data set, your code will also need to change in order to plot it. That\u2019s not the case if we use long data with a column holding the ticker variable.<\/p>\n\n\n\n<p><em>Visit Robot Wealth website to read the full article and watch the instructional video:&nbsp;<a href=\"https:\/\/robotwealth.com\/working-with-tidy-financial-data-in-tidyr\/\">https:\/\/robotwealth.com\/working-with-tidy-financial-data-in-tidyr\/<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.<\/p>\n","protected":false},"author":271,"featured_media":38395,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,338,350,341,344,342],"tags":[806,8962,7811,8596,8594,1045],"contributors-categories":[13676],"class_list":{"0":"post-69894","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-ibkr-quant-news","10":"category-quant-asia-pacific","11":"category-quant-development","12":"category-quant-regions","13":"category-r-development","14":"tag-data-science","15":"tag-math","16":"tag-r-rstats","17":"tag-tidy-financial-data","18":"tag-tidyr","19":"tag-tidyverse","20":"contributors-categories-robot-wealth"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Working with Tidy Financial Data in tidyr \u2013 Part III<\/title>\n<meta name=\"description\" content=\"Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/69894\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working with Tidy Financial Data in tidyr \u2013 Part III | IBKR Quant Blog\" \/>\n<meta property=\"og:description\" content=\"Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-18T14:45:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-21T14:46:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"505\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Kris Longmore\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kris Longmore\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Kris Longmore\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/79c2a2775a70a4da1accf0068d731933\"\n\t            },\n\t            \"headline\": \"Working with Tidy Financial Data in tidyr \u2013 Part III\",\n\t            \"datePublished\": \"2020-12-18T14:45:29+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:46:47+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/\"\n\t            },\n\t            \"wordCount\": 690,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/03\\\/spiral-math.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"Math\",\n\t                \"R rstats\",\n\t                \"tidy financial data\",\n\t                \"tidyr\",\n\t                \"tidyverse\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Quant\",\n\t                \"Quant Asia Pacific\",\n\t                \"Quant Development\",\n\t                \"Quant Regions\",\n\t                \"R Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/\",\n\t            \"name\": \"Working with Tidy Financial Data in tidyr \u2013 Part III | IBKR Quant Blog\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/03\\\/spiral-math.jpg\",\n\t            \"datePublished\": \"2020-12-18T14:45:29+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:46:47+00:00\",\n\t            \"description\": \"Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/working-with-tidy-financial-data-in-tidyr-part-iii\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/03\\\/spiral-math.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2020\\\/03\\\/spiral-math.jpg\",\n\t            \"width\": 800,\n\t            \"height\": 505,\n\t            \"caption\": \"Quant\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/79c2a2775a70a4da1accf0068d731933\",\n\t            \"name\": \"Kris Longmore\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/krislongmore\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Working with Tidy Financial Data in tidyr \u2013 Part III","description":"Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/69894\/","og_locale":"en_US","og_type":"article","og_title":"Working with Tidy Financial Data in tidyr \u2013 Part III | IBKR Quant Blog","og_description":"Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/","og_site_name":"IBKR Campus US","article_published_time":"2020-12-18T14:45:29+00:00","article_modified_time":"2022-11-21T14:46:47+00:00","og_image":[{"width":800,"height":505,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg","type":"image\/jpeg"}],"author":"Kris Longmore","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kris Longmore","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/"},"author":{"name":"Kris Longmore","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/79c2a2775a70a4da1accf0068d731933"},"headline":"Working with Tidy Financial Data in tidyr \u2013 Part III","datePublished":"2020-12-18T14:45:29+00:00","dateModified":"2022-11-21T14:46:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/"},"wordCount":690,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg","keywords":["Data Science","Math","R rstats","tidy financial data","tidyr","tidyverse"],"articleSection":["Data Science","Programming Languages","Quant","Quant Asia Pacific","Quant Development","Quant Regions","R Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/","name":"Working with Tidy Financial Data in tidyr \u2013 Part III | IBKR Quant Blog","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg","datePublished":"2020-12-18T14:45:29+00:00","dateModified":"2022-11-21T14:46:47+00:00","description":"Kris Longmore demonstrates how to use tidry::pivot_longer for pivoting from wide to long format, and how to plot returns series in a grid.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/working-with-tidy-financial-data-in-tidyr-part-iii\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg","width":800,"height":505,"caption":"Quant"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/79c2a2775a70a4da1accf0068d731933","name":"Kris Longmore","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/krislongmore\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2020\/03\/spiral-math.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/69894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/271"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=69894"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/69894\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/38395"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=69894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=69894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=69894"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=69894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}