{"id":190923,"date":"2023-05-25T10:35:31","date_gmt":"2023-05-25T14:35:31","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=190923"},"modified":"2023-05-25T10:35:24","modified_gmt":"2023-05-25T14:35:24","slug":"r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/","title":{"rendered":"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index"},"content":{"rendered":"\n<p>This post shows how to read all prices of constituents of a stock index given all symbols as a string. It is a prerequisite of the pairs trading backtest.<\/p>\n\n\n\n<p>Pairs trading aims to select good performing pairs from a set of universe of a stock index. It is, therefore, a starting point of pairs trading backtest to collect daily stock prices of a given stock index.<\/p>\n\n\n\n<p>Sometimes there are symbols for which price information is not available. In this case, we should check the all components of the stock index. In case of Nasdaq 100, recent information can be found at<\/p>\n\n\n\n<p><a href=\"https:\/\/www.slickcharts.com\/nasdaq100\">https:\/\/www.slickcharts.com\/nasdaq100<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-r-code\">R code<\/h3>\n\n\n\n<p>The following R code retreives historical daily prices of constituents of the Nasdaq 100 index given all symbols of it as of 2022-07-29.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#========================================================#\n# Quantitative ALM, Financial Econometrics &amp; Derivatives \n# ML\/DL using R, Python, Tensorflow by Sang-Heon Lee \n#\n# https:\/\/kiandlee.blogspot.com\n#--------------------------------------------------------#\n# load prices of constituents of a stock index\n#========================================================#\n \ngraphics.off(); rm(list = ls())\n \nlibrary(quantmod)\n \n#-------------------------------------------------\n# Components of the Nasdaq 100, as of 2022-07-29\n#-------------------------------------------------\nvstr_nasdaq100 &lt;- \n    \"AAPL,MSFT,AMZN,TSLA,GOOG,GOOGL,NVDA,META,PEP,COST,\n    AVGO,CMCSA,ADBE,CSCO,TMUS,QCOM,INTC,TXN,AMD,AMGN,\n    HON,INTU,NFLX,PYPL,ADP,SBUX,AMAT,MDLZ,ADI,ISRG,\n    CHTR,GILD,BKNG,VRTX,CSX,MU,FISV,LRCX,REGN,MNA,\n    ATVI,SNPS,KLAC,KDP,MNST,MAR,AEP,CDNS,PANW,NXPI,\n    ASML,FTNT,ORLY,PAYX,MRVL,KHC,ADSK,EXC,CTAS,ABNB,\n    MELI,AZN,XEL,CRWD,EA,MCHP,CTSH,LULU,DLTR,WBA,\n    DXCM,ILMN,SGEN,IDXX,JD,BIIB,ODFL,PCAR,LCID,BIDU,\n    WDAY,CPRT,VRSK,TEAM,ROST,FAST,ZM,DDOG,EBAY,SIRI,\n    PDD,ANSS,ZS,ALGN,MTCH,VRSN,CEG,NTES,SWKS,SPLK,\n    OKTA,DOCU\"\n \n#-------------------------------------------\n# split symbols and make vector\n#-------------------------------------------\nnasdaq100_symbols &lt;- \n    gsub(\" \", \"\", strsplit(vstr_nasdaq100, \n                           \"\\\\s*,\\\\s*\")[[1]])\nnasdaq100_symbols\n \n#-------------------------------------------\n# read price information of constituents\n#-------------------------------------------\nsdate &lt;- as.Date(\"2020-07-01\")\nedate &lt;- as.Date(\"2022-06-30\")\ngetSymbols(nasdaq100_symbols,from=sdate,to=edate)\n \n#-------------------------------------------\n# collect only adjusted prices\n#-------------------------------------------\nprice &lt;- NULL\nfor(i in 1:length(nasdaq100_symbols)) {\n    eval(parse(text=paste0(\n        \"price &lt;- cbind(price,\",\n        nasdaq100_symbols[i],\"[,6])\")))\n}\n \n# modify column name as only symbol\ncolnames(price) &lt;- \n    gsub(\".Adjusted\", \"\", colnames(price))\n \n#-------------------------------------------\n# print price time series of Components\n#-------------------------------------------\nhead(price)\ntail(price)<\/pre>\n\n\n\n<p>Running the above R code displays the status of data reading process as follows.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"554\" height=\"577\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/getSymbols-sh-fintech.png\" alt=\"\" class=\"wp-image-190925 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/getSymbols-sh-fintech.png 554w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/getSymbols-sh-fintech-300x312.png 300w\" data-sizes=\"(max-width: 554px) 100vw, 554px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 554px; aspect-ratio: 554\/577;\" \/><\/figure>\n\n\n\n<p>Finally, we can get the collection of individual stock prices, which are components of the Nasdaq 100 index<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"550\" height=\"630\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/price_head_tail-sh-fintech.png\" alt=\"\" class=\"wp-image-190927 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/price_head_tail-sh-fintech.png 550w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/price_head_tail-sh-fintech-300x344.png 300w\" data-sizes=\"(max-width: 550px) 100vw, 550px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 550px; aspect-ratio: 550\/630;\" \/><\/figure>\n\n\n\n<p><em>Originally posted on <a href=\"https:\/\/kiandlee.blogspot.com\/2022\/07\/r-read-and-concatenate-prices-of.html\">SH Fintech Modeling<\/a>. <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post shows how to read all prices of constituents of a stock index given all symbols as a string.<\/p>\n","protected":false},"author":662,"featured_media":98761,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,338,341,342],"tags":[8435,806,4922,487,44],"contributors-categories":[13728],"class_list":{"0":"post-190923","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-development","11":"category-r-development","12":"tag-backtest","13":"tag-data-science","14":"tag-econometrics","15":"tag-r","16":"tag-stocks","17":"contributors-categories-sh-fintech-modeling"},"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.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index<\/title>\n<meta name=\"description\" content=\"This post shows how to read all prices of constituents of a stock index given all symbols as a string.\" \/>\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\/190923\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"This post shows how to read all prices of constituents of a stock index given all symbols as a string.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-25T14:35:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sang-Heon Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sang-Heon Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 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\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Sang-Heon Lee\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\"\n\t            },\n\t            \"headline\": \"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index\",\n\t            \"datePublished\": \"2023-05-25T14:35:31+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/\"\n\t            },\n\t            \"wordCount\": 180,\n\t            \"commentCount\": 0,\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\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/08\\\/stock-numbers-green.jpg\",\n\t            \"keywords\": [\n\t                \"backtest\",\n\t                \"Data Science\",\n\t                \"Econometrics\",\n\t                \"R\",\n\t                \"stocks\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Quant\",\n\t                \"Quant Development\",\n\t                \"R Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/\",\n\t            \"name\": \"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index | IBKR Campus US\",\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\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/08\\\/stock-numbers-green.jpg\",\n\t            \"datePublished\": \"2023-05-25T14:35:31+00:00\",\n\t            \"description\": \"This post shows how to read all prices of constituents of a stock index given all symbols as a string.\",\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\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/\"\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\\\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/08\\\/stock-numbers-green.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/08\\\/stock-numbers-green.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"ESG Investing: The Growing Allure of Green Assets\"\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\\\/0a959ff9de7f0465a07baa1fe1ae0200\",\n\t            \"name\": \"Sang-Heon Lee\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/sang-heonlee\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index","description":"This post shows how to read all prices of constituents of a stock index given all symbols as a string.","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\/190923\/","og_locale":"en_US","og_type":"article","og_title":"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index | IBKR Campus US","og_description":"This post shows how to read all prices of constituents of a stock index given all symbols as a string.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/","og_site_name":"IBKR Campus US","article_published_time":"2023-05-25T14:35:31+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg","type":"image\/jpeg"}],"author":"Sang-Heon Lee","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sang-Heon Lee","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/"},"author":{"name":"Sang-Heon Lee","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200"},"headline":"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index","datePublished":"2023-05-25T14:35:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/"},"wordCount":180,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg","keywords":["backtest","Data Science","Econometrics","R","stocks"],"articleSection":["Data Science","Programming Languages","Quant","Quant Development","R Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/","name":"R Code Snippet : Read and Concatenate Prices of Constituents of a Stock Index | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg","datePublished":"2023-05-25T14:35:31+00:00","description":"This post shows how to read all prices of constituents of a stock index given all symbols as a string.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/r-code-snippet-read-and-concatenate-prices-of-constituents-of-a-stock-index\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg","width":1000,"height":563,"caption":"ESG Investing: The Growing Allure of Green Assets"},{"@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\/0a959ff9de7f0465a07baa1fe1ae0200","name":"Sang-Heon Lee","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/sang-heonlee\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/08\/stock-numbers-green.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/190923","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\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=190923"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/190923\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/98761"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=190923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=190923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=190923"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=190923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}