{"id":236457,"date":"2025-12-23T12:50:32","date_gmt":"2025-12-23T17:50:32","guid":{"rendered":"https:\/\/ibkrcampus.com\/campus\/?p=236457"},"modified":"2025-12-24T05:44:19","modified_gmt":"2025-12-24T10:44:19","slug":"how-to-calculate-vwap-in-python-with-databento-and-pandas","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/","title":{"rendered":"How to Calculate VWAP in Python with Databento and Pandas"},"content":{"rendered":"\n<p><em>The article &#8220;How to Calculate VWAP in Python with Databento and Pandas&#8221; was originally published on <a href=\"https:\/\/databento.com\/blog\/vwap-python\">Databento<\/a> blog<\/em>.<\/p>\n\n\n\n<p>This guide explains the VWAP, its construction and use cases, and how you can compute it quickly in Python with data from&nbsp;<a href=\"https:\/\/databento.com\/\">Databento<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-overview\">Overview<\/h2>\n\n\n\n<p>The volume-weighted price average (VWAP) is a commonly used execution benchmark.<\/p>\n\n\n\n<p>For example, when executing a parent order over a fixed period, the execution quality may be evaluated based on the number of basis points (bps) that the average fill price was better than VWAP in that period.<\/p>\n\n\n\n<p>Since VWAP is widely used by agency execution desks to express execution quality, this creates a self-fulfilling effect where VWAP is an important price level and may be used as a predictive feature, especially at common execution horizons like 1 day.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-formulation\">Formulation<\/h2>\n\n\n\n<p>The formulation of VWAP is simple:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"661\" height=\"99\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/12\/vwap-databento.png\" alt=\"VWAP\" class=\"wp-image-236459 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/12\/vwap-databento.png 661w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/12\/vwap-databento-300x45.png 300w\" data-sizes=\"(max-width: 661px) 100vw, 661px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 661px; aspect-ratio: 661\/99;\" \/><\/figure>\n\n\n\n<p>There\u2019s no strict definition that you must use a specific form of price or sampling frequency. So it\u2019s possible to compute VWAP either with OHLCV aggregates or tick-by-tick with last sales (for that matter L1 or time and sales data)<\/p>\n\n\n\n<p>Since&nbsp;<strong>Databento<\/strong>&nbsp;supports&nbsp;<a href=\"https:\/\/databento.com\/docs\/schemas-and-data-formats?historical=python&amp;live=python&amp;reference=python\">multiple data formats<\/a>, also called \u201cschemas\u201d, we can easily demonstrate how to compute VWAP in both ways.<\/p>\n\n\n\n<p>Databento also has built-in support for&nbsp;<strong>pandas<\/strong>, which is great for this example because the sum products and elementwise operations in the VWAP formula are easily expressed in pandas with vectorized expressions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-computing-vwap-with-1-minute-bar-data\">Computing VWAP with 1-minute bar data<\/h3>\n\n\n\n<p>Charting apps often compute VWAP on OHLCV aggregates, say using 1-minute close prices and volumes. These can be obtained from Databento\u2019s&nbsp;<code>ohlcv-1m<\/code>&nbsp;<a href=\"https:\/\/databento.com\/docs\/schemas-and-data-formats\/ohlcv?historical=python&amp;live=python&amp;reference=python\">schema<\/a>.<\/p>\n\n\n\n<p>We\u2019ll replicate this on NVDA stock prices:<\/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=\"\">import databento as db\n\n\nclient = db.Historical(\"YOUR_API_KEY\")\n\ndata = client.timeseries.get_range(\n    dataset=\"XNAS.ITCH\",\n    start=\"2022-09-20\",\n    symbols=[\"NVDA\"],\n    stype_in=\"raw_symbol\",\n    schema=\"ohlcv-1m\",\n)\n\n# Convert to a DataFrame\nohlcv_data = data.to_df()\n\n# Calculate VWAP using close prices\nohlcv_data[\"pvt\"] = ohlcv_data[\"close\"] * ohlcv_data[\"volume\"]\n\n# Alternatively, calculate VWAP using mean of open, high, close prices\n# ohlcv_data[\"pvt\"] = ohlcv_data[[\"open\", \"high\", \"close\"]].mean(axis=1) * ohlcv_data[\"volume\"]\n\nohlcv_data[\"vwap\"] = ohlcv_data[\"pvt\"].cumsum() \/ ohlcv_data[\"volume\"].cumsum()\n\nprint(ohlcv_data[[\"symbol\", \"open\", \"close\", \"vwap\"]])<\/pre>\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=\"\">                         symbol     open    close           vwap\nts_event\n2022-09-20 08:00:00+00:00   NVDA  133.380  133.170  133.170000000\n2022-09-20 08:01:00+00:00   NVDA  133.170  133.340  133.232213115\n2022-09-20 08:02:00+00:00   NVDA  133.100  133.080  133.199489023\n2022-09-20 08:03:00+00:00   NVDA  133.100  133.050  133.161253521\n2022-09-20 08:04:00+00:00   NVDA  133.050  133.000  133.152816337\n2022-09-20 08:05:00+00:00   NVDA  132.950  132.920  133.151089030\n2022-09-20 08:06:00+00:00   NVDA  133.150  133.020  133.150363636\n2022-09-20 08:07:00+00:00   NVDA  133.020  132.920  133.131422007\n2022-09-20 08:08:00+00:00   NVDA  132.930  132.740  133.076282984\n2022-09-20 08:09:00+00:00   NVDA  132.870  132.880  133.059227851\n2022-09-20 08:10:00+00:00   NVDA  132.940  132.860  133.053750923<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-computing-vwap-with-tick-data\">Computing VWAP with tick data<\/h3>\n\n\n\n<p>It\u2019s easy to modify the above code to compute VWAP using tick-level trades instead, i.e. with Databento\u2019s&nbsp;<code>trades<\/code>&nbsp;<a href=\"https:\/\/databento.com\/docs\/schemas-and-data-formats\/trades?historical=python&amp;live=python&amp;reference=python\">schema<\/a>.<\/p>\n\n\n\n<p>There are only two small differences: the trade price is simply found in the&nbsp;<code>price<\/code>&nbsp;field and the volume is found in the&nbsp;<code>size<\/code>&nbsp;field:<\/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 = client.timeseries.get_range(\n    dataset=\"XNAS.ITCH\",\n    start=\"2022-09-20\",\n    symbols=[\"NVDA\"],\n    stype_in=\"raw_symbol\",\n    schema=\"trades\",    # Use tick-by-tick trades instead\n)\n\n# Convert to a DataFrame\ndf = data.to_df()\n\n# Calculate VWAP using close prices\ndf[\"pvt\"] = df[\"price\"] * df[\"size\"]\n\ndf[\"vwap\"] = df[\"pvt\"].cumsum() \/ df[\"size\"].cumsum()\n\nprint(df[[\"symbol\", \"price\", \"vwap\"]])<\/pre>\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=\"\">    symbol   price           vwap\nts_recv\n2022-09-20 08:00:18.777587048+00:00   NVDA  133.38  133.380000000\n2022-09-20 08:00:18.777587048+00:00   NVDA  133.42  133.386666667\n2022-09-20 08:00:18.777587048+00:00   NVDA  133.43  133.404000000\n2022-09-20 08:00:19.191961847+00:00   NVDA  133.40  133.403200000\n2022-09-20 08:00:29.302335850+00:00   NVDA  133.39  133.400645161\n...                                    ...     ...            ...\n2022-09-20 23:57:08.376523375+00:00   NVDA  131.54  132.503784836\n2022-09-20 23:57:24.638954944+00:00   NVDA  131.68  132.503783783\n2022-09-20 23:58:55.036247499+00:00   NVDA  131.60  132.503783668\n2022-09-20 23:59:09.753291472+00:00   NVDA  131.56  132.503782462\n2022-09-20 23:59:47.114153377+00:00   NVDA  131.53  132.503776864\n\n[101230 rows x 3 columns]<\/pre>\n\n\n\n<p>This example runs in under\u00a0<strong>1.8 seconds<\/strong>\u00a0end-to-end, including extraction of data, on a regular home workstation environment with Databento 0.39.0 and pandas 2.2.2.<\/p>\n\n\n\n<p><em>Visit <a href=\"https:\/\/databento.com\/blog\/vwap-python\">Databento<\/a> for additional insights on this topic.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The volume-weighted price average (VWAP) is a commonly used execution benchmark.<\/p>\n","protected":false},"author":186,"featured_media":193877,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":true,"footnotes":""},"categories":[339,343,349,338,341],"tags":[851,806,595],"contributors-categories":[18930],"class_list":{"0":"post-236457","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-python-development","10":"category-ibkr-quant-news","11":"category-quant-development","12":"tag-algo-trading","13":"tag-data-science","14":"tag-python","15":"contributors-categories-databento"},"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.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Calculate VWAP in Python with Databento and Pandas<\/title>\n<meta name=\"description\" content=\"The volume-weighted price average (VWAP) is a commonly used execution benchmark.\" \/>\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\/236457\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Calculate VWAP in Python with Databento and Pandas\" \/>\n<meta property=\"og:description\" content=\"The volume-weighted price average (VWAP) is a commonly used execution benchmark.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-23T17:50:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-24T10:44:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.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=\"Contributor Author\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Contributor Author\" \/>\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:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Contributor Author\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e823e46b42ca381080387e794318a485\"\n\t            },\n\t            \"headline\": \"How to Calculate VWAP in Python with Databento and Pandas\",\n\t            \"datePublished\": \"2025-12-23T17:50:32+00:00\",\n\t            \"dateModified\": \"2025-12-24T10:44:19+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/\"\n\t            },\n\t            \"wordCount\": 369,\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\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-blue-keyboard.jpg\",\n\t            \"keywords\": [\n\t                \"Algo Trading\",\n\t                \"Data Science\",\n\t                \"Python\"\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            ],\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\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/#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\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/\",\n\t            \"name\": \"How to Calculate VWAP in Python with Databento and Pandas | 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\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-blue-keyboard.jpg\",\n\t            \"datePublished\": \"2025-12-23T17:50:32+00:00\",\n\t            \"dateModified\": \"2025-12-24T10:44:19+00:00\",\n\t            \"description\": \"The volume-weighted price average (VWAP) is a commonly used execution benchmark.\",\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\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/\"\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\\\/how-to-calculate-vwap-in-python-with-databento-and-pandas\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-blue-keyboard.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-blue-keyboard.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Python\"\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\\\/e823e46b42ca381080387e794318a485\",\n\t            \"name\": \"Contributor Author\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/contributor-author\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Calculate VWAP in Python with Databento and Pandas","description":"The volume-weighted price average (VWAP) is a commonly used execution benchmark.","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\/236457\/","og_locale":"en_US","og_type":"article","og_title":"How to Calculate VWAP in Python with Databento and Pandas","og_description":"The volume-weighted price average (VWAP) is a commonly used execution benchmark.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/","og_site_name":"IBKR Campus US","article_published_time":"2025-12-23T17:50:32+00:00","article_modified_time":"2025-12-24T10:44:19+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.jpg","type":"image\/jpeg"}],"author":"Contributor Author","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Contributor Author","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/#article","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/"},"author":{"name":"Contributor Author","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e823e46b42ca381080387e794318a485"},"headline":"How to Calculate VWAP in Python with Databento and Pandas","datePublished":"2025-12-23T17:50:32+00:00","dateModified":"2025-12-24T10:44:19+00:00","mainEntityOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/"},"wordCount":369,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.jpg","keywords":["Algo Trading","Data Science","Python"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/","url":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/","name":"How to Calculate VWAP in Python with Databento and Pandas | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/#primaryimage"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.jpg","datePublished":"2025-12-23T17:50:32+00:00","dateModified":"2025-12-24T10:44:19+00:00","description":"The volume-weighted price average (VWAP) is a commonly used execution benchmark.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/how-to-calculate-vwap-in-python-with-databento-and-pandas\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.jpg","width":1000,"height":563,"caption":"Python"},{"@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\/e823e46b42ca381080387e794318a485","name":"Contributor Author","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/contributor-author\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-blue-keyboard.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/236457","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\/186"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=236457"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/236457\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/193877"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=236457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=236457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=236457"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=236457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}