{"id":291,"date":"2023-08-08T03:56:59","date_gmt":"2023-08-08T07:56:59","guid":{"rendered":"https:\/\/www.tiingo.com\/blog\/?p=291"},"modified":"2026-07-23T11:39:44","modified_gmt":"2026-07-23T15:39:44","slug":"python-finance","status":"publish","type":"post","link":"https:\/\/www.tiingo.com\/blog\/python-finance\/","title":{"rendered":"Using Python for Finance: A Practical Guide"},"content":{"rendered":"<p>Ask anyone doing serious market work what language they use and you&#8217;ll almost always get the same answer. Python for finance became the default for good reasons: the language reads nearly like English, it ships with batteries included, and the open-source data libraries built around it are some of the best software ever written, at any price. Hedge funds use them. Academic researchers use them. And &#8211; this is the part I love &#8211; a curious person with a laptop and a free API token can use the exact same tools. High-end tooling, made accessible to all.<\/p>\n<p>I&#8217;m a data nut, so rather than tell you Python is great, I&#8217;d rather show you. By the end of this guide you will have pulled real daily price history into Python, computed returns and volatility, and plotted the result &#8211; about 20 lines of code in total. No &#8220;what is Python&#8221; chapter and no machine learning detour. Just the actual work.<\/p>\n<h2>The Python for finance toolkit: four libraries that matter<\/h2>\n<p>There are hundreds of thousands of Python packages. Financial analysis with Python rests on a very small core of them:<\/p>\n<ul>\n<li><strong>requests<\/strong> &#8211; talks to web APIs. Any time you fetch data over HTTP, this is the tool. Simple, boring, reliable &#8211; exactly what you want.<\/li>\n<li><strong>pandas<\/strong> &#8211; the workhorse. Its DataFrame is a table with superpowers, practically born for time series: date indexes, rolling windows, resampling, joins.<\/li>\n<li><strong>numpy<\/strong> &#8211; fast numerical arrays and the math that runs on them. pandas is built on top of it, and you&#8217;ll reach for it directly whenever you need logs, square roots, or arithmetic across a whole column at once.<\/li>\n<li><strong>matplotlib<\/strong> &#8211; plotting. Not the flashiest charts out of the box, but it is everywhere and it just works.<\/li>\n<\/ul>\n<p>When you go deeper into statistics, <code>scipy<\/code> and <code>statsmodels<\/code> are waiting for you (hypothesis tests, regressions, and friends). But you can go a very long way with just the first three. Most exploratory market work is requests, pandas, and numpy, full stop.<\/p>\n<h2>Getting real market data into Python<\/h2>\n<p>Tutorials love toy CSVs. Markets are not toys, so let&#8217;s use real data: daily price history for Apple, pulled from our end-of-day API. If you want to follow along (please do &#8211; this is a typing-along kind of guide), grab a free API token at <a href=\"https:\/\/www.tiingo.com\/\">tiingo.com<\/a>. The free Starter plan is $0 and covers 500 unique symbols a month with 30+ years of price history, which is far more than everything in this article needs. We built the free tier to be genuinely useful on purpose &#8211; we don&#8217;t believe in holding good data hostage.<\/p>\n<pre><code>import requests\n\nurl = \"https:\/\/api.tiingo.com\/tiingo\/daily\/aapl\/prices\"\nparams = {\"token\": \"YOUR_TOKEN\", \"startDate\": \"2024-01-01\"}\ndata = requests.get(url, params=params).json()<\/code><\/pre>\n<p>That&#8217;s the entire fetch. <code>data<\/code> is now a list of dictionaries, one per trading day, and each one is a daily bar: <code>date<\/code>, <code>open<\/code>, <code>high<\/code>, <code>low<\/code>, <code>close<\/code>, and <code>volume<\/code>, plus adjusted versions of the prices and volume (<code>adjClose<\/code>, <code>adjOpen<\/code>, <code>adjHigh<\/code>, <code>adjLow<\/code>, <code>adjVolume<\/code>). Hold that thought on the adjusted fields &#8211; they matter far more than most newcomers realize, and they get their own section below. The full response format is in our <a href=\"https:\/\/www.tiingo.com\/documentation\/end-of-day\">end-of-day API documentation<\/a>.<\/p>\n<p>A list of dictionaries is fine. A DataFrame is better:<\/p>\n<pre><code>import pandas as pd\n\ndf = pd.DataFrame(data)\ndf[\"date\"] = pd.to_datetime(df[\"date\"])\ndf = df.set_index(\"date\").sort_index()<\/code><\/pre>\n<p>Three lines, each doing one job. <code>pd.DataFrame(data)<\/code> turns the list into a table. <code>pd.to_datetime<\/code> converts the date strings into real timestamps, which is what unlocks all of pandas&#8217; time-series machinery. And <code>set_index(\"date\").sort_index()<\/code> makes those dates the index, in chronological order, so slicing by date (<code>df.loc[\"2024-03\"]<\/code> for one month, for example) just works.<\/p>\n<p>Run <code>df.head()<\/code> and admire it for a second: a clean table of daily bars, one row per trading day, indexed by date. That structure &#8211; a datetime index with one column per field &#8211; is the foundation nearly all market data work in Python sits on. Get comfortable here and everything downstream gets easier.<\/p>\n<h2>Your first real analysis<\/h2>\n<p>Now the fun part. Let&#8217;s compute three of the most fundamental quantities in finance: daily returns, a moving average, and annualized volatility.<\/p>\n<pre><code>import numpy as np\n\ndf[\"return\"] = np.log(df[\"adjClose\"]).diff()\ndf[\"ma20\"] = df[\"adjClose\"].rolling(20).mean()\nannualized_vol = df[\"return\"].std(ddof=1) * np.sqrt(252)<\/code><\/pre>\n<p>Line by line:<\/p>\n<ul>\n<li><strong>Returns.<\/strong> <code>np.log(df[\"adjClose\"]).diff()<\/code> takes the logarithm of each adjusted close, then differences consecutive days. These are log returns, and quants are fond of them because they add cleanly across time: sum a month of daily log returns and you get the month&#8217;s log return. Notice we used <code>adjClose<\/code> rather than <code>close<\/code>. That is deliberate, and the section after next explains why.<\/li>\n<li><strong>Moving average.<\/strong> <code>.rolling(20).mean()<\/code> averages the prior 20 trading days at every point &#8211; roughly one month of trading. It smooths out the daily noise so the trend is visible.<\/li>\n<li><strong>Volatility.<\/strong> <code>.std(ddof=1)<\/code> is the sample standard deviation of those daily returns. Multiplying by <code>np.sqrt(252)<\/code> scales it to an annual figure, because a year has about 252 trading days and volatility grows with the square root of time. That single number, annualized vol, is the standard yardstick for how bumpy a ride a stock has been.<\/li>\n<\/ul>\n<p>Three lines, and you&#8217;ve done genuine quantitative analysis &#8211; the same calculations that sit inside professional risk systems. One caveat that applies to everything in this guide: these numbers describe the past. They are not a prediction, and nothing here is investment advice.<\/p>\n<h2>Plotting it<\/h2>\n<p>Numbers in a table hide things a chart makes obvious. Context in markets is everything, and a chart is the fastest context there is.<\/p>\n<pre><code>import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots(figsize=(10, 5))\nax.plot(df.index, df[\"adjClose\"], label=\"Adjusted close\")\nax.plot(df.index, df[\"ma20\"], label=\"20-day moving average\")\nax.set_title(\"AAPL adjusted close\")\nax.legend()\nplt.show()<\/code><\/pre>\n<p><code>plt.subplots<\/code> creates the figure, the two <code>ax.plot<\/code> calls draw the price and its rolling average against the date index, and <code>plt.show()<\/code> renders it. You should see the price wiggling around a smoother line &#8211; the moving average trailing the close like a calm friend. When the two cross, that&#8217;s the kind of moment traders start arguing about.<\/p>\n<h2>Why adjusted prices matter<\/h2>\n<p>Here is the gotcha that bites nearly everyone exactly once.<\/p>\n<p>Suppose a company does a 4-for-1 stock split. Every shareholder now owns four shares at a quarter of the price, so economically nothing happened. But in the raw <code>close<\/code> column, the price just dropped roughly 75% overnight. If you compute returns from <code>close<\/code> instead of <code>adjClose<\/code>, your data now contains a catastrophic crash that never occurred, and every statistic downstream of it &#8211; volatility, correlations, backtest results &#8211; is quietly poisoned. One split can undo months of careful work.<\/p>\n<p>Dividends are subtler but just as real. When a company pays a dividend, its price typically dips by about that amount, but shareholders received cash. Raw closes record the dip and ignore the cash, so a returns series built on them understates what holding the stock actually earned. Compound that over years of a steady dividend payer and the gap becomes serious.<\/p>\n<p>Adjusted prices fix both: splits and dividends are folded back into the series so the numbers reflect economic reality. That is why every calculation in this guide uses <code>adjClose<\/code>.<\/p>\n<p>It is also exactly the kind of thing your data provider should carry for you. Corporate actions are constant, messy, and deeply unglamorous, and handling them well is a monk-like responsibility &#8211; clean data should be boring. Every price we serve is split- and dividend-adjusted and error-checked, precisely so that a returns calculation written at your kitchen table behaves like one written on a trading desk.<\/p>\n<h2>Where to go next<\/h2>\n<p>You now have the loop that most professional market work is built on: fetch, frame, compute, plot. Some natural next steps, in rough order of fun:<\/p>\n<ul>\n<li><strong>Backtest a simple rule.<\/strong> You already have a moving average; you could test what holding only when price sits above it would have done historically. Be ruthlessly skeptical of your own results &#8211; the classic mistake is letting tomorrow&#8217;s information sneak into today&#8217;s decision, and it flatters every strategy it touches.<\/li>\n<li><strong>Go deeper into history.<\/strong> Our end-of-day data reaches back to 1962. Long histories keep you honest: an idea that looks brilliant over five years can fall apart over fifty. The <a href=\"https:\/\/www.tiingo.com\/products\/stock-api\">stock API<\/a> covers 80,000+ assets across US equities, ETFs, mutual funds, and Chinese A-shares, so there is plenty to explore.<\/li>\n<li><strong>Add context.<\/strong> Prices tell you what happened; fundamentals and news help explain why. We carry 20+ years of fundamentals and 70M+ news articles, and they join onto your price DataFrame with the same pandas patterns you just learned.<\/li>\n<li><strong>Automate it.<\/strong> A small script on a nightly schedule (cron is fine) can pull fresh bars and append them to a growing local dataset. The Starter plan&#8217;s limits &#8211; 50 requests an hour, 1,000 a day &#8211; fit a nightly job comfortably.<\/li>\n<li><strong>Try other markets.<\/strong> The same fetch-and-frame pattern works for our crypto data (150+ exchanges) and forex (140+ currency pairs). Different tickers, same muscle memory.<\/li>\n<\/ul>\n<p>And yes, eventually machine learning, if that&#8217;s your thing &#8211; but the fundamentals above will carry you further than most people expect.<\/p>\n<h2>The bottom line<\/h2>\n<p>You don&#8217;t need expensive terminals or anyone&#8217;s permission to do real financial analysis anymore. A laptop, about 20 lines of Python, and good clean data will get you from zero to returns, volatility, and a chart in an afternoon. That accessibility is the whole reason Tiingo exists: we&#8217;ve been making high-end market data accessible and affordable since 2014, with no outside investors and 8+ years of profitability, which is what lets us keep asking &#8220;how much can we give?&#8221; instead of &#8220;how much can we charge?&#8221; Our motto is Actively Do Good, and handing a beginner the same data quality a fund gets is our favorite way of doing it.<\/p>\n<p>The Starter plan is $0, and if you outgrow it, <a href=\"https:\/\/www.tiingo.com\/pricing\">plans start at $30\/month<\/a> for individuals. Grab a <a href=\"https:\/\/www.tiingo.com\/\">free API token<\/a>, paste in the snippets above, and go analyze something. If you build something neat, we&#8217;d genuinely love to see it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ask anyone doing serious market work what language they use and you&#8217;ll almost always get the same answer. Python for finance became the default for good reasons: the language reads nearly like English, it ships with batteries included, and the open-source data libraries built around it are some of the best software ever written, at [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":688,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"osom_blocks_metabox":"","inline_featured_image":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-291","post","type-post","status-publish","format-standard","has-post-thumbnail","category-engineering","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.3 (Yoast SEO v28.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Using Python for Finance: A Practical Guide - Tiingo Blog<\/title>\n<meta name=\"description\" content=\"A practical guide to Python for finance: pull real market data with requests, load it into pandas, compute returns and volatility, and plot it in about 20 lines.\" \/>\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.tiingo.com\/blog\/python-finance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Python for Finance: A Practical Guide\" \/>\n<meta property=\"og:description\" content=\"A practical guide to Python for finance: pull real market data with requests, load it into pandas, compute returns and volatility, and plot it in about 20 lines.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tiingo.com\/blog\/python-finance\/\" \/>\n<meta property=\"og:site_name\" content=\"Tiingo Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/tiingofinance\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-08T07:56:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-23T15:39:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/green-python.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"835\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rishi S.\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tiingofinance\" \/>\n<meta name=\"twitter:site\" content=\"@tiingofinance\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rishi S.\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/\"},\"author\":{\"name\":\"Rishi S.\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#\\\/schema\\\/person\\\/54fc93e1626ed221a37fcfddb597c3d6\"},\"headline\":\"Using Python for Finance: A Practical Guide\",\"datePublished\":\"2023-08-08T07:56:59+00:00\",\"dateModified\":\"2026-07-23T15:39:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/\"},\"wordCount\":1564,\"publisher\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/h291.png\",\"articleSection\":[\"Engineering\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/\",\"url\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/\",\"name\":\"Using Python for Finance: A Practical Guide - Tiingo Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/h291.png\",\"datePublished\":\"2023-08-08T07:56:59+00:00\",\"dateModified\":\"2026-07-23T15:39:44+00:00\",\"description\":\"A practical guide to Python for finance: pull real market data with requests, load it into pandas, compute returns and volatility, and plot it in about 20 lines.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/h291.png\",\"contentUrl\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/h291.png\",\"width\":1200,\"height\":630,\"caption\":\"Flat illustration of a code editor window showing Python fetching market data from an API\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/python-finance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Python for Finance: A Practical Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/\",\"name\":\"Tiingo API Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#organization\",\"name\":\"Tiingo.com\",\"url\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/api.tiingo.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/purple-for-light-bg.svg\",\"contentUrl\":\"https:\\\/\\\/api.tiingo.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/purple-for-light-bg.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"Tiingo.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/tiingofinance\\\/\",\"https:\\\/\\\/x.com\\\/tiingofinance\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/#\\\/schema\\\/person\\\/54fc93e1626ed221a37fcfddb597c3d6\",\"name\":\"Rishi S.\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28ae16ae1fe9df62492ab4b742241b19a6a12395109570074a7b8194c6709ec4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28ae16ae1fe9df62492ab4b742241b19a6a12395109570074a7b8194c6709ec4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28ae16ae1fe9df62492ab4b742241b19a6a12395109570074a7b8194c6709ec4?s=96&d=mm&r=g\",\"caption\":\"Rishi S.\"},\"description\":\"Rishi Singh is the CEO of Tiingo.com. A prior algorithmic and quant researcher, Rishi started Tiingo.com to modernize the financial data vertical by focusing on data acquisition, cleansing, aggregation, innovation, and distribution of data.\",\"sameAs\":[\"http:\\\/\\\/www.tiingo.com\"],\"url\":\"https:\\\/\\\/www.tiingo.com\\\/blog\\\/author\\\/rishi-s\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Python for Finance: A Practical Guide - Tiingo Blog","description":"A practical guide to Python for finance: pull real market data with requests, load it into pandas, compute returns and volatility, and plot it in about 20 lines.","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.tiingo.com\/blog\/python-finance\/","og_locale":"en_US","og_type":"article","og_title":"Using Python for Finance: A Practical Guide","og_description":"A practical guide to Python for finance: pull real market data with requests, load it into pandas, compute returns and volatility, and plot it in about 20 lines.","og_url":"https:\/\/www.tiingo.com\/blog\/python-finance\/","og_site_name":"Tiingo Blog","article_publisher":"https:\/\/www.facebook.com\/tiingofinance\/","article_published_time":"2023-08-08T07:56:59+00:00","article_modified_time":"2026-07-23T15:39:44+00:00","og_image":[{"width":1200,"height":835,"url":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/green-python.jpeg","type":"image\/jpeg"}],"author":"Rishi S.","twitter_card":"summary_large_image","twitter_creator":"@tiingofinance","twitter_site":"@tiingofinance","twitter_misc":{"Written by":"Rishi S.","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#article","isPartOf":{"@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/"},"author":{"name":"Rishi S.","@id":"https:\/\/www.tiingo.com\/blog\/#\/schema\/person\/54fc93e1626ed221a37fcfddb597c3d6"},"headline":"Using Python for Finance: A Practical Guide","datePublished":"2023-08-08T07:56:59+00:00","dateModified":"2026-07-23T15:39:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/"},"wordCount":1564,"publisher":{"@id":"https:\/\/www.tiingo.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#primaryimage"},"thumbnailUrl":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/h291.png","articleSection":["Engineering"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/","url":"https:\/\/www.tiingo.com\/blog\/python-finance\/","name":"Using Python for Finance: A Practical Guide - Tiingo Blog","isPartOf":{"@id":"https:\/\/www.tiingo.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#primaryimage"},"image":{"@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#primaryimage"},"thumbnailUrl":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/h291.png","datePublished":"2023-08-08T07:56:59+00:00","dateModified":"2026-07-23T15:39:44+00:00","description":"A practical guide to Python for finance: pull real market data with requests, load it into pandas, compute returns and volatility, and plot it in about 20 lines.","breadcrumb":{"@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.tiingo.com\/blog\/python-finance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#primaryimage","url":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/h291.png","contentUrl":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/h291.png","width":1200,"height":630,"caption":"Flat illustration of a code editor window showing Python fetching market data from an API"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tiingo.com\/blog\/python-finance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.tiingo.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Python for Finance: A Practical Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.tiingo.com\/blog\/#website","url":"https:\/\/www.tiingo.com\/blog\/","name":"Tiingo API Blog","description":"","publisher":{"@id":"https:\/\/www.tiingo.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.tiingo.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.tiingo.com\/blog\/#organization","name":"Tiingo.com","url":"https:\/\/www.tiingo.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.tiingo.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/api.tiingo.com\/blog\/wp-content\/uploads\/2023\/05\/purple-for-light-bg.svg","contentUrl":"https:\/\/api.tiingo.com\/blog\/wp-content\/uploads\/2023\/05\/purple-for-light-bg.svg","width":"1024","height":"1024","caption":"Tiingo.com"},"image":{"@id":"https:\/\/www.tiingo.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/tiingofinance\/","https:\/\/x.com\/tiingofinance"]},{"@type":"Person","@id":"https:\/\/www.tiingo.com\/blog\/#\/schema\/person\/54fc93e1626ed221a37fcfddb597c3d6","name":"Rishi S.","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/28ae16ae1fe9df62492ab4b742241b19a6a12395109570074a7b8194c6709ec4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/28ae16ae1fe9df62492ab4b742241b19a6a12395109570074a7b8194c6709ec4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28ae16ae1fe9df62492ab4b742241b19a6a12395109570074a7b8194c6709ec4?s=96&d=mm&r=g","caption":"Rishi S."},"description":"Rishi Singh is the CEO of Tiingo.com. A prior algorithmic and quant researcher, Rishi started Tiingo.com to modernize the financial data vertical by focusing on data acquisition, cleansing, aggregation, innovation, and distribution of data.","sameAs":["http:\/\/www.tiingo.com"],"url":"https:\/\/www.tiingo.com\/blog\/author\/rishi-s\/"}]}},"featured_image_src":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/h291-600x400.png","featured_image_src_square":"https:\/\/www.tiingo.com\/blog\/wp-content\/uploads\/2023\/08\/h291-600x600.png","author_info":{"display_name":"Rishi S.","author_link":"https:\/\/www.tiingo.com\/blog\/author\/rishi-s\/"},"_links":{"self":[{"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/posts\/291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/comments?post=291"}],"version-history":[{"count":2,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/posts\/291\/revisions"}],"predecessor-version":[{"id":687,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/posts\/291\/revisions\/687"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/media\/688"}],"wp:attachment":[{"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/media?parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/categories?post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tiingo.com\/blog\/wp-json\/wp\/v2\/tags?post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}