{"id":223541,"date":"2026-09-28T12:40:56","date_gmt":"2026-09-28T16:40:56","guid":{"rendered":"https:\/\/ibkrcampus.com\/campus\/?p=223541"},"modified":"2026-09-28T12:41:36","modified_gmt":"2026-09-28T16:41:36","slug":"yfscreen-yahoo-finance-screener-in-r-and-python","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/","title":{"rendered":"yfscreen: Yahoo Finance Screener in R and Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Last updated: September 28, 2026 (originally published on May 7, 2025)<\/em><\/p>\n\n\n\n<h2 id=\"h-open-source-quantitative-finance\" class=\"wp-block-heading\">Open Source Quantitative Finance<\/h2>\n\n\n\n<h3 id=\"h-overview\" class=\"wp-block-heading\">Overview<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>yfscreen<\/strong> is a package that provides simple and efficient access to Yahoo Finance\u2019s <strong>screener<\/strong> API (<a href=\"https:\/\/finance.yahoo.com\/research-hub\/screener\/\">https:\/\/finance.yahoo.com\/research-hub\/screener\/<\/a>) for querying and retrieving financial data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The core functionality of the <strong>yfscreen<\/strong> package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, pagination, and JSON payload generation. This abstraction allows users to focus on filtering and retrieving data rather than managing API details. Use cases include screening across a range of security types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Equities<\/strong>: coverage spans 50 regions for identifying top-performing stocks by specified criteria<\/li>\n\n\n\n<li><strong>Mutual funds<\/strong>: screened by metrics such as historical performance and performance ratings<\/li>\n\n\n\n<li><strong>ETFs<\/strong>: filtered by criteria including expense ratio and historical performance<\/li>\n\n\n\n<li><strong>Indices<\/strong>: stock market indices covering sectors, industries, or the overall market<\/li>\n\n\n\n<li><strong>Futures<\/strong>: contracts screened by exchange, percent price change, and region<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The package supports advanced query capabilities, including logical operators, nested filters, and customizable payloads. It automatically handles pagination for efficient retrieval of large datasets by fetching results in batches of up to 250 entries per request. Filters are defined as lists of conditions to accommodate a wide range of screens.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The implementation uses standard HTTP libraries to handle API interactions efficiently and supports both R and Python to make it accessible for a broad audience.<\/p>\n\n\n\n<h2 id=\"h-installation-in-r\" class=\"wp-block-heading\">Installation in R<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install the released version from CRAN:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">install.packages(\"yfscreen\")<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Or the development version from GitHub:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># install.packages(\"pak\")\npak::pak(\"jasonjfoster\/screen\/r\")<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Then load the package:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">library(yfscreen)<\/pre>\n\n\n\n<h2 id=\"h-installation-in-python\" class=\"wp-block-heading\">Installation in Python<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install the released version from PyPI:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install yfscreen<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Or the development version from GitHub:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install \\\n  git+https:\/\/github.com\/jasonjfoster\/screen.git@main#subdirectory=python<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Then import the package:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import yfscreen as yfs<\/pre>\n\n\n\n<h2 id=\"h-available-filters\" class=\"wp-block-heading\">Available filters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Load the package and explore the available filter options using <strong>yfscreen::data_filters<\/strong> in R or <strong>yfs.data_filters<\/strong> in Python:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>Security types<\/strong><\/td><td><strong>Data types<\/strong><\/td><td><strong>Field names<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>equity<\/strong><\/td><td><strong>Market Data<\/strong><\/td><td><strong>eodprice<\/strong><\/td><\/tr><tr><td><strong>mutualfund<\/strong><\/td><td><strong>Ratios<\/strong><\/td><td><strong>exchange<\/strong><\/td><\/tr><tr><td><strong>etf<\/strong><\/td><td><strong>Performance<\/strong><\/td><td><strong>intradayprice<\/strong><\/td><\/tr><tr><td><strong>index<\/strong><\/td><td><strong>\u22ee<\/strong><\/td><td><strong>\u22ee<\/strong><\/td><\/tr><tr><td><strong>future<\/strong><\/td><td><strong>Technicals<\/strong><\/td><td><strong>ticker<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"h-usage\" class=\"wp-block-heading\">Usage<\/h2>\n\n\n\n<h3 id=\"h-create-query\" class=\"wp-block-heading\">Create query<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>yfscreen::create_query<\/strong> function in R and <strong>yfs.create_query<\/strong> function in Python create a structured query with logical operations and nested conditions formatted for the Yahoo Finance API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Parameters<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>filters<\/strong>: list. Each element is a sublist that defines a filtering condition with the following structure:<ul><li><strong>comparison<\/strong>: string. Comparison operator (i.e., <strong>&#8220;gt&#8221;<\/strong>, <strong>&#8220;lt&#8221;<\/strong>, <strong>&#8220;eq&#8221;<\/strong>, <strong>&#8220;btwn&#8221;<\/strong>).<\/li><\/ul>\n<ul class=\"wp-block-list\">\n<li><strong>field<\/strong>: list. Field name (e.g., <strong>&#8220;region&#8221;<\/strong>) and its associated value(s).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>top_operator<\/strong>: string. Top-level logical operator to combine the filter groups (i.e., <strong>&#8220;and&#8221;<\/strong>, <strong>&#8220;or&#8221;<\/strong>). Filters that share a field name are grouped and combined with the <strong>&#8220;or&#8221;<\/strong> operator, so repeated conditions on the same field select any of the values (e.g., a performance rating of 4 or 5).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Value<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A nested list representing the structured query with logical operations and nested conditions formatted for the Yahoo Finance API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Examples<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Most active stocks<\/strong>: discover the most traded equities during the trading day.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>R<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">most_actives &lt;- list(\n  list(\"eq\", list(\"region\", \"us\")),\n  list(\"btwn\", list(\"intradaymarketcap\", 2e9, 1e11)),\n  list(\"gt\", list(\"dayvolume\", 5e6))\n)\nquery &lt;- yfscreen::create_query(most_actives)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Python<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">most_actives = [\n  [\"eq\", [\"region\", \"us\"]],\n  [\"btwn\", [\"intradaymarketcap\", 2e9, 1e11]],\n  [\"gt\", [\"dayvolume\", 5e6]]\n]\nquery = yfs.create_query(most_actives)<\/pre>\n\n\n\n<h2 id=\"h-create-payload\" class=\"wp-block-heading\">Create payload<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>yfscreen::create_payload<\/strong> function in R and <strong>yfs.create_payload<\/strong> function in Python create a payload with the search criteria formatted for the Yahoo Finance API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Parameters<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>sec_type<\/strong>: string. Security type (i.e., <strong>&#8220;equity&#8221;<\/strong>, <strong>&#8220;mutualfund&#8221;<\/strong>, <strong>&#8220;etf&#8221;<\/strong>, <strong>&#8220;index&#8221;<\/strong>, <strong>&#8220;future&#8221;<\/strong>).<\/li>\n\n\n\n<li><strong>query<\/strong>: list. Structured query created using <strong>create_query()<\/strong>.<\/li>\n\n\n\n<li><strong>size<\/strong>: integer. Number of results to return.<\/li>\n\n\n\n<li><strong>offset<\/strong>: integer. Starting position of the results.<\/li>\n\n\n\n<li><strong>sort_field<\/strong>: string. Field to sort the results by.<\/li>\n\n\n\n<li><strong>sort_type<\/strong>: string. Sort type (i.e., <strong>&#8220;asc&#8221;<\/strong>, <strong>&#8220;desc&#8221;<\/strong>).<\/li>\n\n\n\n<li><strong>top_operator<\/strong>: string. Top-level logical operator of the payload (i.e., <strong>&#8220;and&#8221;<\/strong>, <strong>&#8220;or&#8221;<\/strong>); it does not modify the query, so keep it consistent with <strong>create_query()<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Value<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A list representing the payload with the search criteria formatted for the Yahoo Finance API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Examples<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>R<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">payload &lt;- yfscreen::create_payload(\"equity\", query)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Python<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">payload = yfs.create_payload(\"equity\", query)<\/pre>\n\n\n\n<h2 id=\"h-get-data\" class=\"wp-block-heading\">Get data<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>yfscreen::get_data<\/strong> function in R and <strong>yfs.get_data<\/strong> function in Python get data from the Yahoo Finance API using the specified payload.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Parameters<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>payload<\/strong>: list. Payload that contains search criteria created using <strong>create_query()<\/strong> and <strong>create_payload()<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Value<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A data frame that contains data from the Yahoo Finance API for the specified search criteria.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Examples<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>R<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data &lt;- yfscreen::get_data(payload)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Python<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data = yfs.get_data(payload)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>View data<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>R<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">head(data[ , c(\"symbol\", \"regularMarketPrice.raw\",\n               \"regularMarketChangePercent.raw\", ...)])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Python<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data[[\"symbol\", \"regularMarketPrice.raw\",\n      \"regularMarketChangePercent.raw\", ...]].head()<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>symbol<\/strong><\/td><td><strong>price<\/strong><\/td><td><strong>chg (%)<\/strong><\/td><td><strong>vol (m)<\/strong><\/td><td><strong>mkt cap (b)<\/strong><\/td><td><strong>\u22ef<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>AAPL<\/strong><\/td><td><strong>208.27<\/strong><\/td><td><strong>1.79<\/strong><\/td><td><strong>28.10<\/strong><\/td><td><strong>3,128.65<\/strong><\/td><td><strong>\u22ef<\/strong><\/td><\/tr><tr><td><strong>MSFT<\/strong><\/td><td><strong>388.00<\/strong><\/td><td><strong>3.64<\/strong><\/td><td><strong>13.01<\/strong><\/td><td><strong>2,884.38<\/strong><\/td><td><strong>\u22ef<\/strong><\/td><\/tr><tr><td><strong>NVDA<\/strong><\/td><td><strong>106.26<\/strong><\/td><td><strong>3.46<\/strong><\/td><td><strong>177.99<\/strong><\/td><td><strong>2,592.74<\/strong><\/td><td><strong>\u22ef<\/strong><\/td><\/tr><tr><td><strong>GOOG<\/strong><\/td><td><strong>161.22<\/strong><\/td><td><strong>2.22<\/strong><\/td><td><strong>17.21<\/strong><\/td><td><strong>1,949.05<\/strong><\/td><td><strong>\u22ef<\/strong><\/td><\/tr><tr><td><strong>AMZN<\/strong><\/td><td><strong>186.41<\/strong><\/td><td><strong>3.22<\/strong><\/td><td><strong>31.64<\/strong><\/td><td><strong>1,978.26<\/strong><\/td><td><strong>\u22ef<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"h-more-filters-in-r\" class=\"wp-block-heading\">More filters in R<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each screen defines the security type and filters, then follows the same workflow to create the query, create the payload, and get the data:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Top mutual funds<\/strong>: find mutual funds with a price above $15 and a performance rating of 4 or 5.<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sec_type &lt;- \"mutualfund\"\ntop_mutual_funds &lt;- list(\n  list(\"gt\", list(\"intradayprice\", 15)),\n  list(\"eq\", list(\"performanceratingoverall\", 4)),\n  list(\"eq\", list(\"performanceratingoverall\", 5))\n)<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Low-cost ETFs<\/strong>: screen ETFs with net expense ratios below 0.25%, at least $1 billion in net assets, and a performance rating of 4 or 5. Note that the <strong>fundnetassets<\/strong> field is denominated in millions, while the price and market capitalization fields are denominated in dollars.<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sec_type &lt;- \"etf\"\nlow_cost_etfs &lt;- list(\n  list(\"lt\", list(\"annualreportnetexpenseratio\", 0.25)),\n  list(\"gt\", list(\"fundnetassets\", 1e3)),\n  list(\"eq\", list(\"performanceratingoverall\", 4)),\n  list(\"eq\", list(\"performanceratingoverall\", 5))\n)<\/pre>\n\n\n\n<h2 id=\"h-more-filters-in-python\" class=\"wp-block-heading\">More filters in Python<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each screen defines the security type and filters, then follows the same workflow to create the query, create the payload, and get the data:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Active futures<\/strong>: identify U.S. futures contracts with high trading volume and open interest.<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sec_type = \"future\"\nactive_futures = [\n  [\"eq\", [\"region\", \"us\"]],\n  [\"gt\", [\"dayvolume\", 1e4]],\n  [\"gt\", [\"open_interest\", 1e4]]\n]<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Advancing indices<\/strong>: track U.S. stock market indices with positive price changes during the trading day.<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sec_type = \"index\"\nadvancing_indices = [\n  [\"eq\", [\"region\", \"us\"]],\n  [\"gt\", [\"percentchange\", 0]]\n]<\/pre>\n\n\n\n<h2 id=\"h-application\" class=\"wp-block-heading\">Application<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next we use the <strong>yfscreen<\/strong> package to analyze how estimated positioning relates to recent performance among \u201cTactical Allocation\u201d mutual funds, with the <strong>categoryname<\/strong> field defining the peer group. The <strong>categoryname<\/strong> field reflects the category assigned by the data provider: the screen returns the members of the category at the time the screen is run. The analysis includes 86 funds as of April 1, 2025, with the return history the estimation requires. The sample therefore reflects survivorship bias: the screen includes only the current members of the category, so funds that closed, merged, or left the category over the estimation period are absent. The bias in the results below is limited to attrition during the five-month results window. A screen of current members cannot measure that attrition.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To estimate asset allocations, we use a constrained least squares regression with two explanatory variables: the S&amp;P 500 index (SP500) to represent market exposure and the 3-month Treasury bill rate (DTB3) to represent cash. The objective is to estimate how each mutual fund allocates between market and cash exposures subject to the following constraints:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"680\" height=\"105\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/estimate-formula-yfscreen.png\" alt=\"yfscreen: Yahoo Finance Screener in R and Python\" class=\"wp-image-257657 lazyload\" style=\"--smush-placeholder-width: 680px; aspect-ratio: 680\/105;width:680px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/estimate-formula-yfscreen.png 680w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/estimate-formula-yfscreen-300x46.png 300w\" data-sizes=\"(max-width: 680px) 100vw, 680px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The sum-to-one constraint ensures that the entire portfolio is allocated between market and cash positions without leverage. The bounds reflect the typical long-only structure of mutual funds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exposures are estimated for each fund on each business day from April 2015 through April 2025 using daily returns over a trailing 60-day (three-month) window, with performance measured over the same window. The analysis includes funds once they have sufficient history for the estimation. The results below focus on the window since the U.S. election in November 2024.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We also extend the analysis to an attribution of the difference in performance between quartiles. That is, the actual difference in median performance between the top (Q1) and bottom (Q4) performance quartiles is compared with the difference implied by the median market exposures multiplied by the excess market return over the same trailing window:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"706\" height=\"44\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/implied-difference-yfscreen.png\" alt=\"yfscreen: Yahoo Finance Screener in R and Python\" class=\"wp-image-257663 lazyload\" style=\"--smush-placeholder-width: 706px; aspect-ratio: 706\/44;aspect-ratio:16.050799289520427;width:706px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/implied-difference-yfscreen.png 706w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/implied-difference-yfscreen-700x44.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/implied-difference-yfscreen-300x19.png 300w\" data-sizes=\"(max-width: 706px) 100vw, 706px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>R<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">actual &lt;- median(performance[q1]) - median(performance[q4])\nimplied &lt;- (median(beta[q1]) - median(beta[q4])) * (market - cash)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Python<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">actual = performance[q1].median() - performance[q4].median()\nimplied = (beta[q1].median() - beta[q4].median()) * (market - cash)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The market and cash exposures sum to one by construction, so the implied difference isolates the contribution of the estimated market versus cash split to the actual difference in median performance. Note that the actual difference is positive by construction because the quartiles are sorted on performance at each date. The residual between the actual and implied differences therefore reflects dispersion within quartiles rather than the estimated exposures. The exposures are estimated over the same trailing window used to measure performance, so the attribution is a decomposition rather than a test. That is, sorting on performance also sorts on the product of the exposures and the excess market return. The implied difference is therefore positive as well, apart from days when the trailing market return is near the cash return.<\/p>\n\n\n\n<h2 id=\"h-results\" class=\"wp-block-heading\">Results<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After the estimation of market and cash exposures, we separate mutual funds into performance quartiles and compare positioning over time. The chart below shows the regression-based median market exposure for the top (Q1) and bottom (Q4) performing \u201cTactical Allocation\u201d funds since the U.S. election in November 2024. The analysis provides insight into how differences in the estimated market versus cash split between quartiles correspond to differences in recent mutual fund performance.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"560\" height=\"280\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/median-market-exposure-yfscreeen.png\" alt=\"yfscreen: Yahoo Finance Screener in R and Python\" class=\"wp-image-257670 lazyload\" style=\"--smush-placeholder-width: 560px; aspect-ratio: 560\/280;width:560px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/median-market-exposure-yfscreeen.png 560w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/median-market-exposure-yfscreeen-300x150.png 300w\" data-sizes=\"(max-width: 560px) 100vw, 560px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Data source: Federal Reserve Economic Data (FRED): <\/em><a href=\"https:\/\/fred.stlouisfed.org\/\"><em>https:\/\/fred.stlouisfed.org\/<\/em><\/a><em>; Yahoo Finance API: <\/em><a href=\"https:\/\/finance.yahoo.com\/\"><em>https:\/\/finance.yahoo.com\/<\/em><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The estimated market exposure for the top quartile falls at the end of February (i.e., the estimated cash allocation rises), ahead of the market volatility that followed. The quartiles also switch over the results window: the top quartile holds the higher market exposure through December, when the trailing market return exceeds the cash return. The excess market return turns negative after February 20, 2025, which is also the last date the top quartile holds the higher market exposure. The exposure gap between quartiles therefore changes sign with the excess market return, as the shared trailing window implies. The bottom quartile holds the higher market exposure afterward, with the gap reaching roughly 80 percentage points on March 10, 2025. The excess market return is roughly -9% at that date, down from a high of roughly 11% on November 29, 2024. The performance difference between quartiles therefore corresponds to the difference in the estimated market versus cash split rather than to security selection within the funds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The chart below extends the comparison to the difference in median performance between quartiles, together with the difference implied by the estimated exposures.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"560\" height=\"280\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/median-market-exposure-actual-implied-yfscreeen.png\" alt=\"yfscreen: Yahoo Finance Screener in R and Python\" class=\"wp-image-257673 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/median-market-exposure-actual-implied-yfscreeen.png 560w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/05\/median-market-exposure-actual-implied-yfscreeen-300x150.png 300w\" data-sizes=\"(max-width: 560px) 100vw, 560px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 560px; aspect-ratio: 560\/280;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Data source: Federal Reserve Economic Data (FRED): <\/em><a href=\"https:\/\/fred.stlouisfed.org\/\"><em>https:\/\/fred.stlouisfed.org\/<\/em><\/a><em>; Yahoo Finance API: <\/em><a href=\"https:\/\/finance.yahoo.com\/\"><em>https:\/\/finance.yahoo.com\/<\/em><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The implied difference tracks the actual difference over the results window: the correlation between the two series is 0.87, although the shared trailing window raises the correlation by construction. Both series peak on November 29, 2024, when the implied difference of roughly 7 percentage points accounts for about two-thirds of the actual difference of roughly 11 percentage points. The residual between the two series is roughly constant, averaging 4 percentage points with a standard deviation of 1 percentage point, across months of different market conditions. Dispersion within quartiles keeps the residual positive even when the trailing market return is near the cash return, though the stability of the residual is an empirical result rather than a mechanical one. That is, the decomposition attributes the variation over time in the performance difference between quartiles to the estimated market versus cash split, and the roughly constant level of the residual to dispersion within quartiles.<\/p>\n\n\n\n<h2 id=\"h-conclusion\" class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>yfscreen<\/strong> package provides simple and efficient access to Yahoo Finance\u2019s screener API for querying and retrieving financial data. It abstracts the complexities of session management, crumb and cookie handling, query construction, pagination, and JSON payload generation. This allows users to focus on filtering and retrieving data across a range of security types, including equities, mutual funds, ETFs, indices, and futures. The package supports advanced query capabilities, such as logical operators, nested filters, and customizable payloads, and automatically handles pagination to retrieve large datasets efficiently. It is available for both R and Python to make it accessible for a broad audience. The analysis of tactical allocation mutual funds illustrates how the package can be used to estimate asset exposures and interpret positioning differences across funds, including a decomposition of the performance difference between quartiles into the estimated market versus cash split and dispersion within quartiles. The workflow is available in both languages: for more on constrained least squares, go to <a href=\"https:\/\/jasonjfoster.github.io\/posts\/optim-r\/\">https:\/\/jasonjfoster.github.io\/posts\/optim-r\/<\/a> for R code and <a href=\"https:\/\/jasonjfoster.github.io\/posts\/optim-py\/\">https:\/\/jasonjfoster.github.io\/posts\/optim-py\/<\/a> for Python code.<\/p>\n\n\n\n<h2 id=\"h-explore-more-articles-by-jason-foster\" class=\"wp-block-heading\">Explore more articles by Jason Foster:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/secfile-sec-edgar-filings-in-r-and-python\/\">secfile: SEC EDGAR Filings in R and Python<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/time-series-of-implied-shocks-using-principal-component-analysis\/\">Time-Series of Implied Shocks Using Principal Component Analysis<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, pagination, and JSON payload generation. <\/p>\n","protected":false},"author":1534,"featured_media":199475,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":true},"categories":[339,343,349,338,341,342],"tags":[4922,865,4804,595,487,6591,7852,19404],"contributors-categories":[17926],"class_list":["post-223541","post","type-post","status-publish","format-standard","has-post-thumbnail","category-data-science","category-programing-languages","category-python-development","category-ibkr-quant-news","category-quant-development","category-r-development","tag-econometrics","tag-github","tag-pypi","tag-python","tag-r","tag-rstats","tag-tactical-allocation","tag-yfscreen","contributors-categories-jason-foster"],"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 v28.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>yfscreen: Yahoo Finance Screener in R and Python<\/title>\n<meta name=\"description\" content=\"The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management\" \/>\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\/223541\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"yfscreen: Yahoo Finance Screener in R and Python\" \/>\n<meta property=\"og:description\" content=\"The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, pagination, and JSON payload generation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-28T16:40:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-28T16:41:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.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=\"Jason Foster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jason Foster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 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:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Jason Foster\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/cadf6fa1a2bad766b9b1f5d3cd889454\"\n\t            },\n\t            \"headline\": \"yfscreen: Yahoo Finance Screener in R and Python\",\n\t            \"datePublished\": \"2026-09-28T16:40:56+00:00\",\n\t            \"dateModified\": \"2026-09-28T16:41:36+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/\"\n\t            },\n\t            \"wordCount\": 1902,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/11\\\/large-option-delta-volume-trade-screener-finance.jpg\",\n\t            \"keywords\": [\n\t                \"Econometrics\",\n\t                \"GitHub\",\n\t                \"PyPi\",\n\t                \"Python\",\n\t                \"R\",\n\t                \"rstats\",\n\t                \"tactical allocation\",\n\t                \"yfscreen\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\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:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/\",\n\t            \"name\": \"yfscreen: Yahoo Finance Screener in R and Python | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/11\\\/large-option-delta-volume-trade-screener-finance.jpg\",\n\t            \"datePublished\": \"2026-09-28T16:40:56+00:00\",\n\t            \"dateModified\": \"2026-09-28T16:41:36+00:00\",\n\t            \"description\": \"The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/yfscreen-yahoo-finance-screener-in-r-and-python\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/11\\\/large-option-delta-volume-trade-screener-finance.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/11\\\/large-option-delta-volume-trade-screener-finance.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563\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\\\/cadf6fa1a2bad766b9b1f5d3cd889454\",\n\t            \"name\": \"Jason Foster\",\n\t            \"description\": \"Jason Foster is a director and risk manager for public and private credit portfolios at a global credit manager in New York. Previously, he was a risk manager on flagship fixed income and multi-asset portfolios at one of the world's largest asset managers. He is the author of open-source R and Python packages for analytical computation and financial data retrieval, available on CRAN and PyPI. Mr. Foster holds bachelor's degrees in mathematics and finance and a master's degree in financial engineering. https:\\\/\\\/www.linkedin.com\\\/in\\\/jasonjfoster\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/jasonfoster\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"yfscreen: Yahoo Finance Screener in R and Python","description":"The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management","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\/223541\/","og_locale":"en_US","og_type":"article","og_title":"yfscreen: Yahoo Finance Screener in R and Python","og_description":"The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, pagination, and JSON payload generation.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/","og_site_name":"IBKR Campus US","article_published_time":"2026-09-28T16:40:56+00:00","article_modified_time":"2026-09-28T16:41:36+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.jpg","type":"image\/jpeg"}],"author":"Jason Foster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jason Foster","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/#article","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/"},"author":{"name":"Jason Foster","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/cadf6fa1a2bad766b9b1f5d3cd889454"},"headline":"yfscreen: Yahoo Finance Screener in R and Python","datePublished":"2026-09-28T16:40:56+00:00","dateModified":"2026-09-28T16:41:36+00:00","mainEntityOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/"},"wordCount":1902,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.jpg","keywords":["Econometrics","GitHub","PyPi","Python","R","rstats","tactical allocation","yfscreen"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development","R Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/","url":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/","name":"yfscreen: Yahoo Finance Screener in R and Python | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/#primaryimage"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.jpg","datePublished":"2026-09-28T16:40:56+00:00","dateModified":"2026-09-28T16:41:36+00:00","description":"The core functionality of the yfscreen package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/yfscreen-yahoo-finance-screener-in-r-and-python\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.jpg","width":1000,"height":563},{"@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\/cadf6fa1a2bad766b9b1f5d3cd889454","name":"Jason Foster","description":"Jason Foster is a director and risk manager for public and private credit portfolios at a global credit manager in New York. Previously, he was a risk manager on flagship fixed income and multi-asset portfolios at one of the world's largest asset managers. He is the author of open-source R and Python packages for analytical computation and financial data retrieval, available on CRAN and PyPI. Mr. Foster holds bachelor's degrees in mathematics and finance and a master's degree in financial engineering. https:\/\/www.linkedin.com\/in\/jasonjfoster\/","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/jasonfoster\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/11\/large-option-delta-volume-trade-screener-finance.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/223541","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\/1534"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=223541"}],"version-history":[{"count":49,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/223541\/revisions"}],"predecessor-version":[{"id":257682,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/223541\/revisions\/257682"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/199475"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=223541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=223541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=223541"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=223541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}