1<!DOCTYPE html> 2<html lang="en"> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial-scale=1"> 7 <meta name="description" content="API Documentation for Alpha Vantage. Alpha Vantage offers free JSON APIs for realtime and historical stock market data & options data with over 50 technical indicators. Supports intraday, daily, weekly, and monthly stock quotes and technical analysis with charting-ready time series. "> 8 9 <title>API Documentation | Alpha Vantage</title> 10 11 <!-- Scripts --> 12 <!-- Google tag (gtag.js) -->
vendor: 68 bytes, lines 12-13
12 13 <script async src="https://www.googletagmanager.com/gtag/js?id=
13G-FQEDGD32JV
vendor: 16 bytes, lines 13-14
13"></script> 14
14<script> 15
vendor: 146 bytes, lines 15-19
15window.dataLayer = window.dataLayer || []; 16 function gtag(){dataLayer.push(arguments);} 17 gtag('js', new Date()); 18 19 gtag('config', '
19G-FQEDGD32JV
vendor: 8 bytes, lines 19-20
19'); 20
20</script>
20 21 22
22<script>!function(w,d,s,u){if(w.oaiq)return;var q=function(){q.q.push(arguments)};q.q=[];w.oaiq=q;var j=d.createElement(s);j.async=1;j.src=u;var f=d.getElementsByTagName(s)[0];f.parentNode.insertBefore(j,f)}(window,document,"script","https://bzrcdn.openai.com/sdk/oaiq.min.js");oaiq("init",{pixelId:"7fcjg8nFJtW8vxh9FvVQWv",debug:true});</script>
22 23 24
24<script> 25 (function(){if(!window.chatbase||window.chatbase("getState")!=="initialized"){window.chatbase=(...arguments)=>{if(!window.chatbase.q){window.chatbase.q=[]}window.chatbase.q.push(arguments)};window.chatbase=new Proxy(window.chatbase,{get(target,prop){if(prop==="q"){return target.q}return(...args)=>target(prop,...args)}})}const onLoad=function(){const script=document.createElement("script");script.src="https://www.chatbase.co/embed.min.js";script.id="a_DkhsL8IBuhoPYYWDawG";script.domain="www.chatbase.co";document.body.appendChild(script)};if(document.readyState==="complete"){onLoad()}else{window.addEventListener("load",onLoad)}})(); 26 </script>
26 27 28 <!-- Styles --> 29 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/styles/github.min.css"> 30 <link href="/static/css/theDocs.all.min.css" rel="stylesheet"> 31 <link href="/static/css/custom.css" rel="stylesheet"> 32 33 <!-- Fonts --> 34 <link href='https://fonts.googleapis.com/css?family=Raleway:100,300,400,500%7CLato:300,400' rel='stylesheet' type='text/css'> 35 36 <!-- Favicons --> 37 <link rel="icon" href="/static/img/favicon.ico"> 38 39 <style> 40 41 .premium-msg { 42 border: 2px solid #5cc7b2; 43 padding: 5px; 44 } 45 46 .code-btn-active{ 47 text-align: center; 48 background-color: #5cc7b2; 49 border-radius: 3px; 50 border: 2px solid #5cc7b2; 51 } 52 53 .code-btn-default{ 54 text-align: center; 55 background-color: lightgray; 56 border-radius: 3px; 57 border: 2px solid lightgray; 58 } 59 60 .language-name { 61 display: none; 62 } 63 64 .clipboard-copy { 65 display: none; 66 } 67 68 .exclusive-label { 69 background-color: purple; 70 border: none; 71 border-radius: 0px; 72 color: #fff; 73 font-weight: normal; 74 font-size: 90%; 75 line-height: 12px; 76 margin-left: 12px; 77 padding: 2px 4px; 78 } 79 80 .utility-label { 81 background-color: lightslategray; 82 border: none; 83 border-radius: 0px; 84 color: #fff; 85 font-weight: normal; 86 font-size: 90%; 87 line-height: 12px; 88 margin-left: 12px; 89 padding: 2px 4px; 90 } 91 92 .premium-label { 93 background-color: dodgerblue; 94 border: none; 95 border-radius: 0px; 96 color: #fff; 97 font-weight: normal; 98 font-size: 90%; 99 line-height: 12px; 100 margin-left: 12px; 101 padding: 2px 4px; 102 } 103 104 table{ 105 border-collapse:collapse; 106 border:1px solid black; 107 } 108 109 table td{ 110 border:1px solid black; 111 padding:5px; 112 } 113 114 table th{ 115 border:1px solid black; 116 text-align:center; 117 } 118 119 </style> 120 121 </head> 122 123 <body data-spy="scroll" data-target=".sidebar" data-offset="200"> 124 125 126 <!-- Sidebar --> 127 <aside class="sidebar sidebar-boxed sidebar-dark"> 128 129 <ul class="nav sidenav"> 130 <li id="table-of-contents"><a href="#">Table of Contents</a></li> 131 132 <li><a href="#time-series-data">Core Stock APIs</a> 133 <ul> 134 <li><a href="#intraday">Intraday <span class="popular-label">Trending</span></a></li> 135 <li><a href="#daily">Daily</a></li> 136 <li><a href="#dailyadj">Daily Adjusted <span class="popular-label">Trending</span></a></li> 137 <li><a href="#weekly">Weekly</a></li> 138 <li><a href="#weeklyadj">Weekly Adjusted </a></li> 139 <li><a href="#monthly">Monthly</a></li> 140 <li><a href="#monthlyadj">Monthly Adjusted</a></li> 141 <li><a href="#latestprice">Quote Endpoint <span class="popular-label">Trending</span></a></li> 142 <li><a href="#realtime-bulk-quotes">Realtime Bulk Quotes <span class="premium-label">Premium</span></a></li> 143 <li><a href="#realtime-bulk-bid-ask-prices">Realtime Bulk Bid & Ask Prices</a></li> 144 <li><a href="#symbolsearch">Ticker Search <span class="utility-label">ð§ Utility</span></a></li> 145 <li><a href="#market-status">Global Market Status <span class="utility-label">ð§ Utility</span></a></li> 146 </ul> 147 </li> 148 149 <li><a href="#index-data">Index Data APIs <span class="premium-label">Premium</span></a> 150 <ul> 151 <li><a href="#index-data-dow">Dow Jones Industrial Average</a></li> 152 <li><a href="#index-data-sp500">S&P 500 <span class="popular-label">Trending</span></a></li> 153 <li><a href="#index-data-nasdaq">Nasdaq Composite <span class="popular-label">Trending</span></a></li> 154 <li><a href="#index-data-nasdaq100">Nasdaq 100</a></li> 155 <li><a href="#index-data-vix">CBOE VIX <span class="popular-label">Trending</span></a></li> 156 <li><a href="#index-data-russell">Russell 2000</a></li> 157 <li><a href="#index-data-other">Other Major Indices</a></li> 158 <li><a href="#index-catalog">
158Index Catalog <span class="utility-label">ð§ Utility</span></a></li> 159 </ul> 160 </li> 161 162 <li><a href="#options">Options Data APIs</a> 163 <ul> 164 <li><a href="#realtime-options">Realtime Options <span class="popular-label">Trending</span></a></li> 165 <li><a href="#realtime-put-call-ratio">Realtime Put-Call Ratio</a></li> 166 <li><a href="#realtime-volume-open-interest-ratio">Realtime Volume-to-OI Ratio</a></li> 167 <li><a href="#historical-options">Historical Options <span class="popular-label">Trending</span></a></li> 168 <li><a href="#historical-put-call-ratio">Historical Put-Call Ratio</a></li> 169 <li><a href="#historical-volume-open-interest-ratio">Historical Volume-to-OI Ratio</a></li> 170 </ul> 171 </li> 172 173 <li><a href="#intelligence">Alpha Intelligence™</a> 174 <ul> 175 <li><a href="#news-sentiment">News & Sentiments <span class="popular-label">Trending</span></a></li> 176 <li><a href="#transcript">Earnings Call Transcript</a></li> 177 <li><a href="#gainer-loser">Top Gainers & Losers</a></li> 178 <li><a href="#insider-transactions">Insider Transactions <span class="popular-label">Trending</span></a></li> 179 <li><a href="#congress-trades">Congress Trades <span class="popular-label">Trending</span></a></li> 180 <li><a href="#politician-metadata">Politician Metadata <span class="utility-label">ð§ Utility</span></a></li> 181 <li><a href="#institutional-holdings">Institutional Holdings</a></li> 182 <li><a href="#analytics-fixed-window">Analytics (Fixed Window)</a></li> 183 <li><a href="#analytics-sliding-window">Analytics (Sliding Window)</a></li> 184 </ul> 185 </li> 186 187 <li><a href="#fundamentals">Fundamental Data</a> 188 <ul> 189 <li><a href="#company-overview">Company Overview <span class="popular-label">Trending</span></a></li> 190 <li><a href="#company-logo">Company Logo</a></li> 191 <li><a href="#etf-profile">ETF Profile & Holdings</a></li> 192 <li><a href="#dividends">Corporate Action - Dividends</a></li> 193 <li><a href="#splits">Corporate Action - Splits</a></li> 194 <li><a href="#income-statement">Income Statement</a></li> 195 <li><a href="#balance-sheet">Balance Sheet</a></li> 196 <li><a href="#cash-flow">Cash Flow</a></li> 197 <li><a href="#shares-outstanding">Shares Outstanding</a></li> 198 <li><a href="#earnings">Earnings History</a></li> 199 <li><a href="#earnings-estimates">Earnings Estimates <span class="popular-label">Trending</span></a></li> 200 <li><a href="#listing-status">Listing/Delisting Status <span class="utility-label">ð§ Utility</span></a></li> 201 <li><a href="#earnings-calendar">Earnings Calendar</a></li> 202 <li><a href="#ipo-calendar">IPO Calendar</a></li> 203 </ul> 204 </li> 205 206 <li><a href="#fx">Forex (FX)</a> 207 <ul> 208 <li><a href="#currency-exchange">Exchange Rates <span class="popular-label">Trending</span></a></li> 209 <li><a href="#fx-intraday">Intraday <span class="premium-label">Premium</span></a></li> 210 <li><a href="#fx-daily">Daily </a></li> 211 <li><a href="#fx-weekly">Weekly </a></li> 212 <li><a href="#fx-monthly">Monthly </a></li> 213 </ul> 214 </li> 215 216 217 <li><a href="#digital-currency">Cryptocurrencies</a> 218 <ul> 219 <li><a href="#crypto-exchange">Exchange Rates <span class="popular-label">Trending</span></a></li> 220 <li><a href="#crypto-intraday">Intraday <span class="premium-label">Premium</span></a></li> 221 <li><a href="#currency-daily">Daily</a></li> 222 <li><a href="#currency-weekly">Weekly</a></li> 223 <li><a href="#currency-monthly">Monthly</a></li> 224 </ul> 225 </li> 226 227 <li><a href="#commodities">Commodities</a> 228 <ul> 229 <li><a href="#gold-silver-spot">Gold & Silver (Spot) <span class="popular-label">Trending</span></a></li> 230 <li><a href="#gold-silver-history">Gold & Silver (History) <span class="popular-label">Trending</span></a></li> 231 <li><a href="#wti">Crude Oil (WTI)</a></li> 232 <li><a href="#brent">Crude Oil (Brent) <span class="popular-label">Trending</span></a></li> 233 <li><a href="#natural-gas">Natural Gas</a></li> 234 <li><a href="#copper">Copper</a></li> 235 <li><a href="#aluminum">Aluminum</a></li> 236 <li><a href="#wheat">Wheat</a></li> 237 <li><a href="#corn">Corn</a></li> 238 <li><a href="#cotton">Cotton</a></li> 239 <li><a href="#sugar">Sugar</a></li> 240 <li><a href="#coffee">Coffee</a></li> 241 <li><a href="#all-commodities">Global Commodities Index</a></li> 242 </ul> 243 </li> 244 245 246 <li><a href="#economic-indicators">Economic Indicators</a> 247 <ul> 248 <li><a href="#real-gdp">Real GDP <span class="popular-label">Trending</span></a></li> 249 <li><a href="#real-gdp-per-capita">Real GDP per Capita</a></li> 250 <li><a href="#treasury-yield">Treasury Yield <span class="popular-label">Trending</span></a></li> 251 <li><a href="#interest-rate">Federal Funds (Interest) Rate</a></li> 252 <li><a href="#cpi">CPI</a></li> 253 <li><a href="#inflation">Inflation</a></li> 254 <li><a href="#retail-sales">Retail Sales</a></li> 255 <li><a href="#durable-goods">Durable Goods Orders</a></li> 256 <li><a href="#unemployment">Unemployment Rate</a></li> 257 <li><a href="#nonfarm-payroll">Nonfarm Payroll</a></li> 258 </ul> 259 </li> 260 261 <li> 262 <a href="#technical-indicators">Technical Indicators</a> 263 <ul> 264 <li><a href="#sma">SMA <span class="popular-label">Trending</span></a></li> 265 <li><a href="#ema">EMA <span class="popular-label">Trending</span></a></li> 266 <li><a href="#wma">WMA</a></li> 267 <li><a href="#dema">DEMA</a></li> 268 <li><a href="#tema">TEMA</a></li> 269 <li><a href="#trima">TRIMA</a></li> 270 <li><a href="#kama">KAMA</a></li> 271 <li><a href="#mama">MAMA</a></li> 272 <li><a href="#vwap">VWAP <span class="premium-label">Premium</span></a></li> 273 <li><a href="#t3">T3</a></li> 274 <li><a href="#macd">MACD <span class="premium-label">Premium</span></a></li> 275 <li><a href="#macdext">MACDEXT</a></li> 276 <li><a href="#stoch">STOCH <span class="popular-label">Trending</span></a></li> 277 <li><a href="#stochf">STOCHF</a></li> 278 <li><a href="#rsi">RSI <span class="popular-label">Trending</span></a></li> 279 <li><a href="#stochrsi">STOCHRSI</a></li> 280 <li><a href="#willr">WILLR</a></li> 281 <li><a href="#adx">ADX <span class="popular-label">Trending</span></a></li> 282 <li><a href="#adxr">ADXR</a></li> 283 <li><a href="#apo">
283APO</a></li> 284 <li><a href="#ppo">PPO</a></li> 285 <li><a href="#mom">MOM</a></li> 286 <li><a href="#bop">BOP</a></li> 287 <li><a href="#cci">CCI <span class="popular-label">Trending</span></a></li> 288 <li><a href="#cmo">CMO</a></li> 289 <li><a href="#roc">ROC</a></li> 290 <li><a href="#rocr">ROCR</a></li> 291 <li><a href="#aroon">AROON <span class="popular-label">Trending</span></a></li> 292 <li><a href="#aroonosc">AROONOSC</a></li> 293 <li><a href="#mfi">MFI</a></li> 294 <li><a href="#trix">TRIX</a></li> 295 <li><a href="#ultosc">ULTOSC</a></li> 296 <li><a href="#dx">DX</a></li> 297 <li><a href="#minusdi">MINUS_DI</a></li> 298 <li><a href="#plusdi">PLUS_DI</a></li> 299 <li><a href="#minusdm">MINUS_DM</a></li> 300 <li><a href="#plusdm">PLUS_DM</a></li> 301 <li><a href="#bbands">BBANDS <span class="popular-label">Trending</span></a></li> 302 <li><a href="#midpoint">MIDPOINT</a></li> 303 <li><a href="#midprice">MIDPRICE</a></li> 304 <li><a href="#sar">SAR</a></li> 305 <li><a href="#trange">TRANGE</a></li> 306 <li><a href="#atr">ATR</a></li> 307 <li><a href="#natr">NATR</a></li> 308 <li><a href="#ad">AD <span class="popular-label">Trending</span></a></li> 309 <li><a href="#adosc">ADOSC</a></li> 310 <li><a href="#obv">OBV <span class="popular-label">Trending</span></a></li> 311 <li><a href="#httrendline">HT_TRENDLINE</a></li> 312 <li><a href="#htsine">HT_SINE</a></li> 313 <li><a href="#httrendmode">HT_TRENDMODE</a></li> 314 <li><a href="#htdcperiod">HT_DCPERIOD</a></li> 315 <li><a href="#htdcphase">HT_DCPHASE</a></li> 316 <li><a href="#htphasor">HT_PHASOR</a></li> 317 318 </ul> 319 </li> 320 321 </ul> 322 323 </aside> 324 <!-- END Sidebar --> 325 326 327 <header class="site-header navbar-transparent"> 328 329 <!-- Top navbar & branding --> 330 <nav class="navbar navbar-default"> 331 <div class="container-fluid"> 332 333 <!-- Toggle buttons and brand --> 334 <div class="navbar-header"> 335 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar" aria-expanded="true" aria-controls="navbar"> 336 <span class="glyphicon glyphicon-option-vertical"></span> 337 </button> 338 339 <button type="button" class="navbar-toggle for-sidebar" data-toggle="offcanvas"> 340 <span class="icon-bar"></span> 341 <span class="icon-bar"></span> 342 <span class="icon-bar"></span> 343 </button> 344 345 </div> 346 <!-- END Toggle buttons and brand --> 347 348 <!-- Top navbar --> 349 <div id="navbar" class="navbar-collapse collapse" aria-expanded="true" role="banner"> 350 <ul class="nav navbar-nav navbar-right"> 351 <li><a href="https://www.alphavantage.co/" target="_blank">Stock API Home</a></li> 352 <li class="active"><a href="">Documentation</a></li> 353 <li><a href="https://mcp.alphavantage.co/" target="_blank">â¨MCP + AI Agents</a></li> 354 <li><a href="https://trading-agents.ai/" target="_blank">Equity Research</a></li> 355 <li><a href="https://www.alphavantage.co/spreadsheets/" target="_blank">Spreadsheets</a></li> 356 <li><a href="https://www.alphavantage.co/academy/" target="_blank">Academy</a></li> 357 <li><a href="https://www.alphavantage.co/support/#support" target="_blank">Support</a></li> 358 </ul> 359 </div> 360 <!-- END Top navbar --> 361 362 </div> 363 </nav> 364 <!-- END Top navbar & branding --> 365 366 <!-- Banner --> 367 <div class="banner auto-size" style="background-color: #5cc7b2"> 368 <div class="container-fluid text-white"> 369 <h1><strong>Alpha Vantage</strong> API Documentation</h1> 370 </div> 371 </div> 372 <!-- END Banner --> 373 374 </header> 375 376 <main class="container-fluid"> 377 378 <!-- Main content --> 379 <article class="main-content" role="main"> 380 381 <p class="lead">Spanning over 130 endpoints, our market data APIs are grouped into 9 broad asset classes / categories: (1) Core Time Series Stock Data APIs covering stocks, ETFs, and mutual funds, (2) Index Data APIs, (3) Options Data APIs, (4) Alpha Intelligence covering news and sentiments, earnings call transcripts, insider transactions, congressional/politician trades, institutional holdings, top gainers and losers, and other market insights, (5) Fundamental Data, (6) Forex and Crypto Currencies (e.g., Bitcoin), (7) Commodities, (8) Economic Indicators, and (9) Technical Indicators - also outlined <a href="https://www.alphavantage.co/best_stock_market_api_review/" target="_blank">here</a>. Examples in this documentation are for demo purposes. <a href="https://www.alphavantage.co/support/#api-key" target="_blank">Claim your free API key</a> today to explore our full API offerings! </p> 382 383 <section> 384 <h2 id="time-series-data">Time Series Stock Data APIs</h2> 385 <p>This suite of APIs provides global equity data in 4 different temporal resolutions: (1) daily, (2) weekly, (3) monthly, and (4) intraday, with 25+ years of historical depth and split/dividend-based adjustments. For US markets specifically, our data also includes deep, consolidated NBBO quotes/trades/volumes, minute-level aggregates, and snapshots across exchanges, dark pools, and FINRA TRFs. A lightweight ticker quote endpoint and several utility functions such as ticker search and market open/closure status are also included for your convenience.</p> 386 <br> 387 <h4 id="intraday">TIME_SERIES_INTRADAY <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 388 <br> 389 <p>This API returns current and 25+ years of historical intraday OHLCV time series of the equity specified, covering <u>pre-market and post-market hours</u> where applicable (e.g., 4:00am to 8:00pm Eastern Time for the US market). You can query both raw (as-traded) and split/dividend-adjusted
389intraday data from this endpoint. The OHLCV data is sometimes called "candles" in finance literature.</p> 390 <br> 391 <h6><b>API Parameters</b></h6> 392 <p><b>â Required: <code>function</code></b></p> 393 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_INTRADAY</code> </p> 394 <p><b>â Required: <code>symbol</code></b></p> 395 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 396 <p><b>â Required: <code>interval</code></b></p> 397 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code></p> 398 <p>â Optional: <code>adjusted</code></p> 399 <p>By default, <code>adjusted=true</code> and the output time series is adjusted by historical split and dividend events. Set <code>adjusted=false</code> to query raw (as-traded) intraday values. </p> 400 <p>â Optional: <code>extended_hours</code></p> 401 <p>By default, <code>extended_hours=true</code> and the output time series will include both the regular trading hours and the extended (pre-market and post-market) trading hours (4:00am to 8:00pm Eastern Time for the US market). Set <code>extended_hours=false</code> to query regular trading hours (9:30am to 4:00pm US Eastern Time) only. </p> 402 <p>â Optional: <code>month</code></p> 403 <p>By default, this parameter is not set and the API will return intraday data for the most recent days of trading. You can use the <code>month</code> parameter (in YYYY-MM format) to query a specific month in history. For example, <code>month=2009-01</code>. Any month in the last 25+ years since 2000-01 (January 2000) is supported.</p> 404 <p>â Optional: <code>outputsize</code></p> 405 <p>By default, <code>outputsize=compact</code>. Strings <code>compact</code> and <code>full</code> are accepted with the following specifications: <code>compact</code> returns only the latest 100 data points in the intraday time series; <code>full</code> returns trailing 30 days of the most recent intraday data if the <code>month</code> parameter (see above) is not specified, or the full intraday data for a specific month in history if the <code>month</code> parameter is specified. The "compact" option is recommended if you would like to reduce the data size of each API call.</p> 406 <p>â Optional: <code>datatype</code></p> 407 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 408 <p>â Optional: <code>entitlement</code></p> 409 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> intraday time series. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> intraday time series.</p> 410 <p><b>â Required: <code>apikey</code></b></p> 411 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 412 <br> 413 414 <h6><b>Examples (click for JSON output)</b></h6> 415 <i>The API will return the most recent 100 intraday OHLCV bars by default when the outputsize parameter is not set</i> 416 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_INTRADAY&<b>symbol</b>=IBM&<b>interval</b>=5min&<b>apikey</b>=demo</code></a></p> 417 <i>Query the most recent 30 days of intraday data by setting outputsize=full</i> 418 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_INTRADAY&<b>symbol</b>=IBM&<b>interval</b>=5min&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 419 <i>Query intraday data for a full month in history (e.g., 2009-01). Any month in the last 25+ years (since 2000-01) is supported</i> 420 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&month=2009-01&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_INTRADAY&<b>symbol</b>=IBM&<b>interval</b>=5min&<b>month</b>=2009-01&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 421 Downloadable CSV file: 422 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_INTRADAY&<b>symbol</b>=IBM&<b>interval</b>=5min&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 423 <br> 424 425 <div class="premium-msg"> 426 <p>ð¡ Tip: This is a premium endpoint. If you would like to access realtime, 15-minute delayed, and/or historical intraday data, please subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> for your personal use. For commercial use, please <a href="/cdn-cgi/l/email-protection#d7a4a2a7a7b8a5a397b6bba7bfb6a1b6b9a3b6b0b2f9b4b8" target="_blank">contact sales</a>.</p> 427 <p style="font-size:90%">* Realtime and 15-minute delayed US market data is regulated by the stock exchanges, FINRA, and the SEC. <a href="https://www.alphavantage.co/realtime_data_policy/" target="_blank">Learn more</a> about the key market data policies you need to know as a data consumer.</p> 428 </div> 429 <br> 430 431 <h6><b>Language-specific guides</b></h6> 432 <div> 433 <button class="python-btn">Python</button> 434 <button class="node-btn">NodeJS</button> 435 <button class="php-btn">PHP</button> 436 <button class="cs-btn">C#/.NET</button> 437 <button class="other-btn">â¨MCP & Other</button> 438</div> 439 440<div class="python-code"> 441 <pre><code class="python"> 442import requests 443 444# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 445url = 'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo' 446r = requests.get(url) 447data = r.json() 448 449print(data) 450 </code></pre> 451</div> 452 453<div class="node-code"> 454 <pre><code class="javascript"> 455'use strict'; 456var request = require('request'); 457 458// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 459var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo'; 460 461request.get({ 462 url: url, 463 json: true, 464 headers: {'User-Agent': 'request'} 465 }, (err, res, data) => { 466 if (err) { 467 console.log('Error:', err); 468 } else if (res.statusCode !== 200) { 469 console.log('Status:', res.statusCode); 470 } else { 471 // data is successfully parsed as a JSON object: 472 console.log(data); 473 } 474}); 475 </code></pre> 476</div> 477 478<div class="php-code"> 479 <pre><code class="php"> 480<?php 481// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 482$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo'); 483 484$data = json_decode($json,true); 485 486print_r($data); 487 488exit; 489 </code></pre> 490</div> 491 492<div class="cs-code"> 493 <pre><code class="cs"> 494using System; 495using System.Collections.Generic; 496using System.Net; 497
498// ------------------------------------------------------------------------- 499// if using .NET Framework 500// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 501// This requires including the reference to System.Web.Extensions in your project 502using System.Web.Script.Serialization; 503// ------------------------------------------------------------------------- 504// if using .Net Core 505// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 506using System.Text.Json; 507// ------------------------------------------------------------------------- 508 509namespace ConsoleTests 510{ 511 internal class Program 512 { 513 private static void Main(string[] args) 514 { 515 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 516 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo" 517 Uri queryUri = new Uri(QUERY_URL); 518 519 using (WebClient client = new WebClient()) 520 { 521 // ------------------------------------------------------------------------- 522 // if using .NET Framework (System.Web.Script.Serialization) 523 524 JavaScriptSerializer js = new JavaScriptSerializer(); 525 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 526 527 // ------------------------------------------------------------------------- 528 // if using .NET Core (System.Text.Json) 529 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 530 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 531 532 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 533 534 // ------------------------------------------------------------------------- 535 536 // do something with the json_data 537 } 538 } 539 } 540} 541 </code></pre> 542</div> 543 544 545<div class="other-code" style="background-color: #f9f9f9;"> 546 <br> 547 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 548 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 549 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 550 <br> 551</div> 552 553 <br> 554 <br> 555 556 <h4 id="daily">TIME_SERIES_DAILY</h4> 557 <br> 558 <p>This API returns <u>raw</u> (as-traded) daily time series (date, daily open, daily high, daily low, daily close, daily volume) of the global equity specified, covering 25+ years of historical data. The OHLCV data is sometimes called "candles" in finance literature. If you are also interested in split/dividend-adjusted data, please use the <a href="#dailyadj">Daily Adjusted API</a>, which covers adjusted close values and historical split and dividend events.</p> 559 <br> 560 <h6><b>API Parameters</b></h6> 561 <p><b>â Required: <code>function</code></b></p> 562 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_DAILY</code> </p> 563 <p><b>â Required: <code>symbol</code></b></p> 564 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 565 <p>â Optional: <code>outputsize</code></p> 566 <p>By default, <code>outputsize=compact</code>. Strings <code>compact</code> and <code>full</code> are accepted with the following specifications: <code>compact</code> returns only the latest 100 data points; <code>full</code> returns the full-length time series of 25+ years of historical data. The "compact" option is recommended if you would like to reduce the data size of each API call. The "compact" outputsize is available to both <span class="popular-label" style="margin-left:0;">free</span> and <span class="premium-label" style="margin-left:0;">premium</span> API keys. The "full" outputsize is available to <span class="premium-label" style="margin-left:0;">premium</span> keys. Please subscribe to any <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to unlock the outputsize=full capability.</p> 567 <p>â Optional: <code>datatype</code></p> 568 <p>
568By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 569 <p><b>â Required: <code>apikey</code></b></p> 570 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 571 <br> 572 573 <h6><b>Examples (click for JSON output)</b></h6> 574 <i>Sample ticker traded in the United States</i> 575 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 576 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=IBM&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 577 <i>Sample ticker traded in UK - London Stock Exchange</i> 578 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=TSCO.LON&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=TSCO.LON&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 579 <i>Sample ticker traded in Canada - Toronto Stock Exchange</i> 580 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=SHOP.TRT&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=SHOP.TRT&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 581 <i>Sample ticker traded in Canada - Toronto Venture Exchange</i> 582 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=GPV.TRV&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=GPV.TRV&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 583 <i>Sample ticker traded in Germany - XETRA</i> 584 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=MBG.DEX&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=MBG.DEX&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 585 <i>Sample ticker traded in India - BSE</i> 586 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=RELIANCE.BSE&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=RELIANCE.BSE&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 587 <i>Sample ticker traded in China - Shanghai Stock Exchange</i> 588 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=600104.SHH&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=600104.SHH&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 589 <i>Sample ticker traded in China - Shenzhen Stock Exchange</i> 590 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=000002.SHZ&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=000002.SHZ&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 591 <p>The above is just a small sample of the 100,000+ symbols we support. Please refer to our <a href="#symbolsearch">Search Endpoint</a>
591 to look up any supported global stock, ETF, or mutual fund symbols of your interest.</p> 592 593 <br> 594 Downloadable CSV file: 595 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 596 <br> 597 598 <br> 599 600 <h6><b>Language-specific guides</b></h6> 601 <div> 602 <button class="python-btn">Python</button> 603 <button class="node-btn">NodeJS</button> 604 <button class="php-btn">PHP</button> 605 <button class="cs-btn">C#/.NET</button> 606 <button class="other-btn">â¨MCP & Other</button> 607</div> 608 609<div class="python-code"> 610 <pre><code class="python"> 611import requests 612 613# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 614url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo' 615r = requests.get(url) 616data = r.json() 617 618print(data) 619 </code></pre> 620</div> 621 622<div class="node-code"> 623 <pre><code class="javascript"> 624'use strict'; 625var request = require('request'); 626 627// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 628var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo'; 629 630request.get({ 631 url: url, 632 json: true, 633 headers: {'User-Agent': 'request'} 634 }, (err, res, data) => { 635 if (err) { 636 console.log('Error:', err); 637 } else if (res.statusCode !== 200) { 638 console.log('Status:', res.statusCode); 639 } else { 640 // data is successfully parsed as a JSON object: 641 console.log(data); 642 } 643}); 644 </code></pre> 645</div> 646 647<div class="php-code"> 648 <pre><code class="php"> 649<?php 650// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 651$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo'); 652 653$data = json_decode($json,true); 654 655print_r($data); 656 657exit; 658 </code></pre> 659</div> 660 661<div class="cs-code"> 662 <pre><code class="cs"> 663using System; 664using System.Collections.Generic; 665using System.Net; 666 667// ------------------------------------------------------------------------- 668// if using .NET Framework 669// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 670// This requires including the reference to System.Web.Extensions in your project 671using System.Web.Script.Serialization; 672// ------------------------------------------------------------------------- 673// if using .Net Core 674// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 675using System.Text.Json; 676// ------------------------------------------------------------------------- 677 678namespace ConsoleTests 679{ 680 internal class Program 681 { 682 private static void Main(string[] args) 683 { 684 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 685 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo" 686 Uri queryUri = new Uri(QUERY_URL); 687 688 using (WebClient client = new WebClient()) 689 { 690 // ------------------------------------------------------------------------- 691 // if using .NET Framework (System.Web.Script.Serialization) 692 693 JavaScriptSerializer js = new JavaScriptSerializer(); 694 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 695 696 // ------------------------------------------------------------------------- 697 // if using .NET Core (System.Text.Json) 698 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 699 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 700 701 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 702 703 // ------------------------------------------------------------------------- 704
705 // do something with the json_data 706 } 707 } 708 } 709} 710 </code></pre> 711</div> 712 713 714<div class="other-code" style="background-color: #f9f9f9;"> 715 <br> 716 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 717 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 718 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 719 <br> 720</div> 721 <br> 722 723 <br> 724 725 <h4 id="dailyadj">TIME_SERIES_DAILY_ADJUSTED <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 726 <br> 727 <p>This API returns raw (as-traded) daily open/high/low/close/volume values, <u>adjusted close</u> values, and historical split/dividend events of the global equity specified, covering 25+ years of historical data. The OHLCV data is sometimes called "candles" in finance literature.</p> 728 <br> 729 <h6><b>API Parameters</b></h6> 730 <p><b>â Required: <code>function</code></b></p> 731 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_DAILY_ADJUSTED</code> </p> 732 <p><b>â Required: <code>symbol</code></b></p> 733 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 734 <p>â Optional: <code>outputsize</code></p> 735 <p>By default, <code>outputsize=compact</code>. Strings <code>compact</code> and <code>full</code> are accepted with the following specifications: <code>compact</code> returns only the latest 100 data points; <code>full</code> returns the full-length time series of 25+ years of historical data. The "compact" option is recommended if you would like to reduce the data size of each API call. </p> 736 <p>â Optional: <code>datatype</code></p> 737 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 738 <p>â Optional: <code>entitlement</code></p> 739 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 740 <p><b>â Required: <code>apikey</code></b></p> 741 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 742 <br> 743 744 <h6><b>Examples (click for JSON output)</b></h6> 745 <i>Sample ticker traded in the United States</i> 746 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 747 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=IBM&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 748 <i>Sample ticker traded in UK - London Stock Exchange</i> 749 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=TSCO.
749LON&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=TSCO.LON&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 750 <i>Sample ticker traded in Canada - Toronto Stock Exchange</i> 751 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=SHOP.TRT&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=SHOP.TRT&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 752 <i>Sample ticker traded in Canada - Toronto Venture Exchange</i> 753 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=GPV.TRV&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=GPV.TRV&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 754 <i>Sample ticker traded in Germany - XETRA</i> 755 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=MBG.DEX&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=MBG.DEX&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 756 <i>Sample ticker traded in India - BSE</i> 757 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=RELIANCE.BSE&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=RELIANCE.BSE&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 758 <i>Sample ticker traded in China - Shanghai Stock Exchange</i> 759 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=600104.SHH&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=600104.SHH&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 760 <i>Sample ticker traded in China - Shenzhen Stock Exchange</i> 761 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=000002.SHZ&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=000002.SHZ&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 762 <p>The above is just a small sample of the 100,000+ symbols we support. Please refer to our <a href="#symbolsearch">Search Endpoint</a> to look up any supported global stock, ETF, or mutual fund symbols of your interest.</p> 763 <br> 764 Downloadable CSV file: 765 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_DAILY_ADJUSTED&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 766 <br> 767 768 <div class="premium-msg"> 769 <p>ð¡ Tip: this is a premium API function. Subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to instantly unlock all premium APIs.</p> 770 </div> 771 <br> 772 773 774<h6><b>Language-specific guides</b></h6> 775 <div> 776 <button class="python-btn">Python</button> 777 <button class="node-btn">NodeJS</button> 778 <button class="php-btn">PHP</button> 779 <button class="cs-btn">C#/.NET</button> 780 <button class="other-btn">â¨MCP & Other</button> 781</div> 782 783<div class="python-code"> 784 <pre><code class="python"> 785import requests 786 787# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 788url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&apikey=demo' 789r = requests.get(url) 790data = r.json() 791 792print(data) 793 </code></pre> 794</div> 795 796<div class="node-code"> 797 <pre><code class="javascript"> 798'use strict'; 799var request = require('request'); 800 801// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 802var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&apikey=demo'; 803 804request.get({ 805 url: url, 806 json: true, 807 headers: {'User-Agent': 'request'} 808 }, (err, res, data) => { 809 if (err) { 810 console.log('Error:', err); 811 } else if (res.statusCode !== 200) { 812 console.log('Status:', res.statusCode); 813 } else { 814 // data is successfully parsed as a JSON object: 815 console.log(data); 816 } 817}); 818 </code></pre> 819</div> 820 821<div class="php-code"> 822 <pre><code class="php"> 823<?php 824// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 825$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&apikey=demo'); 826 827$data = json_decode($json,true); 828 829print_r($data); 830 831exit; 832 </code></pre> 833</div> 834 835<div class="cs-code"> 836 <pre><code class="cs"> 837using System; 838using System.Collections.Generic; 839using System.Net; 840
841// ------------------------------------------------------------------------- 842// if using .NET Framework 843// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 844// This requires including the reference to System.Web.Extensions in your project 845using System.Web.Script.Serialization; 846// ------------------------------------------------------------------------- 847// if using .Net Core 848// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 849using System.Text.Json; 850// ------------------------------------------------------------------------- 851 852namespace ConsoleTests 853{ 854 internal class Program 855 { 856 private static void Main(string[] args) 857 { 858 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 859 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=IBM&apikey=demo" 860 Uri queryUri = new Uri(QUERY_URL); 861 862 using (WebClient client = new WebClient()) 863 { 864 // ------------------------------------------------------------------------- 865 // if using .NET Framework (System.Web.Script.Serialization) 866 867 JavaScriptSerializer js = new JavaScriptSerializer(); 868 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 869 870 // ------------------------------------------------------------------------- 871 // if using .NET Core (System.Text.Json) 872 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 873 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 874 875 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 876 877 // ------------------------------------------------------------------------- 878 879 // do something with the json_data 880 } 881 } 882 } 883} 884 </code></pre> 885</div> 886 887 888<div class="other-code" style="background-color: #f9f9f9;"> 889 <br> 890 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 891 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 892 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 893 <br> 894</div> 895 <br> 896 897 <h4 id="weekly">TIME_SERIES_WEEKLY</h4> 898 <br> 899 <p>This API returns weekly time series (last trading day of each week, weekly open, weekly high, weekly low, weekly close, weekly volume) of the global equity specified, covering 25+ years of historical data. </p> 900 <br> 901 <h6><b>API Parameters</b></h6> 902 <p><b>â Required: <code>function</code></b></p> 903 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_WEEKLY</code> </p> 904 <p><b>â Required: <code>symbol</code></b></p> 905 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 906 <p>â Optional: <code>datatype</code></p> 907 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the weekly time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 908 <p><b>â Required: <code>apikey</code></b></p> 909 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 910 <br> 911 912 <h6><b>Example (click for JSON output)</b></h6> 913 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_WEEKLY&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 914 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=TSCO.
914LON&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_WEEKLY&<b>symbol</b>=TSCO.LON&<b>apikey</b>=demo</code></a></p> 915 Downloadable CSV file: 916 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_WEEKLY&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 917 <br> 918 919 <h6><b>Language-specific guides</b></h6> 920 <div> 921 <button class="python-btn">Python</button> 922 <button class="node-btn">NodeJS</button> 923 <button class="php-btn">PHP</button> 924 <button class="cs-btn">C#/.NET</button> 925 <button class="other-btn">â¨MCP & Other</button> 926</div> 927 928<div class="python-code"> 929 <pre><code class="python"> 930import requests 931 932# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 933url = 'https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=IBM&apikey=demo' 934r = requests.get(url) 935data = r.json() 936 937print(data) 938 </code></pre> 939</div> 940 941<div class="node-code"> 942 <pre><code class="javascript"> 943'use strict'; 944var request = require('request'); 945 946// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 947var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=IBM&apikey=demo'; 948 949request.get({ 950 url: url, 951 json: true, 952 headers: {'User-Agent': 'request'} 953 }, (err, res, data) => { 954 if (err) { 955 console.log('Error:', err); 956 } else if (res.statusCode !== 200) { 957 console.log('Status:', res.statusCode); 958 } else { 959 // data is successfully parsed as a JSON object: 960 console.log(data); 961 } 962}); 963 </code></pre> 964</div> 965 966<div class="php-code"> 967 <pre><code class="php"> 968<?php 969// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 970$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=IBM&apikey=demo'); 971 972$data = json_decode($json,true); 973 974print_r($data); 975 976exit; 977 </code></pre> 978</div> 979 980<div class="cs-code"> 981 <pre><code class="cs"> 982using System; 983using System.Collections.Generic; 984using System.Net; 985 986// ------------------------------------------------------------------------- 987// if using .NET Framework 988// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 989// This requires including the reference to System.Web.Extensions in your project 990using System.Web.Script.Serialization; 991// ------------------------------------------------------------------------- 992// if using .Net Core 993// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 994using System.Text.Json; 995// ------------------------------------------------------------------------- 996 997namespace ConsoleTests 998{ 999 internal class Program 1000 { 1001 private static void Main(string[] args) 1002 { 1003 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1004 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=IBM&apikey=demo" 1005 Uri queryUri = new Uri(QUERY_URL); 1006 1007 using (WebClient client = new WebClient()) 1008 { 1009 // ------------------------------------------------------------------------- 1010 // if using .NET Framework (System.Web.Script.Serialization) 1011 1012 JavaScriptSerializer js = new JavaScriptSerializer(); 1013 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1014 1015 // ------------------------------------------------------------------------- 1016 // if using .NET Core (System.Text.Json) 1017 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1018 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1019 1020 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1021 1022 // ------------------------------------------------------------------------- 1023
1024 // do something with the json_data 1025 } 1026 } 1027 } 1028} 1029 </code></pre> 1030</div> 1031 1032 1033<div class="other-code" style="background-color: #f9f9f9;"> 1034 <br> 1035 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1036 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1037 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1038 <br> 1039</div> 1040 <br> 1041 1042 1043 <h4 id="weeklyadj">TIME_SERIES_WEEKLY_ADJUSTED</h4> 1044 <br> 1045 <p>This API returns weekly adjusted time series (last trading day of each week, weekly open, weekly high, weekly low, weekly close, weekly adjusted close, weekly volume, weekly dividend) of the global equity specified, covering 25+ years of historical data. </p> 1046 <br> 1047 <h6><b>API Parameters</b></h6> 1048 <p><b>â Required: <code>function</code></b></p> 1049 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_WEEKLY_ADJUSTED</code> </p> 1050 <p><b>â Required: <code>symbol</code></b></p> 1051 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 1052 <p>â Optional: <code>datatype</code></p> 1053 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the weekly time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 1054 <p><b>â Required: <code>apikey</code></b></p> 1055 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1056 <br> 1057 1058 <h6><b>Example (click for JSON output)</b></h6> 1059 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_WEEKLY_ADJUSTED&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 1060 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=TSCO.LON&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_WEEKLY_ADJUSTED&<b>symbol</b>=TSCO.LON&<b>apikey</b>=demo</code></a></p> 1061 Downloadable CSV file: 1062 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_WEEKLY_ADJUSTED&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 1063 <br> 1064 1065 <h6><b>Language-specific guides</b></h6> 1066 <div> 1067 <button class="python-btn">Python</button> 1068 <button class="node-btn">NodeJS</button> 1069 <button class="php-btn">PHP</button> 1070 <button class="cs-btn">C#/.NET</button> 1071 <button class="other-btn">â¨MCP & Other</button> 1072</div> 1073 1074<div class="python-code"> 1075 <pre><code class="python"> 1076import requests 1077 1078# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1079url = 'https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=IBM&apikey=demo' 1080r = requests.get(url) 1081data = r.json() 1082 1083print(data) 1084 </code></pre> 1085</div> 1086 1087<div class="node-code"> 1088 <pre><code class="javascript"> 1089'use strict'; 1090var request = require('request'); 1091 1092// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1093var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=IBM&apikey=demo'; 1094 1095request.get({ 1096 url: url, 1097 json: true, 1098 headers: {'User-Agent': 'request'} 1099 }, (err, res, data) => { 1100 if (err) { 1101 console.log('Error:', err); 1102 } else if (res.statusCode !== 200) { 1103 console.log('Status:', res.statusCode); 1104 } else { 1105 // data is successfully parsed as a JSON object: 1106 console.log(data); 1107 } 1108}); 1109 </code></pre> 1110</div> 1111 1112<div class="php-code"> 1113 <pre><code class="php"> 1114<?php 1115// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1116$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=IBM&apikey=demo'); 1117 1118$data = json_decode($json,true); 1119 1120print_r($data); 1121 1122exit; 1123 </code></pre> 1124</div> 1125 1126<div class="cs-code"> 1127 <pre><code class="cs"> 1128using System; 1129using System.Collections.Generic; 1130using System.Net; 1131
1132// ------------------------------------------------------------------------- 1133// if using .NET Framework 1134// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 1135// This requires including the reference to System.Web.Extensions in your project 1136using System.Web.Script.Serialization; 1137// ------------------------------------------------------------------------- 1138// if using .Net Core 1139// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 1140using System.Text.Json; 1141// ------------------------------------------------------------------------- 1142 1143namespace ConsoleTests 1144{ 1145 internal class Program 1146 { 1147 private static void Main(string[] args) 1148 { 1149 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1150 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=IBM&apikey=demo" 1151 Uri queryUri = new Uri(QUERY_URL); 1152 1153 using (WebClient client = new WebClient()) 1154 { 1155 // ------------------------------------------------------------------------- 1156 // if using .NET Framework (System.Web.Script.Serialization) 1157 1158 JavaScriptSerializer js = new JavaScriptSerializer(); 1159 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1160 1161 // ------------------------------------------------------------------------- 1162 // if using .NET Core (System.Text.Json) 1163 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1164 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1165 1166 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1167 1168 // ------------------------------------------------------------------------- 1169 1170 // do something with the json_data 1171 } 1172 } 1173 } 1174} 1175 </code></pre> 1176</div> 1177 1178 1179<div class="other-code" style="background-color: #f9f9f9;"> 1180 <br> 1181 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1182 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1183 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1184 <br> 1185</div> 1186 <br> 1187 1188 <h4 id="monthly">TIME_SERIES_MONTHLY</h4> 1189 <br> 1190 <p>This API returns monthly time series (last trading day of each month, monthly open, monthly high, monthly low, monthly close, monthly volume) of the global equity specified, covering 25+ years of historical data. </p> 1191 <br> 1192 <h6><b>API Parameters</b></h6> 1193 <p><b>â Required: <code>function</code></b></p> 1194 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_MONTHLY</code> </p> 1195 <p><b>â Required: <code>symbol</code></b></p> 1196 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 1197 <p>â Optional: <code>datatype</code></p> 1198 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the monthly time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 1199 <p><b>â Required: <code>apikey</code></b></p> 1200 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1201 <br> 1202 1203 1204 <h6><b>Example (click for JSON output)</b></h6> 1205 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_MONTHLY&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 1206 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=TSCO.
1206LON&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_MONTHLY&<b>symbol</b>=TSCO.LON&<b>apikey</b>=demo</code></a></p> 1207 Downloadable CSV file: 1208 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_MONTHLY&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 1209 <br> 1210 1211 <h6><b>Language-specific guides</b></h6> 1212 <div> 1213 <button class="python-btn">Python</button> 1214 <button class="node-btn">NodeJS</button> 1215 <button class="php-btn">PHP</button> 1216 <button class="cs-btn">C#/.NET</button> 1217 <button class="other-btn">â¨MCP & Other</button> 1218</div> 1219 1220<div class="python-code"> 1221 <pre><code class="python"> 1222import requests 1223 1224# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1225url = 'https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=IBM&apikey=demo' 1226r = requests.get(url) 1227data = r.json() 1228 1229print(data) 1230 </code></pre> 1231</div> 1232 1233<div class="node-code"> 1234 <pre><code class="javascript"> 1235'use strict'; 1236var request = require('request'); 1237 1238// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1239var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=IBM&apikey=demo'; 1240 1241request.get({ 1242 url: url, 1243 json: true, 1244 headers: {'User-Agent': 'request'} 1245 }, (err, res, data) => { 1246 if (err) { 1247 console.log('Error:', err); 1248 } else if (res.statusCode !== 200) { 1249 console.log('Status:', res.statusCode); 1250 } else { 1251 // data is successfully parsed as a JSON object: 1252 console.log(data); 1253 } 1254}); 1255 </code></pre> 1256</div> 1257 1258<div class="php-code"> 1259 <pre><code class="php"> 1260<?php 1261// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1262$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=IBM&apikey=demo'); 1263 1264$data = json_decode($json,true); 1265 1266print_r($data); 1267 1268exit; 1269 </code></pre> 1270</div> 1271 1272<div class="cs-code"> 1273 <pre><code class="cs"> 1274using System; 1275using System.Collections.Generic; 1276using System.Net; 1277 1278// ------------------------------------------------------------------------- 1279// if using .NET Framework 1280// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 1281// This requires including the reference to System.Web.Extensions in your project 1282using System.Web.Script.Serialization; 1283// ------------------------------------------------------------------------- 1284// if using .Net Core 1285// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 1286using System.Text.Json; 1287// ------------------------------------------------------------------------- 1288 1289namespace ConsoleTests 1290{ 1291 internal class Program 1292 { 1293 private static void Main(string[] args) 1294 { 1295 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1296 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=IBM&apikey=demo" 1297 Uri queryUri = new Uri(QUERY_URL); 1298 1299 using (WebClient client = new WebClient()) 1300 { 1301 // ------------------------------------------------------------------------- 1302 // if using .NET Framework (System.Web.Script.Serialization) 1303 1304 JavaScriptSerializer js = new JavaScriptSerializer(); 1305 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1306 1307 // ------------------------------------------------------------------------- 1308 // if using .NET Core (System.Text.Json) 1309 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1310 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1311 1312 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1313 1314 // ------------------------------------------------------------------------- 1315
1316 // do something with the json_data 1317 } 1318 } 1319 } 1320} 1321 </code></pre> 1322</div> 1323 1324 1325<div class="other-code" style="background-color: #f9f9f9;"> 1326 <br> 1327 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1328 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1329 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1330 <br> 1331</div> 1332 1333 <br> 1334 1335 <h4 id="monthlyadj">TIME_SERIES_MONTHLY_ADJUSTED</h4> 1336 <br> 1337 <p>This API returns monthly adjusted time series (last trading day of each month, monthly open, monthly high, monthly low, monthly close, monthly adjusted close, monthly volume, monthly dividend) of the equity specified, covering 25+ years of historical data. </p> 1338 <br> 1339 <h6><b>API Parameters</b></h6> 1340 <p><b>â Required: <code>function</code></b></p> 1341 <p>The time series of your choice. In this case, <code>function=TIME_SERIES_MONTHLY_ADJUSTED</code> </p> 1342 <p><b>â Required: <code>symbol</code></b></p> 1343 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 1344 <p>â Optional: <code>datatype</code></p> 1345 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the monthly time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 1346 <p><b>â Required: <code>apikey</code></b></p> 1347 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1348 <br> 1349 1350 <h6><b>Example (click for JSON output)</b></h6> 1351 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_MONTHLY_ADJUSTED&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 1352 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=TSCO.LON&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_MONTHLY_ADJUSTED&<b>symbol</b>=TSCO.LON&<b>apikey</b>=demo</code></a></p> 1353 Downloadable CSV file: 1354 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TIME_SERIES_MONTHLY_ADJUSTED&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 1355 <br> 1356 1357 <h6><b>Language-specific guides</b></h6> 1358 <div> 1359 <button class="python-btn">Python</button> 1360 <button class="node-btn">NodeJS</button> 1361 <button class="php-btn">PHP</button> 1362 <button class="cs-btn">C#/.NET</button> 1363 <button class="other-btn">â¨MCP & Other</button> 1364</div> 1365 1366<div class="python-code"> 1367 <pre><code class="python"> 1368import requests 1369 1370# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1371url = 'https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=IBM&apikey=demo' 1372r = requests.get(url) 1373data = r.json() 1374 1375print(data) 1376 </code></pre> 1377</div> 1378 1379<div class="node-code"> 1380 <pre><code class="javascript"> 1381'use strict'; 1382var request = require('request'); 1383 1384// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1385var url = 'https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=IBM&apikey=demo'; 1386 1387request.get({ 1388 url: url, 1389 json: true, 1390 headers: {'User-Agent': 'request'} 1391 }, (err, res, data) => { 1392 if (err) { 1393 console.log('Error:', err); 1394 } else if (res.statusCode !== 200) { 1395 console.log('Status:', res.statusCode); 1396 } else { 1397 // data is successfully parsed as a JSON object: 1398 console.log(data); 1399 } 1400}); 1401 </code></pre> 1402</div> 1403 1404<div class="php-code"> 1405 <pre><code class="php"> 1406<?php 1407// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1408$json = file_get_contents('https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=IBM&apikey=demo'); 1409 1410$data = json_decode($json,true); 1411 1412print_r($data); 1413 1414exit; 1415 </code></pre> 1416</div> 1417 1418<div class="cs-code"> 1419 <pre><code class="cs"> 1420using System; 1421using System.Collections.Generic; 1422using System.Net; 1423
1424// ------------------------------------------------------------------------- 1425// if using .NET Framework 1426// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 1427// This requires including the reference to System.Web.Extensions in your project 1428using System.Web.Script.Serialization; 1429// ------------------------------------------------------------------------- 1430// if using .Net Core 1431// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 1432using System.Text.Json; 1433// ------------------------------------------------------------------------- 1434 1435namespace ConsoleTests 1436{ 1437 internal class Program 1438 { 1439 private static void Main(string[] args) 1440 { 1441 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1442 string QUERY_URL = "https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=IBM&apikey=demo" 1443 Uri queryUri = new Uri(QUERY_URL); 1444 1445 using (WebClient client = new WebClient()) 1446 { 1447 // ------------------------------------------------------------------------- 1448 // if using .NET Framework (System.Web.Script.Serialization) 1449 1450 JavaScriptSerializer js = new JavaScriptSerializer(); 1451 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1452 1453 // ------------------------------------------------------------------------- 1454 // if using .NET Core (System.Text.Json) 1455 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1456 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1457 1458 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1459 1460 // ------------------------------------------------------------------------- 1461 1462 // do something with the json_data 1463 } 1464 } 1465 } 1466} 1467 </code></pre> 1468</div> 1469 1470 1471<div class="other-code" style="background-color: #f9f9f9;"> 1472 <br> 1473 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1474 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1475 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1476 <br> 1477</div> 1478 <br> 1479 1480 <h4 id="latestprice">Quote Endpoint <span class="popular-label">Trending</span></h4> 1481 <br> 1482 <p>This endpoint returns the latest price and volume information for a ticker of your choice. You can specify one ticker per API request.</p> 1483 <p>If you would like to query a large universe of tickers in bulk, you may want to try out our <a href="#realtime-bulk-quotes">Realtime Bulk Quotes API</a>, which accepts up to 100 tickers per API request.</p> 1484 <br> 1485 <h6><b>API Parameters</b></h6> 1486 <p><b>â Required: <code>function</code></b></p> 1487 <p>The API function of your choice. </p> 1488 <p><b>â Required: <code>symbol</code></b></p> 1489 <p>The symbol of the global ticker of your choice. For example: <code>symbol=IBM</code>. 1490 </p> 1491 <p>â Optional: <code>datatype</code></p> 1492 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the quote data in JSON format; <code>csv</code> returns the quote data as a CSV (comma separated value) file. </p> 1493 <p>â Optional: <code>entitlement</code></p> 1494 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
1494realtime</u> US market data. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> US market data.</p> 1495 <p><b>â Required: <code>apikey</code></b></p> 1496 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1497 <br> 1498 1499 1500 <h6><b>Examples (click for JSON output)</b></h6> 1501 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=GLOBAL_QUOTE&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 1502 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=300135.SHZ&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=GLOBAL_QUOTE&<b>symbol</b>=300135.SHZ&<b>apikey</b>=demo</code></a></p> 1503 Downloadable CSV file: 1504 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=GLOBAL_QUOTE&<b>symbol</b>=IBM&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 1505 <br> 1506 1507 <div class="premium-msg"> 1508 <p>ð¡ Tip: by default, the quote endpoint is updated at the end of each trading day for all users. If you would like to access realtime or 15-minute delayed stock quote data for the US market, please subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> for your personal use. For commercial use, please <a href="/cdn-cgi/l/email-protection#463533363629343206272a362e2730272832272123682529" target="_blank">contact sales</a>.</p> 1509 <p style="font-size:90%">* Realtime and 15-minute delayed US market data is regulated by the stock exchanges, FINRA, and the SEC. <a href="https://www.alphavantage.co/realtime_data_policy/" target="_blank">Learn more</a> about the key market data policies you need to know as a data consumer.</p> 1510 </div> 1511 <br> 1512 1513 <h6><b>Language-specific guides</b></h6> 1514 <div> 1515 <button class="python-btn">Python</button> 1516 <button class="node-btn">NodeJS</button> 1517 <button class="php-btn">PHP</button> 1518 <button class="cs-btn">C#/.NET</button> 1519 <button class="other-btn">â¨MCP & Other</button> 1520</div> 1521 1522<div class="python-code"> 1523 <pre><code class="python"> 1524import requests 1525 1526# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1527url = 'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo' 1528r = requests.get(url) 1529data = r.json() 1530 1531print(data) 1532 </code></pre> 1533</div> 1534 1535<div class="node-code"> 1536 <pre><code class="javascript"> 1537'use strict'; 1538var request = require('request'); 1539 1540// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1541var url = 'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo'; 1542 1543request.get({ 1544 url: url, 1545 json: true, 1546 headers: {'User-Agent': 'request'} 1547 }, (err, res, data) => { 1548 if (err) { 1549 console.log('Error:', err); 1550 } else if (res.statusCode !== 200) { 1551 console.log('Status:', res.statusCode); 1552 } else { 1553 // data is successfully parsed as a JSON object: 1554 console.log(data); 1555 } 1556}); 1557 </code></pre> 1558</div> 1559 1560<div class="php-code"> 1561 <pre><code class="php"> 1562<?php 1563// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1564$json = file_get_contents('https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo'); 1565 1566$data = json_decode($json,true); 1567 1568print_r($data); 1569 1570exit; 1571 </code></pre> 1572</div> 1573 1574<div class="cs-code"> 1575 <pre><code class="cs"> 1576using System; 1577using System.Collections.Generic; 1578using System.Net; 1579
1580// ------------------------------------------------------------------------- 1581// if using .NET Framework 1582// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 1583// This requires including the reference to System.Web.Extensions in your project 1584using System.Web.Script.Serialization; 1585// ------------------------------------------------------------------------- 1586// if using .Net Core 1587// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 1588using System.Text.Json; 1589// ------------------------------------------------------------------------- 1590 1591namespace ConsoleTests 1592{ 1593 internal class Program 1594 { 1595 private static void Main(string[] args) 1596 { 1597 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1598 string QUERY_URL = "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo" 1599 Uri queryUri = new Uri(QUERY_URL); 1600 1601 using (WebClient client = new WebClient()) 1602 { 1603 // ------------------------------------------------------------------------- 1604 // if using .NET Framework (System.Web.Script.Serialization) 1605 1606 JavaScriptSerializer js = new JavaScriptSerializer(); 1607 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1608 1609 // ------------------------------------------------------------------------- 1610 // if using .NET Core (System.Text.Json) 1611 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1612 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1613 1614 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1615 1616 // ------------------------------------------------------------------------- 1617 1618 // do something with the json_data 1619 } 1620 } 1621 } 1622} 1623 </code></pre> 1624</div> 1625 1626 1627<div class="other-code" style="background-color: #f9f9f9;"> 1628 <br> 1629 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1630 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1631 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1632 <br> 1633</div> 1634 <br> 1635 <br> 1636 1637 <h4 id="realtime-bulk-quotes">Realtime Bulk Quotes <span class="premium-label">Premium</span></h4> 1638 <br> 1639 <p>This API returns realtime quotes for US-traded symbols in bulk, accepting up to <u>100 symbols</u> per API request and covering both regular and extended (pre-market and post-market) trading hours. You can use this endpoint as a high-throughput alternative to the <a href="#latestprice">Global Quote API</a>, which accepts one symbol per API request.</p> 1640 <br> 1641 <h6><b>API Parameters</b></h6> 1642 <p><b>â Required: <code>function</code></b></p> 1643 <p>The time series of your choice. In this case, <code>function=REALTIME_BULK_QUOTES</code> </p> 1644 <p><b>â Required: <code>symbol</code></b></p> 1645 <p>Up to <u>100 symbols</u> separated by comma. For example: <code>symbol=MSFT,AAPL,IBM</code>. If more than 100 symbols are provided, only the first 100 symbols will be honored as part of the API input.</p> 1646 <p>â Optional: <code>datatype</code></p> 1647 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the search results in JSON format; <code>csv</code> returns the search results as a CSV (comma separated value) file. </p> 1648 <p><b>â Required: <code>apikey</code></b></p> 1649 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1650 <br> 1651 1652 <h6><b>Examples (click for JSON output)</b></h6> 1653 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_BULK_QUOTES&symbol=MSFT,AAPL,IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_BULK_QUOTES&<b>symbol</b>=MSFT,AAPL,IBM&<b>apikey</b>=demo</code></a></p> 1654 <br> 1655 1656 <div class="premium-msg"> 1657 <p>ð¡ Tip: this is a premium API function. Please subscribe to any <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> that mentions "Realtime US Market Data" in its description to unlock this endpoint for your personal use. For commercial use, please <a href="/cdn-cgi/l/email-protection#d5a6a0a5a5baa7a195b4b9a5bdb4a3b4bba1b4b2b0fbb6ba" target="_blank">contact sales</a>.</p> 1658 </div> 1659 <br> 1660 1661 1662<h6><b>Language-specific guides</b></h6> 1663 <div> 1664 <button class="python-btn">Python</button> 1665 <button class="node-btn">NodeJS</button> 1666 <button class="php-btn">PHP</button> 1667 <button class="cs-btn">C#/.NET</button> 1668 <button class="other-btn">â¨MCP & Other</button> 1669</div> 1670 1671<div class="python-code"> 1672 <pre><code class="python"> 1673import requests 1674 1675# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1676url = 'https://www.alphavantage.co/query?function=REALTIME_BULK_QUOTES&symbol=MSFT,AAPL,IBM&apikey=demo' 1677r = requests.get(url) 1678data = r.json() 1679 1680print(data) 1681 </code></pre> 1682</div> 1683 1684<div class="node-code"> 1685 <pre><code class="javascript"> 1686'use strict'; 1687var request = require('request'); 1688 1689// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1690var url = 'https://www.alphavantage.co/query?function=REALTIME_BULK_QUOTES&symbol=MSFT,AAPL,IBM&apikey=demo'; 1691 1692request.get({ 1693 url: url, 1694 json: true, 1695 headers: {'User-Agent': 'request'} 1696 }, (err, res, data) => { 1697 if (err) { 1698 console.log('Error:', err); 1699 } else if (res.statusCode !== 200) { 1700 console.log('Status:', res.statusCode); 1701 } else { 1702 // data is successfully parsed as a JSON object: 1703 console.log(data); 1704 } 1705}); 1706 </code></pre> 1707</div> 1708 1709<div class="php-code"> 1710 <pre><code class="php"> 1711<?php 1712// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1713$json = file_get_contents('https://www.alphavantage.co/query?function=REALTIME_BULK_QUOTES&symbol=MSFT,AAPL,IBM&apikey=demo'); 1714 1715$data = json_decode($json,true); 1716 1717print_r($data); 1718 1719exit; 1720 </code></pre> 1721</div> 1722 1723<div class="cs-code"> 1724 <pre><code class="cs"> 1725using System; 1726using System.Collections.Generic; 1727using System.Net; 1728
1729// ------------------------------------------------------------------------- 1730// if using .NET Framework 1731// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 1732// This requires including the reference to System.Web.Extensions in your project 1733using System.Web.Script.Serialization; 1734// ------------------------------------------------------------------------- 1735// if using .Net Core 1736// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 1737using System.Text.Json; 1738// ------------------------------------------------------------------------- 1739 1740namespace ConsoleTests 1741{ 1742 internal class Program 1743 { 1744 private static void Main(string[] args) 1745 { 1746 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1747 string QUERY_URL = "https://www.alphavantage.co/query?function=REALTIME_BULK_QUOTES&symbol=MSFT,AAPL,IBM&apikey=demo"; 1748 Uri queryUri = new Uri(QUERY_URL); 1749 1750 using (WebClient client = new WebClient()) 1751 { 1752 // ------------------------------------------------------------------------- 1753 // if using .NET Framework (System.Web.Script.Serialization) 1754 1755 JavaScriptSerializer js = new JavaScriptSerializer(); 1756 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1757 1758 // ------------------------------------------------------------------------- 1759 // if using .NET Core (System.Text.Json) 1760 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1761 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1762 1763 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1764 1765 // ------------------------------------------------------------------------- 1766 1767 // do something with the json_data 1768 } 1769 } 1770 } 1771} 1772 </code></pre> 1773</div> 1774 1775 1776<div class="other-code" style="background-color: #f9f9f9;"> 1777 <br> 1778 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1779 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1780 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1781 <br> 1782</div> 1783 <br> 1784 <br> 1785 1786 <h4 id="realtime-bulk-bid-ask-prices">Realtime Bulk Bid & Ask Prices <span class="premium-label">Premium</span></h4> 1787 <br> 1788 <p>This API returns realtime bid and ask prices for US-traded symbols in bulk, accepting up to <u>100 symbols</u> per API request and covering both regular and extended (pre-market and post-market) trading hours. You can use this endpoint as an efficient way to query top-of-the-book Level 2 data.</p> 1789 <br> 1790 <h6><b>API Parameters</b></h6> 1791 <p><b>â Required: <code>function</code></b></p> 1792 <p>The time series of your choice. In this case, <code>function=REALTIME_BULK_BID_ASK_PRICES</code> </p> 1793 <p><b>â Required: <code>symbol</code></b></p> 1794 <p>Up to <u>100 symbols</u> separated by comma. For example: <code>symbol=MSFT,AAPL,IBM</code>. If more than 100 symbols are provided, only the first 100 symbols will be honored as part of the API input.</p> 1795 <p>â Optional: <code>datatype</code></p> 1796 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the search results in JSON format; <code>csv</code> returns the search results as a CSV (comma separated value) file. </p> 1797 <p><b>â Required: <code>apikey</code></b></p> 1798 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1799 <br> 1800 1801 <h6><b>Examples (click for JSON output)</b></h6> 1802 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_BULK_BID_ASK_PRICES&symbol=MSFT,AAPL,IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_BULK_BID_ASK_PRICES&<b>symbol</b>=MSFT,AAPL,IBM&<b>apikey</b>=demo</code></a></p> 1803 <br> 1804 1805 <div class="premium-msg"> 1806 <p>ð¡ Tip: this is a premium API function. Please subscribe to any <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> that mentions "Realtime US Market Data" in its description to unlock this endpoint for your personal use. For commercial use, please <a href="/cdn-cgi/l/email-protection#3a494f4a4a55484e7a5b564a525b4c5b544e5b5d5f145955" target="_blank">contact sales</a>.</p> 1807 </div> 1808 <br> 1809 1810 1811<h6><b>Language-specific guides</b></h6> 1812 <div> 1813 <button class="python-btn">Python</button> 1814 <button class="node-btn">NodeJS</button> 1815 <button class="php-btn">PHP</button> 1816 <button class="cs-btn">C#/.NET</button> 1817 <button class="other-btn">â¨MCP & Other</button> 1818</div> 1819 1820<div class="python-code"> 1821 <pre><code class="python"> 1822import requests 1823 1824# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1825url = 'https://www.alphavantage.co/query?function=REALTIME_BULK_BID_ASK_PRICES&symbol=MSFT,AAPL,IBM&apikey=demo' 1826r = requests.get(url) 1827data = r.json() 1828 1829print(data) 1830 </code></pre> 1831</div> 1832 1833<div class="node-code"> 1834 <pre><code class="javascript"> 1835'use strict'; 1836var request = require('request'); 1837 1838// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1839var url = 'https://www.alphavantage.co/query?function=REALTIME_BULK_BID_ASK_PRICES&symbol=MSFT,AAPL,IBM&apikey=demo'; 1840 1841request.get({ 1842 url: url, 1843 json: true, 1844 headers: {'User-Agent': 'request'} 1845 }, (err, res, data) => { 1846 if (err) { 1847 console.log('Error:', err); 1848 } else if (res.statusCode !== 200) { 1849 console.log('Status:', res.statusCode); 1850 } else { 1851 // data is successfully parsed as a JSON object: 1852 console.log(data); 1853 } 1854}); 1855 </code></pre> 1856</div> 1857 1858<div class="php-code"> 1859 <pre><code class="php"> 1860<?php 1861// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1862$json = file_get_contents('https://www.alphavantage.co/query?function=REALTIME_BULK_BID_ASK_PRICES&symbol=MSFT,AAPL,IBM&apikey=demo'); 1863 1864$data = json_decode($json,true); 1865 1866print_r($data); 1867 1868exit; 1869 </code></pre> 1870</div> 1871 1872<div class="cs-code"> 1873 <pre><code class="cs"> 1874using System; 1875using System.Collections.Generic; 1876using System.Net; 1877
1878// ------------------------------------------------------------------------- 1879// if using .NET Framework 1880// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 1881// This requires including the reference to System.Web.Extensions in your project 1882using System.Web.Script.Serialization; 1883// ------------------------------------------------------------------------- 1884// if using .Net Core 1885// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 1886using System.Text.Json; 1887// ------------------------------------------------------------------------- 1888 1889namespace ConsoleTests 1890{ 1891 internal class Program 1892 { 1893 private static void Main(string[] args) 1894 { 1895 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1896 string QUERY_URL = "https://www.alphavantage.co/query?function=REALTIME_BULK_BID_ASK_PRICES&symbol=MSFT,AAPL,IBM&apikey=demo"; 1897 Uri queryUri = new Uri(QUERY_URL); 1898 1899 using (WebClient client = new WebClient()) 1900 { 1901 // ------------------------------------------------------------------------- 1902 // if using .NET Framework (System.Web.Script.Serialization) 1903 1904 JavaScriptSerializer js = new JavaScriptSerializer(); 1905 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 1906 1907 // ------------------------------------------------------------------------- 1908 // if using .NET Core (System.Text.Json) 1909 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 1910 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 1911 1912 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 1913 1914 // ------------------------------------------------------------------------- 1915 1916 // do something with the json_data 1917 } 1918 } 1919 } 1920} 1921 </code></pre> 1922</div> 1923 1924 1925<div class="other-code" style="background-color: #f9f9f9;"> 1926 <br> 1927 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 1928 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 1929 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 1930 <br> 1931</div> 1932 <br> 1933 <br> 1934 1935 1936 <h4 id="symbolsearch">Search Endpoint <span class="utility-label">Utility</span></h4> 1937 <br> 1938 <p>Looking for some specific symbols or companies? Trying to build an auto-complete search box similar to the one below?</p> 1939 <p><img style="width: 60%; height: auto;" src="/static/img/autocomplete.jpg" alt="The stock symbol search API powers an auto-complete ticker search experience"></p> 1940 <br> 1941 <p>We've got you covered! The Search Endpoint returns the best-matching symbols and market information based on keywords of your choice. The search results also contain match scores that provide you with the full flexibility to develop your own search and filtering logic. </p> 1942 <br> 1943 <h6><b>API Parameters</b></h6> 1944 <p><b>â Required: <code>function</code></b></p> 1945 <p>The API function of your choice. In this case, <code>function=SYMBOL_SEARCH</code></p> 1946 <p><b>â Required: <code>keywords</code></b></p> 1947 <p>A text string of your choice. For example: <code>keywords=microsoft</code>. 1948 </p> 1949 <p>â Optional: <code>datatype</code></p> 1950 <p>
1950By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the search results in JSON format; <code>csv</code> returns the search results as a CSV (comma separated value) file. </p> 1951 <p><b>â Required: <code>apikey</code></b></p> 1952 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 1953 <br> 1954 1955 <h6><b>Examples (click for JSON output)</b></h6> 1956 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=tesco&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SYMBOL_SEARCH&<b>keywords</b>=tesco&<b>apikey</b>=demo</code></a></p> 1957 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=tencent&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SYMBOL_SEARCH&<b>keywords</b>=tencent&<b>apikey</b>=demo</code></a></p> 1958 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=BA&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SYMBOL_SEARCH&<b>keywords</b>=BA&<b>apikey</b>=demo</code></a></p> 1959 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=SAIC&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SYMBOL_SEARCH&<b>keywords</b>=SAIC&<b>apikey</b>=demo</code></a></p> 1960 Downloadable CSV file: 1961 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=BA&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SYMBOL_SEARCH&<b>keywords</b>=BA&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 1962 <br> 1963 1964 <h6><b>Language-specific guides</b></h6> 1965 <div> 1966 <button class="python-btn">Python</button> 1967 <button class="node-btn">NodeJS</button> 1968 <button class="php-btn">PHP</button> 1969 <button class="cs-btn">C#/.NET</button> 1970 <button class="other-btn">â¨MCP & Other</button> 1971</div> 1972 1973<div class="python-code"> 1974 <pre><code class="python"> 1975import requests 1976 1977# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1978url = 'https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=tesco&apikey=demo' 1979r = requests.get(url) 1980data = r.json() 1981 1982print(data) 1983 </code></pre> 1984</div> 1985 1986<div class="node-code"> 1987 <pre><code class="javascript"> 1988'use strict'; 1989var request = require('request'); 1990 1991// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 1992var url = 'https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=tesco&apikey=demo'; 1993 1994request.get({ 1995 url: url, 1996 json: true, 1997 headers: {'User-Agent': 'request'} 1998 }, (err, res, data) => { 1999 if (err) { 2000 console.log('Error:', err); 2001 } else if (res.statusCode !== 200) { 2002 console.log('Status:', res.statusCode); 2003 } else { 2004 // data is successfully parsed as a JSON object: 2005 console.log(data); 2006 } 2007}); 2008 </code></pre> 2009</div> 2010 2011<div class="php-code"> 2012 <pre><code class="php"> 2013<?php 2014// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2015$json = file_get_contents('https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=tesco&apikey=demo'); 2016 2017$data = json_decode($json,true); 2018 2019print_r($data); 2020 2021exit; 2022 </code></pre> 2023</div> 2024 2025<div class="cs-code"> 2026 <pre><code class="cs"> 2027using System; 2028using System.Collections.Generic; 2029using System.Net; 2030 2031// ------------------------------------------------------------------------- 2032// if using .NET Framework
2033// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2034// This requires including the reference to System.Web.Extensions in your project 2035using System.Web.Script.Serialization; 2036// ------------------------------------------------------------------------- 2037// if using .Net Core 2038// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2039using System.Text.Json; 2040// ------------------------------------------------------------------------- 2041 2042namespace ConsoleTests 2043{ 2044 internal class Program 2045 { 2046 private static void Main(string[] args) 2047 { 2048 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2049 string QUERY_URL = "https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=tesco&apikey=demo" 2050 Uri queryUri = new Uri(QUERY_URL); 2051 2052 using (WebClient client = new WebClient()) 2053 { 2054 // ------------------------------------------------------------------------- 2055 // if using .NET Framework (System.Web.Script.Serialization) 2056 2057 JavaScriptSerializer js = new JavaScriptSerializer(); 2058 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2059 2060 // ------------------------------------------------------------------------- 2061 // if using .NET Core (System.Text.Json) 2062 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2063 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2064 2065 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2066 2067 // ------------------------------------------------------------------------- 2068 2069 // do something with the json_data 2070 } 2071 } 2072 } 2073} 2074 </code></pre> 2075</div> 2076 2077 2078<div class="other-code" style="background-color: #f9f9f9;"> 2079 <br> 2080 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2081 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2082 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2083 <br> 2084</div> 2085 <br> 2086 2087 <h4 id="market-status">Global Market Open & Close Status <span class="utility-label">Utility</span></h4> 2088 <br> 2089 <p>This endpoint returns the current market status (open vs. closed) of major trading venues for equities, forex, and cryptocurrencies around the world.</p> 2090 <br> 2091 <h6><b>API Parameters</b></h6> 2092 <p><b>â Required: <code>function</code></b></p> 2093 <p>The API function of your choice. In this case, <code>function=MARKET_STATUS</code></p> 2094 <p><b>â Required: <code>apikey</code></b></p> 2095 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 2096 <br> 2097 2098 <h6><b>Examples (click for JSON output)</b></h6> 2099 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MARKET_STATUS&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MARKET_STATUS&<b>apikey</b>=demo</code></a></p> 2100 <br> 2101 2102 <h6><b>Language-specific guides</b></h6> 2103 <div> 2104 <button class="python-btn">Python</button> 2105 <button class="node-btn">NodeJS</button> 2106 <button class="php-btn">PHP</button> 2107 <button class="cs-btn">C#/.NET</button> 2108 <button class="other-btn">â¨MCP & Other</button> 2109</div> 2110 2111<div class="python-code"> 2112 <pre><code class="python"> 2113import requests 2114 2115# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2116url = 'https://www.alphavantage.co/query?function=MARKET_STATUS&apikey=demo' 2117r = requests.get(url) 2118data = r.json() 2119 2120print(data) 2121 </code></pre> 2122</div> 2123 2124<div class="node-code"> 2125 <pre><code class="javascript"> 2126'use strict'; 2127var request = require('request'); 2128 2129// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2130var url = 'https://www.alphavantage.co/query?function=MARKET_STATUS&apikey=demo'; 2131 2132request.get({ 2133 url: url, 2134 json: true, 2135 headers: {'User-Agent': 'request'} 2136 }, (err, res, data) => { 2137 if (err) { 2138 console.log('Error:', err); 2139 } else if (res.statusCode !== 200) { 2140 console.log('Status:', res.statusCode); 2141 } else { 2142 // data is successfully parsed as a JSON object: 2143 console.log(data); 2144 } 2145}); 2146 </code></pre> 2147</div> 2148 2149<div class="php-code"> 2150 <pre><code class="php"> 2151<?php 2152// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2153$json = file_get_contents('https://www.alphavantage.co/query?function=MARKET_STATUS&apikey=demo'); 2154 2155$data = json_decode($json,true); 2156 2157print_r($data); 2158 2159exit; 2160 </code></pre> 2161</div> 2162 2163<div class="cs-code"> 2164 <pre><code class="cs"> 2165using System; 2166using System.Collections.Generic; 2167using System.Net; 2168
2169// ------------------------------------------------------------------------- 2170// if using .NET Framework 2171// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2172// This requires including the reference to System.Web.Extensions in your project 2173using System.Web.Script.Serialization; 2174// ------------------------------------------------------------------------- 2175// if using .Net Core 2176// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2177using System.Text.Json; 2178// ------------------------------------------------------------------------- 2179 2180namespace ConsoleTests 2181{ 2182 internal class Program 2183 { 2184 private static void Main(string[] args) 2185 { 2186 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2187 string QUERY_URL = "https://www.alphavantage.co/query?function=MARKET_STATUS&apikey=demo"; 2188 Uri queryUri = new Uri(QUERY_URL); 2189 2190 using (WebClient client = new WebClient()) 2191 { 2192 // ------------------------------------------------------------------------- 2193 // if using .NET Framework (System.Web.Script.Serialization) 2194 2195 JavaScriptSerializer js = new JavaScriptSerializer(); 2196 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2197 2198 // ------------------------------------------------------------------------- 2199 // if using .NET Core (System.Text.Json) 2200 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2201 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2202 2203 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2204 2205 // ------------------------------------------------------------------------- 2206 2207 // do something with the json_data 2208 } 2209 } 2210 } 2211} 2212 </code></pre> 2213</div> 2214 2215 2216<div class="other-code" style="background-color: #f9f9f9;"> 2217 <br> 2218 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2219 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2220 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2221 <br> 2222</div> 2223 <br> 2224 2225 2226 </section> 2227 2228 2229 <section> 2230 <h2 id="index-data">Index Data APIs</h2> 2231 <p>This suite of APIs provides decades of history for 200+ major indices in daily, weekly, and monthly temporal resolutions.</p> 2232 <br> 2233 <h4 id="index-data-dow">Dow Jones Industrial Average <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 2234 <br> 2235 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for the Dow Jones Industrial Average Index.</p> 2236 <br> 2237 <h6><b>API Parameters</b></h6> 2238 <p><b>â Required: <code>function</code></b></p> 2239 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 2240 <p><b>â Required: <code>symbol</code></b></p> 2241 <p>In this case, <code>symbol=DJI</code> </p> 2242 <p><b>â Required: <code>interval</code></b></p> 2243 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 2244 <p>â Optional: <code>datatype</code></p> 2245 <p>
2245By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 2246 <p><b>â Required: <code>apikey</code></b></p> 2247 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 2248 <br> 2249 2250 <h6><b>Examples (click for JSON output)</b></h6> 2251 Weekly open, high, low, close (OHLC) time series data for the Dow Jones Industrial Average Index (interval=weekly) 2252 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJI&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=DJI&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 2253 Downloadable CSV file: 2254 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJI&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=DJI&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 2255 <br> 2256 2257 <div class="premium-msg"> 2258 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 2259 </div> 2260 <br> 2261 2262 <h6><b>Language-specific guides</b></h6> 2263 <div> 2264 <button class="python-btn">Python</button> 2265 <button class="node-btn">NodeJS</button> 2266 <button class="php-btn">PHP</button> 2267 <button class="cs-btn">C#/.NET</button> 2268 <button class="other-btn">â¨MCP & Other</button> 2269</div> 2270 2271<div class="python-code"> 2272 <pre><code class="python"> 2273import requests 2274 2275# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2276url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJI&interval=weekly&apikey=demo' 2277r = requests.get(url) 2278data = r.json() 2279 2280print(data) 2281 </code></pre> 2282</div> 2283 2284<div class="node-code"> 2285 <pre><code class="javascript"> 2286'use strict'; 2287var request = require('request'); 2288 2289// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2290var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJI&interval=weekly&apikey=demo'; 2291 2292request.get({ 2293 url: url, 2294 json: true, 2295 headers: {'User-Agent': 'request'} 2296 }, (err, res, data) => { 2297 if (err) { 2298 console.log('Error:', err); 2299 } else if (res.statusCode !== 200) { 2300 console.log('Status:', res.statusCode); 2301 } else { 2302 // data is successfully parsed as a JSON object: 2303 console.log(data); 2304 } 2305}); 2306 </code></pre> 2307</div> 2308 2309<div class="php-code"> 2310 <pre><code class="php"> 2311<?php 2312// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2313$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJI&interval=weekly&apikey=demo'); 2314 2315$data = json_decode($json,true); 2316 2317print_r($data); 2318 2319exit; 2320 </code></pre> 2321</div> 2322 2323<div class="cs-code"> 2324 <pre><code class="cs"> 2325using System; 2326using System.Collections.Generic; 2327using System.Net; 2328 2329// ------------------------------------------------------------------------- 2330// if using .NET Framework 2331// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2332// This requires including the reference to System.Web.Extensions in your project 2333using System.Web.Script.Serialization; 2334// ------------------------------------------------------------------------- 2335// if using .Net Core 2336// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2337using System.Text.Json; 2338// ------------------------------------------------------------------------- 2339 2340namespace ConsoleTests 2341{
2342 internal class Program 2343 { 2344 private static void Main(string[] args) 2345 { 2346 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2347 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJI&interval=weekly&apikey=demo"; 2348 Uri queryUri = new Uri(QUERY_URL); 2349 2350 using (WebClient client = new WebClient()) 2351 { 2352 // ------------------------------------------------------------------------- 2353 // if using .NET Framework (System.Web.Script.Serialization) 2354 2355 JavaScriptSerializer js = new JavaScriptSerializer(); 2356 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2357 2358 // ------------------------------------------------------------------------- 2359 // if using .NET Core (System.Text.Json) 2360 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2361 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2362 2363 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2364 2365 // ------------------------------------------------------------------------- 2366 2367 // do something with the json_data 2368 } 2369 } 2370 } 2371} 2372 </code></pre> 2373</div> 2374 2375 2376<div class="other-code" style="background-color: #f9f9f9;"> 2377 <br> 2378 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2379 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2380 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2381 <br> 2382</div> 2383 2384 <br> 2385 <br> 2386 2387 <h4 id="index-data-sp500">S&P 500 <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 2388 <br> 2389 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for the S&P 500 Index.</p> 2390 <br> 2391 <h6><b>API Parameters</b></h6> 2392 <p><b>â Required: <code>function</code></b></p> 2393 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 2394 <p><b>â Required: <code>symbol</code></b></p> 2395 <p>In this case, <code>symbol=SPX</code> </p> 2396 <p><b>â Required: <code>interval</code></b></p> 2397 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 2398 <p>â Optional: <code>datatype</code></p> 2399 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 2400 <p><b>â Required: <code>apikey</code></b></p> 2401 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 2402 <br> 2403 2404 <h6><b>Examples (click for JSON output)</b></h6> 2405 Weekly open, high, low, close (OHLC) time series data for the S&P 500 Index (interval=weekly) 2406 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=SPX&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=SPX&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 2407 Downloadable CSV file: 2408 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=SPX&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=SPX&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 2409 <br> 2410 2411 <div class="premium-msg"> 2412 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 2413 </div> 2414 <br> 2415 2416 <h6><b>Language-specific guides</b></h6> 2417 <div> 2418 <button class="python-btn">Python</button> 2419 <button class="node-btn">NodeJS</button> 2420 <button class="php-btn">PHP</button> 2421 <button class="cs-btn">C#/.NET</button> 2422 <button class="other-btn">â¨MCP & Other</button> 2423</div> 2424 2425<div class="python-code"> 2426 <pre><code class="python"> 2427import requests 2428 2429# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2430url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=SPX&interval=weekly&apikey=demo' 2431r = requests.get(url) 2432data = r.json() 2433 2434print(data) 2435 </code></pre> 2436</div> 2437 2438<div class="node-code"> 2439 <pre><code class="javascript"> 2440'use strict'; 2441var request = require('request'); 2442 2443// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2444var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=SPX&interval=weekly&apikey=demo'; 2445 2446request.get({ 2447 url: url, 2448 json: true, 2449 headers: {'User-Agent': 'request'} 2450 }, (err, res, data) => { 2451 if (err) { 2452 console.log('Error:', err); 2453 } else if (res.statusCode !== 200) { 2454 console.log('Status:', res.statusCode); 2455 } else { 2456 // data is successfully parsed as a JSON object: 2457 console.log(data); 2458 } 2459}); 2460 </code></pre> 2461</div> 2462 2463<div class="php-code"> 2464 <pre><code class="php"> 2465<?php 2466// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2467$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=SPX&interval=weekly&apikey=demo'); 2468 2469$data = json_decode($json,true); 2470 2471print_r($data); 2472 2473exit; 2474 </code></pre> 2475</div> 2476 2477<div class="cs-code"> 2478 <pre><code class="cs"> 2479using System; 2480using System.Collections.Generic; 2481using System.Net; 2482
2483// ------------------------------------------------------------------------- 2484// if using .NET Framework 2485// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2486// This requires including the reference to System.Web.Extensions in your project 2487using System.Web.Script.Serialization; 2488// ------------------------------------------------------------------------- 2489// if using .Net Core 2490// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2491using System.Text.Json; 2492// ------------------------------------------------------------------------- 2493 2494namespace ConsoleTests 2495{ 2496 internal class Program 2497 { 2498 private static void Main(string[] args) 2499 { 2500 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2501 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=SPX&interval=weekly&apikey=demo"; 2502 Uri queryUri = new Uri(QUERY_URL); 2503 2504 using (WebClient client = new WebClient()) 2505 { 2506 // ------------------------------------------------------------------------- 2507 // if using .NET Framework (System.Web.Script.Serialization) 2508 2509 JavaScriptSerializer js = new JavaScriptSerializer(); 2510 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2511 2512 // ------------------------------------------------------------------------- 2513 // if using .NET Core (System.Text.Json) 2514 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2515 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2516 2517 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2518 2519 // ------------------------------------------------------------------------- 2520 2521 // do something with the json_data 2522 } 2523 } 2524 } 2525} 2526 </code></pre> 2527</div> 2528 2529 2530<div class="other-code" style="background-color: #f9f9f9;"> 2531 <br> 2532 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2533 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2534 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2535 <br> 2536</div> 2537 2538 <br> 2539 <br> 2540 2541 <h4 id="index-data-nasdaq">NASDAQ Composite <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 2542 <br> 2543 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for the NASDAQ Composite Index.</p> 2544 <br> 2545 <h6><b>API Parameters</b></h6> 2546 <p><b>â Required: <code>function</code></b></p> 2547 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 2548 <p><b>â Required: <code>symbol</code></b></p> 2549 <p>In this case, <code>symbol=COMP</code> </p> 2550 <p><b>â Required: <code>interval</code></b></p> 2551 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 2552 <p>â Optional: <code>datatype</code></p> 2553 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 2554 <p><b>â Required: <code>apikey</code></b></p> 2555 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 2556 <br> 2557 2558 <h6><b>Examples (click for JSON output)</b></h6> 2559 Weekly open, high, low, close (OHLC) time series data for the Nasdaq Composite Index (interval=weekly) 2560 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=COMP&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=COMP&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 2561 Downloadable CSV file: 2562 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=COMP&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=COMP&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 2563 <br> 2564 2565 <div class="premium-msg"> 2566 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 2567 </div> 2568 <br> 2569 2570 <h6><b>Language-specific guides</b></h6> 2571 <div> 2572 <button class="python-btn">Python</button> 2573 <button class="node-btn">NodeJS</button> 2574 <button class="php-btn">PHP</button> 2575 <button class="cs-btn">C#/.NET</button> 2576 <button class="other-btn">â¨MCP & Other</button> 2577</div> 2578 2579<div class="python-code"> 2580 <pre><code class="python"> 2581import requests 2582 2583# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2584url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=COMP&interval=weekly&apikey=demo' 2585r = requests.get(url) 2586data = r.json() 2587 2588print(data) 2589 </code></pre> 2590</div> 2591 2592<div class="node-code"> 2593 <pre><code class="javascript"> 2594'use strict'; 2595var request = require('request'); 2596 2597// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2598var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=COMP&interval=weekly&apikey=demo'; 2599 2600request.get({ 2601 url: url, 2602 json: true, 2603 headers: {'User-Agent': 'request'} 2604 }, (err, res, data) => { 2605 if (err) { 2606 console.log('Error:', err); 2607 } else if (res.statusCode !== 200) { 2608 console.log('Status:', res.statusCode); 2609 } else { 2610 // data is successfully parsed as a JSON object: 2611 console.log(data); 2612 } 2613}); 2614 </code></pre> 2615</div> 2616 2617<div class="php-code"> 2618 <pre><code class="php"> 2619<?php 2620// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2621$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=COMP&interval=weekly&apikey=demo'); 2622 2623$data = json_decode($json,true); 2624 2625print_r($data); 2626 2627exit; 2628 </code></pre> 2629</div> 2630 2631<div class="cs-code"> 2632 <pre><code class="cs"> 2633using System; 2634using System.Collections.Generic; 2635using System.Net; 2636
2637// ------------------------------------------------------------------------- 2638// if using .NET Framework 2639// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2640// This requires including the reference to System.Web.Extensions in your project 2641using System.Web.Script.Serialization; 2642// ------------------------------------------------------------------------- 2643// if using .Net Core 2644// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2645using System.Text.Json; 2646// ------------------------------------------------------------------------- 2647 2648namespace ConsoleTests 2649{ 2650 internal class Program 2651 { 2652 private static void Main(string[] args) 2653 { 2654 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2655 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=COMP&interval=weekly&apikey=demo"; 2656 Uri queryUri = new Uri(QUERY_URL); 2657 2658 using (WebClient client = new WebClient()) 2659 { 2660 // ------------------------------------------------------------------------- 2661 // if using .NET Framework (System.Web.Script.Serialization) 2662 2663 JavaScriptSerializer js = new JavaScriptSerializer(); 2664 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2665 2666 // ------------------------------------------------------------------------- 2667 // if using .NET Core (System.Text.Json) 2668 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2669 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2670 2671 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2672 2673 // ------------------------------------------------------------------------- 2674 2675 // do something with the json_data 2676 } 2677 } 2678 } 2679} 2680 </code></pre> 2681</div> 2682 2683 2684<div class="other-code" style="background-color: #f9f9f9;"> 2685 <br> 2686 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2687 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2688 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2689 <br> 2690</div> 2691 2692 <br> 2693 <br> 2694 2695 <h4 id="index-data-nasdaq100">NASDAQ 100 <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 2696 <br> 2697 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for the NASDAQ-100 Index.</p> 2698 <br> 2699 <h6><b>API Parameters</b></h6> 2700 <p><b>â Required: <code>function</code></b></p> 2701 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 2702 <p><b>â Required: <code>symbol</code></b></p> 2703 <p>In this case, <code>symbol=NDX</code> </p> 2704 <p><b>â Required: <code>interval</code></b></p> 2705 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 2706 <p>â Optional: <code>datatype</code></p> 2707 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 2708 <p><b>â Required: <code>apikey</code></b></p> 2709 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 2710 <br> 2711 2712 <h6><b>Examples (click for JSON output)</b></h6> 2713 Weekly open, high, low, close (OHLC) time series data for the Nasdaq 100 Index (interval=weekly) 2714 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=NDX&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=NDX&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 2715 Downloadable CSV file: 2716 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=NDX&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=NDX&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 2717 <br> 2718 2719 <div class="premium-msg"> 2720 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 2721 </div> 2722 <br> 2723 2724 <h6><b>Language-specific guides</b></h6> 2725 <div> 2726 <button class="python-btn">Python</button> 2727 <button class="node-btn">NodeJS</button> 2728 <button class="php-btn">PHP</button> 2729 <button class="cs-btn">C#/.NET</button> 2730 <button class="other-btn">â¨MCP & Other</button> 2731</div> 2732 2733<div class="python-code"> 2734 <pre><code class="python"> 2735import requests 2736 2737# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2738url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=NDX&interval=weekly&apikey=demo' 2739r = requests.get(url) 2740data = r.json() 2741 2742print(data) 2743 </code></pre> 2744</div> 2745 2746<div class="node-code"> 2747 <pre><code class="javascript"> 2748'use strict'; 2749var request = require('request'); 2750 2751// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2752var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=NDX&interval=weekly&apikey=demo'; 2753 2754request.get({ 2755 url: url, 2756 json: true, 2757 headers: {'User-Agent': 'request'} 2758 }, (err, res, data) => { 2759 if (err) { 2760 console.log('Error:', err); 2761 } else if (res.statusCode !== 200) { 2762 console.log('Status:', res.statusCode); 2763 } else { 2764 // data is successfully parsed as a JSON object: 2765 console.log(data); 2766 } 2767}); 2768 </code></pre> 2769</div> 2770 2771<div class="php-code"> 2772 <pre><code class="php"> 2773<?php 2774// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2775$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=NDX&interval=weekly&apikey=demo'); 2776 2777$data = json_decode($json,true); 2778 2779print_r($data); 2780 2781exit; 2782 </code></pre> 2783</div> 2784 2785<div class="cs-code"> 2786 <pre><code class="cs"> 2787using System; 2788using System.Collections.Generic; 2789using System.Net; 2790
2791// ------------------------------------------------------------------------- 2792// if using .NET Framework 2793// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2794// This requires including the reference to System.Web.Extensions in your project 2795using System.Web.Script.Serialization; 2796// ------------------------------------------------------------------------- 2797// if using .Net Core 2798// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2799using System.Text.Json; 2800// ------------------------------------------------------------------------- 2801 2802namespace ConsoleTests 2803{ 2804 internal class Program 2805 { 2806 private static void Main(string[] args) 2807 { 2808 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2809 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=NDX&interval=weekly&apikey=demo"; 2810 Uri queryUri = new Uri(QUERY_URL); 2811 2812 using (WebClient client = new WebClient()) 2813 { 2814 // ------------------------------------------------------------------------- 2815 // if using .NET Framework (System.Web.Script.Serialization) 2816 2817 JavaScriptSerializer js = new JavaScriptSerializer(); 2818 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2819 2820 // ------------------------------------------------------------------------- 2821 // if using .NET Core (System.Text.Json) 2822 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2823 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2824 2825 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2826 2827 // ------------------------------------------------------------------------- 2828 2829 // do something with the json_data 2830 } 2831 } 2832 } 2833} 2834 </code></pre> 2835</div> 2836 2837 2838<div class="other-code" style="background-color: #f9f9f9;"> 2839 <br> 2840 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2841 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2842 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2843 <br> 2844</div> 2845 2846 <br> 2847 <br> 2848 2849 <h4 id="index-data-vix">Cboe Volatility Index (VIX) <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 2850 <br> 2851 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for the Cboe Volatility Index (VIX).</p> 2852 <br> 2853 <h6><b>API Parameters</b></h6> 2854 <p><b>â Required: <code>function</code></b></p> 2855 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 2856 <p><b>â Required: <code>symbol</code></b></p> 2857 <p>In this case, <code>symbol=VIX</code> </p> 2858 <p><b>â Required: <code>interval</code></b></p> 2859 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 2860 <p>â Optional: <code>datatype</code></p> 2861 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 2862 <p><b>â Required: <code>apikey</code></b></p> 2863 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 2864 <br> 2865 2866 <h6><b>Examples (click for JSON output)</b></h6> 2867 Weekly open, high, low, close (OHLC) time series data for the Cboe Volatility Index (VIX) 2868 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=VIX&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=VIX&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 2869 Downloadable CSV file: 2870 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=VIX&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=VIX&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 2871 <br> 2872 2873 <div class="premium-msg"> 2874 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 2875 </div> 2876 <br> 2877 2878 <h6><b>Language-specific guides</b></h6> 2879 <div> 2880 <button class="python-btn">Python</button> 2881 <button class="node-btn">NodeJS</button> 2882 <button class="php-btn">PHP</button> 2883 <button class="cs-btn">C#/.NET</button> 2884 <button class="other-btn">â¨MCP & Other</button> 2885</div> 2886 2887<div class="python-code"> 2888 <pre><code class="python"> 2889import requests 2890 2891# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2892url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=VIX&interval=weekly&apikey=demo' 2893r = requests.get(url) 2894data = r.json() 2895 2896print(data) 2897 </code></pre> 2898</div> 2899 2900<div class="node-code"> 2901 <pre><code class="javascript"> 2902'use strict'; 2903var request = require('request'); 2904 2905// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2906var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=VIX&interval=weekly&apikey=demo'; 2907 2908request.get({ 2909 url: url, 2910 json: true, 2911 headers: {'User-Agent': 'request'} 2912 }, (err, res, data) => { 2913 if (err) { 2914 console.log('Error:', err); 2915 } else if (res.statusCode !== 200) { 2916 console.log('Status:', res.statusCode); 2917 } else { 2918 // data is successfully parsed as a JSON object: 2919 console.log(data); 2920 } 2921}); 2922 </code></pre> 2923</div> 2924 2925<div class="php-code"> 2926 <pre><code class="php"> 2927<?php 2928// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2929$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=VIX&interval=weekly&apikey=demo'); 2930 2931$data = json_decode($json,true); 2932 2933print_r($data); 2934 2935exit; 2936 </code></pre> 2937</div> 2938 2939<div class="cs-code"> 2940 <pre><code class="cs"> 2941using System; 2942using System.Collections.Generic; 2943using System.Net; 2944
2945// ------------------------------------------------------------------------- 2946// if using .NET Framework 2947// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 2948// This requires including the reference to System.Web.Extensions in your project 2949using System.Web.Script.Serialization; 2950// ------------------------------------------------------------------------- 2951// if using .Net Core 2952// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 2953using System.Text.Json; 2954// ------------------------------------------------------------------------- 2955 2956namespace ConsoleTests 2957{ 2958 internal class Program 2959 { 2960 private static void Main(string[] args) 2961 { 2962 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 2963 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=VIX&interval=weekly&apikey=demo"; 2964 Uri queryUri = new Uri(QUERY_URL); 2965 2966 using (WebClient client = new WebClient()) 2967 { 2968 // ------------------------------------------------------------------------- 2969 // if using .NET Framework (System.Web.Script.Serialization) 2970 2971 JavaScriptSerializer js = new JavaScriptSerializer(); 2972 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 2973 2974 // ------------------------------------------------------------------------- 2975 // if using .NET Core (System.Text.Json) 2976 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 2977 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 2978 2979 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 2980 2981 // ------------------------------------------------------------------------- 2982 2983 // do something with the json_data 2984 } 2985 } 2986 } 2987} 2988 </code></pre> 2989</div> 2990 2991 2992<div class="other-code" style="background-color: #f9f9f9;"> 2993 <br> 2994 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 2995 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 2996 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 2997 <br> 2998</div> 2999 3000 <br> 3001 <br> 3002 3003 <h4 id="index-data-russell">Russell 2000 <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 3004 <br> 3005 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for the Russell 2000 Index.</p> 3006 <br> 3007 <h6><b>API Parameters</b></h6> 3008 <p><b>â Required: <code>function</code></b></p> 3009 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 3010 <p><b>â Required: <code>symbol</code></b></p> 3011 <p>In this case, <code>symbol=RUT</code> </p> 3012 <p><b>â Required: <code>interval</code></b></p> 3013 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 3014 <p>â Optional: <code>datatype</code></p> 3015 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 3016 <p><b>â Required: <code>apikey</code></b></p> 3017 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3018 <br> 3019 3020 <h6><b>Examples (click for JSON output)</b></h6> 3021 Weekly open, high, low, close (OHLC) time series data for the Russell 2000 Index (interval=weekly) 3022 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=RUT&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=RUT&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 3023 Downloadable CSV file: 3024 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=RUT&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=RUT&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 3025 <br> 3026 3027 <div class="premium-msg"> 3028 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 3029 </div> 3030 <br> 3031 3032 <h6><b>Language-specific guides</b></h6> 3033 <div> 3034 <button class="python-btn">Python</button> 3035 <button class="node-btn">NodeJS</button> 3036 <button class="php-btn">PHP</button> 3037 <button class="cs-btn">C#/.NET</button> 3038 <button class="other-btn">â¨MCP & Other</button> 3039</div> 3040 3041<div class="python-code"> 3042 <pre><code class="python"> 3043import requests 3044 3045# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3046url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=RUT&interval=weekly&apikey=demo' 3047r = requests.get(url) 3048data = r.json() 3049 3050print(data) 3051 </code></pre> 3052</div> 3053 3054<div class="node-code"> 3055 <pre><code class="javascript"> 3056'use strict'; 3057var request = require('request'); 3058 3059// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3060var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=RUT&interval=weekly&apikey=demo'; 3061 3062request.get({ 3063 url: url, 3064 json: true, 3065 headers: {'User-Agent': 'request'} 3066 }, (err, res, data) => { 3067 if (err) { 3068 console.log('Error:', err); 3069 } else if (res.statusCode !== 200) { 3070 console.log('Status:', res.statusCode); 3071 } else { 3072 // data is successfully parsed as a JSON object: 3073 console.log(data); 3074 } 3075}); 3076 </code></pre> 3077</div> 3078 3079<div class="php-code"> 3080 <pre><code class="php"> 3081<?php 3082// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3083$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=RUT&interval=weekly&apikey=demo'); 3084 3085$data = json_decode($json,true); 3086 3087print_r($data); 3088 3089exit; 3090 </code></pre> 3091</div> 3092 3093<div class="cs-code"> 3094 <pre><code class="cs"> 3095using System; 3096using System.Collections.Generic; 3097using System.Net; 3098
3099// ------------------------------------------------------------------------- 3100// if using .NET Framework 3101// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 3102// This requires including the reference to System.Web.Extensions in your project 3103using System.Web.Script.Serialization; 3104// ------------------------------------------------------------------------- 3105// if using .Net Core 3106// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 3107using System.Text.Json; 3108// ------------------------------------------------------------------------- 3109 3110namespace ConsoleTests 3111{ 3112 internal class Program 3113 { 3114 private static void Main(string[] args) 3115 { 3116 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3117 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=RUT&interval=weekly&apikey=demo"; 3118 Uri queryUri = new Uri(QUERY_URL); 3119 3120 using (WebClient client = new WebClient()) 3121 { 3122 // ------------------------------------------------------------------------- 3123 // if using .NET Framework (System.Web.Script.Serialization) 3124 3125 JavaScriptSerializer js = new JavaScriptSerializer(); 3126 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 3127 3128 // ------------------------------------------------------------------------- 3129 // if using .NET Core (System.Text.Json) 3130 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 3131 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 3132 3133 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 3134 3135 // ------------------------------------------------------------------------- 3136 3137 // do something with the json_data 3138 } 3139 } 3140 } 3141} 3142 </code></pre> 3143</div> 3144 3145 3146<div class="other-code" style="background-color: #f9f9f9;"> 3147 <br> 3148 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 3149 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 3150 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 3151 <br> 3152</div> 3153 3154 <br> 3155 <br> 3156 3157 <h4 id="index-data-other">Other Major Indices <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 3158 <br> 3159 <p>This API returns decades of daily/weekly/monthly open, high, low, close (OHLC) time series data for over 200+ major market indices. For the full list of supported indices, please refer to the <a href="https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo&datatype=csv" target="_blank">Index Catalog</a>.</p> 3160 <br> 3161 <h6><b>API Parameters</b></h6> 3162 <p><b>â Required: <code>function</code></b></p> 3163 <p>The time series of your choice. In this case, <code>function=INDEX_DATA</code> </p> 3164 <p><b>â Required: <code>symbol</code></b></p> 3165 <p>The index symbol of your choice. For example, <code>symbol=DJS</code>. For the full list of supported indices, please refer to the <a href="https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo&datatype=csv" target="_blank">Index Catalog</a>.</p> 3166 <p><b>â Required: <code>interval</code></b></p> 3167 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 3168 <p>â Optional: <code>datatype</code></p> 3169 <p>
3169By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 3170 <p><b>â Required: <code>apikey</code></b></p> 3171 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3172 <br> 3173 3174 <h6><b>Examples (click for JSON output)</b></h6> 3175 Weekly open, high, low, close (OHLC) time series data for the DJX SOQ Index (symbol=DJS; interval=weekly) 3176 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJS&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=DJS&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 3177 Downloadable CSV file: 3178 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJS&interval=weekly&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_DATA&<b>symbol</b>=DJS&<b>interval</b>=weekly&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 3179 <br> 3180 3181 <div class="premium-msg"> 3182 <p>ð¡ Tip: this is a premium API endpoint. Subscribe to any of our 150, 300, 600, or 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium plans</a> to instantly unlock this endpoint.</p> 3183 </div> 3184 <br> 3185 3186 <h6><b>Language-specific guides</b></h6> 3187 <div> 3188 <button class="python-btn">Python</button> 3189 <button class="node-btn">NodeJS</button> 3190 <button class="php-btn">PHP</button> 3191 <button class="cs-btn">C#/.NET</button> 3192 <button class="other-btn">â¨MCP & Other</button> 3193</div> 3194 3195<div class="python-code"> 3196 <pre><code class="python"> 3197import requests 3198 3199# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3200url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJS&interval=weekly&apikey=demo' 3201r = requests.get(url) 3202data = r.json() 3203 3204print(data) 3205 </code></pre> 3206</div> 3207 3208<div class="node-code"> 3209 <pre><code class="javascript"> 3210'use strict'; 3211var request = require('request'); 3212 3213// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3214var url = 'https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJS&interval=weekly&apikey=demo'; 3215 3216request.get({ 3217 url: url, 3218 json: true, 3219 headers: {'User-Agent': 'request'} 3220 }, (err, res, data) => { 3221 if (err) { 3222 console.log('Error:', err); 3223 } else if (res.statusCode !== 200) { 3224 console.log('Status:', res.statusCode); 3225 } else { 3226 // data is successfully parsed as a JSON object: 3227 console.log(data); 3228 } 3229}); 3230 </code></pre> 3231</div> 3232 3233<div class="php-code"> 3234 <pre><code class="php"> 3235<?php 3236// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3237$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJS&interval=weekly&apikey=demo'); 3238 3239$data = json_decode($json,true); 3240 3241print_r($data); 3242 3243exit; 3244 </code></pre> 3245</div> 3246 3247<div class="cs-code"> 3248 <pre><code class="cs"> 3249using System; 3250using System.Collections.Generic; 3251using System.Net; 3252 3253// ------------------------------------------------------------------------- 3254// if using .NET Framework 3255// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 3256// This requires including the reference to System.Web.Extensions in your project 3257using System.Web.Script.Serialization; 3258// ------------------------------------------------------------------------- 3259// if using .Net Core 3260// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 3261using System.Text.Json; 3262// ------------------------------------------------------------------------- 3263 3264namespace ConsoleTests 3265{
3266 internal class Program 3267 { 3268 private static void Main(string[] args) 3269 { 3270 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3271 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_DATA&symbol=DJS&interval=weekly&apikey=demo"; 3272 Uri queryUri = new Uri(QUERY_URL); 3273 3274 using (WebClient client = new WebClient()) 3275 { 3276 // ------------------------------------------------------------------------- 3277 // if using .NET Framework (System.Web.Script.Serialization) 3278 3279 JavaScriptSerializer js = new JavaScriptSerializer(); 3280 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 3281 3282 // ------------------------------------------------------------------------- 3283 // if using .NET Core (System.Text.Json) 3284 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 3285 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 3286 3287 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 3288 3289 // ------------------------------------------------------------------------- 3290 3291 // do something with the json_data 3292 } 3293 } 3294 } 3295} 3296 </code></pre> 3297</div> 3298 3299 3300<div class="other-code" style="background-color: #f9f9f9;"> 3301 <br> 3302 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 3303 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 3304 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 3305 <br> 3306</div> 3307 3308 <br> 3309 <br> 3310 3311 <h4 id="index-catalog">Index Catalog <span class="utility-label">Utility</span></h4> 3312 <br> 3313 <p>The Index Catalog API returns the full list of supported index symbols, along with the corresponding long-form names.</p> 3314 <br> 3315 <h6><b>API Parameters</b></h6> 3316 <p><b>â Required: <code>function</code></b></p> 3317 <p>The API function of your choice. In this case, <code>function=INDEX_CATALOG</code></p> 3318 <p>â Optional: <code>datatype</code></p> 3319 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the search results in JSON format; <code>csv</code> returns the search results as a CSV (comma separated value) file. </p> 3320 <p><b>â Required: <code>apikey</code></b></p> 3321 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3322 <br> 3323 3324 <h6><b>Index Catalog in JSON format:</b></h6> 3325 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_CATALOG&<b>apikey</b>=demo</code></a></p> 3326 Downloadable CSV file: 3327 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INDEX_CATALOG&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 3328 <br> 3329 3330 <h6><b>Language-specific guides</b></h6> 3331 <div> 3332 <button class="python-btn">Python</button> 3333 <button class="node-btn">NodeJS</button> 3334 <button class="php-btn">PHP</button> 3335 <button class="cs-btn">C#/.NET</button> 3336 <button class="other-btn">â¨MCP & Other</button> 3337</div> 3338 3339<div class="python-code"> 3340 <pre><code class="python"> 3341import requests 3342 3343# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3344url = 'https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo' 3345r = requests.get(url) 3346data = r.json() 3347 3348print(data) 3349 </code></pre> 3350</div> 3351 3352<div class="node-code"> 3353 <pre><code class="javascript"> 3354'use strict'; 3355var request = require('request'); 3356 3357// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3358var url = 'https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo'; 3359 3360request.get({ 3361 url: url, 3362 json: true, 3363 headers: {'User-Agent': 'request'} 3364 }, (err, res, data) => { 3365 if (err) { 3366 console.log('Error:', err); 3367 } else if (res.statusCode !== 200) { 3368 console.log('Status:', res.statusCode); 3369 } else { 3370 // data is successfully parsed as a JSON object: 3371 console.log(data); 3372 } 3373}); 3374 </code></pre> 3375</div> 3376 3377<div class="php-code"> 3378 <pre><code class="php"> 3379<?php 3380// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3381$json = file_get_contents('https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo'); 3382 3383$data = json_decode($json,true); 3384 3385print_r($data); 3386 3387exit; 3388 </code></pre> 3389</div> 3390 3391<div class="cs-code"> 3392 <pre><code class="cs"> 3393using System; 3394using System.Collections.Generic; 3395using System.Net; 3396
3397// ------------------------------------------------------------------------- 3398// if using .NET Framework 3399// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 3400// This requires including the reference to System.Web.Extensions in your project 3401using System.Web.Script.Serialization; 3402// ------------------------------------------------------------------------- 3403// if using .Net Core 3404// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 3405using System.Text.Json; 3406// ------------------------------------------------------------------------- 3407 3408namespace ConsoleTests 3409{ 3410 internal class Program 3411 { 3412 private static void Main(string[] args) 3413 { 3414 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3415 string QUERY_URL = "https://www.alphavantage.co/query?function=INDEX_CATALOG&apikey=demo"; 3416 Uri queryUri = new Uri(QUERY_URL); 3417 3418 using (WebClient client = new WebClient()) 3419 { 3420 // ------------------------------------------------------------------------- 3421 // if using .NET Framework (System.Web.Script.Serialization) 3422 3423 JavaScriptSerializer js = new JavaScriptSerializer(); 3424 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 3425 3426 // ------------------------------------------------------------------------- 3427 // if using .NET Core (System.Text.Json) 3428 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 3429 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 3430 3431 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 3432 3433 // ------------------------------------------------------------------------- 3434 3435 // do something with the json_data 3436 } 3437 } 3438 } 3439} 3440 </code></pre> 3441</div> 3442 3443 3444<div class="other-code" style="background-color: #f9f9f9;"> 3445 <br> 3446 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 3447 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 3448 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 3449 <br> 3450</div> 3451 <br> 3452 3453 </section> 3454 3455 <section> 3456 <h2 id="options">Options Data APIs</h2> 3457 <p>This suite of APIs provides realtime and historical US options data, spanning 15+ years of history with full market coverage. Bullish/bearish option signals such as put-call ratios are also provided.</p> 3458 <br> 3459 3460 <h4 id="realtime-options">Realtime Options <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 3461 <br> 3462 <p>This API returns realtime US options data with full market coverage. Option chains are sorted by expiration dates in chronological order. Within the same expiration date, contracts are sorted by strike prices from low to high. </p> 3463 <br> 3464 <h6><b>API Parameters</b></h6> 3465 <p><b>â Required: <code>function</code></b></p> 3466 <p>The time series of your choice. In this case, <code>function=REALTIME_OPTIONS</code> </p> 3467 <p><b>â Required: <code>symbol</code></b></p> 3468 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 3469 <p>â Optional: <code>require_greeks</code></p> 3470 <p>Enable greeks & implied volatility (IV) fields. By default, <code>require_greeks=false</code>. Set <code>require_greeks=true</code> to enable greeks & IVs in the API response.</p> 3471 <p>â Optional: <code>contract</code></p> 3472 <p>The US options contract ID you would like to specify. By default, the <code>contract</code> parameter is not set and the entire option chain for a given symbol will be returned. </p> 3473 <p>â Optional: <code>expiration</code></p> 3474 <p>The contract expiration date (in YYYY-MM-DD format) you would like to specify. By default, the <code>expiration</code> parameter is not set and contracts across all expiration dates will be returned. The expiration date must be in YYYY-MM-DD format and must be on or after today's date.</p> 3475 <p>â Optional: <code>datatype</code></p> 3476 <p>
3476By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the options data in JSON format; <code>csv</code> returns the data as a CSV (comma separated value) file. </p> 3477 <p><b>â Required: <code>apikey</code></b></p> 3478 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3479 <br> 3480 3481 <h6><b>Examples (click for JSON output)</b></h6> 3482 <i>By default, the entire realtime option chain is returned</i> 3483 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_OPTIONS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 3484 <i>Set require_greeks=true to enable greeks & implied volatility (IV) fields in the API response</i> 3485 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&require_greeks=true&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_OPTIONS&<b>symbol</b>=IBM&<b>require_greeks</b>=true&<b>apikey</b>=demo</code></a></p> 3486 <i>Query a specific contract (instead of the entire option chain) with greeks & IVs enabled</i> 3487 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&require_greeks=true&contract=IBM270115C00390000&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_OPTIONS&<b>symbol</b>=IBM&<b>require_greeks</b>=true&<b>contract</b>=IBM270115C00390000&<b>apikey</b>=demo</code></a></p> 3488 <br> 3489 3490 <div class="premium-msg"> 3491 <p>ð¡ Tip: this is a premium API function. Subscribe to either the 600 requests per minute or the 1200 requests per minute <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to unlock realtime options data.</p> 3492 </div> 3493 <br> 3494 3495 3496<h6><b>Language-specific guides</b></h6> 3497 <div> 3498 <button class="python-btn">Python</button> 3499 <button class="node-btn">NodeJS</button> 3500 <button class="php-btn">PHP</button> 3501 <button class="cs-btn">C#/.NET</button> 3502 <button class="other-btn">â¨MCP & Other</button> 3503</div> 3504 3505<div class="python-code"> 3506 <pre><code class="python"> 3507import requests 3508 3509# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3510url = 'https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&apikey=demo' 3511r = requests.get(url) 3512data = r.json() 3513 3514print(data) 3515 </code></pre> 3516</div> 3517 3518<div class="node-code"> 3519 <pre><code class="javascript"> 3520'use strict'; 3521var request = require('request'); 3522 3523// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3524var url = 'https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&apikey=demo'; 3525 3526request.get({ 3527 url: url, 3528 json: true, 3529 headers: {'User-Agent': 'request'} 3530 }, (err, res, data) => { 3531 if (err) { 3532 console.log('Error:', err); 3533 } else if (res.statusCode !== 200) { 3534 console.log('Status:', res.statusCode); 3535 } else { 3536 // data is successfully parsed as a JSON object: 3537 console.log(data); 3538 } 3539}); 3540 </code></pre> 3541</div> 3542 3543<div class="php-code"> 3544 <pre><code class="php"> 3545<?php 3546// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3547$json = file_get_contents('https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&apikey=demo'); 3548 3549$data = json_decode($json,true); 3550 3551print_r($data); 3552 3553exit; 3554 </code></pre> 3555</div> 3556 3557<div class="cs-code"> 3558 <pre><code class="cs"> 3559using System; 3560using System.Collections.Generic; 3561using System.Net; 3562 3563// ------------------------------------------------------------------------- 3564// if using .NET Framework
3565// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 3566// This requires including the reference to System.Web.Extensions in your project 3567using System.Web.Script.Serialization; 3568// ------------------------------------------------------------------------- 3569// if using .Net Core 3570// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 3571using System.Text.Json; 3572// ------------------------------------------------------------------------- 3573 3574namespace ConsoleTests 3575{ 3576 internal class Program 3577 { 3578 private static void Main(string[] args) 3579 { 3580 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3581 string QUERY_URL = "https://www.alphavantage.co/query?function=REALTIME_OPTIONS&symbol=IBM&apikey=demo"; 3582 Uri queryUri = new Uri(QUERY_URL); 3583 3584 using (WebClient client = new WebClient()) 3585 { 3586 // ------------------------------------------------------------------------- 3587 // if using .NET Framework (System.Web.Script.Serialization) 3588 3589 JavaScriptSerializer js = new JavaScriptSerializer(); 3590 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 3591 3592 // ------------------------------------------------------------------------- 3593 // if using .NET Core (System.Text.Json) 3594 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 3595 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 3596 3597 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 3598 3599 // ------------------------------------------------------------------------- 3600 3601 // do something with the json_data 3602 } 3603 } 3604 } 3605} 3606 </code></pre> 3607</div> 3608 3609 3610<div class="other-code" style="background-color: #f9f9f9;"> 3611 <br> 3612 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 3613 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 3614 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 3615 <br> 3616</div> 3617 <br> 3618 <br> 3619 3620 <h4 id="realtime-put-call-ratio">Realtime Put-Call Ratio</h4> 3621 <br> 3622 <p>This API returns realtime put-call ratios for both the entire option chain and for specific expiration dates. A lower put-call ratio (<=0.6) typically signals bullish sentiment, as investors are purchasing more call options in expectation of rising prices. On the other hand, a higher ratio (>=1.0) suggests bearish sentiment. However, because this metric is often used as a contrarian indicator, extreme values can imply the opposite - e.g., readings much higher than 1.0 may actually indicate a bullish outlook, while very low readings close to zero can point to potential bearish conditions.</p> 3623 <br> 3624 <h6><b>API Parameters</b></h6> 3625 <p><b>â Required: <code>function</code></b></p> 3626 <p>The time series of your choice. In this case, <code>function=REALTIME_PUT_CALL_RATIO</code> </p> 3627 <p><b>â Required: <code>symbol</code></b></p> 3628 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 3629 <p><b>â Required: <code>apikey</code></b></p> 3630 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3631 <br> 3632 3633 <h6><b>Examples (click for JSON output)</b></h6> 3634 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_PUT_CALL_RATIO&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_PUT_CALL_RATIO&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 3635 <br> 3636 3637 3638<h6><b>Language-specific guides</b></h6> 3639 <div> 3640 <button class="python-btn">Python</button> 3641 <button class="node-btn">NodeJS</button> 3642 <button class="php-btn">PHP</button> 3643 <button class="cs-btn">C#/.NET</button> 3644 <button class="other-btn">â¨MCP & Other</button> 3645</div> 3646 3647<div class="python-code"> 3648 <pre><code class="python"> 3649import requests 3650 3651# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3652url = 'https://www.alphavantage.co/query?function=REALTIME_PUT_CALL_RATIO&symbol=IBM&apikey=demo' 3653r = requests.get(url) 3654data = r.json() 3655 3656print(data) 3657 </code></pre> 3658</div> 3659 3660<div class="node-code"> 3661 <pre><code class="javascript"> 3662'use strict'; 3663var request = require('request'); 3664 3665// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3666var url = 'https://www.alphavantage.co/query?function=REALTIME_PUT_CALL_RATIO&symbol=IBM&apikey=demo'; 3667 3668request.get({ 3669 url: url, 3670 json: true, 3671 headers: {'User-Agent': 'request'} 3672 }, (err, res, data) => { 3673 if (err) { 3674 console.log('Error:', err); 3675 } else if (res.statusCode !== 200) { 3676 console.log('Status:', res.statusCode); 3677 } else { 3678 // data is successfully parsed as a JSON object: 3679 console.log(data); 3680 } 3681}); 3682 </code></pre> 3683</div> 3684 3685<div class="php-code"> 3686 <pre><code class="php"> 3687<?php 3688// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3689$json = file_get_contents('https://www.alphavantage.co/query?function=REALTIME_PUT_CALL_RATIO&symbol=IBM&apikey=demo'); 3690 3691$data = json_decode($json,true); 3692 3693print_r($data); 3694 3695exit; 3696 </code></pre> 3697</div> 3698 3699<div class="cs-code"> 3700 <pre><code class="cs"> 3701using System; 3702using System.Collections.Generic; 3703using System.Net; 3704
3705// ------------------------------------------------------------------------- 3706// if using .NET Framework 3707// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 3708// This requires including the reference to System.Web.Extensions in your project 3709using System.Web.Script.Serialization; 3710// ------------------------------------------------------------------------- 3711// if using .Net Core 3712// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 3713using System.Text.Json; 3714// ------------------------------------------------------------------------- 3715 3716namespace ConsoleTests 3717{ 3718 internal class Program 3719 { 3720 private static void Main(string[] args) 3721 { 3722 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3723 string QUERY_URL = "https://www.alphavantage.co/query?function=REALTIME_PUT_CALL_RATIO&symbol=IBM&apikey=demo"; 3724 Uri queryUri = new Uri(QUERY_URL); 3725 3726 using (WebClient client = new WebClient()) 3727 { 3728 // ------------------------------------------------------------------------- 3729 // if using .NET Framework (System.Web.Script.Serialization) 3730 3731 JavaScriptSerializer js = new JavaScriptSerializer(); 3732 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 3733 3734 // ------------------------------------------------------------------------- 3735 // if using .NET Core (System.Text.Json) 3736 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 3737 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 3738 3739 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 3740 3741 // ------------------------------------------------------------------------- 3742 3743 // do something with the json_data 3744 } 3745 } 3746 } 3747} 3748 </code></pre> 3749</div> 3750 3751 3752<div class="other-code" style="background-color: #f9f9f9;"> 3753 <br> 3754 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 3755 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 3756 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 3757 <br> 3758</div> 3759 <br> 3760 <br> 3761 3762 <h4 id="realtime-volume-open-interest-ratio">Realtime Volume-to-Open-Interest Ratio</h4> 3763 <br> 3764 <p>This API returns realtime volume-to-open-interest ratios within an option chain. A high ratio (volume much larger than open interest) often suggests heavy trading activity relative to existing positions, which can indicate short-term speculation, increased liquidity, or possible trend changes. A low ratio (volume small compared to open interest) implies that most positions are being held rather than actively traded, signaling more stable or less volatile conditions. Traders use this ratio to understand whether price moves are driven by new participation (potentially stronger signals) or just minor adjustments within existing positions.</p> 3765 <br> 3766 <h6><b>API Parameters</b></h6> 3767 <p><b>â Required: <code>function</code></b></p> 3768 <p>The time series of your choice. In this case, <code>function=REALTIME_VOLUME_OPEN_INTEREST_RATIO</code> </p> 3769 <p><b>â Required: <code>symbol</code></b></p> 3770 <p>The name of the equity of your choice. For example: <code>symbol=NVDA</code> </p> 3771 <p><b>â Required: <code>apikey</code></b></p> 3772 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3773 <br> 3774 3775 <h6><b>Examples (click for JSON output)</b></h6> 3776 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REALTIME_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=REALTIME_VOLUME_OPEN_INTEREST_RATIO&<b>symbol</b>=NVDA&<b>apikey</b>=demo</code></a></p> 3777 <br> 3778 3779 3780<h6><b>Language-specific guides</b></h6> 3781 <div> 3782 <button class="python-btn">Python</button> 3783 <button class="node-btn">NodeJS</button> 3784 <button class="php-btn">PHP</button> 3785 <button class="cs-btn">C#/.NET</button> 3786 <button class="other-btn">â¨MCP & Other</button> 3787</div> 3788 3789<div class="python-code"> 3790 <pre><code class="python"> 3791import requests 3792 3793# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3794url = 'https://www.alphavantage.co/query?function=REALTIME_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&apikey=demo' 3795r = requests.get(url) 3796data = r.json() 3797 3798print(data) 3799 </code></pre> 3800</div> 3801 3802<div class="node-code"> 3803 <pre><code class="javascript"> 3804'use strict'; 3805var request = require('request'); 3806 3807// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3808var url = 'https://www.alphavantage.co/query?function=REALTIME_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&apikey=demo'; 3809 3810request.get({ 3811 url: url, 3812 json: true, 3813 headers: {'User-Agent': 'request'} 3814 }, (err, res, data) => { 3815 if (err) { 3816 console.log('Error:', err); 3817 } else if (res.statusCode !== 200) { 3818 console.log('Status:', res.statusCode); 3819 } else { 3820 // data is successfully parsed as a JSON object: 3821 console.log(data); 3822 } 3823}); 3824 </code></pre> 3825</div> 3826 3827<div class="php-code"> 3828 <pre><code class="php"> 3829<?php 3830// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3831$json = file_get_contents('https://www.alphavantage.co/query?function=REALTIME_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&apikey=demo'); 3832 3833$data = json_decode($json,true); 3834 3835print_r($data); 3836 3837exit; 3838 </code></pre> 3839</div> 3840 3841<div class="cs-code"> 3842 <pre><code class="cs"> 3843using System; 3844using System.Collections.Generic; 3845using System.Net; 3846
3847// ------------------------------------------------------------------------- 3848// if using .NET Framework 3849// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 3850// This requires including the reference to System.Web.Extensions in your project 3851using System.Web.Script.Serialization; 3852// ------------------------------------------------------------------------- 3853// if using .Net Core 3854// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 3855using System.Text.Json; 3856// ------------------------------------------------------------------------- 3857 3858namespace ConsoleTests 3859{ 3860 internal class Program 3861 { 3862 private static void Main(string[] args) 3863 { 3864 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3865 string QUERY_URL = "https://www.alphavantage.co/query?function=REALTIME_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&apikey=demo"; 3866 Uri queryUri = new Uri(QUERY_URL); 3867 3868 using (WebClient client = new WebClient()) 3869 { 3870 // ------------------------------------------------------------------------- 3871 // if using .NET Framework (System.Web.Script.Serialization) 3872 3873 JavaScriptSerializer js = new JavaScriptSerializer(); 3874 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 3875 3876 // ------------------------------------------------------------------------- 3877 // if using .NET Core (System.Text.Json) 3878 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 3879 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 3880 3881 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 3882 3883 // ------------------------------------------------------------------------- 3884 3885 // do something with the json_data 3886 } 3887 } 3888 } 3889} 3890 </code></pre> 3891</div> 3892 3893 3894<div class="other-code" style="background-color: #f9f9f9;"> 3895 <br> 3896 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 3897 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 3898 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 3899 <br> 3900</div> 3901 <br> 3902 <br> 3903 3904 3905 <h4 id="historical-options">Historical Options <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 3906 <br> 3907 <p>This API returns the full historical options chain for a specific symbol on a specific date, covering 15+ years of history. Implied volatility (IV) and common Greeks (e.g., delta, gamma, theta, vega, rho) are also returned. Option chains are sorted by expiration dates in chronological order. Within the same expiration date, contracts are sorted by strike prices from low to high. </p> 3908 <br> 3909 <h6><b>API Parameters</b></h6> 3910 <p><b>â Required: <code>function</code></b></p> 3911 <p>The time series of your choice. In this case, <code>function=HISTORICAL_OPTIONS</code> </p> 3912 <p><b>â Required: <code>symbol</code></b></p> 3913 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 3914 <p>â Optional: <code>date</code></p> 3915 <p>By default, the <code>date</code> parameter is not set and the API will return data for the previous trading session. Any date later than 2008-01-01 is accepted. For example, <code>date=2017-11-15</code>.</p> 3916 <p>â Optional: <code>contract</code></p> 3917 <p>The US options contract ID you would like to specify. By default, the <code>contract</code> parameter is not set and the entire option chain for a given symbol will be returned.</p> 3918 <p>â Optional: <code>expiration</code></p> 3919 <p>The contract expiration date (in YYYY-MM-DD format) you would like to specify. By default, the <code>expiration</code> parameter is not set and contracts across all expiration dates will be returned. The expiration date must be in YYYY-MM-DD format.</p> 3920 <p>â Optional: <code>datatype</code></p> 3921 <p>
3921By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the options data in JSON format; <code>csv</code> returns the data as a CSV (comma separated value) file. </p> 3922 <p><b>â Required: <code>apikey</code></b></p> 3923 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 3924 <br> 3925 3926 <h6><b>Example (click for JSON output)</b></h6> 3927 <i>When the date parameter is not set, data from the previous trading session is returned</i> 3928 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HISTORICAL_OPTIONS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 3929 <i>Specify a date to retrieve options data for any trading day in the past 15+ years (since 2008-01-01)</i> 3930 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&date=2017-11-15&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HISTORICAL_OPTIONS&<b>symbol</b>=IBM&<b>date</b>=2017-11-15&<b>apikey</b>=demo</code></a></p> 3931 Downloadable CSV file: 3932 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&date=2017-11-15&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HISTORICAL_OPTIONS&<b>symbol</b>=IBM&<b>date</b>=2017-11-15&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 3933 <br> 3934 3935 <div class="premium-msg"> 3936 <p>ð¡ Tip: this is a premium API function. Subscribe to any of the <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plans</a> to unlock historical options data.</p> 3937 </div> 3938 <br> 3939 3940 <h6><b>Language-specific guides</b></h6> 3941 <div> 3942 <button class="python-btn">Python</button> 3943 <button class="node-btn">NodeJS</button> 3944 <button class="php-btn">PHP</button> 3945 <button class="cs-btn">C#/.NET</button> 3946 <button class="other-btn">â¨MCP & Other</button> 3947</div> 3948 3949<div class="python-code"> 3950 <pre><code class="python"> 3951import requests 3952 3953# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3954url = 'https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&apikey=demo' 3955r = requests.get(url) 3956data = r.json() 3957 3958print(data) 3959 </code></pre> 3960</div> 3961 3962<div class="node-code"> 3963 <pre><code class="javascript"> 3964'use strict'; 3965var request = require('request'); 3966 3967// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3968var url = 'https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&apikey=demo'; 3969 3970request.get({ 3971 url: url, 3972 json: true, 3973 headers: {'User-Agent': 'request'} 3974 }, (err, res, data) => { 3975 if (err) { 3976 console.log('Error:', err); 3977 } else if (res.statusCode !== 200) { 3978 console.log('Status:', res.statusCode); 3979 } else { 3980 // data is successfully parsed as a JSON object: 3981 console.log(data); 3982 } 3983}); 3984 </code></pre> 3985</div> 3986 3987<div class="php-code"> 3988 <pre><code class="php"> 3989<?php 3990// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 3991$json = file_get_contents('https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&apikey=demo'); 3992 3993$data = json_decode($json,true); 3994 3995print_r($data); 3996 3997exit; 3998 </code></pre> 3999</div> 4000 4001<div class="cs-code"> 4002 <pre><code class="cs"> 4003using System; 4004using System.Collections.Generic; 4005using System.Net; 4006 4007// ------------------------------------------------------------------------- 4008// if using .NET Framework 4009// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptseri
4009alizer?view=netframework-4.8 4010// This requires including the reference to System.Web.Extensions in your project 4011using System.Web.Script.Serialization; 4012// ------------------------------------------------------------------------- 4013// if using .Net Core 4014// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4015using System.Text.Json; 4016// ------------------------------------------------------------------------- 4017 4018namespace ConsoleTests 4019{ 4020 internal class Program 4021 { 4022 private static void Main(string[] args) 4023 { 4024 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4025 string QUERY_URL = "https://www.alphavantage.co/query?function=HISTORICAL_OPTIONS&symbol=IBM&apikey=demo"; 4026 Uri queryUri = new Uri(QUERY_URL); 4027 4028 using (WebClient client = new WebClient()) 4029 { 4030 // ------------------------------------------------------------------------- 4031 // if using .NET Framework (System.Web.Script.Serialization) 4032 4033 JavaScriptSerializer js = new JavaScriptSerializer(); 4034 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4035 4036 // ------------------------------------------------------------------------- 4037 // if using .NET Core (System.Text.Json) 4038 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4039 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4040 4041 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4042 4043 // ------------------------------------------------------------------------- 4044 4045 // do something with the json_data 4046 } 4047 } 4048 } 4049} 4050 </code></pre> 4051</div> 4052 4053 4054<div class="other-code" style="background-color: #f9f9f9;"> 4055 <br> 4056 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4057 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4058 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4059 <br> 4060</div> 4061 <br> 4062 <br> 4063 4064 <h4 id="historical-put-call-ratio">Historical Put-Call Ratio</h4> 4065 <br> 4066 <p>This API returns historical put-call ratios for both the entire option chain and for specific expiration dates. A lower put-call ratio (<=0.6) typically signals bullish sentiment, as investors are purchasing more call options in expectation of rising prices. On the other hand, a higher ratio (>=1.0) suggests bearish sentiment. However, because this metric is often used as a contrarian indicator, extreme values can imply the opposite - e.g., readings much higher than 1.0 may actually indicate a bullish outlook, while very low readings close to zero can point to potential bearish conditions.</p> 4067 <br> 4068 <h6><b>API Parameters</b></h6> 4069 <p><b>â Required: <code>function</code></b></p> 4070 <p>The time series of your choice. In this case, <code>function=HISTORICAL_PUT_CALL_RATIO</code> </p> 4071 <p><b>â Required: <code>symbol</code></b></p> 4072 <p>The name of the equity of your choice. For example: <code>symbol=IBM</code> </p> 4073 <p>â Optional: <code>date</code></p> 4074 <p>By default, the <code>date</code> parameter is not set and the API will return data for the previous trading session. Any date later than 2008-01-01 is accepted. For example, <code>date=2026-03-12</code>.</p> 4075 <p><b>â Required: <code>apikey</code></b></p> 4076 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4077 <br> 4078 4079 <h6><b>Examples (click for JSON output)</b></h6> 4080 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HISTORICAL_PUT_CALL_RATIO&symbol=IBM&date=2026-03-12&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HISTORICAL_PUT_CALL_RATIO&<b>symbol</b>=IBM&<b>date</b>=2026-03-12&<b>apikey</b>=demo</code></a></p> 4081 <br> 4082 4083 4084<h6><b>Language-specific guides</b></h6> 4085 <div> 4086 <button class="python-btn">Python</button> 4087 <button class="node-btn">NodeJS</button> 4088 <button class="php-btn">PHP</button> 4089 <button class="cs-btn">C#/.NET</button> 4090 <button class="other-btn">â¨MCP & Other</button> 4091</div> 4092 4093<div class="python-code"> 4094 <pre><code class="python"> 4095import requests 4096 4097# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4098url = 'https://www.alphavantage.co/query?function=HISTORICAL_PUT_CALL_RATIO&symbol=IBM&date=2026-03-12&apikey=demo' 4099r = requests.get(url) 4100data = r.json() 4101 4102print(data) 4103 </code></pre> 4104</div> 4105 4106<div class="node-code"> 4107 <pre><code class="javascript"> 4108'use strict'; 4109var request = require('request'); 4110 4111// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4112var url = 'https://www.alphavantage.co/query?function=HISTORICAL_PUT_CALL_RATIO&symbol=IBM&date=2026-03-12&apikey=demo'; 4113 4114request.get({ 4115 url: url, 4116 json: true, 4117 headers: {'User-Agent': 'request'} 4118 }, (err, res, data) => { 4119 if (err) { 4120 console.log('Error:', err); 4121 } else if (res.statusCode !== 200) { 4122 console.log('Status:', res.statusCode); 4123 } else { 4124 // data is successfully parsed as a JSON object: 4125 console.log(data); 4126 } 4127}); 4128 </code></pre> 4129</div> 4130 4131<div class="php-code"> 4132 <pre><code class="php"> 4133<?php 4134// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4135$json = file_get_contents('https://www.alphavantage.co/query?function=HISTORICAL_PUT_CALL_RATIO&symbol=IBM&date=2026-03-12&apikey=demo'); 4136 4137$data = json_decode($json,true); 4138 4139print_r($data); 4140 4141exit; 4142 </code></pre> 4143</div> 4144 4145<div class="cs-code"> 4146 <pre><code class="cs"> 4147using System; 4148using System.Collections.Generic; 4149using System.Net; 4150
4151// ------------------------------------------------------------------------- 4152// if using .NET Framework 4153// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 4154// This requires including the reference to System.Web.Extensions in your project 4155using System.Web.Script.Serialization; 4156// ------------------------------------------------------------------------- 4157// if using .Net Core 4158// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4159using System.Text.Json; 4160// ------------------------------------------------------------------------- 4161 4162namespace ConsoleTests 4163{ 4164 internal class Program 4165 { 4166 private static void Main(string[] args) 4167 { 4168 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4169 string QUERY_URL = "https://www.alphavantage.co/query?function=HISTORICAL_PUT_CALL_RATIO&symbol=IBM&date=2026-03-12&apikey=demo"; 4170 Uri queryUri = new Uri(QUERY_URL); 4171 4172 using (WebClient client = new WebClient()) 4173 { 4174 // ------------------------------------------------------------------------- 4175 // if using .NET Framework (System.Web.Script.Serialization) 4176 4177 JavaScriptSerializer js = new JavaScriptSerializer(); 4178 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4179 4180 // ------------------------------------------------------------------------- 4181 // if using .NET Core (System.Text.Json) 4182 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4183 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4184 4185 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4186 4187 // ------------------------------------------------------------------------- 4188 4189 // do something with the json_data 4190 } 4191 } 4192 } 4193} 4194 </code></pre> 4195</div> 4196 4197 4198<div class="other-code" style="background-color: #f9f9f9;"> 4199 <br> 4200 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4201 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4202 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4203 <br> 4204</div> 4205 <br> 4206 <br> 4207 4208 <h4 id="historical-volume-open-interest-ratio">Historical Volume-to-Open-Interest Ratio</h4> 4209 <br> 4210 <p>This API returns historical volume-to-open-interest ratios within an option chain. A high ratio (volume much larger than open interest) often suggests heavy trading activity relative to existing positions, which can indicate short-term speculation, increased liquidity, or possible trend changes. A low ratio (volume small compared to open interest) implies that most positions are being held rather than actively traded, signaling more stable or less volatile conditions. Traders use this ratio to understand whether price moves are driven by new participation (potentially stronger signals) or just minor adjustments within existing positions.</p> 4211 <br> 4212 <h6><b>API Parameters</b></h6> 4213 <p><b>â Required: <code>function</code></b></p> 4214 <p>The time series of your choice. In this case, <code>function=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO</code> </p> 4215 <p><b>â Required: <code>symbol</code></b></p> 4216 <p>The name of the equity of your choice. For example: <code>symbol=NVDA</code> </p> 4217 <p>â Optional: <code>date</code></p> 4218 <p>
4218By default, the <code>date</code> parameter is not set and the API will return data for the previous trading session. Any date later than 2008-01-01 is accepted. For example, <code>date=2026-04-06</code>.</p> 4219 <p><b>â Required: <code>apikey</code></b></p> 4220 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4221 <br> 4222 4223 <h6><b>Examples (click for JSON output)</b></h6> 4224 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&date=2026-04-06&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO&<b>symbol</b>=NVDA&<b>date</b>=2026-04-06&<b>apikey</b>=demo</code></a></p> 4225 <br> 4226 4227 4228<h6><b>Language-specific guides</b></h6> 4229 <div> 4230 <button class="python-btn">Python</button> 4231 <button class="node-btn">NodeJS</button> 4232 <button class="php-btn">PHP</button> 4233 <button class="cs-btn">C#/.NET</button> 4234 <button class="other-btn">â¨MCP & Other</button> 4235</div> 4236 4237<div class="python-code"> 4238 <pre><code class="python"> 4239import requests 4240 4241# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4242url = 'https://www.alphavantage.co/query?function=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&date=2026-04-06&apikey=demo' 4243r = requests.get(url) 4244data = r.json() 4245 4246print(data) 4247 </code></pre> 4248</div> 4249 4250<div class="node-code"> 4251 <pre><code class="javascript"> 4252'use strict'; 4253var request = require('request'); 4254 4255// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4256var url = 'https://www.alphavantage.co/query?function=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&date=2026-04-06&apikey=demo'; 4257 4258request.get({ 4259 url: url, 4260 json: true, 4261 headers: {'User-Agent': 'request'} 4262 }, (err, res, data) => { 4263 if (err) { 4264 console.log('Error:', err); 4265 } else if (res.statusCode !== 200) { 4266 console.log('Status:', res.statusCode); 4267 } else { 4268 // data is successfully parsed as a JSON object: 4269 console.log(data); 4270 } 4271}); 4272 </code></pre> 4273</div> 4274 4275<div class="php-code"> 4276 <pre><code class="php"> 4277<?php 4278// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4279$json = file_get_contents('https://www.alphavantage.co/query?function=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&date=2026-04-06&apikey=demo'); 4280 4281$data = json_decode($json,true); 4282 4283print_r($data); 4284 4285exit; 4286 </code></pre> 4287</div> 4288 4289<div class="cs-code"> 4290 <pre><code class="cs"> 4291using System; 4292using System.Collections.Generic; 4293using System.Net; 4294 4295// ------------------------------------------------------------------------- 4296// if using .NET Framework 4297// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 4298// This requires including the reference to System.Web.Extensions in your project 4299using System.Web.Script.Serialization; 4300// ------------------------------------------------------------------------- 4301// if using .Net Core 4302// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4303using System.Text.Json; 4304// ------------------------------------------------------------------------- 4305 4306namespace ConsoleTests 4307{ 4308 internal class Program 4309 { 4310 private static void Main(string[] args) 4311 { 4312 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4313 string QUERY_URL = "https://www.alphavantage.co/query?function=HISTORICAL_VOLUME_OPEN_INTEREST_RATIO&symbol=NVDA&date=2026-04-06&apikey=demo"; 4314 Uri queryUri = new Uri(QUERY_URL); 4315 4316 using (WebClient client = new WebClient()) 4317 { 4318 // ------------------------------------------------------------------------- 4319 // if using .NET Framework (System.Web.Script.Serialization) 4320 4321 JavaScriptSerializer js = new JavaScriptSerializer(); 4322 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4323 4324 // ------------------------------------------------------------------------- 4325 // if using .NET Core (System.Text.Json) 4326 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4327 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4328 4329 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4330 4331 // ------------------------------------------------------------------------- 4332
4333 // do something with the json_data 4334 } 4335 } 4336 } 4337} 4338 </code></pre> 4339</div> 4340 4341 4342<div class="other-code" style="background-color: #f9f9f9;"> 4343 <br> 4344 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4345 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4346 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4347 <br> 4348</div> 4349 <br> 4350 <br> 4351 4352 </section> 4353 4354 4355 4356 4357 4358 <section> 4359 <h2 id="intelligence">Alpha Intelligence™</h2> 4360 <p>The APIs in this section contain advanced market intelligence built with our decades of expertise in AI, machine learning, and quantitative finance. We hope these highly differentiated alternative datasets can help turbocharge your trading strategy, market research, and financial software application to the next level. </p> 4361 <br> 4362 4363 <h4 id="news-sentiment">Market News & Sentiment <span class="popular-label">Trending</span></h4> 4364 <p>Looking for market news data to train your LLM models or to augment your trading strategy? You have just found it. This API returns live and historical market news & sentiment data from a large & growing selection of premier news outlets around the world, covering stocks, cryptocurrencies, forex, and a wide range of topics such as fiscal policy, mergers & acquisitions, IPOs, etc. This API, combined with our core stock API, fundamental data, and technical indicator APIs, can provide you with a 360-degree view of the financial market and the broader economy. </p> 4365 <br> 4366 <h6><b>API Parameters</b></h6> 4367 <p><b>â Required: <code>function</code></b></p> 4368 <p>The function of your choice. In this case, <code>function=NEWS_SENTIMENT</code> </p> 4369 <p><b>â Optional: <code>tickers</code></b></p> 4370 <p>The stock/crypto/forex symbols of your choice. For example: <code>tickers=IBM</code> will filter for articles that mention the IBM ticker; <code>tickers=COIN,CRYPTO:BTC,FOREX:USD</code> will filter for articles that <u>simultaneously</u> mention Coinbase (COIN), Bitcoin (CRYPTO:BTC), and US Dollar (FOREX:USD) in their content.</p> 4371 <p><b>â Optional: <code>topics</code></b></p> 4372 <p>The news topics of your choice. For example: <code>topics=technology</code> will filter for articles that write about the technology sector; <code>topics=technology,ipo</code> will filter for articles that <u>simultaneously</u> cover technology <u>and</u> IPO in their content. Below is the full list of supported topics:</p> 4373 <ul> 4374 <li>Blockchain: <code>blockchain</code></li> 4375 <li>Earnings: <code>earnings</code></li> 4376 <li>IPO: <code>ipo</code></li> 4377 <li>Mergers & Acquisitions: <code>mergers_and_acquisitions</code></li> 4378 <li>Financial Markets: <code>financial_markets</code></li> 4379 <li>Economy - Fiscal Policy (e.g., tax reform, government spending): <code>economy_fiscal</code></li> 4380 <li>Economy - Monetary Policy (e.g., interest rates, inflation): <code>economy_monetary</code></li> 4381 <li>Economy - Macro/Overall: <code>economy_macro</code></li> 4382 <li>Energy & Transportation: <code>energy_transportation</code></li> 4383 <li>Finance: <code>finance</code></li> 4384 <li>Life Sciences: <code>life_sciences</code></li> 4385 <li>Manufacturing: <code>manufacturing</code></li> 4386 <li>Real Estate & Construction: <code>real_estate</code></li> 4387 <li>Retail & Wholesale: <code>retail_wholesale</code></li> 4388 <li>Technology: <code>technology</code></li> 4389 </ul> 4390 <p><b>â Optional: <code>time_from</code> and <code>time_to</code></b></p> 4391 <p>The time range of the news articles you are targeting, in YYYYMMDDTHHMM format. For example: <code>time_from=20220410T0130</code>. If time_from is specified but time_to is missing, the API will return articles published between the time_from value and the current time.</p> 4392 <p><b>â Optional: <code>sort</code></b></p> 4393 <p>
4393By default, <code>sort=LATEST</code> and the API will return the latest articles first. You can also set <code>sort=EARLIEST</code> or <code>sort=RELEVANCE</code> based on your use case.</p> 4394 <p><b>â Optional: <code>limit</code></b></p> 4395 <p>By default, <code>limit=50</code> and the API will return up to 50 matching results. You can also set <code>limit=1000</code> to output up to 1000 results.</p> 4396 <p><b>â Required: <code>apikey</code></b></p> 4397 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4398 <br> 4399 4400 <h6><b>Examples (click for JSON output)</b></h6> 4401 <i>Querying news articles that mention the AAPL ticker.</i> 4402 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=NEWS_SENTIMENT&tickers=AAPL&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=NEWS_SENTIMENT&<b>tickers</b>=AAPL&<b>apikey</b>=demo</code></a></p> 4403 <i>Querying news articles that <u>simultaneously</u> mention the Coinbase stock (COIN), Bitcoin (CRYPTO:BTC), and US Dollar (FOREX:USD) and are published on or after 2022-04-10, 1:30am UTC.</i> 4404 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=NEWS_SENTIMENT&tickers=COIN,CRYPTO:BTC,FOREX:USD&time_from=20220410T0130&limit=1000&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=NEWS_SENTIMENT&tickers=COIN,CRYPTO:BTC,FOREX:USD&time_from=20220410T0130&limit=1000&apikey=demo</code></a></p> 4405 <br> 4406 4407 <h6><b>Language-specific guides</b></h6> 4408 <div> 4409 <button class="python-btn">Python</button> 4410 <button class="node-btn">NodeJS</button> 4411 <button class="php-btn">PHP</button> 4412 <button class="cs-btn">C#/.NET</button> 4413 <button class="other-btn">â¨MCP & Other</button> 4414</div> 4415 4416<div class="python-code"> 4417 <pre><code class="python"> 4418import requests 4419 4420# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4421url = 'https://www.alphavantage.co/query?function=NEWS_SENTIMENT&tickers=AAPL&apikey=demo' 4422r = requests.get(url) 4423data = r.json() 4424 4425print(data) 4426 </code></pre> 4427</div> 4428 4429<div class="node-code"> 4430 <pre><code class="javascript"> 4431'use strict'; 4432var request = require('request'); 4433 4434// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4435var url = 'https://www.alphavantage.co/query?function=NEWS_SENTIMENT&tickers=AAPL&apikey=demo'; 4436 4437request.get({ 4438 url: url, 4439 json: true, 4440 headers: {'User-Agent': 'request'} 4441 }, (err, res, data) => { 4442 if (err) { 4443 console.log('Error:', err); 4444 } else if (res.statusCode !== 200) { 4445 console.log('Status:', res.statusCode); 4446 } else { 4447 // data is successfully parsed as a JSON object: 4448 console.log(data); 4449 } 4450}); 4451 </code></pre> 4452</div> 4453 4454<div class="php-code"> 4455 <pre><code class="php"> 4456<?php 4457// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4458$json = file_get_contents('https://www.alphavantage.co/query?function=NEWS_SENTIMENT&tickers=AAPL&apikey=demo'); 4459 4460$data = json_decode($json,true); 4461 4462print_r($data); 4463 4464exit; 4465 </code></pre> 4466</div> 4467 4468<div class="cs-code"> 4469 <pre><code class="cs"> 4470using System; 4471using System.Collections.Generic; 4472using System.Net; 4473 4474// ------------------------------------------------------------------------- 4475// if using .NET Framework 4476// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 4477// This requires including the reference to System.Web.Extensions in your project 4478using System.Web.Script.Serialization; 4479// ------------------------------------------------------------------------- 4480// if using .Net Core 4481// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4482using System.Text.Json; 4483// ------------------------------------------------------------------------- 4484 4485namespace ConsoleTests 4486{
4487 internal class Program 4488 { 4489 private static void Main(string[] args) 4490 { 4491 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4492 string QUERY_URL = "https://www.alphavantage.co/query?function=NEWS_SENTIMENT&tickers=AAPL&apikey=demo" 4493 Uri queryUri = new Uri(QUERY_URL); 4494 4495 using (WebClient client = new WebClient()) 4496 { 4497 // ------------------------------------------------------------------------- 4498 // if using .NET Framework (System.Web.Script.Serialization) 4499 4500 JavaScriptSerializer js = new JavaScriptSerializer(); 4501 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4502 4503 // ------------------------------------------------------------------------- 4504 // if using .NET Core (System.Text.Json) 4505 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4506 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4507 4508 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4509 4510 // ------------------------------------------------------------------------- 4511 4512 // do something with the json_data 4513 } 4514 } 4515 } 4516} 4517 </code></pre> 4518</div> 4519 4520 4521<div class="other-code" style="background-color: #f9f9f9;"> 4522 <br> 4523 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4524 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4525 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4526 <br> 4527</div> 4528 4529 <br> 4530 <h4 id="transcript">Earnings Call Transcript <span class="popular-label">Trending</span></h4> 4531 <p>This API returns the earnings call transcript for a given company in a specific quarter, covering over 15 years of history and enriched with turn-by-turn sentiment signals.</p> 4532 <br> 4533 <h6><b>API Parameters</b></h6> 4534 <p><b>â Required: <code>function</code></b></p> 4535 <p>The function of your choice. In this case, <code>function=EARNINGS_CALL_TRANSCRIPT</code> </p> 4536 <p><b>â Required: <code>symbol</code></b></p> 4537 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>.</p> 4538 <p><b>â Required: <code>quarter</code></b></p> 4539 <p>Fiscal quarter in YYYYQM format. For example: <code>quarter=2024Q1</code>. Any quarter since 2010Q1 is supported.</p> 4540 <p><b>â Required: <code>apikey</code></b></p> 4541 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4542 <br> 4543 4544 <h6><b>Example (click for JSON output)</b></h6> 4545 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EARNINGS_CALL_TRANSCRIPT&symbol=IBM&quarter=2024Q1&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EARNINGS_CALL_TRANSCRIPT&<b>symbol</b>=IBM&<b>quarter</b>=2024Q1&<b>apikey</b>=demo</code></a></p> 4546 <br> 4547 4548 4549 <h6><b>Language-specific guides</b></h6> 4550 <div> 4551 <button class="python-btn">Python</button> 4552 <button class="node-btn">NodeJS</button> 4553 <button class="php-btn">PHP</button> 4554 <button class="cs-btn">C#/.NET</button> 4555 <button class="other-btn">â¨MCP & Other</button> 4556</div> 4557 4558<div class="python-code"> 4559 <pre><code class="python"> 4560import requests 4561 4562# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4563url = 'https://www.alphavantage.co/query?function=EARNINGS_CALL_TRANSCRIPT&symbol=IBM&quarter=2024Q1&apikey=demo' 4564r = requests.get(url) 4565data = r.json() 4566 4567print(data) 4568 </code></pre> 4569</div> 4570 4571<div class="node-code"> 4572 <pre><code class="javascript"> 4573'use strict'; 4574var request = require('request'); 4575 4576// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4577var url = 'https://www.alphavantage.co/query?function=EARNINGS_CALL_TRANSCRIPT&symbol=IBM&quarter=2024Q1&apikey=demo'; 4578 4579request.get({ 4580 url: url, 4581 json: true, 4582 headers: {'User-Agent': 'request'} 4583 }, (err, res, data) => { 4584 if (err) { 4585 console.log('Error:', err); 4586 } else if (res.statusCode !== 200) { 4587 console.log('Status:', res.statusCode); 4588 } else { 4589 // data is successfully parsed as a JSON object: 4590 console.log(data); 4591 } 4592}); 4593 </code></pre> 4594</div> 4595 4596<div class="php-code"> 4597 <pre><code class="php"> 4598<?php 4599// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4600$json = file_get_contents('https://www.alphavantage.co/query?function=EARNINGS_CALL_TRANSCRIPT&symbol=IBM&quarter=2024Q1&apikey=demo'); 4601 4602$data = json_decode($json,true); 4603 4604print_r($data); 4605 4606exit; 4607 </code></pre> 4608</div> 4609 4610<div class="cs-code"> 4611 <pre><code class="cs"> 4612using System; 4613using System.Collections.Generic; 4614using System.Net; 4615
4616// ------------------------------------------------------------------------- 4617// if using .NET Framework 4618// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 4619// This requires including the reference to System.Web.Extensions in your project 4620using System.Web.Script.Serialization; 4621// ------------------------------------------------------------------------- 4622// if using .Net Core 4623// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4624using System.Text.Json; 4625// ------------------------------------------------------------------------- 4626 4627namespace ConsoleTests 4628{ 4629 internal class Program 4630 { 4631 private static void Main(string[] args) 4632 { 4633 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4634 string QUERY_URL = "https://www.alphavantage.co/query?function=EARNINGS_CALL_TRANSCRIPT&symbol=IBM&quarter=2024Q1&apikey=demo"; 4635 Uri queryUri = new Uri(QUERY_URL); 4636 4637 using (WebClient client = new WebClient()) 4638 { 4639 // ------------------------------------------------------------------------- 4640 // if using .NET Framework (System.Web.Script.Serialization) 4641 4642 JavaScriptSerializer js = new JavaScriptSerializer(); 4643 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4644 4645 // ------------------------------------------------------------------------- 4646 // if using .NET Core (System.Text.Json) 4647 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4648 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4649 4650 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4651 4652 // ------------------------------------------------------------------------- 4653 4654 // do something with the json_data 4655 } 4656 } 4657 } 4658} 4659 </code></pre> 4660</div> 4661 4662 4663<div class="other-code" style="background-color: #f9f9f9;"> 4664 <br> 4665 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4666 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4667 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4668 <br> 4669</div> 4670 4671 <br> 4672 4673 4674 4675 4676 <h4 id="gainer-loser">Top Gainers, Losers, and Most Actively Traded Tickers (US Market)</h4> 4677 <br> 4678 <p>This endpoint returns the top 20 gainers, losers, and the most active traded tickers in the US market.</p> 4679 <br> 4680 <h6><b>API Parameters</b></h6> 4681 <p><b>â Required: <code>function</code></b></p> 4682 <p>The API function of your choice. In this case, <code>function=TOP_GAINERS_LOSERS</code></p> 4683 <p>â Optional: <code>entitlement</code></p> 4684 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 4685 <p><b>â Required: <code>apikey</code></b></p> 4686 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4687 <br> 4688 4689 4690 4691 <h6><b>Examples (click for JSON output)</b></h6> 4692 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TOP_GAINERS_LOSERS&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TOP_GAINERS_LOSERS&<b>apikey</b>=demo</code></a></p> 4693 <br> 4694 4695 <div class="premium-msg"> 4696 <p>ð¡ Tip: By default, the top gainers, losers, and the most active traded ticker information is updated at the end of each trading day for all users. If you would like to access realtime or 15-minute delayed data, please subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> for your personal use. For commercial use, please <a href="/cdn-cgi/l/email-protection#f2818782829d8086b2939e829a9384939c86939597dc919d" target="_blank">contact sales</a>.</p> 4697 <p style="font-size:90%">* Realtime and 15-minute delayed US market data is regulated by the stock exchanges, FINRA, and the SEC. <a href="https://www.alphavantage.co/realtime_data_policy/" target="_blank">Learn more</a> about the key market data policies you need to know as a data consumer.</p> 4698 </div> 4699 <br> 4700 4701 <h6><b>Language-specific guides</b></h6> 4702 <div> 4703 <button class="python-btn">Python</button> 4704 <button class="node-btn">NodeJS</button> 4705 <button class="php-btn">PHP</button> 4706 <button class="cs-btn">C#/.NET</button> 4707 <button class="other-btn">â¨MCP & Other</button> 4708</div> 4709 4710<div class="python-code"> 4711 <pre><code class="python"> 4712import requests 4713 4714# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4715url = 'https://www.alphavantage.co/query?function=TOP_GAINERS_LOSERS&apikey=demo' 4716r = requests.get(url) 4717data = r.json() 4718 4719print(data) 4720 </code></pre> 4721</div> 4722 4723<div class="node-code"> 4724 <pre><code class="javascript"> 4725'use strict'; 4726var request = require('request'); 4727 4728// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4729var url = 'https://www.alphavantage.co/query?function=TOP_GAINERS_LOSERS&apikey=demo'; 4730 4731request.get({ 4732 url: url, 4733 json: true, 4734 headers: {'User-Agent': 'request'} 4735 }, (err, res, data) => { 4736 if (err) { 4737 console.log('Error:', err); 4738 } else if (res.statusCode !== 200) { 4739 console.log('Status:', res.statusCode); 4740 } else { 4741 // data is successfully parsed as a JSON object: 4742 console.log(data); 4743 } 4744}); 4745 </code></pre> 4746</div> 4747 4748<div class="php-code"> 4749 <pre><code class="php"> 4750<?php 4751// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4752$json = file_get_contents('https://www.alphavantage.co/query?function=TOP_GAINERS_LOSERS&apikey=demo'); 4753 4754$data = json_decode($json,true); 4755 4756print_r($data); 4757 4758exit; 4759 </code></pre> 4760</div> 4761 4762<div class="cs-code"> 4763 <pre><code class="cs"> 4764using System; 4765using System.Collections.Generic; 4766using System.Net; 4767
4768// ------------------------------------------------------------------------- 4769// if using .NET Framework 4770// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 4771// This requires including the reference to System.Web.Extensions in your project 4772using System.Web.Script.Serialization; 4773// ------------------------------------------------------------------------- 4774// if using .Net Core 4775// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4776using System.Text.Json; 4777// ------------------------------------------------------------------------- 4778 4779namespace ConsoleTests 4780{ 4781 internal class Program 4782 { 4783 private static void Main(string[] args) 4784 { 4785 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4786 string QUERY_URL = "https://www.alphavantage.co/query?function=TOP_GAINERS_LOSERS&apikey=demo"; 4787 Uri queryUri = new Uri(QUERY_URL); 4788 4789 using (WebClient client = new WebClient()) 4790 { 4791 // ------------------------------------------------------------------------- 4792 // if using .NET Framework (System.Web.Script.Serialization) 4793 4794 JavaScriptSerializer js = new JavaScriptSerializer(); 4795 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4796 4797 // ------------------------------------------------------------------------- 4798 // if using .NET Core (System.Text.Json) 4799 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4800 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4801 4802 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4803 4804 // ------------------------------------------------------------------------- 4805 4806 // do something with the json_data 4807 } 4808 } 4809 } 4810} 4811 </code></pre> 4812</div> 4813 4814 4815<div class="other-code" style="background-color: #f9f9f9;"> 4816 <br> 4817 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4818 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4819 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4820 <br> 4821</div> 4822 <br> 4823 4824 <h4 id="insider-transactions">Insider Transactions <span class="popular-label">Trending</span></h4> 4825 <p>This API returns the latest and historical insider transactions made by key stakeholders (e.g., founders, executives, board members, etc.) of a specific company.</p> 4826 <br> 4827 <h6><b>API Parameters</b></h6> 4828 <p><b>â Required: <code>function</code></b></p> 4829 <p>The function of your choice. In this case, <code>function=INSIDER_TRANSACTIONS</code> </p> 4830 <p><b>â Required: <code>symbol</code></b></p> 4831 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>.</p> 4832 <p>â Optional: <code>from</code></p> 4833 <p>An optional date filter in YYYY-MM-DD format that only keeps transaction records made on or after a certain date. For example: <code>from=2026-03-01</code>. By default, this parameter is not set and all transactions will be returned.</p> 4834 <p><b>â Required: <code>apikey</code></b></p> 4835 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4836 <br> 4837 4838 <h6><b>Example (click for JSON output)</b></h6> 4839 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INSIDER_TRANSACTIONS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INSIDER_TRANSACTIONS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 4840 <br> 4841 4842 4843 <h6><b>Language-specific guides</b></h6> 4844 <div> 4845 <button class="python-btn">Python</button> 4846 <button class="node-btn">NodeJS</button> 4847 <button class="php-btn">PHP</button> 4848 <button class="cs-btn">C#/.NET</button> 4849 <button class="other-btn">â¨MCP & Other</button> 4850</div> 4851 4852<div class="python-code"> 4853 <pre><code class="python"> 4854import requests 4855 4856# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4857url = 'https://www.alphavantage.co/query?function=INSIDER_TRANSACTIONS&symbol=IBM&apikey=demo' 4858r = requests.get(url) 4859data = r.json() 4860 4861print(data) 4862 </code></pre> 4863</div> 4864 4865<div class="node-code"> 4866 <pre><code class="javascript"> 4867'use strict'; 4868var request = require('request'); 4869 4870// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4871var url = 'https://www.alphavantage.co/query?function=INSIDER_TRANSACTIONS&symbol=IBM&apikey=demo'; 4872 4873request.get({ 4874 url: url, 4875 json: true, 4876 headers: {'User-Agent': 'request'} 4877 }, (err, res, data) => { 4878 if (err) { 4879 console.log('Error:', err); 4880 } else if (res.statusCode !== 200) { 4881 console.log('Status:', res.statusCode); 4882 } else { 4883 // data is successfully parsed as a JSON object: 4884 console.log(data); 4885 } 4886}); 4887 </code></pre> 4888</div> 4889 4890<div class="php-code"> 4891 <pre><code class="php"> 4892<?php 4893// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4894$json = file_get_contents('https://www.alphavantage.co/query?function=INSIDER_TRANSACTIONS&symbol=IBM&apikey=demo'); 4895 4896$data = json_decode($json,true); 4897 4898print_r($data); 4899 4900exit; 4901 </code></pre> 4902</div> 4903 4904<div class="cs-code"> 4905 <pre><code class="cs"> 4906using System; 4907using System.Collections.Generic; 4908using System.Net; 4909
4910// ------------------------------------------------------------------------- 4911// if using .NET Framework 4912// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 4913// This requires including the reference to System.Web.Extensions in your project 4914using System.Web.Script.Serialization; 4915// ------------------------------------------------------------------------- 4916// if using .Net Core 4917// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 4918using System.Text.Json; 4919// ------------------------------------------------------------------------- 4920 4921namespace ConsoleTests 4922{ 4923 internal class Program 4924 { 4925 private static void Main(string[] args) 4926 { 4927 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 4928 string QUERY_URL = "https://www.alphavantage.co/query?function=INSIDER_TRANSACTIONS&symbol=IBM&apikey=demo"; 4929 Uri queryUri = new Uri(QUERY_URL); 4930 4931 using (WebClient client = new WebClient()) 4932 { 4933 // ------------------------------------------------------------------------- 4934 // if using .NET Framework (System.Web.Script.Serialization) 4935 4936 JavaScriptSerializer js = new JavaScriptSerializer(); 4937 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 4938 4939 // ------------------------------------------------------------------------- 4940 // if using .NET Core (System.Text.Json) 4941 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 4942 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 4943 4944 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 4945 4946 // ------------------------------------------------------------------------- 4947 4948 // do something with the json_data 4949 } 4950 } 4951 } 4952} 4953 </code></pre> 4954</div> 4955 4956 4957<div class="other-code" style="background-color: #f9f9f9;"> 4958 <br> 4959 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 4960 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 4961 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 4962 <br> 4963</div> 4964 4965 <br> 4966 4967 <h4 id="congress-trades">Congress Trades <span class="popular-label">Trending</span></h4> 4968 <p>This API returns the latest and historical stock trades disclosed by US congressional representatives.</p> 4969 <br> 4970 <h6><b>API Parameters</b></h6> 4971 <p><b>â Required: <code>function</code></b></p> 4972 <p>The function of your choice. In this case, <code>function=CONGRESS_TRADES</code> </p> 4973 <p><b>â Required: <code>symbol</code> OR <code>bioguide_id</code></b></p> 4974 <p>You must specify at least the stock symbol OR the bioguide_id of the politician (or both). For example: <code>symbol=AAPL</code> or <code>bioguide_id=S000510</code>. For a complete mapping of politicians to their corresponding bioguide_ids, please refer to <a href="https://www.alphavantage.co/query?function=POLITICIAN_METADATA&apikey=demo" target="_blank">Politician Metadata</a>.</p> 4975 <p>â Optional: <code>datatype</code></p> 4976 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the options data in JSON format; <code>csv</code> returns the data as a CSV (comma separated value) file. </p> 4977 <p><b>â Required: <code>apikey</code></b></p> 4978 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 4979 <br> 4980 4981 <h6><b>Example (click for JSON output)</b></h6> 4982 <i>Get congress trade records by stock symbol</i> 4983 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CONGRESS_TRADES&symbol=AAPL&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CONGRESS_TRADES&<b>symbol</b>=AAPL&<b>apikey</b>=demo</code></a></p> 4984 <i>Get congress trade records by a politician's bioguide_id</i> 4985 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CONGRESS_TRADES&bioguide_id=S000510&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CONGRESS_TRADES&<b>bioguide_id</b>=S000510&<b>apikey</b>=demo</code></a></p> 4986 Downloadable CSV file: 4987 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CONGRESS_TRADES&symbol=AAPL&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CONGRESS_TRADES&<b>symbol</b>=AAPL&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 4988 4989 <br> 4990 4991 4992 <h6><b>Language-specific guides</b></h6> 4993 <div> 4994 <button class="python-btn">Python</button> 4995 <button class="node-btn">NodeJS</button> 4996 <button class="php-btn">PHP</button> 4997 <button class="cs-btn">C#/.NET</button> 4998 <button class="other-btn">â¨MCP & Other</button> 4999</div> 5000 5001<div class="python-code"> 5002 <pre><code class="python"> 5003import requests 5004 5005# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5006url = 'https://www.alphavantage.co/query?function=CONGRESS_TRADES&symbol=AAPL&apikey=demo' 5007r = requests.get(url) 5008data = r.json() 5009 5010print(data) 5011 </code></pre> 5012</div> 5013 5014<div class="node-code"> 5015 <pre><code class="javascript"> 5016'use strict'; 5017var request = require('request'); 5018 5019// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5020var url = 'https://www.alphavantage.co/query?function=CONGRESS_TRADES&symbol=AAPL&apikey=demo'; 5021 5022request.get({ 5023 url: url, 5024 json: true, 5025 headers: {'User-Agent': 'request'} 5026 }, (err, res, data) => { 5027 if (err) { 5028 console.log('Error:', err); 5029 } else if (res.statusCode !== 200) { 5030 console.log('Status:', res.statusCode); 5031 } else { 5032 // data is successfully parsed as a JSON object: 5033 console.log(data); 5034 } 5035}); 5036 </code></pre> 5037</div> 5038 5039<div class="php-code"> 5040 <pre><code class="php"> 5041<?php 5042// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5043$json = file_get_contents('https://www.alphavantage.co/query?function=CONGRESS_TRADES&symbol=AAPL&apikey=demo'); 5044 5045$data = json_decode($json,true); 5046 5047print_r($data); 5048 5049exit; 5050 </code></pre> 5051</div> 5052 5053<div class="cs-code"> 5054 <pre><code class="cs"> 5055using System; 5056using System.Collections.Generic; 5057using System.Net; 5058
5059// ------------------------------------------------------------------------- 5060// if using .NET Framework 5061// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5062// This requires including the reference to System.Web.Extensions in your project 5063using System.Web.Script.Serialization; 5064// ------------------------------------------------------------------------- 5065// if using .Net Core 5066// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5067using System.Text.Json; 5068// ------------------------------------------------------------------------- 5069 5070namespace ConsoleTests 5071{ 5072 internal class Program 5073 { 5074 private static void Main(string[] args) 5075 { 5076 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5077 string QUERY_URL = "https://www.alphavantage.co/query?function=CONGRESS_TRADES&symbol=AAPL&apikey=demo"; 5078 Uri queryUri = new Uri(QUERY_URL); 5079 5080 using (WebClient client = new WebClient()) 5081 { 5082 // ------------------------------------------------------------------------- 5083 // if using .NET Framework (System.Web.Script.Serialization) 5084 5085 JavaScriptSerializer js = new JavaScriptSerializer(); 5086 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 5087 5088 // ------------------------------------------------------------------------- 5089 // if using .NET Core (System.Text.Json) 5090 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 5091 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 5092 5093 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 5094 5095 // ------------------------------------------------------------------------- 5096 5097 // do something with the json_data 5098 } 5099 } 5100 } 5101} 5102 </code></pre> 5103</div> 5104 5105 5106<div class="other-code" style="background-color: #f9f9f9;"> 5107 <br> 5108 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 5109 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 5110 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 5111 <br> 5112</div> 5113 5114 <br> 5115 5116 <h4 id="politician-metadata">Politician Metadata <span class="utility-label">Utility</span></h4> 5117 <p>This API returns the key metadata for US congressional representatives, such as bioguide_id, district, time in service, etc.</p> 5118 <br> 5119 <h6><b>API Parameters</b></h6> 5120 <p><b>â Required: <code>function</code></b></p> 5121 <p>The function of your choice. In this case, <code>function=POLITICIAN_METADATA</code> </p> 5122 <p><b>â Required: <code>apikey</code></b></p> 5123 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 5124 <br> 5125 5126 <h6><b>Example (click for JSON output)</b></h6> 5127 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=POLITICIAN_METADATA&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=POLITICIAN_METADATA&<b>apikey</b>=demo</code></a></p> 5128 <br> 5129 5130 5131 <h6><b>Language-specific guides</b></h6> 5132 <div> 5133 <button class="python-btn">Python</button> 5134 <button class="node-btn">NodeJS</button> 5135 <button class="php-btn">PHP</button> 5136 <button class="cs-btn">C#/.NET</button> 5137 <button class="other-btn">â¨MCP & Other</button> 5138</div> 5139 5140<div class="python-code"> 5141 <pre><code class="python"> 5142import requests 5143 5144# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5145url = 'https://www.alphavantage.co/query?function=POLITICIAN_METADATA&apikey=demo' 5146r = requests.get(url) 5147data = r.json() 5148 5149print(data) 5150 </code></pre> 5151</div> 5152 5153<div class="node-code"> 5154 <pre><code class="javascript"> 5155'use strict'; 5156var request = require('request'); 5157 5158// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5159var url = 'https://www.alphavantage.co/query?function=POLITICIAN_METADATA&apikey=demo'; 5160 5161request.get({ 5162 url: url, 5163 json: true, 5164 headers: {'User-Agent': 'request'} 5165 }, (err, res, data) => { 5166 if (err) { 5167 console.log('Error:', err); 5168 } else if (res.statusCode !== 200) { 5169 console.log('Status:', res.statusCode); 5170 } else { 5171 // data is successfully parsed as a JSON object: 5172 console.log(data); 5173 } 5174}); 5175 </code></pre> 5176</div> 5177 5178<div class="php-code"> 5179 <pre><code class="php"> 5180<?php 5181// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5182$json = file_get_contents('https://www.alphavantage.co/query?function=POLITICIAN_METADATA&apikey=demo'); 5183 5184$data = json_decode($json,true); 5185 5186print_r($data); 5187 5188exit; 5189 </code></pre> 5190</div> 5191 5192<div class="cs-code"> 5193 <pre><code class="cs"> 5194using System; 5195using System.Collections.Generic; 5196using System.Net; 5197
5198// ------------------------------------------------------------------------- 5199// if using .NET Framework 5200// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5201// This requires including the reference to System.Web.Extensions in your project 5202using System.Web.Script.Serialization; 5203// ------------------------------------------------------------------------- 5204// if using .Net Core 5205// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5206using System.Text.Json; 5207// ------------------------------------------------------------------------- 5208 5209namespace ConsoleTests 5210{ 5211 internal class Program 5212 { 5213 private static void Main(string[] args) 5214 { 5215 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5216 string QUERY_URL = "https://www.alphavantage.co/query?function=POLITICIAN_METADATA&apikey=demo"; 5217 Uri queryUri = new Uri(QUERY_URL); 5218 5219 using (WebClient client = new WebClient()) 5220 { 5221 // ------------------------------------------------------------------------- 5222 // if using .NET Framework (System.Web.Script.Serialization) 5223 5224 JavaScriptSerializer js = new JavaScriptSerializer(); 5225 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 5226 5227 // ------------------------------------------------------------------------- 5228 // if using .NET Core (System.Text.Json) 5229 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 5230 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 5231 5232 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 5233 5234 // ------------------------------------------------------------------------- 5235 5236 // do something with the json_data 5237 } 5238 } 5239 } 5240} 5241 </code></pre> 5242</div> 5243 5244 5245<div class="other-code" style="background-color: #f9f9f9;"> 5246 <br> 5247 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 5248 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 5249 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 5250 <br> 5251</div> 5252 5253 <br> 5254 5255 <h4 id="institutional-holdings">Institutional Holdings</h4> 5256 <p>This API returns the institutional ownership and holdings information for an equity of interest.</p> 5257 <br> 5258 <h6><b>API Parameters</b></h6> 5259 <p><b>â Required: <code>function</code></b></p> 5260 <p>The function of your choice. In this case, <code>function=INSTITUTIONAL_HOLDINGS</code> </p> 5261 <p><b>â Required: <code>symbol</code></b></p> 5262 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 5263 </p> 5264 <p><b>â Required: <code>apikey</code></b></p> 5265 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 5266 <br> 5267 5268 <h6><b>Example (click for JSON output)</b></h6> 5269 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INSTITUTIONAL_HOLDINGS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INSTITUTIONAL_HOLDINGS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 5270 <br> 5271 5272 5273 <h6><b>Language-specific guides</b></h6> 5274 <div> 5275 <button class="python-btn">Python</button> 5276 <button class="node-btn">NodeJS</button> 5277 <button class="php-btn">PHP</button> 5278 <button class="cs-btn">C#/.NET</button> 5279 <button class="other-btn">â¨MCP & Other</button> 5280</div> 5281 5282<div class="python-code"> 5283 <pre><code class="python"> 5284import requests 5285 5286# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5287url = 'https://www.alphavantage.co/query?function=INSTITUTIONAL_HOLDINGS&symbol=IBM&apikey=demo' 5288r = requests.get(url) 5289data = r.json() 5290 5291print(data) 5292 </code></pre> 5293</div> 5294 5295<div class="node-code"> 5296 <pre><code class="javascript"> 5297'use strict'; 5298var request = require('request'); 5299 5300// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5301var url = 'https://www.alphavantage.co/query?function=INSTITUTIONAL_HOLDINGS&symbol=IBM&apikey=demo'; 5302 5303request.get({ 5304 url: url, 5305 json: true, 5306 headers: {'User-Agent': 'request'} 5307 }, (err, res, data) => { 5308 if (err) { 5309 console.log('Error:', err); 5310 } else if (res.statusCode !== 200) { 5311 console.log('Status:', res.statusCode); 5312 } else { 5313 // data is successfully parsed as a JSON object: 5314 console.log(data); 5315 } 5316}); 5317 </code></pre> 5318</div> 5319 5320<div class="php-code"> 5321 <pre><code class="php"> 5322<?php 5323// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5324$json = file_get_contents('https://www.alphavantage.co/query?function=INSTITUTIONAL_HOLDINGS&symbol=IBM&apikey=demo'); 5325 5326$data = json_decode($json,true); 5327 5328print_r($data); 5329 5330exit; 5331 </code></pre> 5332</div> 5333 5334<div class="cs-code"> 5335 <pre><code class="cs"> 5336using System; 5337using System.Collections.Generic; 5338using System.Net; 5339
5340// ------------------------------------------------------------------------- 5341// if using .NET Framework 5342// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5343// This requires including the reference to System.Web.Extensions in your project 5344using System.Web.Script.Serialization; 5345// ------------------------------------------------------------------------- 5346// if using .Net Core 5347// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5348using System.Text.Json; 5349// ------------------------------------------------------------------------- 5350 5351namespace ConsoleTests 5352{ 5353 internal class Program 5354 { 5355 private static void Main(string[] args) 5356 { 5357 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5358 string QUERY_URL = "https://www.alphavantage.co/query?function=INSTITUTIONAL_HOLDINGS&symbol=IBM&apikey=demo"; 5359 Uri queryUri = new Uri(QUERY_URL); 5360 5361 using (WebClient client = new WebClient()) 5362 { 5363 // ------------------------------------------------------------------------- 5364 // if using .NET Framework (System.Web.Script.Serialization) 5365 5366 JavaScriptSerializer js = new JavaScriptSerializer(); 5367 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 5368 5369 // ------------------------------------------------------------------------- 5370 // if using .NET Core (System.Text.Json) 5371 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 5372 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 5373 5374 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 5375 5376 // ------------------------------------------------------------------------- 5377 5378 // do something with the json_data 5379 } 5380 } 5381 } 5382} 5383 </code></pre> 5384</div> 5385 5386 5387<div class="other-code" style="background-color: #f9f9f9;"> 5388 <br> 5389 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 5390 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 5391 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 5392 <br> 5393</div> 5394 5395 <br> 5396 5397 <h4 id="analytics-fixed-window">Advanced Analytics (Fixed Window)</h4> 5398 <p>This endpoint returns a rich set of advanced analytics metrics (e.g., total return, variance, auto-correlation, etc.) for a given time series over a fixed temporal window. </p> 5399 <br> 5400 <h6><b>API Parameters</b></h6> 5401 <p><b>â Required: <code>function</code></b></p> 5402 <p>The function of your choice. In this case, <code>function=ANALYTICS_FIXED_WINDOW</code></p> 5403 <p><b>â Required: <code>SYMBOLS</code></b></p> 5404 <p>A list of symbols for the calculation. It can be a comma separated list of symbols as a string. <span class="popular-label">Free</span> API keys can specify up to 5 symbols per API request. <span class="premium-label">Premium</span> API keys can specify up to 50 symbols per API request.</p> 5405 <p><b>â Required: <code>RANGE</code></b></p> 5406 <p>This is the date range for the series being requested. By default, the date range is the full set of data for the equity history. This can be further modified by the LIMIT variable. </p> 5407 <p>RANGE can take certain text values as inputs. They are: </p> 5408 <ul> 5409 <li><code>full</code></li> 5410 <li><code>{N}day</code></li> 5411 <li><code>{N}week</code></li> 5412 <li><code>{N}month</code></li> 5413 <li><code>{N}year</code></li> 5414 </ul> 5415 <p>For intraday time series, the following RANGE values are also accepted: </p> 5416 <ul> 5417 <li><code>{N}minute</code></li> 5418 <li><code>{N}hour</code></li> 5419 </ul> 5420 <p>Aside from the âfullâ value which represents the entire time series, the other values specify an interval to return the series for as measured backwards from the current date/time.</p> 5421 <p>To specify start & end dates for your analytics calcuation, simply add two RANGE parameters in your API request. For example: <code>RANGE=2023-07-01&RANGE=2023-08-31</code> or <code>RANGE=2020-12-01T00:04:00&RANGE=2020-12-06T23:59:59</code> with minute-level precision for intraday analytics. If the end date is missing, the end date is assumed to be the last trading date. In addition, you can request a full month of data by using YYYY-MM format like <code>2020-12</code>. One day of intraday data can be requested by using YYYY-MM-DD format like <code>2020-12-06</code></p> 5422 <p><b>â Optional: <code>OHLC</code></b></p> 5423 <p>This allows you to choose which open, high, low, or close field the calculation will be performed on. By default, <code>OHLC=close</code>. Valid values for these fields are <code>open</code>, <code>high</code>, <code>low</code>, <code>close</code>.</p> 5424 <p><b>â Required: <code>INTERVAL</code></b></p> 5425 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>DAILY</code>, <code>WEEKLY</code>, <code>MONTHLY</code>.</p> 5426 <p><b>â Required: <code>CALCULATIONS</code></b></p> 5427 <p>A comma separated list of the analytics metrics you would like to calculate: </p> 5428 <ul> 5429 <li><code>MIN</code>: The minimum return (largest negative or smallest positive) for all values in the series</li> 5430 <li><code>MAX</code>: The maximum return for all values in the series</li> 5431 <li><code>MEAN</code>: The mean of all returns in the series</li> 5432 <li><code>MEDIAN</code>: The median of all returns in the series</li> 5433 <li><code>CUMULATIVE_RETURN</code>: The total return from the beginning to the end of the series range</li> 5434 <li><code>VARIANCE</code>: The population variance of returns in the series range. Optionally, you can use <code>VARIANCE(annualized=True)</code>to normalize the output to an annual value. By default, the variance is not annualized.</li> 5435 <li><code>STDDEV</code>: The population standard deviation of returns in the series range for each symbol. Optionally, you can use <code>STDDEV(annualized=True)</code>to normalize the output to an annual value. By default, the standard deviation is not annualized.</li> 5436 <li><code>MAX_DRAWDOWN</code>: Largest peak to trough interval for each symbol in the series range</li> 5437 <li><code>HISTOGRAM</code>: For each symbol, place the observed total returns in bins. By default, bins=10. Use <code>HISTOGRAM(bins=20)</code> to specify a custom bin value (e.g., 20).</li> 5438 <li><code>AUTOCORRELATION</code>: For each symbol place, calculate the autocorrelation for the given lag (e.g., the lag in neighboring points for the autocorrelation calculation). By default, lag=1. Use <code>AUTOCORRELATION(lag=2)</code> to specify a custom lag value (e.g., 2).</li> 5439 <li><code>COVARIANCE</code>: Returns a covariance matrix for the input symbols. Optionally, you can use <code>COVARIANCE(annualized=True)</code>to normalize the output to an annual value. By default, the covariance is not annualized.</li> 5440 <li><code>CORRELATION</code>: Returns a correlation matrix for the input symbols, using the PEARSON method as default. You can also specify the KENDALL or SPEARMAN method through <code>CORRELATION(method=KENDALL)</code> or <code>
5440CORRELATION(method=SPEARMAN)</code>, respectively.</li> 5441 </ul> 5442 <p><b>â Required: <code>apikey</code></b></p> 5443 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 5444 <br> 5445 5446 <h6><b>Examples (click for JSON output)</b></h6> 5447 <i>For AAPL, MSFT, and IBM, calculate the mean & standard deviation of their returns based on daily close prices between 2023-07-01 and 2023-08-31, along with a correlation matrix among the three tickers. </i> 5448 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ANALYTICS_FIXED_WINDOW&SYMBOLS=AAPL,MSFT,IBM&RANGE=2023-07-01&RANGE=2023-08-31&INTERVAL=DAILY&OHLC=close&CALCULATIONS=MEAN,STDDEV,CORRELATION&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=ANALYTICS_FIXED_WINDOW&SYMBOLS=AAPL,MSFT,IBM&RANGE=2023-07-01&RANGE=2023-08-31&INTERVAL=DAILY&OHLC=close&CALCULATIONS=MEAN,STDDEV,CORRELATION&apikey=demo</code></a></p> 5449 <br> 5450 5451 <h6><b>Language-specific guides</b></h6> 5452 <div> 5453 <button class="python-btn">Python</button> 5454 <button class="node-btn">NodeJS</button> 5455 <button class="php-btn">PHP</button> 5456 <button class="cs-btn">C#/.NET</button> 5457 <button class="other-btn">â¨MCP & Other</button> 5458</div> 5459 5460<div class="python-code"> 5461 <pre><code class="python"> 5462import requests 5463 5464# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5465url = 'https://alphavantageapi.co/timeseries/analytics?SYMBOLS=AAPL,MSFT,IBM&RANGE=2023-07-01&RANGE=2023-08-31&INTERVAL=DAILY&OHLC=close&CALCULATIONS=MEAN,STDDEV,CORRELATION&apikey=demo' 5466r = requests.get(url) 5467data = r.json() 5468 5469print(data) 5470 </code></pre> 5471</div> 5472 5473<div class="node-code"> 5474 <pre><code class="javascript"> 5475'use strict'; 5476var request = require('request'); 5477 5478// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5479var url = 'https://alphavantageapi.co/timeseries/analytics?SYMBOLS=AAPL,MSFT,IBM&RANGE=2023-07-01&RANGE=2023-08-31&INTERVAL=DAILY&OHLC=close&CALCULATIONS=MEAN,STDDEV,CORRELATION&apikey=demo'; 5480 5481request.get({ 5482 url: url, 5483 json: true, 5484 headers: {'User-Agent': 'request'} 5485 }, (err, res, data) => { 5486 if (err) { 5487 console.log('Error:', err); 5488 } else if (res.statusCode !== 200) { 5489 console.log('Status:', res.statusCode); 5490 } else { 5491 // data is successfully parsed as a JSON object: 5492 console.log(data); 5493 } 5494}); 5495 </code></pre> 5496</div> 5497 5498<div class="php-code"> 5499 <pre><code class="php"> 5500<?php 5501// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5502$json = file_get_contents('https://alphavantageapi.co/timeseries/analytics?SYMBOLS=AAPL,MSFT,IBM&RANGE=2023-07-01&RANGE=2023-08-31&INTERVAL=DAILY&OHLC=close&CALCULATIONS=MEAN,STDDEV,CORRELATION&apikey=demo'); 5503 5504$data = json_decode($json,true); 5505 5506print_r($data); 5507 5508exit; 5509 </code></pre> 5510</div> 5511 5512<div class="cs-code"> 5513 <pre><code class="cs"> 5514using System; 5515using System.Collections.Generic; 5516using System.Net; 5517 5518// ------------------------------------------------------------------------- 5519// if using .NET Framework 5520// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5521// This requires including the reference to System.Web.Extensions in your project 5522using System.Web.Script.Serialization; 5523// ------------------------------------------------------------------------- 5524// if using .Net Core 5525// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5526using System.Text.Json; 5527// ------------------------------------------------------------------------- 5528 5529namespace ConsoleTests 5530{ 5531 internal class Program 5532 { 5533 private static void Main(string[] args) 5534 { 5535 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5536 string QUERY_URL = "https://alphavantageapi.co/timeseries/analytics?SYMBOLS=AAPL,MSFT,IBM&RANGE=2023-07-01&RANGE=2023-08-31&INTERVAL=DAILY&OHLC=close&CALCULATIONS=MEAN,STDDEV,CORRELATION&apikey=demo"; 5537 Uri queryUri = new Uri(QUERY_URL); 5538 5539 using (WebClient client = new WebClient()) 5540 { 5541 // ------------------------------------------------------------------------- 5542 // if using .NET Framework (System.Web.Script.Serialization) 5543 5544 JavaScriptSerializer js = new JavaScriptSerializer(); 5545 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 5546 5547 // ------------------------------------------------------------------------- 5548 // if using .NET Core (System.Text.Json) 5549 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 5550 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 5551 5552 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 5553 5554 // ------------------------------------------------------------------------- 5555
5556 // do something with the json_data 5557 } 5558 } 5559 } 5560} 5561 </code></pre> 5562</div> 5563 5564 5565<div class="other-code" style="background-color: #f9f9f9;"> 5566 <br> 5567 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 5568 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 5569 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 5570 <br> 5571</div> 5572 5573 <br> 5574 <br> 5575 5576 <h4 id="analytics-sliding-window">Advanced Analytics (Sliding Window) <span class="popular-label">Trending</span></h4> 5577 <p>This endpoint returns a rich set of advanced analytics metrics (e.g., total return, variance, auto-correlation, etc.) for a given time series over sliding time windows. For example, we can calculate a moving variance over 5 years with a window of 100 points to see how the variance changes over time. </p> 5578 <br> 5579 <h6><b>API Parameters</b></h6> 5580 <p><b>â Required: <code>function</code></b></p> 5581 <p>The function of your choice. In this case, <code>function=ANALYTICS_SLIDING_WINDOW</code></p> 5582 <p><b>â Required: <code>SYMBOLS</code></b></p> 5583 <p>A list of symbols for the calculation. It can be a comma separated list of symbols as a string. <span class="popular-label">Free</span> API keys can specify up to 5 symbols per API request. <span class="premium-label">Premium</span> API keys can specify up to 50 symbols per API request.</p> 5584 <p><b>â Required: <code>RANGE</code></b></p> 5585 <p>This is the date range for the series being requested. By default, the date range is the full set of data for the equity history. This can be further modified by the LIMIT variable. </p> 5586 <p>RANGE can take certain text values as inputs. They are: </p> 5587 <ul> 5588 <li><code>full</code></li> 5589 <li><code>{N}day</code></li> 5590 <li><code>{N}week</code></li> 5591 <li><code>{N}month</code></li> 5592 <li><code>{N}year</code></li> 5593 </ul> 5594 <p>For intraday time series, the following RANGE values are also accepted: </p> 5595 <ul> 5596 <li><code>{N}minute</code></li> 5597 <li><code>{N}hour</code></li> 5598 </ul> 5599 <p>Aside from the âfullâ value which represents the entire time series, the other values specify an interval to return the series for as measured backwards from the current date/time.</p> 5600 <p>To specify start & end dates for your analytics calcuation, simply add two RANGE parameters in your API request. For example: <code>RANGE=2023-07-01&RANGE=2023-08-31</code> or <code>RANGE=2020-12-01T00:04:00&RANGE=2020-12-06T23:59:59</code> with minute-level precision for intraday analytics. If the end date is missing, the end date is assumed to be the last trading date. In addition, you can request a full month of data by using YYYY-MM format like <code>2020-12</code>. One day of intraday data can be requested by using YYYY-MM-DD format like <code>2020-12-06</code></p> 5601 <p><b>â Optional: <code>OHLC</code></b></p> 5602 <p>This allows you to choose which open, high, low, or close field the calculation will be performed on. By default, <code>OHLC=close</code>. Valid values for these fields are <code>open</code>, <code>high</code>, <code>low</code>, <code>close</code>.</p> 5603 <p><b>â Required: <code>INTERVAL</code></b></p> 5604 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>DAILY</code>, <code>WEEKLY</code>, <code>MONTHLY</code>.</p> 5605 <p><b>â Required: <code>WINDOW_SIZE</code></b></p> 5606 <p>An integer representing the size of the moving window. A hard lower boundary of 10 has been set though it is recommended to make this window larger to make sure the running calculations are statistically significant.</p> 5607 <p><b>â Required: <code>CALCULATIONS</code></b></p> 5608 <p>A comma separated list of the analytics metrics you would like to calculate. <span class="popular-label">Free</span> API keys can specify 1 metric to be calculated per API request. <span class="premium-label">Premium</span> API keys can specify multiple metrics to be calculated simultaneously per API request. </p> 5609 <ul> 5610 <li><code>MEAN</code>: The mean of all returns in the series</li> 5611 <li><code>MEDIAN</code>: The median of all returns in the series</li> 5612 <li><code>CUMULATIVE_RETURN</code>: The total return from the beginning to the end of the series range</li> 5613 <li><code>VARIANCE</code>: The population variance of returns in the series range. Optionally, you can use <code>VARIANCE(annualized=True)</code>to normalize the output to an annual value. By default, the variance is not annualized.</li> 5614 <li><code>STDDEV</code>: The population standard deviation of returns in the series range for each symbol. Optionally, you can use <code>STDDEV(annualized=True)</code>to normalize the output to an annual value. By default, the standard deviation is not annualized.</li> 5615 <li><code>COVARIANCE</code>: Returns a covariance matrix for the input symbols. Optionally, you can use <code>COVARIANCE(annualized=True)</code>to normalize the output to an annual value. By default, the covariance is not annualized.</li> 5616 <li><code>CORRELATION</code>: Returns a correlation matrix for the input symbols, using the PEARSON method as default. You can also specify the KENDALL or SPEARMAN method through <code>CORRELATION(method=KENDALL)</code> or <code>
5616CORRELATION(method=SPEARMAN)</code>, respectively.</li> 5617 </ul> 5618 <p><b>â Required: <code>apikey</code></b></p> 5619 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 5620 <br> 5621 5622 <h6><b>Examples (click for JSON output)</b></h6> 5623 <i>For AAPL and IBM, calculate the running mean & annualized standard deviation of their returns based on daily close prices in the trailing 2 months, with a sliding window size of 20. </i> 5624 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ANALYTICS_SLIDING_WINDOW&SYMBOLS=AAPL,IBM&RANGE=2month&INTERVAL=DAILY&OHLC=close&WINDOW_SIZE=20&CALCULATIONS=MEAN,STDDEV(annualized=True)&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=ANALYTICS_SLIDING_WINDOW&SYMBOLS=AAPL,IBM&RANGE=2month&INTERVAL=DAILY&OHLC=close&WINDOW_SIZE=20&CALCULATIONS=MEAN,STDDEV(annualized=True)&apikey=demo</code></a></p> 5625 <br> 5626 5627 <h6><b>Language-specific guides</b></h6> 5628 <div> 5629 <button class="python-btn">Python</button> 5630 <button class="node-btn">NodeJS</button> 5631 <button class="php-btn">PHP</button> 5632 <button class="cs-btn">C#/.NET</button> 5633 <button class="other-btn">â¨MCP & Other</button> 5634</div> 5635 5636<div class="python-code"> 5637 <pre><code class="python"> 5638import requests 5639 5640# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5641url = 'https://alphavantageapi.co/timeseries/running_analytics?SYMBOLS=AAPL,IBM&RANGE=2month&INTERVAL=DAILY&OHLC=close&WINDOW_SIZE=20&CALCULATIONS=MEAN,STDDEV(annualized=True)&apikey=demo' 5642r = requests.get(url) 5643data = r.json() 5644 5645print(data) 5646 </code></pre> 5647</div> 5648 5649<div class="node-code"> 5650 <pre><code class="javascript"> 5651'use strict'; 5652var request = require('request'); 5653 5654// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5655var url = 'https://alphavantageapi.co/timeseries/running_analytics?SYMBOLS=AAPL,IBM&RANGE=2month&INTERVAL=DAILY&OHLC=close&WINDOW_SIZE=20&CALCULATIONS=MEAN,STDDEV(annualized=True)&apikey=demo'; 5656 5657request.get({ 5658 url: url, 5659 json: true, 5660 headers: {'User-Agent': 'request'} 5661 }, (err, res, data) => { 5662 if (err) { 5663 console.log('Error:', err); 5664 } else if (res.statusCode !== 200) { 5665 console.log('Status:', res.statusCode); 5666 } else { 5667 // data is successfully parsed as a JSON object: 5668 console.log(data); 5669 } 5670}); 5671 </code></pre> 5672</div> 5673 5674<div class="php-code"> 5675 <pre><code class="php"> 5676<?php 5677// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5678$json = file_get_contents('https://alphavantageapi.co/timeseries/running_analytics?SYMBOLS=AAPL,IBM&RANGE=2month&INTERVAL=DAILY&OHLC=close&WINDOW_SIZE=20&CALCULATIONS=MEAN,STDDEV(annualized=True)&apikey=demo'); 5679 5680$data = json_decode($json,true); 5681 5682print_r($data); 5683 5684exit; 5685 </code></pre> 5686</div> 5687 5688<div class="cs-code"> 5689 <pre><code class="cs"> 5690using System; 5691using System.Collections.Generic; 5692using System.Net; 5693 5694// ------------------------------------------------------------------------- 5695// if using .NET Framework 5696// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5697// This requires including the reference to System.Web.Extensions in your project 5698using System.Web.Script.Serialization; 5699// ------------------------------------------------------------------------- 5700// if using .Net Core 5701// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5702using System.Text.Json; 5703// ------------------------------------------------------------------------- 5704 5705namespace ConsoleTests 5706{ 5707 internal class Program 5708 { 5709 private static void Main(string[] args) 5710 { 5711 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5712 string QUERY_URL = "https://alphavantageapi.co/timeseries/running_analytics?SYMBOLS=AAPL,IBM&RANGE=2month&INTERVAL=DAILY&OHLC=close&WINDOW_SIZE=20&CALCULATIONS=MEAN,STDDEV(annualized=True)&apikey=demo"; 5713 Uri queryUri = new Uri(QUERY_URL); 5714 5715 using (WebClient client = new WebClient()) 5716 { 5717 // ------------------------------------------------------------------------- 5718 // if using .NET Framework (System.Web.Script.Serialization) 5719 5720 JavaScriptSerializer js = new JavaScriptSerializer(); 5721 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 5722 5723 // ------------------------------------------------------------------------- 5724 // if using .NET Core (System.Text.Json) 5725 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 5726 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 5727 5728 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 5729 5730 // ------------------------------------------------------------------------- 5731
5732 // do something with the json_data 5733 } 5734 } 5735 } 5736} 5737 </code></pre> 5738</div> 5739 5740 5741<div class="other-code" style="background-color: #f9f9f9;"> 5742 <br> 5743 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 5744 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 5745 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 5746 <br> 5747</div> 5748 5749 5750 5751 <br> 5752 <br> 5753 5754 5755 </section> 5756 5757 <section> 5758 <h2 id="fundamentals">Fundamental Data</h2> 5759 <p>We offer the following set of fundamental data APIs in various temporal dimensions covering key financial metrics, income statements, balance sheets, cash flow, and other fundamental data points. </p> 5760 <br> 5761 5762 <h4 id="company-overview">Company Overview <span class="popular-label">Trending</span></h4> 5763 <p>This API returns the company information, financial ratios, and other key metrics for the equity specified. Data is generally refreshed on the same day a company reports its latest earnings and financials. </p> 5764 <br> 5765 <h6><b>API Parameters</b></h6> 5766 <p><b>â Required: <code>function</code></b></p> 5767 <p>The function of your choice. In this case, <code>function=OVERVIEW</code> </p> 5768 <p><b>â Required: <code>symbol</code></b></p> 5769 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 5770 </p> 5771 <p><b>â Required: <code>apikey</code></b></p> 5772 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 5773 <br> 5774 5775 <h6><b>Example (click for JSON output)</b></h6> 5776 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=OVERVIEW&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 5777 <br> 5778 5779 <h6><b>Language-specific guides</b></h6> 5780 <div> 5781 <button class="python-btn">Python</button> 5782 <button class="node-btn">NodeJS</button> 5783 <button class="php-btn">PHP</button> 5784 <button class="cs-btn">C#/.NET</button> 5785 <button class="other-btn">â¨MCP & Other</button> 5786</div> 5787 5788<div class="python-code"> 5789 <pre><code class="python"> 5790import requests 5791 5792# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5793url = 'https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo' 5794r = requests.get(url) 5795data = r.json() 5796 5797print(data) 5798 </code></pre> 5799</div> 5800 5801<div class="node-code"> 5802 <pre><code class="javascript"> 5803'use strict'; 5804var request = require('request'); 5805 5806// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5807var url = 'https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo'; 5808 5809request.get({ 5810 url: url, 5811 json: true, 5812 headers: {'User-Agent': 'request'} 5813 }, (err, res, data) => { 5814 if (err) { 5815 console.log('Error:', err); 5816 } else if (res.statusCode !== 200) { 5817 console.log('Status:', res.statusCode); 5818 } else { 5819 // data is successfully parsed as a JSON object: 5820 console.log(data); 5821 } 5822}); 5823 </code></pre> 5824</div> 5825 5826<div class="php-code"> 5827 <pre><code class="php"> 5828<?php 5829// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5830$json = file_get_contents('https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo'); 5831 5832$data = json_decode($json,true); 5833 5834print_r($data); 5835 5836exit; 5837 </code></pre> 5838</div> 5839 5840<div class="cs-code"> 5841 <pre><code class="cs"> 5842using System; 5843using System.Collections.Generic; 5844using System.Net; 5845
5846// ------------------------------------------------------------------------- 5847// if using .NET Framework 5848// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5849// This requires including the reference to System.Web.Extensions in your project 5850using System.Web.Script.Serialization; 5851// ------------------------------------------------------------------------- 5852// if using .Net Core 5853// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5854using System.Text.Json; 5855// ------------------------------------------------------------------------- 5856 5857namespace ConsoleTests 5858{ 5859 internal class Program 5860 { 5861 private static void Main(string[] args) 5862 { 5863 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5864 string QUERY_URL = "https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo" 5865 Uri queryUri = new Uri(QUERY_URL); 5866 5867 using (WebClient client = new WebClient()) 5868 { 5869 // ------------------------------------------------------------------------- 5870 // if using .NET Framework (System.Web.Script.Serialization) 5871 5872 JavaScriptSerializer js = new JavaScriptSerializer(); 5873 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 5874 5875 // ------------------------------------------------------------------------- 5876 // if using .NET Core (System.Text.Json) 5877 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 5878 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 5879 5880 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 5881 5882 // ------------------------------------------------------------------------- 5883 5884 // do something with the json_data 5885 } 5886 } 5887 } 5888} 5889 </code></pre> 5890</div> 5891 5892 5893<div class="other-code" style="background-color: #f9f9f9;"> 5894 <br> 5895 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 5896 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 5897 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 5898 <br> 5899</div> 5900 <br> 5901 5902 <h4 id="company-logo">Company Logo</h4> 5903 <p>This API returns the logo of a publicly traded company in both pixel (PNG) and vector (SVG) formats.</p> 5904 <br> 5905 <h6><b>API Parameters</b></h6> 5906 <p><b>â Required: <code>function</code></b></p> 5907 <p>The function of your choice. In this case, <code>function=COMPANY_LOGO</code> </p> 5908 <p><b>â Required: <code>symbol</code></b></p> 5909 <p>The symbol of the company of your choice. For example: <code>symbol=IBM</code>. 5910 </p> 5911 <p><b>â Required: <code>apikey</code></b></p> 5912 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 5913 <br> 5914 5915 <h6><b>Example (click for JSON output)</b></h6> 5916 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=COMPANY_LOGO&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=COMPANY_LOGO&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 5917 <br> 5918 5919 <h6><b>Language-specific guides</b></h6> 5920 <div> 5921 <button class="python-btn">Python</button> 5922 <button class="node-btn">NodeJS</button> 5923 <button class="php-btn">PHP</button> 5924 <button class="cs-btn">C#/.NET</button> 5925 <button class="other-btn">â¨MCP & Other</button> 5926</div> 5927 5928<div class="python-code"> 5929 <pre><code class="python"> 5930import requests 5931 5932# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5933url = 'https://www.alphavantage.co/query?function=COMPANY_LOGO&symbol=IBM&apikey=demo' 5934r = requests.get(url) 5935data = r.json() 5936 5937print(data) 5938 </code></pre> 5939</div> 5940 5941<div class="node-code"> 5942 <pre><code class="javascript"> 5943'use strict'; 5944var request = require('request'); 5945 5946// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5947var url = 'https://www.alphavantage.co/query?function=COMPANY_LOGO&symbol=IBM&apikey=demo'; 5948 5949request.get({ 5950 url: url, 5951 json: true, 5952 headers: {'User-Agent': 'request'} 5953 }, (err, res, data) => { 5954 if (err) { 5955 console.log('Error:', err); 5956 } else if (res.statusCode !== 200) { 5957 console.log('Status:', res.statusCode); 5958 } else { 5959 // data is successfully parsed as a JSON object: 5960 console.log(data); 5961 } 5962}); 5963 </code></pre> 5964</div> 5965 5966<div class="php-code"> 5967 <pre><code class="php"> 5968<?php 5969// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 5970$json = file_get_contents('https://www.alphavantage.co/query?function=COMPANY_LOGO&symbol=IBM&apikey=demo'); 5971 5972$data = json_decode($json,true); 5973 5974print_r($data); 5975 5976exit; 5977 </code></pre> 5978</div> 5979 5980<div class="cs-code"> 5981 <pre><code class="cs"> 5982using System; 5983using System.Collections.Generic; 5984using System.Net; 5985
5986// ------------------------------------------------------------------------- 5987// if using .NET Framework 5988// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 5989// This requires including the reference to System.Web.Extensions in your project 5990using System.Web.Script.Serialization; 5991// ------------------------------------------------------------------------- 5992// if using .Net Core 5993// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 5994using System.Text.Json; 5995// ------------------------------------------------------------------------- 5996 5997namespace ConsoleTests 5998{ 5999 internal class Program 6000 { 6001 private static void Main(string[] args) 6002 { 6003 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6004 string QUERY_URL = "https://www.alphavantage.co/query?function=COMPANY_LOGO&symbol=IBM&apikey=demo"; 6005 Uri queryUri = new Uri(QUERY_URL); 6006 6007 using (WebClient client = new WebClient()) 6008 { 6009 // ------------------------------------------------------------------------- 6010 // if using .NET Framework (System.Web.Script.Serialization) 6011 6012 JavaScriptSerializer js = new JavaScriptSerializer(); 6013 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6014 6015 // ------------------------------------------------------------------------- 6016 // if using .NET Core (System.Text.Json) 6017 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6018 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6019 6020 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6021 6022 // ------------------------------------------------------------------------- 6023 6024 // do something with the json_data 6025 } 6026 } 6027 } 6028} 6029 </code></pre> 6030</div> 6031 6032 6033<div class="other-code" style="background-color: #f9f9f9;"> 6034 <br> 6035 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6036 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6037 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6038 <br> 6039</div> 6040 <br> 6041 6042 <h4 id="etf-profile">ETF Profile & Holdings</h4> 6043 <p>This API returns key ETF metrics (e.g., net assets, expense ratio, and turnover), along with the corresponding ETF holdings / constituents with allocation by asset types and sectors.</p> 6044 <br> 6045 <h6><b>API Parameters</b></h6> 6046 <p><b>â Required: <code>function</code></b></p> 6047 <p>The function of your choice. In this case, <code>function=ETF_PROFILE</code> </p> 6048 <p><b>â Required: <code>symbol</code></b></p> 6049 <p>The symbol of the ticker of your choice. For example: <code>symbol=QQQ</code>. 6050 </p> 6051 <p><b>â Required: <code>apikey</code></b></p> 6052 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6053 <br> 6054 6055 <h6><b>Example (click for JSON output)</b></h6> 6056 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ETF_PROFILE&symbol=QQQ&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ETF_PROFILE&<b>symbol</b>=QQQ&<b>apikey</b>=demo</code></a></p> 6057 <br> 6058 6059 <h6><b>Language-specific guides</b></h6> 6060 <div> 6061 <button class="python-btn">Python</button> 6062 <button class="node-btn">NodeJS</button> 6063 <button class="php-btn">PHP</button> 6064 <button class="cs-btn">C#/.NET</button> 6065 <button class="other-btn">â¨MCP & Other</button> 6066</div> 6067 6068<div class="python-code"> 6069 <pre><code class="python"> 6070import requests 6071 6072# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6073url = 'https://www.alphavantage.co/query?function=ETF_PROFILE&symbol=QQQ&apikey=demo' 6074r = requests.get(url) 6075data = r.json() 6076 6077print(data) 6078 </code></pre> 6079</div> 6080 6081<div class="node-code"> 6082 <pre><code class="javascript"> 6083'use strict'; 6084var request = require('request'); 6085 6086// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6087var url = 'https://www.alphavantage.co/query?function=ETF_PROFILE&symbol=QQQ&apikey=demo'; 6088 6089request.get({ 6090 url: url, 6091 json: true, 6092 headers: {'User-Agent': 'request'} 6093 }, (err, res, data) => { 6094 if (err) { 6095 console.log('Error:', err); 6096 } else if (res.statusCode !== 200) { 6097 console.log('Status:', res.statusCode); 6098 } else { 6099 // data is successfully parsed as a JSON object: 6100 console.log(data); 6101 } 6102}); 6103 </code></pre> 6104</div> 6105 6106<div class="php-code"> 6107 <pre><code class="php"> 6108<?php 6109// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6110$json = file_get_contents('https://www.alphavantage.co/query?function=ETF_PROFILE&symbol=QQQ&apikey=demo'); 6111 6112$data = json_decode($json,true); 6113 6114print_r($data); 6115 6116exit; 6117 </code></pre> 6118</div> 6119 6120<div class="cs-code"> 6121 <pre><code class="cs"> 6122using System; 6123using System.Collections.Generic; 6124using System.Net; 6125
6126// ------------------------------------------------------------------------- 6127// if using .NET Framework 6128// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6129// This requires including the reference to System.Web.Extensions in your project 6130using System.Web.Script.Serialization; 6131// ------------------------------------------------------------------------- 6132// if using .Net Core 6133// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6134using System.Text.Json; 6135// ------------------------------------------------------------------------- 6136 6137namespace ConsoleTests 6138{ 6139 internal class Program 6140 { 6141 private static void Main(string[] args) 6142 { 6143 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6144 string QUERY_URL = "https://www.alphavantage.co/query?function=ETF_PROFILE&symbol=QQQ&apikey=demo"; 6145 Uri queryUri = new Uri(QUERY_URL); 6146 6147 using (WebClient client = new WebClient()) 6148 { 6149 // ------------------------------------------------------------------------- 6150 // if using .NET Framework (System.Web.Script.Serialization) 6151 6152 JavaScriptSerializer js = new JavaScriptSerializer(); 6153 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6154 6155 // ------------------------------------------------------------------------- 6156 // if using .NET Core (System.Text.Json) 6157 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6158 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6159 6160 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6161 6162 // ------------------------------------------------------------------------- 6163 6164 // do something with the json_data 6165 } 6166 } 6167 } 6168} 6169 </code></pre> 6170</div> 6171 6172 6173<div class="other-code" style="background-color: #f9f9f9;"> 6174 <br> 6175 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6176 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6177 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6178 <br> 6179</div> 6180 <br> 6181 6182 <h4 id="dividends">Corporate Action - Dividends</h4> 6183 <p>This API returns historical and future (declared) dividend distributions.</p> 6184 <br> 6185 <h6><b>API Parameters</b></h6> 6186 <p><b>â Required: <code>function</code></b></p> 6187 <p>The function of your choice. In this case, <code>function=DIVIDENDS</code> </p> 6188 <p><b>â Required: <code>symbol</code></b></p> 6189 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>.</p> 6190 <p>â Optional: <code>datatype</code></p> 6191 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the options data in JSON format; <code>csv</code> returns the data as a CSV (comma separated value) file. </p> 6192 <p><b>â Required: <code>apikey</code></b></p> 6193 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6194 <br> 6195 6196 <h6><b>Example (click for JSON output)</b></h6> 6197 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIVIDENDS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=DIVIDENDS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 6198 6199 <br> 6200 6201 <h6><b>Language-specific guides</b></h6> 6202 <div> 6203 <button class="python-btn">Python</button> 6204 <button class="node-btn">NodeJS</button> 6205 <button class="php-btn">PHP</button> 6206 <button class="cs-btn">C#/.NET</button> 6207 <button class="other-btn">â¨MCP & Other</button> 6208</div> 6209 6210<div class="python-code"> 6211 <pre><code class="python"> 6212import requests 6213 6214# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6215url = 'https://www.alphavantage.co/query?function=DIVIDENDS&symbol=IBM&apikey=demo' 6216r = requests.get(url) 6217data = r.json() 6218 6219print(data) 6220 </code></pre> 6221</div> 6222 6223<div class="node-code"> 6224 <pre><code class="javascript"> 6225'use strict'; 6226var request = require('request'); 6227 6228// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6229var url = 'https://www.alphavantage.co/query?function=DIVIDENDS&symbol=IBM&apikey=demo'; 6230 6231request.get({ 6232 url: url, 6233 json: true, 6234 headers: {'User-Agent': 'request'} 6235 }, (err, res, data) => { 6236 if (err) { 6237 console.log('Error:', err); 6238 } else if (res.statusCode !== 200) { 6239 console.log('Status:', res.statusCode); 6240 } else { 6241 // data is successfully parsed as a JSON object: 6242 console.log(data); 6243 } 6244}); 6245 </code></pre> 6246</div> 6247 6248<div class="php-code"> 6249 <pre><code class="php"> 6250<?php 6251// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6252$json = file_get_contents('https://www.alphavantage.co/query?function=DIVIDENDS&symbol=IBM&apikey=demo'); 6253 6254$data = json_decode($json,true); 6255 6256print_r($data); 6257 6258exit; 6259 </code></pre> 6260</div> 6261 6262<div class="cs-code"> 6263 <pre><code class="cs"> 6264using System; 6265using System.Collections.Generic; 6266using System.Net; 6267
6268// ------------------------------------------------------------------------- 6269// if using .NET Framework 6270// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6271// This requires including the reference to System.Web.Extensions in your project 6272using System.Web.Script.Serialization; 6273// ------------------------------------------------------------------------- 6274// if using .Net Core 6275// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6276using System.Text.Json; 6277// ------------------------------------------------------------------------- 6278 6279namespace ConsoleTests 6280{ 6281 internal class Program 6282 { 6283 private static void Main(string[] args) 6284 { 6285 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6286 string QUERY_URL = "https://www.alphavantage.co/query?function=DIVIDENDS&symbol=IBM&apikey=demo"; 6287 Uri queryUri = new Uri(QUERY_URL); 6288 6289 using (WebClient client = new WebClient()) 6290 { 6291 // ------------------------------------------------------------------------- 6292 // if using .NET Framework (System.Web.Script.Serialization) 6293 6294 JavaScriptSerializer js = new JavaScriptSerializer(); 6295 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6296 6297 // ------------------------------------------------------------------------- 6298 // if using .NET Core (System.Text.Json) 6299 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6300 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6301 6302 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6303 6304 // ------------------------------------------------------------------------- 6305 6306 // do something with the json_data 6307 } 6308 } 6309 } 6310} 6311 </code></pre> 6312</div> 6313 6314 6315<div class="other-code" style="background-color: #f9f9f9;"> 6316 <br> 6317 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6318 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6319 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6320 <br> 6321</div> 6322 <br> 6323 6324 <h4 id="splits">Corporate Action - Splits</h4> 6325 <p>This API returns historical split events.</p> 6326 <br> 6327 <h6><b>API Parameters</b></h6> 6328 <p><b>â Required: <code>function</code></b></p> 6329 <p>The function of your choice. In this case, <code>function=SPLITS</code> </p> 6330 <p><b>â Required: <code>symbol</code></b></p> 6331 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>.</p> 6332 <p>â Optional: <code>datatype</code></p> 6333 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the options data in JSON format; <code>csv</code> returns the data as a CSV (comma separated value) file. </p> 6334 <p><b>â Required: <code>apikey</code></b></p> 6335 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6336 <br> 6337 6338 <h6><b>Example (click for JSON output)</b></h6> 6339 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SPLITS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SPLITS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 6340 6341 <br> 6342 6343 <h6><b>Language-specific guides</b></h6> 6344 <div> 6345 <button class="python-btn">Python</button> 6346 <button class="node-btn">NodeJS</button> 6347 <button class="php-btn">PHP</button> 6348 <button class="cs-btn">C#/.NET</button> 6349 <button class="other-btn">â¨MCP & Other</button> 6350</div> 6351 6352<div class="python-code"> 6353 <pre><code class="python"> 6354import requests 6355 6356# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6357url = 'https://www.alphavantage.co/query?function=SPLITS&symbol=IBM&apikey=demo' 6358r = requests.get(url) 6359data = r.json() 6360 6361print(data) 6362 </code></pre> 6363</div> 6364 6365<div class="node-code"> 6366 <pre><code class="javascript"> 6367'use strict'; 6368var request = require('request'); 6369 6370// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6371var url = 'https://www.alphavantage.co/query?function=SPLITS&symbol=IBM&apikey=demo'; 6372 6373request.get({ 6374 url: url, 6375 json: true, 6376 headers: {'User-Agent': 'request'} 6377 }, (err, res, data) => { 6378 if (err) { 6379 console.log('Error:', err); 6380 } else if (res.statusCode !== 200) { 6381 console.log('Status:', res.statusCode); 6382 } else { 6383 // data is successfully parsed as a JSON object: 6384 console.log(data); 6385 } 6386}); 6387 </code></pre> 6388</div> 6389 6390<div class="php-code"> 6391 <pre><code class="php"> 6392<?php 6393// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6394$json = file_get_contents('https://www.alphavantage.co/query?function=SPLITS&symbol=IBM&apikey=demo'); 6395 6396$data = json_decode($json,true); 6397 6398print_r($data); 6399 6400exit; 6401 </code></pre> 6402</div> 6403 6404<div class="cs-code"> 6405 <pre><code class="cs"> 6406using System; 6407using System.Collections.Generic; 6408using System.Net; 6409
6410// ------------------------------------------------------------------------- 6411// if using .NET Framework 6412// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6413// This requires including the reference to System.Web.Extensions in your project 6414using System.Web.Script.Serialization; 6415// ------------------------------------------------------------------------- 6416// if using .Net Core 6417// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6418using System.Text.Json; 6419// ------------------------------------------------------------------------- 6420 6421namespace ConsoleTests 6422{ 6423 internal class Program 6424 { 6425 private static void Main(string[] args) 6426 { 6427 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6428 string QUERY_URL = "https://www.alphavantage.co/query?function=SPLITS&symbol=IBM&apikey=demo"; 6429 Uri queryUri = new Uri(QUERY_URL); 6430 6431 using (WebClient client = new WebClient()) 6432 { 6433 // ------------------------------------------------------------------------- 6434 // if using .NET Framework (System.Web.Script.Serialization) 6435 6436 JavaScriptSerializer js = new JavaScriptSerializer(); 6437 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6438 6439 // ------------------------------------------------------------------------- 6440 // if using .NET Core (System.Text.Json) 6441 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6442 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6443 6444 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6445 6446 // ------------------------------------------------------------------------- 6447 6448 // do something with the json_data 6449 } 6450 } 6451 } 6452} 6453 </code></pre> 6454</div> 6455 6456 6457<div class="other-code" style="background-color: #f9f9f9;"> 6458 <br> 6459 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6460 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6461 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6462 <br> 6463</div> 6464 <br> 6465 6466 <h4 id="income-statement">INCOME_STATEMENT</h4> 6467 <p>This API returns the annual and quarterly income statements for the company of interest, with normalized fields <a href="https://documentation.alphavantage.co/FundamentalDataDocs/index.html" target="_blank">mapped to GAAP and IFRS taxonomies</a> of the SEC. Data is generally refreshed on the same day a company reports its latest earnings and financials.</p> 6468 <br> 6469 <h6><b>API Parameters</b></h6> 6470 <p><b>â Required: <code>function</code></b></p> 6471 <p>The function of your choice. In this case, <code>function=INCOME_STATEMENT</code> </p> 6472 <p><b>â Required: <code>symbol</code></b></p> 6473 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 6474 </p> 6475 <p><b>â Required: <code>apikey</code></b></p> 6476 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6477 <br> 6478 6479 <h6><b>Example - annual & quarterly income statements for IBM (click for JSON output)</b></h6> 6480 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=INCOME_STATEMENT&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 6481 <br> 6482 6483 6484 <h6><b>Language-specific guides</b></h6> 6485 <div> 6486 <button class="python-btn">Python</button> 6487 <button class="node-btn">NodeJS</button> 6488 <button class="php-btn">PHP</button> 6489 <button class="cs-btn">C#/.NET</button> 6490 <button class="other-btn">â¨MCP & Other</button> 6491</div> 6492 6493<div class="python-code"> 6494 <pre><code class="python"> 6495import requests 6496 6497# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6498url = 'https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo' 6499r = requests.get(url) 6500data = r.json() 6501 6502print(data) 6503 </code></pre> 6504</div> 6505 6506<div class="node-code"> 6507 <pre><code class="javascript"> 6508'use strict'; 6509var request = require('request'); 6510 6511// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6512var url = 'https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo'; 6513 6514request.get({ 6515 url: url, 6516 json: true, 6517 headers: {'User-Agent': 'request'} 6518 }, (err, res, data) => { 6519 if (err) { 6520 console.log('Error:', err); 6521 } else if (res.statusCode !== 200) { 6522 console.log('Status:', res.statusCode); 6523 } else { 6524 // data is successfully parsed as a JSON object: 6525 console.log(data); 6526 } 6527}); 6528 </code></pre> 6529</div> 6530 6531<div class="php-code"> 6532 <pre><code class="php"> 6533<?php 6534// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6535$json = file_get_contents('https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo'); 6536 6537$data = json_decode($json,true); 6538 6539print_r($data); 6540 6541exit; 6542 </code></pre> 6543</div> 6544 6545<div class="cs-code"> 6546 <pre><code class="cs"> 6547using System; 6548using System.Collections.Generic; 6549using System.Net; 6550
6551// ------------------------------------------------------------------------- 6552// if using .NET Framework 6553// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6554// This requires including the reference to System.Web.Extensions in your project 6555using System.Web.Script.Serialization; 6556// ------------------------------------------------------------------------- 6557// if using .Net Core 6558// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6559using System.Text.Json; 6560// ------------------------------------------------------------------------- 6561 6562namespace ConsoleTests 6563{ 6564 internal class Program 6565 { 6566 private static void Main(string[] args) 6567 { 6568 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6569 string QUERY_URL = "https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo" 6570 Uri queryUri = new Uri(QUERY_URL); 6571 6572 using (WebClient client = new WebClient()) 6573 { 6574 // ------------------------------------------------------------------------- 6575 // if using .NET Framework (System.Web.Script.Serialization) 6576 6577 JavaScriptSerializer js = new JavaScriptSerializer(); 6578 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6579 6580 // ------------------------------------------------------------------------- 6581 // if using .NET Core (System.Text.Json) 6582 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6583 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6584 6585 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6586 6587 // ------------------------------------------------------------------------- 6588 6589 // do something with the json_data 6590 } 6591 } 6592 } 6593} 6594 </code></pre> 6595</div> 6596 6597 6598<div class="other-code" style="background-color: #f9f9f9;"> 6599 <br> 6600 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6601 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6602 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6603 <br> 6604</div> 6605 6606 <br> 6607 6608 6609 <h4 id="balance-sheet">BALANCE_SHEET</h4> 6610 <p>This API returns the annual and quarterly balance sheets for the company of interest, with normalized fields <a href="https://documentation.alphavantage.co/FundamentalDataDocs/index.html" target="_blank">mapped to GAAP and IFRS taxonomies</a> of the SEC. Data is generally refreshed on the same day a company reports its latest earnings and financials.</p> 6611 <br> 6612 <h6><b>API Parameters</b></h6> 6613 <p><b>â Required: <code>function</code></b></p> 6614 <p>The function of your choice. In this case, <code>function=BALANCE_SHEET</code> </p> 6615 <p><b>â Required: <code>symbol</code></b></p> 6616 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 6617 </p> 6618 <p><b>â Required: <code>apikey</code></b></p> 6619 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6620 <br> 6621 6622 <h6><b>Example - annual & quarterly balance sheets for IBM (click for JSON output)</b></h6> 6623 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=BALANCE_SHEET&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 6624 <br> 6625 6626 6627 <h6><b>Language-specific guides</b></h6> 6628 <div> 6629 <button class="python-btn">Python</button> 6630 <button class="node-btn">NodeJS</button> 6631 <button class="php-btn">PHP</button> 6632 <button class="cs-btn">C#/.NET</button> 6633 <button class="other-btn">â¨MCP & Other</button> 6634</div> 6635 6636<div class="python-code"> 6637 <pre><code class="python"> 6638import requests 6639 6640# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6641url = 'https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol=IBM&apikey=demo' 6642r = requests.get(url) 6643data = r.json() 6644 6645print(data) 6646 </code></pre> 6647</div> 6648 6649<div class="node-code"> 6650 <pre><code class="javascript"> 6651'use strict'; 6652var request = require('request'); 6653 6654// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6655var url = 'https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol=IBM&apikey=demo'; 6656 6657request.get({ 6658 url: url, 6659 json: true, 6660 headers: {'User-Agent': 'request'} 6661 }, (err, res, data) => { 6662 if (err) { 6663 console.log('Error:', err); 6664 } else if (res.statusCode !== 200) { 6665 console.log('Status:', res.statusCode); 6666 } else { 6667 // data is successfully parsed as a JSON object: 6668 console.log(data); 6669 } 6670}); 6671 </code></pre> 6672</div> 6673 6674<div class="php-code"> 6675 <pre><code class="php"> 6676<?php 6677// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6678$json = file_get_contents('https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol=IBM&apikey=demo'); 6679 6680$data = json_decode($json,true); 6681 6682print_r($data); 6683 6684exit; 6685 </code></pre> 6686</div> 6687 6688<div class="cs-code"> 6689 <pre><code class="cs"> 6690using System; 6691using System.Collections.Generic; 6692using System.Net; 6693
6694// ------------------------------------------------------------------------- 6695// if using .NET Framework 6696// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6697// This requires including the reference to System.Web.Extensions in your project 6698using System.Web.Script.Serialization; 6699// ------------------------------------------------------------------------- 6700// if using .Net Core 6701// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6702using System.Text.Json; 6703// ------------------------------------------------------------------------- 6704 6705namespace ConsoleTests 6706{ 6707 internal class Program 6708 { 6709 private static void Main(string[] args) 6710 { 6711 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6712 string QUERY_URL = "https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol=IBM&apikey=demo" 6713 Uri queryUri = new Uri(QUERY_URL); 6714 6715 using (WebClient client = new WebClient()) 6716 { 6717 // ------------------------------------------------------------------------- 6718 // if using .NET Framework (System.Web.Script.Serialization) 6719 6720 JavaScriptSerializer js = new JavaScriptSerializer(); 6721 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6722 6723 // ------------------------------------------------------------------------- 6724 // if using .NET Core (System.Text.Json) 6725 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6726 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6727 6728 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6729 6730 // ------------------------------------------------------------------------- 6731 6732 // do something with the json_data 6733 } 6734 } 6735 } 6736} 6737 </code></pre> 6738</div> 6739 6740 6741<div class="other-code" style="background-color: #f9f9f9;"> 6742 <br> 6743 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6744 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6745 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6746 <br> 6747</div> 6748 6749 <br> 6750 6751 6752 <h4 id="cash-flow">CASH_FLOW</h4> 6753 <p>This API returns the annual and quarterly cash flow for the company of interest, with normalized fields <a href="https://documentation.alphavantage.co/FundamentalDataDocs/index.html" target="_blank">mapped to GAAP and IFRS taxonomies</a> of the SEC. Data is generally refreshed on the same day a company reports its latest earnings and financials.</p> 6754 <br> 6755 <h6><b>API Parameters</b></h6> 6756 <p><b>â Required: <code>function</code></b></p> 6757 <p>The function of your choice. In this case, <code>function=CASH_FLOW</code> </p> 6758 <p><b>â Required: <code>symbol</code></b></p> 6759 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 6760 </p> 6761 <p><b>â Required: <code>apikey</code></b></p> 6762 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6763 <br> 6764 6765 <h6><b>Example - annual & quarterly cash flows for IBM (click for JSON output)</b></h6> 6766 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CASH_FLOW&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CASH_FLOW&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 6767 <br> 6768 6769 6770 <h6><b>Language-specific guides</b></h6> 6771 <div> 6772 <button class="python-btn">Python</button> 6773 <button class="node-btn">NodeJS</button> 6774 <button class="php-btn">PHP</button> 6775 <button class="cs-btn">C#/.NET</button> 6776 <button class="other-btn">â¨MCP & Other</button> 6777</div> 6778 6779<div class="python-code"> 6780 <pre><code class="python"> 6781import requests 6782 6783# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6784url = 'https://www.alphavantage.co/query?function=CASH_FLOW&symbol=IBM&apikey=demo' 6785r = requests.get(url) 6786data = r.json() 6787 6788print(data) 6789 </code></pre> 6790</div> 6791 6792<div class="node-code"> 6793 <pre><code class="javascript"> 6794'use strict'; 6795var request = require('request'); 6796 6797// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6798var url = 'https://www.alphavantage.co/query?function=CASH_FLOW&symbol=IBM&apikey=demo'; 6799 6800request.get({ 6801 url: url, 6802 json: true, 6803 headers: {'User-Agent': 'request'} 6804 }, (err, res, data) => { 6805 if (err) { 6806 console.log('Error:', err); 6807 } else if (res.statusCode !== 200) { 6808 console.log('Status:', res.statusCode); 6809 } else { 6810 // data is successfully parsed as a JSON object: 6811 console.log(data); 6812 } 6813}); 6814 </code></pre> 6815</div> 6816 6817<div class="php-code"> 6818 <pre><code class="php"> 6819<?php 6820// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6821$json = file_get_contents('https://www.alphavantage.co/query?function=CASH_FLOW&symbol=IBM&apikey=demo'); 6822 6823$data = json_decode($json,true); 6824 6825print_r($data); 6826 6827exit; 6828 </code></pre> 6829</div> 6830 6831<div class="cs-code"> 6832 <pre><code class="cs"> 6833using System; 6834using System.Collections.Generic; 6835using System.Net; 6836
6837// ------------------------------------------------------------------------- 6838// if using .NET Framework 6839// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6840// This requires including the reference to System.Web.Extensions in your project 6841using System.Web.Script.Serialization; 6842// ------------------------------------------------------------------------- 6843// if using .Net Core 6844// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6845using System.Text.Json; 6846// ------------------------------------------------------------------------- 6847 6848namespace ConsoleTests 6849{ 6850 internal class Program 6851 { 6852 private static void Main(string[] args) 6853 { 6854 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6855 string QUERY_URL = "https://www.alphavantage.co/query?function=CASH_FLOW&symbol=IBM&apikey=demo" 6856 Uri queryUri = new Uri(QUERY_URL); 6857 6858 using (WebClient client = new WebClient()) 6859 { 6860 // ------------------------------------------------------------------------- 6861 // if using .NET Framework (System.Web.Script.Serialization) 6862 6863 JavaScriptSerializer js = new JavaScriptSerializer(); 6864 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 6865 6866 // ------------------------------------------------------------------------- 6867 // if using .NET Core (System.Text.Json) 6868 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 6869 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 6870 6871 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 6872 6873 // ------------------------------------------------------------------------- 6874 6875 // do something with the json_data 6876 } 6877 } 6878 } 6879} 6880 </code></pre> 6881</div> 6882 6883 6884<div class="other-code" style="background-color: #f9f9f9;"> 6885 <br> 6886 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 6887 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 6888 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 6889 <br> 6890</div> 6891 6892 <br> 6893 6894 <h4 id="shares-outstanding">SHARES_OUTSTANDING</h4> 6895 <p>This API returns the quarterly numbers of shares outstanding for the company of interest, with both diluted and basic shares outstanding values returned. Data is generally refreshed on the same day a company reports its latest earnings and financials.</p> 6896 <br> 6897 <h6><b>API Parameters</b></h6> 6898 <p><b>â Required: <code>function</code></b></p> 6899 <p>The function of your choice. In this case, <code>function=SHARES_OUTSTANDING</code> </p> 6900 <p><b>â Required: <code>symbol</code></b></p> 6901 <p>The symbol of the ticker of your choice. For example: <code>symbol=MSFT</code>.</p> 6902 <p>â Optional: <code>datatype</code></p> 6903 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the options data in JSON format; <code>csv</code> returns the data as a CSV (comma separated value) file. </p> 6904 <p><b>â Required: <code>apikey</code></b></p> 6905 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 6906 <br> 6907 6908 <h6><b>Example (click for JSON output)</b></h6> 6909 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SHARES_OUTSTANDING&symbol=MSFT&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SHARES_OUTSTANDING&<b>symbol</b>=MSFT&<b>apikey</b>=demo</code></a></p> 6910 <br> 6911 6912 6913 <h6><b>Language-specific guides</b></h6> 6914 <div> 6915 <button class="python-btn">Python</button> 6916 <button class="node-btn">NodeJS</button> 6917 <button class="php-btn">PHP</button> 6918 <button class="cs-btn">C#/.NET</button> 6919 <button class="other-btn">â¨MCP & Other</button> 6920</div> 6921 6922<div class="python-code"> 6923 <pre><code class="python"> 6924import requests 6925 6926# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6927url = 'https://www.alphavantage.co/query?function=SHARES_OUTSTANDING&symbol=MSFT&apikey=demo' 6928r = requests.get(url) 6929data = r.json() 6930 6931print(data) 6932 </code></pre> 6933</div> 6934 6935<div class="node-code"> 6936 <pre><code class="javascript"> 6937'use strict'; 6938var request = require('request'); 6939 6940// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6941var url = 'https://www.alphavantage.co/query?function=SHARES_OUTSTANDING&symbol=MSFT&apikey=demo'; 6942 6943request.get({ 6944 url: url, 6945 json: true, 6946 headers: {'User-Agent': 'request'} 6947 }, (err, res, data) => { 6948 if (err) { 6949 console.log('Error:', err); 6950 } else if (res.statusCode !== 200) { 6951 console.log('Status:', res.statusCode); 6952 } else { 6953 // data is successfully parsed as a JSON object: 6954 console.log(data); 6955 } 6956}); 6957 </code></pre> 6958</div> 6959 6960<div class="php-code"> 6961 <pre><code class="php"> 6962<?php 6963// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6964$json = file_get_contents('https://www.alphavantage.co/query?function=SHARES_OUTSTANDING&symbol=MSFT&apikey=demo'); 6965 6966$data = json_decode($json,true); 6967 6968print_r($data); 6969 6970exit; 6971 </code></pre> 6972</div> 6973 6974<div class="cs-code"> 6975 <pre><code class="cs"> 6976using System; 6977using System.Collections.Generic; 6978using System.Net; 6979
6980// ------------------------------------------------------------------------- 6981// if using .NET Framework 6982// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 6983// This requires including the reference to System.Web.Extensions in your project 6984using System.Web.Script.Serialization; 6985// ------------------------------------------------------------------------- 6986// if using .Net Core 6987// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 6988using System.Text.Json; 6989// ------------------------------------------------------------------------- 6990 6991namespace ConsoleTests 6992{ 6993 internal class Program 6994 { 6995 private static void Main(string[] args) 6996 { 6997 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 6998 string QUERY_URL = "https://www.alphavantage.co/query?function=SHARES_OUTSTANDING&symbol=MSFT&apikey=demo"; 6999 Uri queryUri = new Uri(QUERY_URL); 7000 7001 using (WebClient client = new WebClient()) 7002 { 7003 // ------------------------------------------------------------------------- 7004 // if using .NET Framework (System.Web.Script.Serialization) 7005 7006 JavaScriptSerializer js = new JavaScriptSerializer(); 7007 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 7008 7009 // ------------------------------------------------------------------------- 7010 // if using .NET Core (System.Text.Json) 7011 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 7012 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 7013 7014 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 7015 7016 // ------------------------------------------------------------------------- 7017 7018 // do something with the json_data 7019 } 7020 } 7021 } 7022} 7023 </code></pre> 7024</div> 7025 7026 7027<div class="other-code" style="background-color: #f9f9f9;"> 7028 <br> 7029 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7030 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7031 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7032 <br> 7033</div> 7034 7035 <br> 7036 7037 <h4 id="earnings">Earnings History</h4> 7038 <p>This API returns the annual and quarterly earnings (EPS) for the company of interest. Quarterly data also includes analyst estimates and surprise metrics. </p> 7039 <br> 7040 <h6><b>API Parameters</b></h6> 7041 <p><b>â Required: <code>function</code></b></p> 7042 <p>The function of your choice. In this case, <code>function=EARNINGS</code> </p> 7043 <p><b>â Required: <code>symbol</code></b></p> 7044 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 7045 </p> 7046 <p><b>â Required: <code>apikey</code></b></p> 7047 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7048 <br> 7049 7050 <h6><b>Examples (click for JSON output)</b></h6> 7051 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EARNINGS&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EARNINGS&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 7052 <br> 7053 7054 <h6><b>Language-specific guides</b></h6> 7055 <div> 7056 <button class="python-btn">Python</button> 7057 <button class="node-btn">NodeJS</button> 7058 <button class="php-btn">PHP</button> 7059 <button class="cs-btn">C#/.NET</button> 7060 <button class="other-btn">â¨MCP & Other</button> 7061</div> 7062 7063<div class="python-code"> 7064 <pre><code class="python"> 7065import requests 7066 7067# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7068url = 'https://www.alphavantage.co/query?function=EARNINGS&symbol=IBM&apikey=demo' 7069r = requests.get(url) 7070data = r.json() 7071 7072print(data) 7073 </code></pre> 7074</div> 7075 7076<div class="node-code"> 7077 <pre><code class="javascript"> 7078'use strict'; 7079var request = require('request'); 7080 7081// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7082var url = 'https://www.alphavantage.co/query?function=EARNINGS&symbol=IBM&apikey=demo'; 7083 7084request.get({ 7085 url: url, 7086 json: true, 7087 headers: {'User-Agent': 'request'} 7088 }, (err, res, data) => { 7089 if (err) { 7090 console.log('Error:', err); 7091 } else if (res.statusCode !== 200) { 7092 console.log('Status:', res.statusCode); 7093 } else { 7094 // data is successfully parsed as a JSON object: 7095 console.log(data); 7096 } 7097}); 7098 </code></pre> 7099</div> 7100 7101<div class="php-code"> 7102 <pre><code class="php"> 7103<?php 7104// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7105$json = file_get_contents('https://www.alphavantage.co/query?function=EARNINGS&symbol=IBM&apikey=demo'); 7106 7107$data = json_decode($json,true); 7108 7109print_r($data); 7110 7111exit; 7112 </code></pre> 7113</div> 7114 7115<div class="cs-code"> 7116 <pre><code class="cs"> 7117using System; 7118using System.Collections.Generic; 7119using System.Net; 7120
7121// ------------------------------------------------------------------------- 7122// if using .NET Framework 7123// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 7124// This requires including the reference to System.Web.Extensions in your project 7125using System.Web.Script.Serialization; 7126// ------------------------------------------------------------------------- 7127// if using .Net Core 7128// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 7129using System.Text.Json; 7130// ------------------------------------------------------------------------- 7131 7132namespace ConsoleTests 7133{ 7134 internal class Program 7135 { 7136 private static void Main(string[] args) 7137 { 7138 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7139 string QUERY_URL = "https://www.alphavantage.co/query?function=EARNINGS&symbol=IBM&apikey=demo" 7140 Uri queryUri = new Uri(QUERY_URL); 7141 7142 using (WebClient client = new WebClient()) 7143 { 7144 // ------------------------------------------------------------------------- 7145 // if using .NET Framework (System.Web.Script.Serialization) 7146 7147 JavaScriptSerializer js = new JavaScriptSerializer(); 7148 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 7149 7150 // ------------------------------------------------------------------------- 7151 // if using .NET Core (System.Text.Json) 7152 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 7153 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 7154 7155 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 7156 7157 // ------------------------------------------------------------------------- 7158 7159 // do something with the json_data 7160 } 7161 } 7162 } 7163} 7164 </code></pre> 7165</div> 7166 7167 7168<div class="other-code" style="background-color: #f9f9f9;"> 7169 <br> 7170 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7171 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7172 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7173 <br> 7174</div> 7175 <br> 7176 7177 <h4 id="earnings-estimates">Earnings Estimates <span class="popular-label">Trending</span></h4> 7178 <p>This API returns the annual and quarterly EPS and revenue estimates for the company of interest, along with analyst count and revision history.</p> 7179 <br> 7180 <h6><b>API Parameters</b></h6> 7181 <p><b>â Required: <code>function</code></b></p> 7182 <p>The function of your choice. In this case, <code>function=EARNINGS_ESTIMATES</code> </p> 7183 <p><b>â Required: <code>symbol</code></b></p> 7184 <p>The symbol of the ticker of your choice. For example: <code>symbol=IBM</code>. 7185 </p> 7186 <p><b>â Required: <code>apikey</code></b></p> 7187 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7188 <br> 7189 7190 <h6><b>Examples (click for JSON output)</b></h6> 7191 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EARNINGS_ESTIMATES&symbol=IBM&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EARNINGS_ESTIMATES&<b>symbol</b>=IBM&<b>apikey</b>=demo</code></a></p> 7192 <br> 7193 7194 <h6><b>Language-specific guides</b></h6> 7195 <div> 7196 <button class="python-btn">Python</button> 7197 <button class="node-btn">NodeJS</button> 7198 <button class="php-btn">PHP</button> 7199 <button class="cs-btn">C#/.NET</button> 7200 <button class="other-btn">â¨MCP & Other</button> 7201</div> 7202 7203<div class="python-code"> 7204 <pre><code class="python"> 7205import requests 7206 7207# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7208url = 'https://www.alphavantage.co/query?function=EARNINGS_ESTIMATES&symbol=IBM&apikey=demo' 7209r = requests.get(url) 7210data = r.json() 7211 7212print(data) 7213 </code></pre> 7214</div> 7215 7216<div class="node-code"> 7217 <pre><code class="javascript"> 7218'use strict'; 7219var request = require('request'); 7220 7221// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7222var url = 'https://www.alphavantage.co/query?function=EARNINGS_ESTIMATES&symbol=IBM&apikey=demo'; 7223 7224request.get({ 7225 url: url, 7226 json: true, 7227 headers: {'User-Agent': 'request'} 7228 }, (err, res, data) => { 7229 if (err) { 7230 console.log('Error:', err); 7231 } else if (res.statusCode !== 200) { 7232 console.log('Status:', res.statusCode); 7233 } else { 7234 // data is successfully parsed as a JSON object: 7235 console.log(data); 7236 } 7237}); 7238 </code></pre> 7239</div> 7240 7241<div class="php-code"> 7242 <pre><code class="php"> 7243<?php 7244// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7245$json = file_get_contents('https://www.alphavantage.co/query?function=EARNINGS_ESTIMATES&symbol=IBM&apikey=demo'); 7246 7247$data = json_decode($json,true); 7248 7249print_r($data); 7250 7251exit; 7252 </code></pre> 7253</div> 7254 7255<div class="cs-code"> 7256 <pre><code class="cs"> 7257using System; 7258using System.Collections.Generic; 7259using System.Net; 7260
7261// ------------------------------------------------------------------------- 7262// if using .NET Framework 7263// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 7264// This requires including the reference to System.Web.Extensions in your project 7265using System.Web.Script.Serialization; 7266// ------------------------------------------------------------------------- 7267// if using .Net Core 7268// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 7269using System.Text.Json; 7270// ------------------------------------------------------------------------- 7271 7272namespace ConsoleTests 7273{ 7274 internal class Program 7275 { 7276 private static void Main(string[] args) 7277 { 7278 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7279 string QUERY_URL = "https://www.alphavantage.co/query?function=EARNINGS_ESTIMATES&symbol=IBM&apikey=demo"; 7280 Uri queryUri = new Uri(QUERY_URL); 7281 7282 using (WebClient client = new WebClient()) 7283 { 7284 // ------------------------------------------------------------------------- 7285 // if using .NET Framework (System.Web.Script.Serialization) 7286 7287 JavaScriptSerializer js = new JavaScriptSerializer(); 7288 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 7289 7290 // ------------------------------------------------------------------------- 7291 // if using .NET Core (System.Text.Json) 7292 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 7293 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 7294 7295 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 7296 7297 // ------------------------------------------------------------------------- 7298 7299 // do something with the json_data 7300 } 7301 } 7302 } 7303} 7304 </code></pre> 7305</div> 7306 7307 7308<div class="other-code" style="background-color: #f9f9f9;"> 7309 <br> 7310 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7311 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7312 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7313 <br> 7314</div> 7315 <br> 7316 7317 <h4 id="listing-status">Listing & Delisting Status <span class="utility-label">Utility</span></h4> 7318 <br> 7319 <p>This API returns a list of active or delisted US stocks and ETFs, either as of the latest trading day or at a specific time in history. The endpoint is positioned to facilitate equity research on asset lifecycle and survivorship.</p> 7320 <br> 7321 <h6><b>API Parameters</b></h6> 7322 <p><b>â Required: <code>function</code></b></p> 7323 <p>The API function of your choice. In this case, <code>function=LISTING_STATUS</code> </p> 7324 <p>â Optional: <code>date</code></p> 7325 <p>If no date is set, the API endpoint will return a list of active or delisted symbols as of the latest trading day. If a date is set, the API endpoint will "travel back" in time and return a list of active or delisted symbols on that particular date in history. Any <u>YYYY-MM-DD</u> date later than 2010-01-01 is supported. For example, <code>date=2013-08-03</code></p> 7326 <p>â Optional: <code>state</code></p> 7327 <p>By default, <code>state=active</code> and the API will return a list of actively traded stocks and ETFs. Set <code>state=delisted</code> to query a list of delisted assets. </p> 7328 <p><b>â Required: <code>apikey</code></b></p> 7329 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7330 <br> 7331 7332 <h6><b>Examples</b></h6> 7333 <p>To ensure optimal API response time, this endpoint uses the CSV format which is more memory-efficient than JSON.</p> 7334 Querying all active stocks and ETFs as of the latest trading day: 7335 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=LISTING_STATUS&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=LISTING_STATUS&<b>apikey</b>=demo</code></a></p> 7336 Querying all delisted stocks and ETFs as of 2014-07-10: 7337 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=LISTING_STATUS&date=2014-07-10&state=delisted&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=LISTING_STATUS&<b>date</b>=2014-07-10&<b>state</b>=delisted&<b>apikey</b>=demo</code></a></p> 7338 <br> 7339 7340 <h6><b>Language-specific guides</b></h6> 7341 <div> 7342 <button class="python-btn">Python</button> 7343 <button class="node-btn">NodeJS</button> 7344 <button class="php-btn">PHP</button> 7345 <button class="cs-btn">C#/.NET</button> 7346 <button class="other-btn">â¨MCP & Other</button> 7347</div> 7348 7349<div class="python-code"> 7350 <pre><code class="python"> 7351import csv 7352import requests 7353 7354# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7355CSV_URL = 'https://www.alphavantage.co/query?function=LISTING_STATUS&apikey=demo' 7356 7357with requests.Session() as s: 7358 download = s.get(CSV_URL) 7359 decoded_content = download.content.decode('utf-8') 7360 cr = csv.reader(decoded_content.splitlines(), delimiter=',') 7361 my_list = list(cr) 7362 for row in my_list: 7363 print(row) 7364 </code></pre> 7365</div> 7366 7367<div class="node-code"> 7368 <pre><code class="javascript">
7369const {StringStream} = require("scramjet"); 7370const request = require("request"); 7371 7372// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7373request.get("https://www.alphavantage.co/query?function=LISTING_STATUS&apikey=demo") 7374 .pipe(new StringStream()) 7375 .CSVParse() // parse CSV output into row objects 7376 .consume(object => console.log("Row:", object)) 7377 .then(() => console.log("success")); 7378 </code></pre> 7379</div> 7380 7381<div class="php-code"> 7382 <pre><code class="php"> 7383<?php 7384 7385// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7386$data = file_get_contents("https://www.alphavantage.co/query?function=LISTING_STATUS&apikey=demo"); 7387$rows = explode("\n",$data); 7388$s = array(); 7389foreach($rows as $row) { 7390 $s[] = str_getcsv($row); 7391 print_r($s); 7392} 7393 </code></pre> 7394</div> 7395 7396<div class="cs-code"> 7397 <pre><code class="cs"> 7398using CsvHelper; 7399using System; 7400using System.Globalization; 7401using System.IO; 7402using System.Net; 7403 7404// Compatible with any recent version of .NET Framework or .Net Core 7405 7406namespace ConsoleTests 7407{ 7408 internal class Program 7409 { 7410 private static void Main(string[] args) 7411 { 7412 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7413 string QUERY_URL = "https://www.alphavantage.co/query?function=LISTING_STATUS&apikey=demo"; 7414 7415 Uri queryUri = new Uri(QUERY_URL); 7416 7417 // print the output 7418 // This example uses the fine nuget package CsvHelper (https://www.nuget.org/packages/CsvHelper/) 7419 7420 CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); ; 7421 using (WebClient client = new WebClient()) 7422 { 7423 using (MemoryStream stream = new MemoryStream(client.DownloadDataTaskAsync(queryUri).Result)) 7424 { 7425 stream.Position = 0; 7426 7427 using (StreamReader reader = new StreamReader(stream)) 7428 { 7429 using (CsvReader csv = new CsvReader(reader, CultureInfo.InvariantCulture)) 7430 { 7431 csv.Read(); 7432 csv.ReadHeader(); 7433 Console.WriteLine(string.Join("\t", csv.HeaderRecord)); 7434 while (csv.Read()) 7435 { 7436 Console.WriteLine(string.Join("\t", csv.Parser.Record)); 7437 } 7438 } 7439 } 7440 } 7441 } 7442 } 7443 } 7444} 7445 </code></pre> 7446</div> 7447 7448 7449<div class="other-code" style="background-color: #f9f9f9;"> 7450 <br> 7451 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7452 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7453 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7454 <br> 7455</div> 7456 <br> 7457 7458 <h4 id="earnings-calendar">Earnings Calendar</h4> 7459 <br> 7460 <p>This API returns a list of company earnings expected in the next 3, 6, or 12 months.</p> 7461 <br> 7462 <h6><b>API Parameters</b></h6> 7463 <p><b>â Required: <code>function</code></b></p> 7464 <p>The API function of your choice. In this case, <code>function=EARNINGS_CALENDAR</code> </p> 7465 <p>â Optional: <code>symbol</code></p> 7466 <p>By default, no symbol will be set for this API. When no symbol is set, the API endpoint will return the full list of company earnings scheduled. If a symbol is set, the API endpoint will return the expected earnings for that specific symbol. For example, <code>symbol=IBM</code></p> 7467 <p>â Optional: <code>horizon</code></p> 7468 <p>
7468By default, <code>horizon=3month</code> and the API will return a list of expected company earnings in the next 3 months. You may set <code>horizon=6month</code> or <code>horizon=12month</code> to query the earnings scheduled for the next 6 months or 12 months, respectively. </p> 7469 <p><b>â Required: <code>apikey</code></b></p> 7470 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7471 <br> 7472 7473 <h6><b>Examples</b></h6> 7474 <p>To ensure optimal API response time, this endpoint uses the CSV format which is more memory-efficient than JSON.</p> 7475 Querying all the company earnings expected in the next 3 months: 7476 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EARNINGS_CALENDAR&horizon=3month&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EARNINGS_CALENDAR&<b>horizon</b>=3month&<b>apikey</b>=demo</code></a></p> 7477 Querying all the earnings events for IBM in the next 12 months: 7478 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EARNINGS_CALENDAR&symbol=IBM&horizon=12month&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EARNINGS_CALENDAR&<b>symbol</b>=IBM&<b>horizon</b>=12month&<b>apikey</b>=demo</code></a></p> 7479 <br> 7480 7481 <h6><b>Language-specific guides</b></h6> 7482 <div> 7483 <button class="python-btn">Python</button> 7484 <button class="node-btn">NodeJS</button> 7485 <button class="php-btn">PHP</button> 7486 <button class="cs-btn">C#/.NET</button> 7487 <button class="other-btn">â¨MCP & Other</button> 7488</div> 7489 7490<div class="python-code"> 7491 <pre><code class="python"> 7492import csv 7493import requests 7494 7495# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7496CSV_URL = 'https://www.alphavantage.co/query?function=EARNINGS_CALENDAR&horizon=3month&apikey=demo' 7497 7498with requests.Session() as s: 7499 download = s.get(CSV_URL) 7500 decoded_content = download.content.decode('utf-8') 7501 cr = csv.reader(decoded_content.splitlines(), delimiter=',') 7502 my_list = list(cr) 7503 for row in my_list: 7504 print(row) 7505 </code></pre> 7506</div> 7507 7508<div class="node-code"> 7509 <pre><code class="javascript">
7510const {StringStream} = require("scramjet"); 7511const request = require("request"); 7512 7513// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7514request.get("https://www.alphavantage.co/query?function=EARNINGS_CALENDAR&horizon=3month&apikey=demo") 7515 .pipe(new StringStream()) 7516 .CSVParse() // parse CSV output into row objects 7517 .consume(object => console.log("Row:", object)) 7518 .then(() => console.log("success")); 7519 </code></pre> 7520</div> 7521 7522<div class="php-code"> 7523 <pre><code class="php"> 7524<?php 7525 7526// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7527$data = file_get_contents("https://www.alphavantage.co/query?function=EARNINGS_CALENDAR&horizon=3month&apikey=demo"); 7528$rows = explode("\n",$data); 7529$s = array(); 7530foreach($rows as $row) { 7531 $s[] = str_getcsv($row); 7532 print_r($s); 7533} 7534 </code></pre> 7535</div> 7536 7537<div class="cs-code"> 7538 <pre><code class="cs"> 7539using CsvHelper; 7540using System; 7541using System.Globalization; 7542using System.IO; 7543using System.Net; 7544 7545// Compatible with any recent version of .NET Framework or .Net Core 7546 7547namespace ConsoleTests 7548{ 7549 internal class Program 7550 { 7551 private static void Main(string[] args) 7552 { 7553 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7554 string QUERY_URL = "https://www.alphavantage.co/query?function=EARNINGS_CALENDAR&horizon=3month&apikey=demo"; 7555 7556 Uri queryUri = new Uri(QUERY_URL); 7557 7558 // print the output 7559 // This example uses the fine nuget package CsvHelper (https://www.nuget.org/packages/CsvHelper/) 7560 7561 CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); ; 7562 using (WebClient client = new WebClient()) 7563 { 7564 using (MemoryStream stream = new MemoryStream(client.DownloadDataTaskAsync(queryUri).Result)) 7565 { 7566 stream.Position = 0; 7567 7568 using (StreamReader reader = new StreamReader(stream)) 7569 { 7570 using (CsvReader csv = new CsvReader(reader, CultureInfo.InvariantCulture)) 7571 { 7572 csv.Read(); 7573 csv.ReadHeader(); 7574 Console.WriteLine(string.Join("\t", csv.HeaderRecord)); 7575 while (csv.Read()) 7576 { 7577 Console.WriteLine(string.Join("\t", csv.Parser.Record)); 7578 } 7579 } 7580 } 7581 } 7582 } 7583 } 7584 } 7585} 7586 </code></pre> 7587</div> 7588 7589 7590<div class="other-code" style="background-color: #f9f9f9;"> 7591 <br> 7592 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7593 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7594 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7595 <br> 7596</div> 7597 <br> 7598 7599 7600 <h4 id="ipo-calendar">IPO Calendar</h4> 7601 <br> 7602 <p>This API returns a list of IPOs expected in the next 3 months.</p> 7603 <br> 7604 <h6><b>API Parameters</b></h6> 7605 <p><b>â Required: <code>function</code></b></p> 7606 <p>The API function of your choice. In this case, <code>function=IPO_CALENDAR</code> </p> 7607 <p><b>â Required: <code>apikey</code></b></p> 7608 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7609 <br> 7610 7611 <h6><b>Examples</b></h6> 7612 <p>To ensure optimal API response time, this endpoint uses the CSV format which is more memory-efficient than JSON.</p> 7613 Querying all the IPOs expected in the next 3 months: 7614 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=IPO_CALENDAR&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=IPO_CALENDAR&<b>apikey</b>=demo</code></a></p> 7615 <br> 7616 7617 <h6><b>Language-specific guides</b></h6> 7618 <div> 7619 <button class="python-btn">Python</button> 7620 <button class="node-btn">NodeJS</button> 7621 <button class="php-btn">PHP</button> 7622 <button class="cs-btn">C#/.NET</button> 7623 <button class="other-btn">â¨MCP & Other</button> 7624</div> 7625 7626<div class="python-code"> 7627 <pre><code class="python"> 7628import csv 7629import requests 7630 7631# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7632CSV_URL = 'https://www.alphavantage.co/query?function=IPO_CALENDAR&apikey=demo' 7633 7634with requests.Session() as s: 7635 download = s.get(CSV_URL) 7636 decoded_content = download.content.decode('utf-8') 7637 cr = csv.reader(decoded_content.splitlines(), delimiter=',') 7638 my_list = list(cr) 7639 for row in my_list: 7640 print(row) 7641 </code></pre> 7642</div> 7643 7644<div class="node-code"> 7645 <pre><code class="javascript">
7646const {StringStream} = require("scramjet"); 7647const request = require("request"); 7648 7649// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7650request.get("https://www.alphavantage.co/query?function=IPO_CALENDAR&apikey=demo") 7651 .pipe(new StringStream()) 7652 .CSVParse() // parse CSV output into row objects 7653 .consume(object => console.log("Row:", object)) 7654 .then(() => console.log("success")); 7655 </code></pre> 7656</div> 7657 7658<div class="php-code"> 7659 <pre><code class="php"> 7660<?php 7661 7662// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7663$data = file_get_contents("https://www.alphavantage.co/query?function=IPO_CALENDAR&apikey=demo"); 7664$rows = explode("\n",$data); 7665$s = array(); 7666foreach($rows as $row) { 7667 $s[] = str_getcsv($row); 7668 print_r($s); 7669} 7670 </code></pre> 7671</div> 7672 7673<div class="cs-code"> 7674 <pre><code class="cs"> 7675using CsvHelper; 7676using System; 7677using System.Globalization; 7678using System.IO; 7679using System.Net; 7680 7681// Compatible with any recent version of .NET Framework or .Net Core 7682 7683namespace ConsoleTests 7684{ 7685 internal class Program 7686 { 7687 private static void Main(string[] args) 7688 { 7689 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7690 string QUERY_URL = "https://www.alphavantage.co/query?function=IPO_CALENDAR&apikey=demo"; 7691 7692 Uri queryUri = new Uri(QUERY_URL); 7693 7694 // print the output 7695 // This example uses the fine nuget package CsvHelper (https://www.nuget.org/packages/CsvHelper/) 7696 7697 CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); ; 7698 using (WebClient client = new WebClient()) 7699 { 7700 using (MemoryStream stream = new MemoryStream(client.DownloadDataTaskAsync(queryUri).Result)) 7701 { 7702 stream.Position = 0; 7703 7704 using (StreamReader reader = new StreamReader(stream)) 7705 { 7706 using (CsvReader csv = new CsvReader(reader, CultureInfo.InvariantCulture)) 7707 { 7708 csv.Read(); 7709 csv.ReadHeader(); 7710 Console.WriteLine(string.Join("\t", csv.HeaderRecord)); 7711 while (csv.Read()) 7712 { 7713 Console.WriteLine(string.Join("\t", csv.Parser.Record)); 7714 } 7715 } 7716 } 7717 } 7718 } 7719 } 7720 } 7721} 7722 </code></pre> 7723</div> 7724 7725 7726<div class="other-code" style="background-color: #f9f9f9;"> 7727 <br> 7728 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7729 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7730 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7731 <br> 7732</div> 7733 <br> 7734 7735 7736 </section> 7737 7738 <section> 7739 <h2 id="fx">Foreign Exchange Rates (FX)</h2> 7740 <p>APIs under this section provide a wide range of data feed for realtime and historical forex (FX) rates. </p> 7741 <br> 7742 <h4 id="currency-exchange">CURRENCY_EXCHANGE_RATE <span class="popular-label">Trending</span></h4> 7743 <br> 7744 <p>This API returns the realtime exchange rate for a pair of fiat currencies (e.g., USD, EUR, CNY, etc.).</p> 7745 <div class="premium-msg"> 7746 <p>ð¡ Tip: Looking for gold and silver spot prices? Please check out our dedicated <a href="#gold-silver-spot">gold & silver APIs</a> in the Commodities section.</p> 7747 </div> 7748 <br> 7749 <h6><b>API Parameters</b></h6> 7750 <p><b>â Required: <code>function</code></b></p> 7751 <p>The function of your choice. In this case, <code>function=CURRENCY_EXCHANGE_RATE</code> </p> 7752 <p><b>â Required: <code>from_currency</code></b></p> 7753 <p>The currency you would like to get the exchange rate for. It can either be a <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> physical currency</a> or <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency</a>. For example: <code>from_currency=USD</code> or <code>from_currency=BTC</code>.</p> 7754 <p><b>â Required: <code>to_currency</code></b></p> 7755 <p>The destination currency for the exchange rate. It can either be a <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> physical currency</a> or <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency</a>. For example: <code>to_currency=USD</code> or <code>to_currency=BTC</code>.</p> 7756 <p><b>â Required: <code>apikey</code></b></p> 7757 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7758 <br> 7759 7760 <h6><b>Examples (click for JSON output)</b></h6> 7761 US Dollar to Japanese Yen: 7762 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo</code></a></p> 7763 Bitcoin to Euro: 7764 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo</code></a></p> 7765 <br> 7766 7767 7768 <h6><b>Language-specific guides</b></h6> 7769 <div> 7770 <button class="python-btn">Python</button> 7771 <button class="node-btn">NodeJS</button> 7772 <button class="php-btn">PHP</button> 7773 <button class="cs-btn">C#/.NET</button> 7774 <button class="other-btn">â¨MCP & Other</button> 7775</div> 7776 7777<div class="python-code"> 7778 <pre><code class="python"> 7779import requests 7780 7781# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7782url = 'https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo' 7783r = requests.get(url) 7784data = r.json() 7785 7786print(data) 7787 </code></pre> 7788</div> 7789 7790<div class="node-code"> 7791 <pre><code class="javascript"> 7792'use strict'; 7793var request = require('request'); 7794 7795// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7796var url = 'https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo'; 7797 7798request.get({ 7799 url: url, 7800 json: true, 7801 headers: {'User-Agent': 'request'} 7802 }, (err, res, data) => { 7803 if (err) { 7804 console.log('Error:', err); 7805 } else if (res.statusCode !== 200) { 7806 console.log('Status:', res.statusCode); 7807 } else { 7808 // data is successfully parsed as a JSON object: 7809 console.log(data); 7810 } 7811}); 7812 </code></pre> 7813</div> 7814 7815<div class="php-code"> 7816 <pre><code class="php"> 7817<?php 7818// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7819$json = file_get_contents('https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo'); 7820 7821$data = json_decode($json,true); 7822 7823print_r($data); 7824 7825exit; 7826 </code></pre> 7827</div> 7828 7829<div class="cs-code"> 7830 <pre><code class="cs"> 7831using System; 7832using System.Collections.Generic; 7833using System.Net; 7834
7835// ------------------------------------------------------------------------- 7836// if using .NET Framework 7837// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 7838// This requires including the reference to System.Web.Extensions in your project 7839using System.Web.Script.Serialization; 7840// ------------------------------------------------------------------------- 7841// if using .Net Core 7842// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 7843using System.Text.Json; 7844// ------------------------------------------------------------------------- 7845 7846namespace ConsoleTests 7847{ 7848 internal class Program 7849 { 7850 private static void Main(string[] args) 7851 { 7852 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7853 string QUERY_URL = "https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo" 7854 Uri queryUri = new Uri(QUERY_URL); 7855 7856 using (WebClient client = new WebClient()) 7857 { 7858 // ------------------------------------------------------------------------- 7859 // if using .NET Framework (System.Web.Script.Serialization) 7860 7861 JavaScriptSerializer js = new JavaScriptSerializer(); 7862 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 7863 7864 // ------------------------------------------------------------------------- 7865 // if using .NET Core (System.Text.Json) 7866 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 7867 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 7868 7869 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 7870 7871 // ------------------------------------------------------------------------- 7872 7873 // do something with the json_data 7874 } 7875 } 7876 } 7877} 7878 </code></pre> 7879</div> 7880 7881 7882<div class="other-code" style="background-color: #f9f9f9;"> 7883 <br> 7884 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 7885 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 7886 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 7887 <br> 7888</div> 7889 7890 <br> 7891 <h4 id="fx-intraday">FX_INTRADAY <span class="premium-label">Premium</span> <span class="popular-label">Trending</span></h4> 7892 <br> 7893 <p>This API returns intraday time series (timestamp, open, high, low, close) of the FX currency pair specified, updated realtime. </p> 7894 <br> 7895 <h6><b>API Parameters</b></h6> 7896 <p><b>â Required: <code>function</code></b></p> 7897 <p>The time series of your choice. In this case, <code>function=FX_INTRADAY</code> </p> 7898 <p><b>â Required: <code>from_symbol</code></b></p> 7899 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>from_symbol=EUR</code> </p> 7900 <p><b>â Required: <code>to_symbol</code></b></p> 7901 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>to_symbol=USD</code> </p> 7902 <p><b>â Required: <code>interval</code></b></p> 7903 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code></p> 7904 <p>â Optional: <code>outputsize</code></p> 7905 <p>
7905By default, <code>outputsize=compact</code>. Strings <code>compact</code> and <code>full</code> are accepted with the following specifications: <code>compact</code> returns only the latest 100 data points in the intraday time series; <code>full</code> returns the full-length intraday time series. The "compact" option is recommended if you would like to reduce the data size of each API call. </p> 7906 <p>â Optional: <code>datatype</code></p> 7907 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 7908 <p><b>â Required: <code>apikey</code></b></p> 7909 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 7910 <br> 7911 7912 <h6><b>Examples (click for JSON output)</b></h6> 7913 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_INTRADAY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>interval</b>=5min&<b>apikey</b>=demo</code></a></p> 7914 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_INTRADAY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>interval</b>=5min&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 7915 Downloadable CSV file: 7916 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_INTRADAY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>interval</b>=5min&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 7917 <br> 7918 7919 <div class="premium-msg"> 7920 <p>ð¡ Tip: this is a premium API function. Subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to instantly unlock all premium APIs.</p> 7921 </div> 7922 <br> 7923 7924 <h6><b>Language-specific guides</b></h6> 7925 <div> 7926 <button class="python-btn">Python</button> 7927 <button class="node-btn">NodeJS</button> 7928 <button class="php-btn">PHP</button> 7929 <button class="cs-btn">C#/.NET</button> 7930 <button class="other-btn">â¨MCP & Other</button> 7931</div> 7932 7933<div class="python-code"> 7934 <pre><code class="python"> 7935import requests 7936 7937# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7938url = 'https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo' 7939r = requests.get(url) 7940data = r.json() 7941 7942print(data) 7943 </code></pre> 7944</div> 7945 7946<div class="node-code"> 7947 <pre><code class="javascript"> 7948'use strict'; 7949var request = require('request'); 7950 7951// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7952var url = 'https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo'; 7953 7954request.get({ 7955 url: url, 7956 json: true, 7957 headers: {'User-Agent': 'request'} 7958 }, (err, res, data) => { 7959 if (err) { 7960 console.log('Error:', err); 7961 } else if (res.statusCode !== 200) { 7962 console.log('Status:', res.statusCode); 7963 } else { 7964 // data is successfully parsed as a JSON object: 7965 console.log(data); 7966 } 7967}); 7968 </code></pre> 7969</div> 7970 7971<div class="php-code"> 7972 <pre><code class="php"> 7973<?php 7974// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 7975$json = file_get_contents('https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo'); 7976 7977$data = json_decode($json,true); 7978 7979print_r($data); 7980 7981exit; 7982 </code></pre> 7983</div> 7984 7985<div class="cs-code"> 7986 <pre><code class="cs"> 7987using System; 7988using System.Collections.Generic; 7989using System.Net; 7990
7991// ------------------------------------------------------------------------- 7992// if using .NET Framework 7993// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 7994// This requires including the reference to System.Web.Extensions in your project 7995using System.Web.Script.Serialization; 7996// ------------------------------------------------------------------------- 7997// if using .Net Core 7998// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 7999using System.Text.Json; 8000// ------------------------------------------------------------------------- 8001 8002namespace ConsoleTests 8003{ 8004 internal class Program 8005 { 8006 private static void Main(string[] args) 8007 { 8008 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8009 string QUERY_URL = "https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo" 8010 Uri queryUri = new Uri(QUERY_URL); 8011 8012 using (WebClient client = new WebClient()) 8013 { 8014 // ------------------------------------------------------------------------- 8015 // if using .NET Framework (System.Web.Script.Serialization) 8016 8017 JavaScriptSerializer js = new JavaScriptSerializer(); 8018 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8019 8020 // ------------------------------------------------------------------------- 8021 // if using .NET Core (System.Text.Json) 8022 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8023 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8024 8025 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8026 8027 // ------------------------------------------------------------------------- 8028 8029 // do something with the json_data 8030 } 8031 } 8032 } 8033} 8034 </code></pre> 8035</div> 8036 8037 8038<div class="other-code" style="background-color: #f9f9f9;"> 8039 <br> 8040 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8041 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8042 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8043 <br> 8044</div> 8045 8046 <br> 8047 8048 <h4 id="fx-daily">FX_DAILY </h4> 8049 <br> 8050 <p>This API returns the daily time series (timestamp, open, high, low, close) of the FX currency pair specified, updated realtime. </p> 8051 <br> 8052 <h6><b>API Parameters</b></h6> 8053 <p><b>â Required: <code>function</code></b></p> 8054 <p>The time series of your choice. In this case, <code>function=FX_DAILY</code> </p> 8055 <p><b>â Required: <code>from_symbol</code></b></p> 8056 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>from_symbol=EUR</code> </p> 8057 <p><b>â Required: <code>to_symbol</code></b></p> 8058 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>to_symbol=USD</code> </p> 8059 <p>â Optional: <code>outputsize</code></p> 8060 <p>By default, <code>outputsize=compact</code>. Strings <code>compact</code> and <code>full</code> are accepted with the following specifications: <code>compact</code> returns only the latest 100 data points in the daily time series; <code>full</code> returns the full-length daily time series. The "compact" option is recommended if you would like to reduce the data size of each API call. </p> 8061 <p>â Optional: <code>datatype</code></p> 8062 <p>
8062By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 8063 <p><b>â Required: <code>apikey</code></b></p> 8064 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8065 <br> 8066 8067 <h6><b>Examples (click for JSON output)</b></h6> 8068 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_DAILY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>apikey</b>=demo</code></a></p> 8069 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_DAILY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 8070 Downloadable CSV file: 8071 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_DAILY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 8072 <br> 8073 8074 <h6><b>Language-specific guides</b></h6> 8075 <div> 8076 <button class="python-btn">Python</button> 8077 <button class="node-btn">NodeJS</button> 8078 <button class="php-btn">PHP</button> 8079 <button class="cs-btn">C#/.NET</button> 8080 <button class="other-btn">â¨MCP & Other</button> 8081</div> 8082 8083<div class="python-code"> 8084 <pre><code class="python"> 8085import requests 8086 8087# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8088url = 'https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=demo' 8089r = requests.get(url) 8090data = r.json() 8091 8092print(data) 8093 </code></pre> 8094</div> 8095 8096<div class="node-code"> 8097 <pre><code class="javascript"> 8098'use strict'; 8099var request = require('request'); 8100 8101// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8102var url = 'https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=demo'; 8103 8104request.get({ 8105 url: url, 8106 json: true, 8107 headers: {'User-Agent': 'request'} 8108 }, (err, res, data) => { 8109 if (err) { 8110 console.log('Error:', err); 8111 } else if (res.statusCode !== 200) { 8112 console.log('Status:', res.statusCode); 8113 } else { 8114 // data is successfully parsed as a JSON object: 8115 console.log(data); 8116 } 8117}); 8118 </code></pre> 8119</div> 8120 8121<div class="php-code"> 8122 <pre><code class="php"> 8123<?php 8124// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8125$json = file_get_contents('https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=demo'); 8126 8127$data = json_decode($json,true); 8128 8129print_r($data); 8130 8131exit; 8132 </code></pre> 8133</div> 8134 8135<div class="cs-code"> 8136 <pre><code class="cs"> 8137using System; 8138using System.Collections.Generic; 8139using System.Net; 8140 8141// ------------------------------------------------------------------------- 8142// if using .NET Framework 8143// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 8144// This requires including the reference to System.Web.Extensions in your project 8145using System.Web.Script.Serialization; 8146// ------------------------------------------------------------------------- 8147// if using .Net Core 8148// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 8149using System.Text.Json; 8150// ------------------------------------------------------------------------- 8151 8152namespace ConsoleTests 8153{
8154 internal class Program 8155 { 8156 private static void Main(string[] args) 8157 { 8158 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8159 string QUERY_URL = "https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=demo" 8160 Uri queryUri = new Uri(QUERY_URL); 8161 8162 using (WebClient client = new WebClient()) 8163 { 8164 // ------------------------------------------------------------------------- 8165 // if using .NET Framework (System.Web.Script.Serialization) 8166 8167 JavaScriptSerializer js = new JavaScriptSerializer(); 8168 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8169 8170 // ------------------------------------------------------------------------- 8171 // if using .NET Core (System.Text.Json) 8172 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8173 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8174 8175 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8176 8177 // ------------------------------------------------------------------------- 8178 8179 // do something with the json_data 8180 } 8181 } 8182 } 8183} 8184 </code></pre> 8185</div> 8186 8187 8188<div class="other-code" style="background-color: #f9f9f9;"> 8189 <br> 8190 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8191 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8192 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8193 <br> 8194</div> 8195 8196 <br> 8197 8198 <h4 id="fx-weekly">FX_WEEKLY</h4> 8199 <br> 8200 <p>This API returns the weekly time series (timestamp, open, high, low, close) of the FX currency pair specified, updated realtime. </p> 8201 <p>The latest data point is the price information for the week (or partial week) containing the current trading day, updated realtime. </p> 8202 <br> 8203 <h6><b>API Parameters</b></h6> 8204 <p><b>â Required: <code>function</code></b></p> 8205 <p>The time series of your choice. In this case, <code>function=FX_WEEKLY</code> </p> 8206 <p><b>â Required: <code>from_symbol</code></b></p> 8207 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>from_symbol=EUR</code> </p> 8208 <p><b>â Required: <code>to_symbol</code></b></p> 8209 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>to_symbol=USD</code> </p> 8210 <p>â Optional: <code>datatype</code></p> 8211 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the weekly time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 8212 <p><b>â Required: <code>apikey</code></b></p> 8213 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8214 <br> 8215 8216 <h6><b>Examples (click for JSON output)</b></h6> 8217 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_WEEKLY&from_symbol=EUR&to_symbol=USD&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_WEEKLY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>apikey</b>=demo</code></a></p> 8218 Downloadable CSV file: 8219 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_WEEKLY&from_symbol=EUR&to_symbol=USD&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_WEEKLY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 8220 <br> 8221 8222 <h6><b>Language-specific guides</b></h6> 8223 <div> 8224 <button class="python-btn">Python</button> 8225 <button class="node-btn">NodeJS</button> 8226 <button class="php-btn">PHP</button> 8227 <button class="cs-btn">C#/.NET</button> 8228 <button class="other-btn">â¨MCP & Other</button> 8229</div> 8230 8231<div class="python-code"> 8232 <pre><code class="python"> 8233import requests 8234 8235# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8236url = 'https://www.alphavantage.co/query?function=FX_WEEKLY&from_symbol=EUR&to_symbol=USD&apikey=demo' 8237r = requests.get(url) 8238data = r.json() 8239 8240print(data) 8241 </code></pre> 8242</div> 8243 8244<div class="node-code"> 8245 <pre><code class="javascript"> 8246'use strict'; 8247var request = require('request'); 8248 8249// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8250var url = 'https://www.alphavantage.co/query?function=FX_WEEKLY&from_symbol=EUR&to_symbol=USD&apikey=demo'; 8251 8252request.get({ 8253 url: url, 8254 json: true, 8255 headers: {'User-Agent': 'request'} 8256 }, (err, res, data) => { 8257 if (err) { 8258 console.log('Error:', err); 8259 } else if (res.statusCode !== 200) { 8260 console.log('Status:', res.statusCode); 8261 } else { 8262 // data is successfully parsed as a JSON object: 8263 console.log(data); 8264 } 8265}); 8266 </code></pre> 8267</div> 8268 8269<div class="php-code"> 8270 <pre><code class="php"> 8271<?php 8272// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8273$json = file_get_contents('https://www.alphavantage.co/query?function=FX_WEEKLY&from_symbol=EUR&to_symbol=USD&apikey=demo'); 8274 8275$data = json_decode($json,true); 8276 8277print_r($data); 8278 8279exit; 8280 </code></pre> 8281</div> 8282 8283<div class="cs-code"> 8284 <pre><code class="cs"> 8285using System; 8286using System.Collections.Generic; 8287using System.Net; 8288
8289// ------------------------------------------------------------------------- 8290// if using .NET Framework 8291// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 8292// This requires including the reference to System.Web.Extensions in your project 8293using System.Web.Script.Serialization; 8294// ------------------------------------------------------------------------- 8295// if using .Net Core 8296// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 8297using System.Text.Json; 8298// ------------------------------------------------------------------------- 8299 8300namespace ConsoleTests 8301{ 8302 internal class Program 8303 { 8304 private static void Main(string[] args) 8305 { 8306 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8307 string QUERY_URL = "https://www.alphavantage.co/query?function=FX_WEEKLY&from_symbol=EUR&to_symbol=USD&apikey=demo" 8308 Uri queryUri = new Uri(QUERY_URL); 8309 8310 using (WebClient client = new WebClient()) 8311 { 8312 // ------------------------------------------------------------------------- 8313 // if using .NET Framework (System.Web.Script.Serialization) 8314 8315 JavaScriptSerializer js = new JavaScriptSerializer(); 8316 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8317 8318 // ------------------------------------------------------------------------- 8319 // if using .NET Core (System.Text.Json) 8320 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8321 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8322 8323 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8324 8325 // ------------------------------------------------------------------------- 8326 8327 // do something with the json_data 8328 } 8329 } 8330 } 8331} 8332 </code></pre> 8333</div> 8334 8335 8336<div class="other-code" style="background-color: #f9f9f9;"> 8337 <br> 8338 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8339 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8340 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8341 <br> 8342</div> 8343 8344 <br> 8345 8346 <h4 id="fx-monthly">FX_MONTHLY</h4> 8347 <br> 8348 <p>This API returns the monthly time series (timestamp, open, high, low, close) of the FX currency pair specified, updated realtime. </p> 8349 <p>The latest data point is the prices information for the month (or partial month) containing the current trading day, updated realtime. </p> 8350 <br> 8351 <h6><b>API Parameters</b></h6> 8352 <p><b>â Required: <code>function</code></b></p> 8353 <p>The time series of your choice. In this case, <code>function=FX_MONTHLY</code> </p> 8354 <p><b>â Required: <code>from_symbol</code></b></p> 8355 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>from_symbol=EUR</code> </p> 8356 <p><b>â Required: <code>to_symbol</code></b></p> 8357 <p>A three-letter symbol from the <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> forex currency list</a>. For example: <code>to_symbol=USD</code> </p> 8358 <p>â Optional: <code>datatype</code></p> 8359 <p>
8359By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the monthly time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 8360 <p><b>â Required: <code>apikey</code></b></p> 8361 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8362 <br> 8363 8364 <h6><b>Examples (click for JSON output)</b></h6> 8365 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_MONTHLY&from_symbol=EUR&to_symbol=USD&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_MONTHLY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>apikey</b>=demo</code></a></p> 8366 Downloadable CSV file: 8367 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FX_MONTHLY&from_symbol=EUR&to_symbol=USD&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=FX_MONTHLY&<b>from_symbol</b>=EUR&<b>to_symbol</b>=USD&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 8368 <br> 8369 8370 <h6><b>Language-specific guides</b></h6> 8371 <div> 8372 <button class="python-btn">Python</button> 8373 <button class="node-btn">NodeJS</button> 8374 <button class="php-btn">PHP</button> 8375 <button class="cs-btn">C#/.NET</button> 8376 <button class="other-btn">â¨MCP & Other</button> 8377</div> 8378 8379<div class="python-code"> 8380 <pre><code class="python"> 8381import requests 8382 8383# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8384url = 'https://www.alphavantage.co/query?function=FX_MONTHLY&from_symbol=EUR&to_symbol=USD&apikey=demo' 8385r = requests.get(url) 8386data = r.json() 8387 8388print(data) 8389 </code></pre> 8390</div> 8391 8392<div class="node-code"> 8393 <pre><code class="javascript"> 8394'use strict'; 8395var request = require('request'); 8396 8397// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8398var url = 'https://www.alphavantage.co/query?function=FX_MONTHLY&from_symbol=EUR&to_symbol=USD&apikey=demo'; 8399 8400request.get({ 8401 url: url, 8402 json: true, 8403 headers: {'User-Agent': 'request'} 8404 }, (err, res, data) => { 8405 if (err) { 8406 console.log('Error:', err); 8407 } else if (res.statusCode !== 200) { 8408 console.log('Status:', res.statusCode); 8409 } else { 8410 // data is successfully parsed as a JSON object: 8411 console.log(data); 8412 } 8413}); 8414 </code></pre> 8415</div> 8416 8417<div class="php-code"> 8418 <pre><code class="php"> 8419<?php 8420// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8421$json = file_get_contents('https://www.alphavantage.co/query?function=FX_MONTHLY&from_symbol=EUR&to_symbol=USD&apikey=demo'); 8422 8423$data = json_decode($json,true); 8424 8425print_r($data); 8426 8427exit; 8428 </code></pre> 8429</div> 8430 8431<div class="cs-code"> 8432 <pre><code class="cs"> 8433using System; 8434using System.Collections.Generic; 8435using System.Net; 8436 8437// ------------------------------------------------------------------------- 8438// if using .NET Framework 8439// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 8440// This requires including the reference to System.Web.Extensions in your project 8441using System.Web.Script.Serialization; 8442// ------------------------------------------------------------------------- 8443// if using .Net Core 8444// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 8445using System.Text.Json; 8446// ------------------------------------------------------------------------- 8447 8448namespace ConsoleTests 8449{ 8450 internal class Program 8451 { 8452 private static void Main(string[] args) 8453 { 8454 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8455 string QUERY_URL = "https://www.alphavantage.co/query?function=FX_MONTHLY&from_symbol=EUR&to_symbol=USD&apikey=demo" 8456 Uri queryUri = new Uri(QUERY_URL); 8457 8458 using (WebClient client = new WebClient()) 8459 { 8460 // ------------------------------------------------------------------------- 8461 // if using .NET Framework (System.Web.Script.Serialization) 8462 8463 JavaScriptSerializer js = new JavaScriptSerializer(); 8464 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8465 8466 // ------------------------------------------------------------------------- 8467 // if using .NET Core (System.Text.Json) 8468 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8469 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8470 8471 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8472 8473 // ------------------------------------------------------------------------- 8474
8475 // do something with the json_data 8476 } 8477 } 8478 } 8479} 8480 </code></pre> 8481</div> 8482 8483 8484<div class="other-code" style="background-color: #f9f9f9;"> 8485 <br> 8486 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8487 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8488 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8489 <br> 8490</div> 8491 8492 <br> 8493 8494 </section> 8495 8496 <section> 8497 <h2 id="digital-currency">Digital & Crypto Currencies</h2> 8498 <p>APIs under this section provide a wide range of data feed for digital and crypto currencies such as Bitcoin. </p> 8499 <br> 8500 <h4 id="crypto-exchange">CURRENCY_EXCHANGE_RATE <span class="popular-label">Trending</span></h4> 8501 <br> 8502 <p>This API returns the realtime exchange rate for any pair of cryptocurrency (e.g., Bitcoin) or physical currency (e.g., USD). </p> 8503 <br> 8504 <h6><b>API Parameters</b></h6> 8505 <p><b>â Required: <code>function</code></b></p> 8506 <p>The function of your choice. In this case, <code>function=CURRENCY_EXCHANGE_RATE</code> </p> 8507 <p><b>â Required: <code>from_currency</code></b></p> 8508 <p>The currency you would like to get the exchange rate for. It can either be a <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> physical currency</a> or <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency</a>. For example: <code>from_currency=USD</code> or <code>from_currency=BTC</code>.</p> 8509 <p><b>â Required: <code>to_currency</code></b></p> 8510 <p>The destination currency for the exchange rate. It can either be a <a href="https://www.alphavantage.co/physical_currency_list/" target="_blank"> physical currency</a> or <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency</a>. For example: <code>to_currency=USD</code> or <code>to_currency=BTC</code>.</p> 8511 <p><b>â Required: <code>apikey</code></b></p> 8512 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8513 <br> 8514 8515 <h6><b>Examples (click for JSON output)</b></h6> 8516 Bitcoin to Euro: 8517 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo</code></a></p> 8518 US Dollar to Japanese Yen: 8519 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=USD&to_currency=JPY&apikey=demo</code></a></p> 8520 <br> 8521 8522 8523 <h6><b>Language-specific guides</b></h6> 8524 <div> 8525 <button class="python-btn">Python</button> 8526 <button class="node-btn">NodeJS</button> 8527 <button class="php-btn">PHP</button> 8528 <button class="cs-btn">C#/.NET</button> 8529 <button class="other-btn">â¨MCP & Other</button> 8530</div> 8531 8532<div class="python-code"> 8533 <pre><code class="python"> 8534import requests 8535 8536# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8537url = 'https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo' 8538r = requests.get(url) 8539data = r.json() 8540 8541print(data) 8542 </code></pre> 8543</div> 8544 8545<div class="node-code"> 8546 <pre><code class="javascript"> 8547'use strict'; 8548var request = require('request'); 8549 8550// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8551var url = 'https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo'; 8552 8553request.get({ 8554 url: url, 8555 json: true, 8556 headers: {'User-Agent': 'request'} 8557 }, (err, res, data) => { 8558 if (err) { 8559 console.log('Error:', err); 8560 } else if (res.statusCode !== 200) { 8561 console.log('Status:', res.statusCode); 8562 } else { 8563 // data is successfully parsed as a JSON object: 8564 console.log(data); 8565 } 8566}); 8567 </code></pre> 8568</div> 8569 8570<div class="php-code"> 8571 <pre><code class="php"> 8572<?php 8573// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8574$json = file_get_contents('https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo'); 8575 8576$data = json_decode($json,true); 8577 8578print_r($data); 8579 8580exit; 8581 </code></pre> 8582</div> 8583 8584<div class="cs-code"> 8585 <pre><code class="cs"> 8586using System; 8587using System.Collections.Generic; 8588using System.Net; 8589
8590// ------------------------------------------------------------------------- 8591// if using .NET Framework 8592// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 8593// This requires including the reference to System.Web.Extensions in your project 8594using System.Web.Script.Serialization; 8595// ------------------------------------------------------------------------- 8596// if using .Net Core 8597// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 8598using System.Text.Json; 8599// ------------------------------------------------------------------------- 8600 8601namespace ConsoleTests 8602{ 8603 internal class Program 8604 { 8605 private static void Main(string[] args) 8606 { 8607 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8608 string QUERY_URL = "https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=BTC&to_currency=EUR&apikey=demo" 8609 Uri queryUri = new Uri(QUERY_URL); 8610 8611 using (WebClient client = new WebClient()) 8612 { 8613 // ------------------------------------------------------------------------- 8614 // if using .NET Framework (System.Web.Script.Serialization) 8615 8616 JavaScriptSerializer js = new JavaScriptSerializer(); 8617 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8618 8619 // ------------------------------------------------------------------------- 8620 // if using .NET Core (System.Text.Json) 8621 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8622 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8623 8624 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8625 8626 // ------------------------------------------------------------------------- 8627 8628 // do something with the json_data 8629 } 8630 } 8631 } 8632} 8633 </code></pre> 8634</div> 8635 8636 8637<div class="other-code" style="background-color: #f9f9f9;"> 8638 <br> 8639 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8640 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8641 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8642 <br> 8643</div> 8644 8645 <br> 8646 8647 <h4 id="crypto-intraday">CRYPTO_INTRADAY <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 8648 <br> 8649 <p>This API returns intraday time series (timestamp, open, high, low, close, volume) of the cryptocurrency specified, updated realtime. </p> 8650 <br> 8651 <h6><b>API Parameters</b></h6> 8652 <p><b>â Required: <code>function</code></b></p> 8653 <p>The time series of your choice. In this case, <code>function=CRYPTO_INTRADAY</code> </p> 8654 <p><b>â Required: <code>symbol</code></b></p> 8655 <p>The cryptocurrency of your choice. It can be any of the "from" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>symbol=ETH</code>.</p> 8656 <p><b>â Required: <code>market</code></b></p> 8657 <p>The exchange market of your choice. It can be any of the "to" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>market=USD</code>.</p> 8658 <p><b>â Required: <code>interval</code></b></p> 8659 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code></p> 8660 <p>â Optional: <code>outputsize</code></p> 8661 <p>
8661By default, <code>outputsize=compact</code>. Strings <code>compact</code> and <code>full</code> are accepted with the following specifications: <code>compact</code> returns only the latest 100 data points in the intraday time series; <code>full</code> returns the full-length intraday time series. The "compact" option is recommended if you would like to reduce the data size of each API call. </p> 8662 <p>â Optional: <code>datatype</code></p> 8663 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the intraday time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 8664 <p><b>â Required: <code>apikey</code></b></p> 8665 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8666 <br> 8667 8668 <h6><b>Examples (click for JSON output)</b></h6> 8669 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CRYPTO_INTRADAY&<b>symbol</b>=ETH&<b>market</b>=USD&<b>interval</b>=5min&<b>apikey</b>=demo</code></a></p> 8670 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&outputsize=full&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CRYPTO_INTRADAY&<b>symbol</b>=ETH&<b>market</b>=USD&<b>interval</b>=5min&<b>outputsize</b>=full&<b>apikey</b>=demo</code></a></p> 8671 Downloadable CSV file: 8672 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CRYPTO_INTRADAY&<b>symbol</b>=ETH&<b>market</b>=USD&<b>interval</b>=5min&<b>apikey</b>=demo&<b>datatype</b>=csv</code></a></p> 8673 <br> 8674 8675 <div class="premium-msg"> 8676 <p>ð¡ Tip: this is a premium API function. Subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to instantly unlock all premium APIs.</p> 8677 </div> 8678 <br> 8679 8680 <h6><b>Language-specific guides</b></h6> 8681 <div> 8682 <button class="python-btn">Python</button> 8683 <button class="node-btn">NodeJS</button> 8684 <button class="php-btn">PHP</button> 8685 <button class="cs-btn">C#/.NET</button> 8686 <button class="other-btn">â¨MCP & Other</button> 8687</div> 8688 8689<div class="python-code"> 8690 <pre><code class="python"> 8691import requests 8692 8693# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8694url = 'https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo' 8695r = requests.get(url) 8696data = r.json() 8697 8698print(data) 8699 </code></pre> 8700</div> 8701 8702<div class="node-code"> 8703 <pre><code class="javascript"> 8704'use strict'; 8705var request = require('request'); 8706 8707// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8708var url = 'https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo'; 8709 8710request.get({ 8711 url: url, 8712 json: true, 8713 headers: {'User-Agent': 'request'} 8714 }, (err, res, data) => { 8715 if (err) { 8716 console.log('Error:', err); 8717 } else if (res.statusCode !== 200) { 8718 console.log('Status:', res.statusCode); 8719 } else { 8720 // data is successfully parsed as a JSON object: 8721 console.log(data); 8722 } 8723}); 8724 </code></pre> 8725</div> 8726 8727<div class="php-code"> 8728 <pre><code class="php"> 8729<?php 8730// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8731$json = file_get_contents('https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo'); 8732 8733$data = json_decode($json,true); 8734 8735print_r($data); 8736 8737exit; 8738 </code></pre> 8739</div> 8740 8741<div class="cs-code"> 8742 <pre><code class="cs"> 8743using System; 8744using System.Collections.Generic; 8745using System.Net; 8746
8747// ------------------------------------------------------------------------- 8748// if using .NET Framework 8749// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 8750// This requires including the reference to System.Web.Extensions in your project 8751using System.Web.Script.Serialization; 8752// ------------------------------------------------------------------------- 8753// if using .Net Core 8754// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 8755using System.Text.Json; 8756// ------------------------------------------------------------------------- 8757 8758namespace ConsoleTests 8759{ 8760 internal class Program 8761 { 8762 private static void Main(string[] args) 8763 { 8764 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8765 string QUERY_URL = "https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo" 8766 Uri queryUri = new Uri(QUERY_URL); 8767 8768 using (WebClient client = new WebClient()) 8769 { 8770 // ------------------------------------------------------------------------- 8771 // if using .NET Framework (System.Web.Script.Serialization) 8772 8773 JavaScriptSerializer js = new JavaScriptSerializer(); 8774 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8775 8776 // ------------------------------------------------------------------------- 8777 // if using .NET Core (System.Text.Json) 8778 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8779 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8780 8781 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8782 8783 // ------------------------------------------------------------------------- 8784 8785 // do something with the json_data 8786 } 8787 } 8788 } 8789} 8790 </code></pre> 8791</div> 8792 8793 8794<div class="other-code" style="background-color: #f9f9f9;"> 8795 <br> 8796 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8797 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8798 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8799 <br> 8800</div> 8801 8802 <br> 8803 8804 <h4 id="currency-daily">DIGITAL_CURRENCY_DAILY </h4> 8805 <br> 8806 <p>This API returns the daily historical time series for a cryptocurrency (e.g., BTC) traded on a specific market (e.g., EUR/Euro), refreshed daily at midnight (UTC). Prices and volumes are quoted in both the market-specific currency and USD. </p> 8807 <br> 8808 <h6><b>API Parameters</b></h6> 8809 <p><b>â Required: <code>function</code></b></p> 8810 <p>The time series of your choice. In this case, <code>function=DIGITAL_CURRENCY_DAILY</code> </p> 8811 <p><b>â Required: <code>symbol</code></b></p> 8812 <p>The cryptocurrency of your choice. It can be any of the "from" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>symbol=BTC</code>.</p> 8813 <p><b>â Required: <code>market</code></b></p> 8814 <p>The exchange market of your choice. It can be any of the "to" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>market=EUR</code>.</p> 8815 <p><b>â Required: <code>apikey</code></b></p> 8816 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8817 <br> 8818 8819 <h6><b>Examples (click for JSON output)</b></h6> 8820 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo</code></a></p> 8821 Downloadable CSV file: 8822 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo&datatype=csv</code></a></p> 8823 <br> 8824 8825 <h6><b>Language-specific guides</b></h6> 8826 <div> 8827 <button class="python-btn">Python</button> 8828 <button class="node-btn">NodeJS</button> 8829 <button class="php-btn">PHP</button> 8830 <button class="cs-btn">C#/.NET</button> 8831 <button class="other-btn">â¨MCP & Other</button> 8832</div> 8833 8834<div class="python-code"> 8835 <pre><code class="python"> 8836import requests 8837 8838# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8839url = 'https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo' 8840r = requests.get(url) 8841data = r.json() 8842 8843print(data) 8844 </code></pre> 8845</div> 8846 8847<div class="node-code"> 8848 <pre><code class="javascript"> 8849'use strict'; 8850var request = require('request'); 8851 8852// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8853var url = 'https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo'; 8854 8855request.get({ 8856 url: url, 8857 json: true, 8858 headers: {'User-Agent': 'request'} 8859 }, (err, res, data) => { 8860 if (err) { 8861 console.log('Error:', err); 8862 } else if (res.statusCode !== 200) { 8863 console.log('Status:', res.statusCode); 8864 } else { 8865 // data is successfully parsed as a JSON object: 8866 console.log(data); 8867 } 8868}); 8869 </code></pre> 8870</div> 8871 8872<div class="php-code"> 8873 <pre><code class="php"> 8874<?php 8875// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8876$json = file_get_contents('https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo'); 8877 8878$data = json_decode($json,true); 8879 8880print_r($data); 8881 8882exit; 8883 </code></pre> 8884</div> 8885 8886<div class="cs-code"> 8887 <pre><code class="cs"> 8888using System; 8889using System.Collections.Generic; 8890using System.Net; 8891
8892// ------------------------------------------------------------------------- 8893// if using .NET Framework 8894// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 8895// This requires including the reference to System.Web.Extensions in your project 8896using System.Web.Script.Serialization; 8897// ------------------------------------------------------------------------- 8898// if using .Net Core 8899// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 8900using System.Text.Json; 8901// ------------------------------------------------------------------------- 8902 8903namespace ConsoleTests 8904{ 8905 internal class Program 8906 { 8907 private static void Main(string[] args) 8908 { 8909 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8910 string QUERY_URL = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=EUR&apikey=demo" 8911 Uri queryUri = new Uri(QUERY_URL); 8912 8913 using (WebClient client = new WebClient()) 8914 { 8915 // ------------------------------------------------------------------------- 8916 // if using .NET Framework (System.Web.Script.Serialization) 8917 8918 JavaScriptSerializer js = new JavaScriptSerializer(); 8919 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 8920 8921 // ------------------------------------------------------------------------- 8922 // if using .NET Core (System.Text.Json) 8923 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 8924 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 8925 8926 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 8927 8928 // ------------------------------------------------------------------------- 8929 8930 // do something with the json_data 8931 } 8932 } 8933 } 8934} 8935 </code></pre> 8936</div> 8937 8938 8939<div class="other-code" style="background-color: #f9f9f9;"> 8940 <br> 8941 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 8942 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 8943 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 8944 <br> 8945</div> 8946 8947 <br> 8948 8949 <h4 id="currency-weekly">DIGITAL_CURRENCY_WEEKLY <span class="popular-label">Trending</span></h4> 8950 <br> 8951 <p>This API returns the weekly historical time series for a cryptocurrency (e.g., BTC) traded on a specific market (e.g., EUR/Euro), refreshed daily at midnight (UTC). Prices and volumes are quoted in both the market-specific currency and USD. </p> 8952 <br> 8953 <h6><b>API Parameters</b></h6> 8954 <p><b>â Required: <code>function</code></b></p> 8955 <p>The time series of your choice. In this case, <code>function=DIGITAL_CURRENCY_WEEKLY</code> </p> 8956 <p><b>â Required: <code>symbol</code></b></p> 8957 <p>The cryptocurrency of your choice. It can be any of the "from" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>symbol=BTC</code>.</p> 8958 <p><b>â Required: <code>market</code></b></p> 8959 <p>The exchange market of your choice. It can be any of the "to" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>market=EUR</code>.</p> 8960 <p><b>â Required: <code>apikey</code></b></p> 8961 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 8962 <br> 8963 8964 <h6><b>Examples (click for JSON output)</b></h6> 8965 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo</code></a></p> 8966 Downloadable CSV file: 8967 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo&datatype=csv</code></a></p> 8968 <br> 8969 8970 <h6><b>Language-specific guides</b></h6> 8971 <div> 8972 <button class="python-btn">Python</button> 8973 <button class="node-btn">NodeJS</button> 8974 <button class="php-btn">PHP</button> 8975 <button class="cs-btn">C#/.NET</button> 8976 <button class="other-btn">â¨MCP & Other</button> 8977</div> 8978 8979<div class="python-code"> 8980 <pre><code class="python"> 8981import requests 8982 8983# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8984url = 'https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo' 8985r = requests.get(url) 8986data = r.json() 8987 8988print(data) 8989 </code></pre> 8990</div> 8991 8992<div class="node-code"> 8993 <pre><code class="javascript"> 8994'use strict'; 8995var request = require('request'); 8996 8997// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 8998var url = 'https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo'; 8999 9000request.get({ 9001 url: url, 9002 json: true, 9003 headers: {'User-Agent': 'request'} 9004 }, (err, res, data) => { 9005 if (err) { 9006 console.log('Error:', err); 9007 } else if (res.statusCode !== 200) { 9008 console.log('Status:', res.statusCode); 9009 } else { 9010 // data is successfully parsed as a JSON object: 9011 console.log(data); 9012 } 9013}); 9014 </code></pre> 9015</div> 9016 9017<div class="php-code"> 9018 <pre><code class="php"> 9019<?php 9020// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9021$json = file_get_contents('https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo'); 9022 9023$data = json_decode($json,true); 9024 9025print_r($data); 9026 9027exit; 9028 </code></pre> 9029</div> 9030 9031<div class="cs-code"> 9032 <pre><code class="cs"> 9033using System; 9034using System.Collections.Generic; 9035using System.Net; 9036
9037// ------------------------------------------------------------------------- 9038// if using .NET Framework 9039// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9040// This requires including the reference to System.Web.Extensions in your project 9041using System.Web.Script.Serialization; 9042// ------------------------------------------------------------------------- 9043// if using .Net Core 9044// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9045using System.Text.Json; 9046// ------------------------------------------------------------------------- 9047 9048namespace ConsoleTests 9049{ 9050 internal class Program 9051 { 9052 private static void Main(string[] args) 9053 { 9054 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9055 string QUERY_URL = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=EUR&apikey=demo" 9056 Uri queryUri = new Uri(QUERY_URL); 9057 9058 using (WebClient client = new WebClient()) 9059 { 9060 // ------------------------------------------------------------------------- 9061 // if using .NET Framework (System.Web.Script.Serialization) 9062 9063 JavaScriptSerializer js = new JavaScriptSerializer(); 9064 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9065 9066 // ------------------------------------------------------------------------- 9067 // if using .NET Core (System.Text.Json) 9068 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9069 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9070 9071 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9072 9073 // ------------------------------------------------------------------------- 9074 9075 // do something with the json_data 9076 } 9077 } 9078 } 9079} 9080 </code></pre> 9081</div> 9082 9083 9084<div class="other-code" style="background-color: #f9f9f9;"> 9085 <br> 9086 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9087 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9088 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9089 <br> 9090</div> 9091 9092 <br> 9093 9094 <h4 id="currency-monthly">DIGITAL_CURRENCY_MONTHLY <span class="popular-label">Trending</span></h4> 9095 <br> 9096 <p>This API returns the monthly historical time series for a cryptocurrency (e.g., BTC) traded on a specific market (e.g., EUR/Euro), refreshed daily at midnight (UTC). Prices and volumes are quoted in both the market-specific currency and USD. </p> 9097 <br> 9098 <h6><b>API Parameters</b></h6> 9099 <p><b>â Required: <code>function</code></b></p> 9100 <p>The time series of your choice. In this case, <code>function=DIGITAL_CURRENCY_MONTHLY</code> </p> 9101 <p><b>â Required: <code>symbol</code></b></p> 9102 <p>The cryptocurrency of your choice. It can be any of the "from" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>symbol=BTC</code>.</p> 9103 <p><b>â Required: <code>market</code></b></p> 9104 <p>The exchange market of your choice. It can be any of the "to" currencies in the <a href="https://www.alphavantage.co/cryptocurrency_list/" target="_blank">cryptocurrency list</a>. For example: <code>market=EUR</code>.</p> 9105 <p><b>â Required: <code>apikey</code></b></p> 9106 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9107 <br> 9108 9109 <h6><b>Examples (click for JSON output)</b></h6> 9110 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo</code></a></p> 9111 Downloadable CSV file: 9112 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo&datatype=csv" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo&datatype=csv</code></a></p> 9113 <br> 9114 9115 <h6><b>Language-specific guides</b></h6> 9116 <div> 9117 <button class="python-btn">Python</button> 9118 <button class="node-btn">NodeJS</button> 9119 <button class="php-btn">PHP</button> 9120 <button class="cs-btn">C#/.NET</button> 9121 <button class="other-btn">â¨MCP & Other</button> 9122</div> 9123 9124<div class="python-code"> 9125 <pre><code class="python"> 9126import requests 9127 9128# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9129url = 'https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo' 9130r = requests.get(url) 9131data = r.json() 9132 9133print(data) 9134 </code></pre> 9135</div> 9136 9137<div class="node-code"> 9138 <pre><code class="javascript"> 9139'use strict'; 9140var request = require('request'); 9141 9142// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9143var url = 'https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo'; 9144 9145request.get({ 9146 url: url, 9147 json: true, 9148 headers: {'User-Agent': 'request'} 9149 }, (err, res, data) => { 9150 if (err) { 9151 console.log('Error:', err); 9152 } else if (res.statusCode !== 200) { 9153 console.log('Status:', res.statusCode); 9154 } else { 9155 // data is successfully parsed as a JSON object: 9156 console.log(data); 9157 } 9158}); 9159 </code></pre> 9160</div> 9161 9162<div class="php-code"> 9163 <pre><code class="php"> 9164<?php 9165// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9166$json = file_get_contents('https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo'); 9167 9168$data = json_decode($json,true); 9169 9170print_r($data); 9171 9172exit; 9173 </code></pre> 9174</div> 9175 9176<div class="cs-code"> 9177 <pre><code class="cs"> 9178using System; 9179using System.Collections.Generic; 9180using System.Net; 9181
9182// ------------------------------------------------------------------------- 9183// if using .NET Framework 9184// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9185// This requires including the reference to System.Web.Extensions in your project 9186using System.Web.Script.Serialization; 9187// ------------------------------------------------------------------------- 9188// if using .Net Core 9189// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9190using System.Text.Json; 9191// ------------------------------------------------------------------------- 9192 9193namespace ConsoleTests 9194{ 9195 internal class Program 9196 { 9197 private static void Main(string[] args) 9198 { 9199 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9200 string QUERY_URL = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=EUR&apikey=demo" 9201 Uri queryUri = new Uri(QUERY_URL); 9202 9203 using (WebClient client = new WebClient()) 9204 { 9205 // ------------------------------------------------------------------------- 9206 // if using .NET Framework (System.Web.Script.Serialization) 9207 9208 JavaScriptSerializer js = new JavaScriptSerializer(); 9209 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9210 9211 // ------------------------------------------------------------------------- 9212 // if using .NET Core (System.Text.Json) 9213 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9214 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9215 9216 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9217 9218 // ------------------------------------------------------------------------- 9219 9220 // do something with the json_data 9221 } 9222 } 9223 } 9224} 9225 </code></pre> 9226</div> 9227 9228 9229<div class="other-code" style="background-color: #f9f9f9;"> 9230 <br> 9231 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9232 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9233 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9234 <br> 9235</div> 9236 <br> 9237 9238 </section> 9239 9240 <section> 9241 <h2 id="commodities">Commodities</h2> 9242 <p>APIs under this section provide price data for major commodities such as gold, silver, crude oil, natural gas, copper, wheat, etc., spanning across various temporal horizons (daily, weekly, monthly, quarterly, etc.)</p> 9243 9244 <br> 9245 9246 <h4 id="gold-silver-spot">Gold & Silver Spot Prices <span class="popular-label">Trending</span></h4> 9247 <br> 9248 <p>This API returns the live spot prices of gold and silver metals.</p> 9249 <br> 9250 <h6><b>API Parameters</b></h6> 9251 <p><b>â Required: <code>function</code></b></p> 9252 <p>The function of your choice. In this case, <code>function=GOLD_SILVER_SPOT</code> </p> 9253 <p><b>â Required: <code>symbol</code></b></p> 9254 <p>For gold, strings <code>GOLD</code> and <code>XAU</code> are accepted. For silver, strings <code>SILVER</code> and <code>XAG</code> are accepted.</p> 9255 <p><b>â Required: <code>apikey</code></b></p> 9256 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9257 <br> 9258 9259 <h6><b>Examples (click for JSON output)</b></h6> 9260 <i>Silver spot price (symbol=SILVER and symbol=XAG are both accepted)</i> 9261 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=GOLD_SILVER_SPOT&symbol=SILVER&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=GOLD_SILVER_SPOT&symbol=SILVER&apikey=demo</code></a></p> 9262 <br> 9263 9264 <h6><b>Language-specific guides</b></h6> 9265 <div> 9266 <button class="python-btn">Python</button> 9267 <button class="node-btn">NodeJS</button> 9268 <button class="php-btn">PHP</button> 9269 <button class="cs-btn">C#/.NET</button> 9270 <button class="other-btn">â¨MCP & Other</button> 9271</div> 9272 9273<div class="python-code"> 9274 <pre><code class="python"> 9275import requests 9276 9277# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9278url = 'https://www.alphavantage.co/query?function=GOLD_SILVER_SPOT&symbol=SILVER&apikey=demo' 9279r = requests.get(url) 9280data = r.json() 9281 9282print(data) 9283 </code></pre> 9284</div> 9285 9286<div class="node-code"> 9287 <pre><code class="javascript"> 9288'use strict'; 9289var request = require('request'); 9290 9291// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9292var url = 'https://www.alphavantage.co/query?function=GOLD_SILVER_SPOT&symbol=SILVER&apikey=demo'; 9293 9294request.get({ 9295 url: url, 9296 json: true, 9297 headers: {'User-Agent': 'request'} 9298 }, (err, res, data) => { 9299 if (err) { 9300 console.log('Error:', err); 9301 } else if (res.statusCode !== 200) { 9302 console.log('Status:', res.statusCode); 9303 } else { 9304 // data is successfully parsed as a JSON object: 9305 console.log(data); 9306 } 9307}); 9308 </code></pre> 9309</div> 9310 9311<div class="php-code"> 9312 <pre><code class="php"> 9313<?php 9314// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9315$json = file_get_contents('https://www.alphavantage.co/query?function=GOLD_SILVER_SPOT&symbol=SILVER&apikey=demo'); 9316 9317$data = json_decode($json,true); 9318 9319print_r($data); 9320 9321exit; 9322 </code></pre> 9323</div> 9324 9325<div class="cs-code"> 9326 <pre><code class="cs"> 9327using System; 9328using System.Collections.Generic; 9329using System.Net; 9330
9331// ------------------------------------------------------------------------- 9332// if using .NET Framework 9333// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9334// This requires including the reference to System.Web.Extensions in your project 9335using System.Web.Script.Serialization; 9336// ------------------------------------------------------------------------- 9337// if using .Net Core 9338// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9339using System.Text.Json; 9340// ------------------------------------------------------------------------- 9341 9342namespace ConsoleTests 9343{ 9344 internal class Program 9345 { 9346 private static void Main(string[] args) 9347 { 9348 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9349 string QUERY_URL = "https://www.alphavantage.co/query?function=GOLD_SILVER_SPOT&symbol=SILVER&apikey=demo"; 9350 Uri queryUri = new Uri(QUERY_URL); 9351 9352 using (WebClient client = new WebClient()) 9353 { 9354 // ------------------------------------------------------------------------- 9355 // if using .NET Framework (System.Web.Script.Serialization) 9356 9357 JavaScriptSerializer js = new JavaScriptSerializer(); 9358 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9359 9360 // ------------------------------------------------------------------------- 9361 // if using .NET Core (System.Text.Json) 9362 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9363 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9364 9365 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9366 9367 // ------------------------------------------------------------------------- 9368 9369 // do something with the json_data 9370 } 9371 } 9372 } 9373} 9374 </code></pre> 9375</div> 9376 9377 9378<div class="other-code" style="background-color: #f9f9f9;"> 9379 <br> 9380 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9381 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9382 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9383 <br> 9384</div> 9385 9386 <br> 9387 9388 <br> 9389 <h4 id="gold-silver-history">Gold & Silver Historical Prices <span class="popular-label">Trending</span></h4> 9390 <br> 9391 <p>This API returns the historical gold and silver prices in daily, weekly, and monthly horizons.</p> 9392 <div class="premium-msg"> 9393 <p>ð¡ Tip: Looking for gold and silver live prices instead? Please check out our dedicated <a href="#gold-silver-spot">gold & silver spot price API</a>.</p> 9394 </div> 9395 <br> 9396 <h6><b>API Parameters</b></h6> 9397 <p><b>â Required: <code>function</code></b></p> 9398 <p>The function of your choice. In this case, <code>function=GOLD_SILVER_HISTORY</code> </p> 9399 <p><b>â Required: <code>symbol</code></b></p> 9400 <p>For gold, strings <code>GOLD</code> and <code>XAU</code> are accepted. For silver, strings <code>SILVER</code> and <code>XAG</code> are accepted.</p> 9401 <p><b>â Required: <code>interval</code></b></p> 9402 <p>Strings <code>daily</code>, <code>weekly</code> and <code>monthly</code> are accepted</p> 9403 <p><b>â Required: <code>apikey</code></b></p> 9404 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9405 <br> 9406 9407 <h6><b>Examples (click for JSON output)</b></h6> 9408 <i>Daily close prices for silver (symbol=SILVER and symbol=XAG are both accepted)</i> 9409 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=GOLD_SILVER_HISTORY&symbol=SILVER&interval=daily&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=GOLD_SILVER_HISTORY&symbol=SILVER&interval=daily&apikey=demo</code></a></p> 9410 <br> 9411 9412 <h6><b>Language-specific guides</b></h6> 9413 <div> 9414 <button class="python-btn">Python</button> 9415 <button class="node-btn">NodeJS</button> 9416 <button class="php-btn">PHP</button> 9417 <button class="cs-btn">C#/.NET</button> 9418 <button class="other-btn">â¨MCP & Other</button> 9419</div> 9420 9421<div class="python-code"> 9422 <pre><code class="python"> 9423import requests 9424 9425# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9426url = 'https://www.alphavantage.co/query?function=GOLD_SILVER_HISTORY&symbol=SILVER&interval=daily&apikey=demo' 9427r = requests.get(url) 9428data = r.json() 9429 9430print(data) 9431 </code></pre> 9432</div> 9433 9434<div class="node-code"> 9435 <pre><code class="javascript"> 9436'use strict'; 9437var request = require('request'); 9438 9439// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9440var url = 'https://www.alphavantage.co/query?function=GOLD_SILVER_HISTORY&symbol=SILVER&interval=daily&apikey=demo'; 9441 9442request.get({ 9443 url: url, 9444 json: true, 9445 headers: {'User-Agent': 'request'} 9446 }, (err, res, data) => { 9447 if (err) { 9448 console.log('Error:', err); 9449 } else if (res.statusCode !== 200) { 9450 console.log('Status:', res.statusCode); 9451 } else { 9452 // data is successfully parsed as a JSON object: 9453 console.log(data); 9454 } 9455}); 9456 </code></pre> 9457</div> 9458 9459<div class="php-code"> 9460 <pre><code class="php"> 9461<?php 9462// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9463$json = file_get_contents('https://www.alphavantage.co/query?function=GOLD_SILVER_HISTORY&symbol=SILVER&interval=daily&apikey=demo'); 9464 9465$data = json_decode($json,true); 9466 9467print_r($data); 9468 9469exit; 9470 </code></pre> 9471</div> 9472 9473<div class="cs-code"> 9474 <pre><code class="cs"> 9475using System; 9476using System.Collections.Generic; 9477using System.Net; 9478
9479// ------------------------------------------------------------------------- 9480// if using .NET Framework 9481// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9482// This requires including the reference to System.Web.Extensions in your project 9483using System.Web.Script.Serialization; 9484// ------------------------------------------------------------------------- 9485// if using .Net Core 9486// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9487using System.Text.Json; 9488// ------------------------------------------------------------------------- 9489 9490namespace ConsoleTests 9491{ 9492 internal class Program 9493 { 9494 private static void Main(string[] args) 9495 { 9496 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9497 string QUERY_URL = "https://www.alphavantage.co/query?function=GOLD_SILVER_HISTORY&symbol=SILVER&interval=daily&apikey=demo"; 9498 Uri queryUri = new Uri(QUERY_URL); 9499 9500 using (WebClient client = new WebClient()) 9501 { 9502 // ------------------------------------------------------------------------- 9503 // if using .NET Framework (System.Web.Script.Serialization) 9504 9505 JavaScriptSerializer js = new JavaScriptSerializer(); 9506 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9507 9508 // ------------------------------------------------------------------------- 9509 // if using .NET Core (System.Text.Json) 9510 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9511 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9512 9513 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9514 9515 // ------------------------------------------------------------------------- 9516 9517 // do something with the json_data 9518 } 9519 } 9520 } 9521} 9522 </code></pre> 9523</div> 9524 9525 9526<div class="other-code" style="background-color: #f9f9f9;"> 9527 <br> 9528 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9529 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9530 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9531 <br> 9532</div> 9533 9534 <br> 9535 9536 <br> 9537 9538 <h4 id="wti">
9538Crude Oil Prices: West Texas Intermediate (WTI) <span class="popular-label">Trending</span></h4> 9539 <br> 9540 <p>This API returns the West Texas Intermediate (WTI) crude oil prices in daily, weekly, and monthly horizons.</p> 9541 <p>Source: U.S. Energy Information Administration, Crude Oil Prices: West Texas Intermediate (WTI) - Cushing, Oklahoma, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 9542 <br> 9543 <h6><b>API Parameters</b></h6> 9544 <p><b>â Required: <code>function</code></b></p> 9545 <p>The function of your choice. In this case, <code>function=WTI</code> </p> 9546 <p>â Optional: <code>interval</code></p> 9547 <p>By default, <code>interval=monthly</code>. Strings <code>daily</code>, <code>weekly</code>, and <code>monthly</code> are accepted.</p> 9548 <p>â Optional: <code>datatype</code></p> 9549 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 9550 <p><b>â Required: <code>apikey</code></b></p> 9551 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9552 <br> 9553 9554 <h6><b>Examples (click for JSON output)</b></h6> 9555 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=WTI&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=WTI&interval=monthly&apikey=demo</code></a></p> 9556 <br> 9557 9558 <h6><b>Language-specific guides</b></h6> 9559 <div> 9560 <button class="python-btn">Python</button> 9561 <button class="node-btn">NodeJS</button> 9562 <button class="php-btn">PHP</button> 9563 <button class="cs-btn">C#/.NET</button> 9564 <button class="other-btn">â¨MCP & Other</button> 9565</div> 9566 9567<div class="python-code"> 9568 <pre><code class="python"> 9569import requests 9570 9571# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9572url = 'https://www.alphavantage.co/query?function=WTI&interval=monthly&apikey=demo' 9573r = requests.get(url) 9574data = r.json() 9575 9576print(data) 9577 </code></pre> 9578</div> 9579 9580<div class="node-code"> 9581 <pre><code class="javascript"> 9582'use strict'; 9583var request = require('request'); 9584 9585// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9586var url = 'https://www.alphavantage.co/query?function=WTI&interval=monthly&apikey=demo'; 9587 9588request.get({ 9589 url: url, 9590 json: true, 9591 headers: {'User-Agent': 'request'} 9592 }, (err, res, data) => { 9593 if (err) { 9594 console.log('Error:', err); 9595 } else if (res.statusCode !== 200) { 9596 console.log('Status:', res.statusCode); 9597 } else { 9598 // data is successfully parsed as a JSON object: 9599 console.log(data); 9600 } 9601}); 9602 </code></pre> 9603</div> 9604 9605<div class="php-code"> 9606 <pre><code class="php"> 9607<?php 9608// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9609$json = file_get_contents('https://www.alphavantage.co/query?function=WTI&interval=monthly&apikey=demo'); 9610 9611$data = json_decode($json,true); 9612 9613print_r($data); 9614 9615exit; 9616 </code></pre> 9617</div> 9618 9619<div class="cs-code"> 9620 <pre><code class="cs"> 9621using System; 9622using System.Collections.Generic; 9623using System.Net; 9624 9625// ------------------------------------------------------------------------- 9626// if using .NET Framework 9627// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9628// This requires including the reference to System.Web.Extensions in your project 9629using System.Web.Script.Serialization; 9630// ------------------------------------------------------------------------- 9631// if using .Net Core
9632// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9633using System.Text.Json; 9634// ------------------------------------------------------------------------- 9635 9636namespace ConsoleTests 9637{ 9638 internal class Program 9639 { 9640 private static void Main(string[] args) 9641 { 9642 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9643 string QUERY_URL = "https://www.alphavantage.co/query?function=WTI&interval=monthly&apikey=demo" 9644 Uri queryUri = new Uri(QUERY_URL); 9645 9646 using (WebClient client = new WebClient()) 9647 { 9648 // ------------------------------------------------------------------------- 9649 // if using .NET Framework (System.Web.Script.Serialization) 9650 9651 JavaScriptSerializer js = new JavaScriptSerializer(); 9652 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9653 9654 // ------------------------------------------------------------------------- 9655 // if using .NET Core (System.Text.Json) 9656 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9657 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9658 9659 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9660 9661 // ------------------------------------------------------------------------- 9662 9663 // do something with the json_data 9664 } 9665 } 9666 } 9667} 9668 </code></pre> 9669</div> 9670 9671 9672<div class="other-code" style="background-color: #f9f9f9;"> 9673 <br> 9674 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9675 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9676 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9677 <br> 9678</div> 9679 9680 <br> 9681 9682 <br> 9683 <h4 id="brent">
9683Crude Oil Prices (Brent) <span class="popular-label">Trending</span></h4> 9684 <br> 9685 <p>This API returns the Brent (Europe) crude oil prices in daily, weekly, and monthly horizons.</p> 9686 <p>Source: U.S. Energy Information Administration, Crude Oil Prices: Brent - Europe, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 9687 <br> 9688 <h6><b>API Parameters</b></h6> 9689 <p><b>â Required: <code>function</code></b></p> 9690 <p>The function of your choice. In this case, <code>function=BRENT</code> </p> 9691 <p>â Optional: <code>interval</code></p> 9692 <p>By default, <code>interval=monthly</code>. Strings <code>daily</code>, <code>weekly</code>, and <code>monthly</code> are accepted.</p> 9693 <p>â Optional: <code>datatype</code></p> 9694 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 9695 <p><b>â Required: <code>apikey</code></b></p> 9696 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9697 <br> 9698 9699 <h6><b>Examples (click for JSON output)</b></h6> 9700 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=BRENT&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=BRENT&interval=monthly&apikey=demo</code></a></p> 9701 <br> 9702 9703 <h6><b>Language-specific guides</b></h6> 9704 <div> 9705 <button class="python-btn">Python</button> 9706 <button class="node-btn">NodeJS</button> 9707 <button class="php-btn">PHP</button> 9708 <button class="cs-btn">C#/.NET</button> 9709 <button class="other-btn">â¨MCP & Other</button> 9710</div> 9711 9712<div class="python-code"> 9713 <pre><code class="python"> 9714import requests 9715 9716# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9717url = 'https://www.alphavantage.co/query?function=BRENT&interval=monthly&apikey=demo' 9718r = requests.get(url) 9719data = r.json() 9720 9721print(data) 9722 </code></pre> 9723</div> 9724 9725<div class="node-code"> 9726 <pre><code class="javascript"> 9727'use strict'; 9728var request = require('request'); 9729 9730// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9731var url = 'https://www.alphavantage.co/query?function=BRENT&interval=monthly&apikey=demo'; 9732 9733request.get({ 9734 url: url, 9735 json: true, 9736 headers: {'User-Agent': 'request'} 9737 }, (err, res, data) => { 9738 if (err) { 9739 console.log('Error:', err); 9740 } else if (res.statusCode !== 200) { 9741 console.log('Status:', res.statusCode); 9742 } else { 9743 // data is successfully parsed as a JSON object: 9744 console.log(data); 9745 } 9746}); 9747 </code></pre> 9748</div> 9749 9750<div class="php-code"> 9751 <pre><code class="php"> 9752<?php 9753// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9754$json = file_get_contents('https://www.alphavantage.co/query?function=BRENT&interval=monthly&apikey=demo'); 9755 9756$data = json_decode($json,true); 9757 9758print_r($data); 9759 9760exit; 9761 </code></pre> 9762</div> 9763 9764<div class="cs-code"> 9765 <pre><code class="cs"> 9766using System; 9767using System.Collections.Generic; 9768using System.Net; 9769 9770// ------------------------------------------------------------------------- 9771// if using .NET Framework 9772// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9773// This requires including the reference to System.Web.Extensions in your project 9774using System.Web.Script.Serialization; 9775// ------------------------------------------------------------------------- 9776// if using .Net Core
9777// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9778using System.Text.Json; 9779// ------------------------------------------------------------------------- 9780 9781namespace ConsoleTests 9782{ 9783 internal class Program 9784 { 9785 private static void Main(string[] args) 9786 { 9787 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9788 string QUERY_URL = "https://www.alphavantage.co/query?function=BRENT&interval=monthly&apikey=demo" 9789 Uri queryUri = new Uri(QUERY_URL); 9790 9791 using (WebClient client = new WebClient()) 9792 { 9793 // ------------------------------------------------------------------------- 9794 // if using .NET Framework (System.Web.Script.Serialization) 9795 9796 JavaScriptSerializer js = new JavaScriptSerializer(); 9797 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9798 9799 // ------------------------------------------------------------------------- 9800 // if using .NET Core (System.Text.Json) 9801 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9802 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9803 9804 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9805 9806 // ------------------------------------------------------------------------- 9807 9808 // do something with the json_data 9809 } 9810 } 9811 } 9812} 9813 </code></pre> 9814</div> 9815 9816 9817<div class="other-code" style="background-color: #f9f9f9;"> 9818 <br> 9819 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9820 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9821 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9822 <br> 9823</div> 9824 9825 <br> 9826 9827 <br> 9828 <h4 id="natural-gas">Natural Gas</h4> 9829 <br> 9830 <p>This API returns the Henry Hub natural gas spot prices in daily, weekly, and monthly horizons.</p> 9831 <p>Source: U.S. Energy Information Administration, Henry Hub Natural Gas Spot Price, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 9832 <br> 9833 <h6><b>API Parameters</b></h6> 9834 <p><b>â Required: <code>function</code></b></p> 9835 <p>The function of your choice. In this case, <code>function=NATURAL_GAS</code> </p> 9836 <p>â Optional: <code>interval</code></p> 9837 <p>By default, <code>interval=monthly</code>. Strings <code>daily</code>, <code>weekly</code>, and <code>monthly</code> are accepted.</p> 9838 <p>â Optional: <code>datatype</code></p> 9839 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 9840 <p><b>â Required: <code>apikey</code></b></p> 9841 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9842 <br> 9843 9844 <h6><b>Examples (click for JSON output)</b></h6> 9845 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=NATURAL_GAS&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=NATURAL_GAS&interval=monthly&apikey=demo</code></a></p> 9846 <br> 9847 9848 <h6><b>Language-specific guides</b></h6> 9849 <div> 9850 <button class="python-btn">Python</button> 9851 <button class="node-btn">NodeJS</button> 9852 <button class="php-btn">PHP</button> 9853 <button class="cs-btn">C#/.NET</button> 9854 <button class="other-btn">â¨MCP & Other</button> 9855</div> 9856 9857<div class="python-code"> 9858 <pre><code class="python"> 9859import requests 9860 9861# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9862url = 'https://www.alphavantage.co/query?function=NATURAL_GAS&interval=monthly&apikey=demo' 9863r = requests.get(url) 9864data = r.json() 9865 9866print(data) 9867 </code></pre> 9868</div> 9869 9870<div class="node-code"> 9871 <pre><code class="javascript"> 9872'use strict'; 9873var request = require('request'); 9874 9875// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9876var url = 'https://www.alphavantage.co/query?function=NATURAL_GAS&interval=monthly&apikey=demo'; 9877 9878request.get({ 9879 url: url, 9880 json: true, 9881 headers: {'User-Agent': 'request'} 9882 }, (err, res, data) => { 9883 if (err) { 9884 console.log('Error:', err); 9885 } else if (res.statusCode !== 200) { 9886 console.log('Status:', res.statusCode); 9887 } else { 9888 // data is successfully parsed as a JSON object: 9889 console.log(data); 9890 } 9891}); 9892 </code></pre> 9893</div> 9894 9895<div class="php-code"> 9896 <pre><code class="php"> 9897<?php 9898// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9899$json = file_get_contents('https://www.alphavantage.co/query?function=NATURAL_GAS&interval=monthly&apikey=demo'); 9900 9901$data = json_decode($json,true); 9902 9903print_r($data); 9904 9905exit; 9906 </code></pre> 9907</div> 9908 9909<div class="cs-code"> 9910 <pre><code class="cs"> 9911using System; 9912using System.Collections.Generic; 9913using System.Net; 9914
9915// ------------------------------------------------------------------------- 9916// if using .NET Framework 9917// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 9918// This requires including the reference to System.Web.Extensions in your project 9919using System.Web.Script.Serialization; 9920// ------------------------------------------------------------------------- 9921// if using .Net Core 9922// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 9923using System.Text.Json; 9924// ------------------------------------------------------------------------- 9925 9926namespace ConsoleTests 9927{ 9928 internal class Program 9929 { 9930 private static void Main(string[] args) 9931 { 9932 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 9933 string QUERY_URL = "https://www.alphavantage.co/query?function=NATURAL_GAS&interval=monthly&apikey=demo"; 9934 Uri queryUri = new Uri(QUERY_URL); 9935 9936 using (WebClient client = new WebClient()) 9937 { 9938 // ------------------------------------------------------------------------- 9939 // if using .NET Framework (System.Web.Script.Serialization) 9940 9941 JavaScriptSerializer js = new JavaScriptSerializer(); 9942 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 9943 9944 // ------------------------------------------------------------------------- 9945 // if using .NET Core (System.Text.Json) 9946 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 9947 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 9948 9949 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 9950 9951 // ------------------------------------------------------------------------- 9952 9953 // do something with the json_data 9954 } 9955 } 9956 } 9957} 9958 </code></pre> 9959</div> 9960 9961 9962<div class="other-code" style="background-color: #f9f9f9;"> 9963 <br> 9964 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 9965 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 9966 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 9967 <br> 9968</div> 9969 9970 <br> 9971 9972 <br> 9973 <h4 id="copper">Global Price of Copper</h4> 9974 <br> 9975 <p>This API returns the global price of copper in monthly, quarterly, and annual horizons.</p> 9976 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Copper, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 9977 <br> 9978 <h6><b>API Parameters</b></h6> 9979 <p><b>â Required: <code>function</code></b></p> 9980 <p>The function of your choice. In this case, <code>function=COPPER</code> </p> 9981 <p>â Optional: <code>interval</code></p> 9982 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 9983 <p>â Optional: <code>datatype</code></p> 9984 <p>
9984By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 9985 <p><b>â Required: <code>apikey</code></b></p> 9986 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 9987 <br> 9988 9989 <h6><b>Examples (click for JSON output)</b></h6> 9990 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=demo</code></a></p> 9991 <br> 9992 9993 <h6><b>Language-specific guides</b></h6> 9994 <div> 9995 <button class="python-btn">Python</button> 9996 <button class="node-btn">NodeJS</button> 9997 <button class="php-btn">PHP</button> 9998 <button class="cs-btn">C#/.NET</button> 9999 <button class="other-btn">â¨MCP & Other</button> 10000</div> 10001 10002<div class="python-code"> 10003 <pre><code class="python"> 10004import requests 10005 10006# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10007url = 'https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=demo' 10008r = requests.get(url) 10009data = r.json() 10010 10011print(data) 10012 </code></pre> 10013</div> 10014 10015<div class="node-code"> 10016 <pre><code class="javascript"> 10017'use strict'; 10018var request = require('request'); 10019 10020// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10021var url = 'https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=demo'; 10022 10023request.get({ 10024 url: url, 10025 json: true, 10026 headers: {'User-Agent': 'request'} 10027 }, (err, res, data) => { 10028 if (err) { 10029 console.log('Error:', err); 10030 } else if (res.statusCode !== 200) { 10031 console.log('Status:', res.statusCode); 10032 } else { 10033 // data is successfully parsed as a JSON object: 10034 console.log(data); 10035 } 10036}); 10037 </code></pre> 10038</div> 10039 10040<div class="php-code"> 10041 <pre><code class="php"> 10042<?php 10043// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10044$json = file_get_contents('https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=demo'); 10045 10046$data = json_decode($json,true); 10047 10048print_r($data); 10049 10050exit; 10051 </code></pre> 10052</div> 10053 10054<div class="cs-code"> 10055 <pre><code class="cs"> 10056using System; 10057using System.Collections.Generic; 10058using System.Net; 10059 10060// ------------------------------------------------------------------------- 10061// if using .NET Framework 10062// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10063// This requires including the reference to System.Web.Extensions in your project 10064using System.Web.Script.Serialization; 10065// ------------------------------------------------------------------------- 10066// if using .Net Core 10067// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10068using System.Text.Json; 10069// ------------------------------------------------------------------------- 10070 10071namespace ConsoleTests 10072{ 10073 internal class Program 10074 { 10075 private static void Main(string[] args) 10076 { 10077 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10078 string QUERY_URL = "https://www.alphavantage.co/query?function=COPPER&interval=monthly&apikey=demo"; 10079 Uri queryUri = new Uri(QUERY_URL); 10080 10081 using (WebClient client = new WebClient()) 10082 { 10083 // ------------------------------------------------------------------------- 10084 // if using .NET Framework (System.Web.Script.Serialization) 10085 10086 JavaScriptSerializer js = new JavaScriptSerializer(); 10087 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10088 10089 // ------------------------------------------------------------------------- 10090 // if using .NET Core (System.Text.Json) 10091 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10092 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10093 10094 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10095 10096 // ------------------------------------------------------------------------- 10097
10098 // do something with the json_data 10099 } 10100 } 10101 } 10102} 10103 </code></pre> 10104</div> 10105 10106 10107<div class="other-code" style="background-color: #f9f9f9;"> 10108 <br> 10109 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10110 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10111 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10112 <br> 10113</div> 10114 10115 <br> 10116 10117 <br> 10118 <h4 id="aluminum">Global Price of Aluminum </h4> 10119 <br> 10120 <p>This API returns the global price of aluminum in monthly, quarterly, and annual horizons.</p> 10121 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Aluminum, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10122 <br> 10123 <h6><b>API Parameters</b></h6> 10124 <p><b>â Required: <code>function</code></b></p> 10125 <p>The function of your choice. In this case, <code>function=ALUMINUM</code> </p> 10126 <p>â Optional: <code>interval</code></p> 10127 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 10128 <p>â Optional: <code>datatype</code></p> 10129 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 10130 <p><b>â Required: <code>apikey</code></b></p> 10131 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 10132 <br> 10133 10134 <h6><b>Examples (click for JSON output)</b></h6> 10135 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=demo</code></a></p> 10136 <br> 10137 10138 <h6><b>Language-specific guides</b></h6> 10139 <div> 10140 <button class="python-btn">Python</button> 10141 <button class="node-btn">NodeJS</button> 10142 <button class="php-btn">PHP</button> 10143 <button class="cs-btn">C#/.NET</button> 10144 <button class="other-btn">â¨MCP & Other</button> 10145</div> 10146 10147<div class="python-code"> 10148 <pre><code class="python"> 10149import requests 10150 10151# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10152url = 'https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=demo' 10153r = requests.get(url) 10154data = r.json() 10155 10156print(data) 10157 </code></pre> 10158</div> 10159 10160<div class="node-code"> 10161 <pre><code class="javascript"> 10162'use strict'; 10163var request = require('request'); 10164 10165// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10166var url = 'https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=demo'; 10167 10168request.get({ 10169 url: url, 10170 json: true, 10171 headers: {'User-Agent': 'request'} 10172 }, (err, res, data) => { 10173 if (err) { 10174 console.log('Error:', err); 10175 } else if (res.statusCode !== 200) { 10176 console.log('Status:', res.statusCode); 10177 } else { 10178 // data is successfully parsed as a JSON object: 10179 console.log(data); 10180 } 10181}); 10182 </code></pre> 10183</div> 10184 10185<div class="php-code"> 10186 <pre><code class="php"> 10187<?php 10188// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10189$json = file_get_contents('https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=demo'); 10190 10191$data = json_decode($json,true); 10192 10193print_r($data); 10194 10195exit; 10196 </code></pre> 10197</div> 10198 10199<div class="cs-code"> 10200 <pre><code class="cs"> 10201using System; 10202using System.Collections.Generic; 10203using System.Net; 10204
10205// ------------------------------------------------------------------------- 10206// if using .NET Framework 10207// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10208// This requires including the reference to System.Web.Extensions in your project 10209using System.Web.Script.Serialization; 10210// ------------------------------------------------------------------------- 10211// if using .Net Core 10212// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10213using System.Text.Json; 10214// ------------------------------------------------------------------------- 10215 10216namespace ConsoleTests 10217{ 10218 internal class Program 10219 { 10220 private static void Main(string[] args) 10221 { 10222 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10223 string QUERY_URL = "https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=demo"; 10224 Uri queryUri = new Uri(QUERY_URL); 10225 10226 using (WebClient client = new WebClient()) 10227 { 10228 // ------------------------------------------------------------------------- 10229 // if using .NET Framework (System.Web.Script.Serialization) 10230 10231 JavaScriptSerializer js = new JavaScriptSerializer(); 10232 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10233 10234 // ------------------------------------------------------------------------- 10235 // if using .NET Core (System.Text.Json) 10236 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10237 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10238 10239 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10240 10241 // ------------------------------------------------------------------------- 10242 10243 // do something with the json_data 10244 } 10245 } 10246 } 10247} 10248 </code></pre> 10249</div> 10250 10251 10252<div class="other-code" style="background-color: #f9f9f9;"> 10253 <br> 10254 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10255 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10256 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10257 <br> 10258</div> 10259 10260 <br> 10261 10262 10263 <br> 10264 <h4 id="wheat">Global Price of Wheat </h4> 10265 <br> 10266 <p>This API returns the global price of wheat in monthly, quarterly, and annual horizons.</p> 10267 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Wheat, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10268 <br> 10269 <h6><b>API Parameters</b></h6> 10270 <p><b>â Required: <code>function</code></b></p> 10271 <p>The function of your choice. In this case, <code>function=WHEAT</code> </p> 10272 <p>â Optional: <code>interval</code></p> 10273 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 10274 <p>â Optional: <code>datatype</code></p> 10275 <p>
10275By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 10276 <p><b>â Required: <code>apikey</code></b></p> 10277 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 10278 <br> 10279 10280 <h6><b>Examples (click for JSON output)</b></h6> 10281 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=WHEAT&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=WHEAT&interval=monthly&apikey=demo</code></a></p> 10282 <br> 10283 10284 <h6><b>Language-specific guides</b></h6> 10285 <div> 10286 <button class="python-btn">Python</button> 10287 <button class="node-btn">NodeJS</button> 10288 <button class="php-btn">PHP</button> 10289 <button class="cs-btn">C#/.NET</button> 10290 <button class="other-btn">â¨MCP & Other</button> 10291</div> 10292 10293<div class="python-code"> 10294 <pre><code class="python"> 10295import requests 10296 10297# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10298url = 'https://www.alphavantage.co/query?function=WHEAT&interval=monthly&apikey=demo' 10299r = requests.get(url) 10300data = r.json() 10301 10302print(data) 10303 </code></pre> 10304</div> 10305 10306<div class="node-code"> 10307 <pre><code class="javascript"> 10308'use strict'; 10309var request = require('request'); 10310 10311// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10312var url = 'https://www.alphavantage.co/query?function=WHEAT&interval=monthly&apikey=demo'; 10313 10314request.get({ 10315 url: url, 10316 json: true, 10317 headers: {'User-Agent': 'request'} 10318 }, (err, res, data) => { 10319 if (err) { 10320 console.log('Error:', err); 10321 } else if (res.statusCode !== 200) { 10322 console.log('Status:', res.statusCode); 10323 } else { 10324 // data is successfully parsed as a JSON object: 10325 console.log(data); 10326 } 10327}); 10328 </code></pre> 10329</div> 10330 10331<div class="php-code"> 10332 <pre><code class="php"> 10333<?php 10334// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10335$json = file_get_contents('https://www.alphavantage.co/query?function=WHEAT&interval=monthly&apikey=demo'); 10336 10337$data = json_decode($json,true); 10338 10339print_r($data); 10340 10341exit; 10342 </code></pre> 10343</div> 10344 10345<div class="cs-code"> 10346 <pre><code class="cs"> 10347using System; 10348using System.Collections.Generic; 10349using System.Net; 10350 10351// ------------------------------------------------------------------------- 10352// if using .NET Framework 10353// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10354// This requires including the reference to System.Web.Extensions in your project 10355using System.Web.Script.Serialization; 10356// ------------------------------------------------------------------------- 10357// if using .Net Core 10358// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10359using System.Text.Json; 10360// ------------------------------------------------------------------------- 10361 10362namespace ConsoleTests 10363{ 10364 internal class Program 10365 { 10366 private static void Main(string[] args) 10367 { 10368 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10369 string QUERY_URL = "https://www.alphavantage.co/query?function=WHEAT&interval=monthly&apikey=demo"; 10370 Uri queryUri = new Uri(QUERY_URL); 10371 10372 using (WebClient client = new WebClient()) 10373 { 10374 // ------------------------------------------------------------------------- 10375 // if using .NET Framework (System.Web.Script.Serialization) 10376 10377 JavaScriptSerializer js = new JavaScriptSerializer(); 10378 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10379 10380 // ------------------------------------------------------------------------- 10381 // if using .NET Core (System.Text.Json) 10382 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10383 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10384 10385 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10386 10387 // ------------------------------------------------------------------------- 10388
10389 // do something with the json_data 10390 } 10391 } 10392 } 10393} 10394 </code></pre> 10395</div> 10396 10397 10398<div class="other-code" style="background-color: #f9f9f9;"> 10399 <br> 10400 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10401 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10402 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10403 <br> 10404</div> 10405 10406 <br> 10407 10408 <br> 10409 <h4 id="corn">Global Price of Corn </h4> 10410 <br> 10411 <p>This API returns the global price of corn in monthly, quarterly, and annual horizons.</p> 10412 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Corn, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10413 <br> 10414 <h6><b>API Parameters</b></h6> 10415 <p><b>â Required: <code>function</code></b></p> 10416 <p>The function of your choice. In this case, <code>function=CORN</code> </p> 10417 <p>â Optional: <code>interval</code></p> 10418 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 10419 <p>â Optional: <code>datatype</code></p> 10420 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 10421 <p><b>â Required: <code>apikey</code></b></p> 10422 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 10423 <br> 10424 10425 <h6><b>Examples (click for JSON output)</b></h6> 10426 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CORN&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=CORN&interval=monthly&apikey=demo</code></a></p> 10427 <br> 10428 10429 <h6><b>Language-specific guides</b></h6> 10430 <div> 10431 <button class="python-btn">Python</button> 10432 <button class="node-btn">NodeJS</button> 10433 <button class="php-btn">PHP</button> 10434 <button class="cs-btn">C#/.NET</button> 10435 <button class="other-btn">â¨MCP & Other</button> 10436</div> 10437 10438<div class="python-code"> 10439 <pre><code class="python"> 10440import requests 10441 10442# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10443url = 'https://www.alphavantage.co/query?function=CORN&interval=monthly&apikey=demo' 10444r = requests.get(url) 10445data = r.json() 10446 10447print(data) 10448 </code></pre> 10449</div> 10450 10451<div class="node-code"> 10452 <pre><code class="javascript"> 10453'use strict'; 10454var request = require('request'); 10455 10456// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10457var url = 'https://www.alphavantage.co/query?function=CORN&interval=monthly&apikey=demo'; 10458 10459request.get({ 10460 url: url, 10461 json: true, 10462 headers: {'User-Agent': 'request'} 10463 }, (err, res, data) => { 10464 if (err) { 10465 console.log('Error:', err); 10466 } else if (res.statusCode !== 200) { 10467 console.log('Status:', res.statusCode); 10468 } else { 10469 // data is successfully parsed as a JSON object: 10470 console.log(data); 10471 } 10472}); 10473 </code></pre> 10474</div> 10475 10476<div class="php-code"> 10477 <pre><code class="php"> 10478<?php 10479// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10480$json = file_get_contents('https://www.alphavantage.co/query?function=CORN&interval=monthly&apikey=demo'); 10481 10482$data = json_decode($json,true); 10483 10484print_r($data); 10485 10486exit; 10487 </code></pre> 10488</div> 10489 10490<div class="cs-code"> 10491 <pre><code class="cs"> 10492using System; 10493using System.Collections.Generic; 10494using System.Net; 10495
10496// ------------------------------------------------------------------------- 10497// if using .NET Framework 10498// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10499// This requires including the reference to System.Web.Extensions in your project 10500using System.Web.Script.Serialization; 10501// ------------------------------------------------------------------------- 10502// if using .Net Core 10503// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10504using System.Text.Json; 10505// ------------------------------------------------------------------------- 10506 10507namespace ConsoleTests 10508{ 10509 internal class Program 10510 { 10511 private static void Main(string[] args) 10512 { 10513 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10514 string QUERY_URL = "https://www.alphavantage.co/query?function=CORN&interval=monthly&apikey=demo"; 10515 Uri queryUri = new Uri(QUERY_URL); 10516 10517 using (WebClient client = new WebClient()) 10518 { 10519 // ------------------------------------------------------------------------- 10520 // if using .NET Framework (System.Web.Script.Serialization) 10521 10522 JavaScriptSerializer js = new JavaScriptSerializer(); 10523 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10524 10525 // ------------------------------------------------------------------------- 10526 // if using .NET Core (System.Text.Json) 10527 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10528 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10529 10530 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10531 10532 // ------------------------------------------------------------------------- 10533 10534 // do something with the json_data 10535 } 10536 } 10537 } 10538} 10539 </code></pre> 10540</div> 10541 10542 10543<div class="other-code" style="background-color: #f9f9f9;"> 10544 <br> 10545 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10546 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10547 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10548 <br> 10549</div> 10550 10551 <br> 10552 10553 <br> 10554 <h4 id="cotton">Global Price of Cotton </h4> 10555 <br> 10556 <p>This API returns the global price of cotton in monthly, quarterly, and annual horizons.</p> 10557 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Cotton, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10558 <br> 10559 <h6><b>API Parameters</b></h6> 10560 <p><b>â Required: <code>function</code></b></p> 10561 <p>The function of your choice. In this case, <code>function=COTTON</code> </p> 10562 <p>â Optional: <code>interval</code></p> 10563 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 10564 <p>â Optional: <code>datatype</code></p> 10565 <p>
10565By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 10566 <p><b>â Required: <code>apikey</code></b></p> 10567 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 10568 <br> 10569 10570 <h6><b>Examples (click for JSON output)</b></h6> 10571 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=COTTON&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=COTTON&interval=monthly&apikey=demo</code></a></p> 10572 <br> 10573 10574 <h6><b>Language-specific guides</b></h6> 10575 <div> 10576 <button class="python-btn">Python</button> 10577 <button class="node-btn">NodeJS</button> 10578 <button class="php-btn">PHP</button> 10579 <button class="cs-btn">C#/.NET</button> 10580 <button class="other-btn">â¨MCP & Other</button> 10581</div> 10582 10583<div class="python-code"> 10584 <pre><code class="python"> 10585import requests 10586 10587# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10588url = 'https://www.alphavantage.co/query?function=COTTON&interval=monthly&apikey=demo' 10589r = requests.get(url) 10590data = r.json() 10591 10592print(data) 10593 </code></pre> 10594</div> 10595 10596<div class="node-code"> 10597 <pre><code class="javascript"> 10598'use strict'; 10599var request = require('request'); 10600 10601// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10602var url = 'https://www.alphavantage.co/query?function=COTTON&interval=monthly&apikey=demo'; 10603 10604request.get({ 10605 url: url, 10606 json: true, 10607 headers: {'User-Agent': 'request'} 10608 }, (err, res, data) => { 10609 if (err) { 10610 console.log('Error:', err); 10611 } else if (res.statusCode !== 200) { 10612 console.log('Status:', res.statusCode); 10613 } else { 10614 // data is successfully parsed as a JSON object: 10615 console.log(data); 10616 } 10617}); 10618 </code></pre> 10619</div> 10620 10621<div class="php-code"> 10622 <pre><code class="php"> 10623<?php 10624// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10625$json = file_get_contents('https://www.alphavantage.co/query?function=COTTON&interval=monthly&apikey=demo'); 10626 10627$data = json_decode($json,true); 10628 10629print_r($data); 10630 10631exit; 10632 </code></pre> 10633</div> 10634 10635<div class="cs-code"> 10636 <pre><code class="cs"> 10637using System; 10638using System.Collections.Generic; 10639using System.Net; 10640 10641// ------------------------------------------------------------------------- 10642// if using .NET Framework 10643// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10644// This requires including the reference to System.Web.Extensions in your project 10645using System.Web.Script.Serialization; 10646// ------------------------------------------------------------------------- 10647// if using .Net Core 10648// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10649using System.Text.Json; 10650// ------------------------------------------------------------------------- 10651 10652namespace ConsoleTests 10653{ 10654 internal class Program 10655 { 10656 private static void Main(string[] args) 10657 { 10658 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10659 string QUERY_URL = "https://www.alphavantage.co/query?function=COTTON&interval=monthly&apikey=demo"; 10660 Uri queryUri = new Uri(QUERY_URL); 10661 10662 using (WebClient client = new WebClient()) 10663 { 10664 // ------------------------------------------------------------------------- 10665 // if using .NET Framework (System.Web.Script.Serialization) 10666 10667 JavaScriptSerializer js = new JavaScriptSerializer(); 10668 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10669 10670 // ------------------------------------------------------------------------- 10671 // if using .NET Core (System.Text.Json) 10672 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10673 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10674 10675 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10676 10677 // ------------------------------------------------------------------------- 10678
10679 // do something with the json_data 10680 } 10681 } 10682 } 10683} 10684 </code></pre> 10685</div> 10686 10687 10688<div class="other-code" style="background-color: #f9f9f9;"> 10689 <br> 10690 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10691 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10692 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10693 <br> 10694</div> 10695 10696 <br> 10697 10698 10699 <br> 10700 <h4 id="sugar">Global Price of Sugar </h4> 10701 <br> 10702 <p>This API returns the global price of sugar in monthly, quarterly, and annual horizons.</p> 10703 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Sugar, No. 11, World, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10704 <br> 10705 <h6><b>API Parameters</b></h6> 10706 <p><b>â Required: <code>function</code></b></p> 10707 <p>The function of your choice. In this case, <code>function=SUGAR</code> </p> 10708 <p>â Optional: <code>interval</code></p> 10709 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 10710 <p>â Optional: <code>datatype</code></p> 10711 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 10712 <p><b>â Required: <code>apikey</code></b></p> 10713 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 10714 <br> 10715 10716 <h6><b>Examples (click for JSON output)</b></h6> 10717 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SUGAR&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=SUGAR&interval=monthly&apikey=demo</code></a></p> 10718 <br> 10719 10720 <h6><b>Language-specific guides</b></h6> 10721 <div> 10722 <button class="python-btn">Python</button> 10723 <button class="node-btn">NodeJS</button> 10724 <button class="php-btn">PHP</button> 10725 <button class="cs-btn">C#/.NET</button> 10726 <button class="other-btn">â¨MCP & Other</button> 10727</div> 10728 10729<div class="python-code"> 10730 <pre><code class="python"> 10731import requests 10732 10733# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10734url = 'https://www.alphavantage.co/query?function=SUGAR&interval=monthly&apikey=demo' 10735r = requests.get(url) 10736data = r.json() 10737 10738print(data) 10739 </code></pre> 10740</div> 10741 10742<div class="node-code"> 10743 <pre><code class="javascript"> 10744'use strict'; 10745var request = require('request'); 10746 10747// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10748var url = 'https://www.alphavantage.co/query?function=SUGAR&interval=monthly&apikey=demo'; 10749 10750request.get({ 10751 url: url, 10752 json: true, 10753 headers: {'User-Agent': 'request'} 10754 }, (err, res, data) => { 10755 if (err) { 10756 console.log('Error:', err); 10757 } else if (res.statusCode !== 200) { 10758 console.log('Status:', res.statusCode); 10759 } else { 10760 // data is successfully parsed as a JSON object: 10761 console.log(data); 10762 } 10763}); 10764 </code></pre> 10765</div> 10766 10767<div class="php-code"> 10768 <pre><code class="php"> 10769<?php 10770// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10771$json = file_get_contents('https://www.alphavantage.co/query?function=SUGAR&interval=monthly&apikey=demo'); 10772 10773$data = json_decode($json,true); 10774 10775print_r($data); 10776 10777exit; 10778 </code></pre> 10779</div> 10780 10781<div class="cs-code"> 10782 <pre><code class="cs"> 10783using System; 10784using System.Collections.Generic; 10785using System.Net; 10786
10787// ------------------------------------------------------------------------- 10788// if using .NET Framework 10789// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10790// This requires including the reference to System.Web.Extensions in your project 10791using System.Web.Script.Serialization; 10792// ------------------------------------------------------------------------- 10793// if using .Net Core 10794// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10795using System.Text.Json; 10796// ------------------------------------------------------------------------- 10797 10798namespace ConsoleTests 10799{ 10800 internal class Program 10801 { 10802 private static void Main(string[] args) 10803 { 10804 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10805 string QUERY_URL = "https://www.alphavantage.co/query?function=SUGAR&interval=monthly&apikey=demo"; 10806 Uri queryUri = new Uri(QUERY_URL); 10807 10808 using (WebClient client = new WebClient()) 10809 { 10810 // ------------------------------------------------------------------------- 10811 // if using .NET Framework (System.Web.Script.Serialization) 10812 10813 JavaScriptSerializer js = new JavaScriptSerializer(); 10814 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10815 10816 // ------------------------------------------------------------------------- 10817 // if using .NET Core (System.Text.Json) 10818 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10819 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10820 10821 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10822 10823 // ------------------------------------------------------------------------- 10824 10825 // do something with the json_data 10826 } 10827 } 10828 } 10829} 10830 </code></pre> 10831</div> 10832 10833 10834<div class="other-code" style="background-color: #f9f9f9;"> 10835 <br> 10836 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10837 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10838 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10839 <br> 10840</div> 10841 10842 <br> 10843 10844 <br> 10845 <h4 id="coffee">Global Price of Coffee </h4> 10846 <br> 10847 <p>This API returns the global price of coffee in monthly, quarterly, and annual horizons.</p> 10848 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global price of Coffee, Other Mild Arabica, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10849 <br> 10850 <h6><b>API Parameters</b></h6> 10851 <p><b>â Required: <code>function</code></b></p> 10852 <p>The function of your choice. In this case, <code>function=COFFEE</code> </p> 10853 <p>â Optional: <code>interval</code></p> 10854 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 10855 <p>â Optional: <code>datatype</code></p> 10856 <p>
10856By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 10857 <p><b>â Required: <code>apikey</code></b></p> 10858 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 10859 <br> 10860 10861 <h6><b>Examples (click for JSON output)</b></h6> 10862 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=COFFEE&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=COFFEE&interval=monthly&apikey=demo</code></a></p> 10863 <br> 10864 10865 <h6><b>Language-specific guides</b></h6> 10866 <div> 10867 <button class="python-btn">Python</button> 10868 <button class="node-btn">NodeJS</button> 10869 <button class="php-btn">PHP</button> 10870 <button class="cs-btn">C#/.NET</button> 10871 <button class="other-btn">â¨MCP & Other</button> 10872</div> 10873 10874<div class="python-code"> 10875 <pre><code class="python"> 10876import requests 10877 10878# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10879url = 'https://www.alphavantage.co/query?function=COFFEE&interval=monthly&apikey=demo' 10880r = requests.get(url) 10881data = r.json() 10882 10883print(data) 10884 </code></pre> 10885</div> 10886 10887<div class="node-code"> 10888 <pre><code class="javascript"> 10889'use strict'; 10890var request = require('request'); 10891 10892// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10893var url = 'https://www.alphavantage.co/query?function=COFFEE&interval=monthly&apikey=demo'; 10894 10895request.get({ 10896 url: url, 10897 json: true, 10898 headers: {'User-Agent': 'request'} 10899 }, (err, res, data) => { 10900 if (err) { 10901 console.log('Error:', err); 10902 } else if (res.statusCode !== 200) { 10903 console.log('Status:', res.statusCode); 10904 } else { 10905 // data is successfully parsed as a JSON object: 10906 console.log(data); 10907 } 10908}); 10909 </code></pre> 10910</div> 10911 10912<div class="php-code"> 10913 <pre><code class="php"> 10914<?php 10915// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10916$json = file_get_contents('https://www.alphavantage.co/query?function=COFFEE&interval=monthly&apikey=demo'); 10917 10918$data = json_decode($json,true); 10919 10920print_r($data); 10921 10922exit; 10923 </code></pre> 10924</div> 10925 10926<div class="cs-code"> 10927 <pre><code class="cs"> 10928using System; 10929using System.Collections.Generic; 10930using System.Net; 10931 10932// ------------------------------------------------------------------------- 10933// if using .NET Framework 10934// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 10935// This requires including the reference to System.Web.Extensions in your project 10936using System.Web.Script.Serialization; 10937// ------------------------------------------------------------------------- 10938// if using .Net Core 10939// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 10940using System.Text.Json; 10941// ------------------------------------------------------------------------- 10942 10943namespace ConsoleTests 10944{ 10945 internal class Program 10946 { 10947 private static void Main(string[] args) 10948 { 10949 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 10950 string QUERY_URL = "https://www.alphavantage.co/query?function=COFFEE&interval=monthly&apikey=demo"; 10951 Uri queryUri = new Uri(QUERY_URL); 10952 10953 using (WebClient client = new WebClient()) 10954 { 10955 // ------------------------------------------------------------------------- 10956 // if using .NET Framework (System.Web.Script.Serialization) 10957 10958 JavaScriptSerializer js = new JavaScriptSerializer(); 10959 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 10960 10961 // ------------------------------------------------------------------------- 10962 // if using .NET Core (System.Text.Json) 10963 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 10964 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 10965 10966 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 10967 10968 // ------------------------------------------------------------------------- 10969
10970 // do something with the json_data 10971 } 10972 } 10973 } 10974} 10975 </code></pre> 10976</div> 10977 10978 10979<div class="other-code" style="background-color: #f9f9f9;"> 10980 <br> 10981 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 10982 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 10983 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 10984 <br> 10985</div> 10986 10987 <br> 10988 10989 <br> 10990 <h4 id="all-commodities">Global Price Index of All Commodities</h4> 10991 <br> 10992 <p>This API returns the global price index of all commodities in monthly, quarterly, and annual temporal dimensions.</p> 10993 <p>Source: International Monetary Fund (<a href="https://www.imf.org/external/terms.htm" target="_blank">IMF Terms of Use</a>), Global Price Index of All Commodities, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>. </p> 10994 <br> 10995 <h6><b>API Parameters</b></h6> 10996 <p><b>â Required: <code>function</code></b></p> 10997 <p>The function of your choice. In this case, <code>function=ALL_COMMODITIES</code> </p> 10998 <p>â Optional: <code>interval</code></p> 10999 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code>, <code>quarterly</code>, and <code>annual</code> are accepted.</p> 11000 <p>â Optional: <code>datatype</code></p> 11001 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11002 <p><b>â Required: <code>apikey</code></b></p> 11003 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11004 <br> 11005 11006 <h6><b>Examples (click for JSON output)</b></h6> 11007 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ALL_COMMODITIES&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=ALL_COMMODITIES&interval=monthly&apikey=demo</code></a></p> 11008 <br> 11009 11010 <h6><b>Language-specific guides</b></h6> 11011 <div> 11012 <button class="python-btn">Python</button> 11013 <button class="node-btn">NodeJS</button> 11014 <button class="php-btn">PHP</button> 11015 <button class="cs-btn">C#/.NET</button> 11016 <button class="other-btn">â¨MCP & Other</button> 11017</div> 11018 11019<div class="python-code"> 11020 <pre><code class="python"> 11021import requests 11022 11023# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11024url = 'https://www.alphavantage.co/query?function=ALL_COMMODITIES&interval=monthly&apikey=demo' 11025r = requests.get(url) 11026data = r.json() 11027 11028print(data) 11029 </code></pre> 11030</div> 11031 11032<div class="node-code"> 11033 <pre><code class="javascript"> 11034'use strict'; 11035var request = require('request'); 11036 11037// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11038var url = 'https://www.alphavantage.co/query?function=ALL_COMMODITIES&interval=monthly&apikey=demo'; 11039 11040request.get({ 11041 url: url, 11042 json: true, 11043 headers: {'User-Agent': 'request'} 11044 }, (err, res, data) => { 11045 if (err) { 11046 console.log('Error:', err); 11047 } else if (res.statusCode !== 200) { 11048 console.log('Status:', res.statusCode); 11049 } else { 11050 // data is successfully parsed as a JSON object: 11051 console.log(data); 11052 } 11053}); 11054 </code></pre> 11055</div> 11056 11057<div class="php-code"> 11058 <pre><code class="php"> 11059<?php 11060// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11061$json = file_get_contents('https://www.alphavantage.co/query?function=ALL_COMMODITIES&interval=monthly&apikey=demo'); 11062 11063$data = json_decode($json,true); 11064 11065print_r($data); 11066 11067exit; 11068 </code></pre> 11069</div> 11070 11071<div class="cs-code"> 11072 <pre><code class="cs"> 11073using System; 11074using System.Collections.Generic; 11075using System.Net; 11076
11077// ------------------------------------------------------------------------- 11078// if using .NET Framework 11079// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11080// This requires including the reference to System.Web.Extensions in your project 11081using System.Web.Script.Serialization; 11082// ------------------------------------------------------------------------- 11083// if using .Net Core 11084// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11085using System.Text.Json; 11086// ------------------------------------------------------------------------- 11087 11088namespace ConsoleTests 11089{ 11090 internal class Program 11091 { 11092 private static void Main(string[] args) 11093 { 11094 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11095 string QUERY_URL = "https://www.alphavantage.co/query?function=ALL_COMMODITIES&interval=monthly&apikey=demo" 11096 Uri queryUri = new Uri(QUERY_URL); 11097 11098 using (WebClient client = new WebClient()) 11099 { 11100 // ------------------------------------------------------------------------- 11101 // if using .NET Framework (System.Web.Script.Serialization) 11102 11103 JavaScriptSerializer js = new JavaScriptSerializer(); 11104 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11105 11106 // ------------------------------------------------------------------------- 11107 // if using .NET Core (System.Text.Json) 11108 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11109 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11110 11111 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11112 11113 // ------------------------------------------------------------------------- 11114 11115 // do something with the json_data 11116 } 11117 } 11118 } 11119} 11120 </code></pre> 11121</div> 11122 11123 11124<div class="other-code" style="background-color: #f9f9f9;"> 11125 <br> 11126 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11127 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11128 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11129 <br> 11130</div> 11131 11132 <br> 11133 11134 </section> 11135 11136 <section> 11137 <h2 id="economic-indicators">Economic Indicators</h2> 11138 <p>APIs under this section provide key US economic indicators frequently used for investment strategy formulation and application development. </p> 11139 11140 <br> 11141 <h4 id="real-gdp">REAL_GDP <span class="popular-label">Trending</span></h4> 11142 <br> 11143 <p>This API returns the annual and quarterly Real GDP of the United States.</p> 11144 <p>Source: U.S. Bureau of Economic Analysis, Real Gross Domestic Product, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 11145 <br> 11146 <h6><b>API Parameters</b></h6> 11147 <p><b>â Required: <code>function</code></b></p> 11148 <p>The function of your choice. In this case, <code>function=REAL_GDP</code> </p> 11149 <p>â Optional: <code>interval</code></p> 11150 <p>
11150By default, <code>interval=annual</code>. Strings <code>quarterly</code> and <code>annual</code> are accepted.</p> 11151 <p>â Optional: <code>datatype</code></p> 11152 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11153 <p><b>â Required: <code>apikey</code></b></p> 11154 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11155 <br> 11156 11157 <h6><b>Examples (click for JSON output)</b></h6> 11158 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REAL_GDP&interval=annual&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=REAL_GDP&interval=annual&apikey=demo</code></a></p> 11159 <br> 11160 11161 <h6><b>Language-specific guides</b></h6> 11162 <div> 11163 <button class="python-btn">Python</button> 11164 <button class="node-btn">NodeJS</button> 11165 <button class="php-btn">PHP</button> 11166 <button class="cs-btn">C#/.NET</button> 11167 <button class="other-btn">â¨MCP & Other</button> 11168</div> 11169 11170<div class="python-code"> 11171 <pre><code class="python"> 11172import requests 11173 11174# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11175url = 'https://www.alphavantage.co/query?function=REAL_GDP&interval=annual&apikey=demo' 11176r = requests.get(url) 11177data = r.json() 11178 11179print(data) 11180 </code></pre> 11181</div> 11182 11183<div class="node-code"> 11184 <pre><code class="javascript"> 11185'use strict'; 11186var request = require('request'); 11187 11188// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11189var url = 'https://www.alphavantage.co/query?function=REAL_GDP&interval=annual&apikey=demo'; 11190 11191request.get({ 11192 url: url, 11193 json: true, 11194 headers: {'User-Agent': 'request'} 11195 }, (err, res, data) => { 11196 if (err) { 11197 console.log('Error:', err); 11198 } else if (res.statusCode !== 200) { 11199 console.log('Status:', res.statusCode); 11200 } else { 11201 // data is successfully parsed as a JSON object: 11202 console.log(data); 11203 } 11204}); 11205 </code></pre> 11206</div> 11207 11208<div class="php-code"> 11209 <pre><code class="php"> 11210<?php 11211// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11212$json = file_get_contents('https://www.alphavantage.co/query?function=REAL_GDP&interval=annual&apikey=demo'); 11213 11214$data = json_decode($json,true); 11215 11216print_r($data); 11217 11218exit; 11219 </code></pre> 11220</div> 11221 11222<div class="cs-code"> 11223 <pre><code class="cs"> 11224using System; 11225using System.Collections.Generic; 11226using System.Net; 11227 11228// ------------------------------------------------------------------------- 11229// if using .NET Framework 11230// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11231// This requires including the reference to System.Web.Extensions in your project 11232using System.Web.Script.Serialization; 11233// ------------------------------------------------------------------------- 11234// if using .Net Core 11235// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11236using System.Text.Json; 11237// ------------------------------------------------------------------------- 11238 11239namespace ConsoleTests 11240{ 11241 internal class Program 11242 { 11243 private static void Main(string[] args) 11244 { 11245 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11246 string QUERY_URL = "https://www.alphavantage.co/query?function=REAL_GDP&interval=annual&apikey=demo" 11247 Uri queryUri = new Uri(QUERY_URL); 11248 11249 using (WebClient client = new WebClient()) 11250 { 11251 // ------------------------------------------------------------------------- 11252 // if using .NET Framework (System.Web.Script.Serialization) 11253 11254 JavaScriptSerializer js = new JavaScriptSerializer(); 11255 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11256 11257 // ------------------------------------------------------------------------- 11258 // if using .NET Core (System.Text.Json) 11259 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11260 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11261 11262 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11263 11264 // ------------------------------------------------------------------------- 11265
11266 // do something with the json_data 11267 } 11268 } 11269 } 11270} 11271 </code></pre> 11272</div> 11273 11274 11275<div class="other-code" style="background-color: #f9f9f9;"> 11276 <br> 11277 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11278 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11279 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11280 <br> 11281</div> 11282 11283 <br> 11284 <h4 id="real-gdp-per-capita">REAL_GDP_PER_CAPITA</h4> 11285 <p>This API returns the quarterly Real GDP per Capita data of the United States.</p> 11286 <p>Source: U.S. Bureau of Economic Analysis, Real gross domestic product per capita, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 11287 <br> 11288 <br> 11289 <h6><b>API Parameters</b></h6> 11290 <p><b>â Required: <code>function</code></b></p> 11291 <p>The function of your choice. In this case, <code>function=REAL_GDP_PER_CAPITA</code> </p> 11292 <p>â Optional: <code>datatype</code></p> 11293 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11294 <p><b>â Required: <code>apikey</code></b></p> 11295 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11296 <br> 11297 11298 <h6><b>Examples (click for JSON output)</b></h6> 11299 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=REAL_GDP_PER_CAPITA&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=REAL_GDP_PER_CAPITA&apikey=demo</code></a></p> 11300 <br> 11301 11302 <h6><b>Language-specific guides</b></h6> 11303 <div> 11304 <button class="python-btn">Python</button> 11305 <button class="node-btn">NodeJS</button> 11306 <button class="php-btn">PHP</button> 11307 <button class="cs-btn">C#/.NET</button> 11308 <button class="other-btn">â¨MCP & Other</button> 11309</div> 11310 11311<div class="python-code"> 11312 <pre><code class="python"> 11313import requests 11314 11315# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11316url = 'https://www.alphavantage.co/query?function=REAL_GDP_PER_CAPITA&apikey=demo' 11317r = requests.get(url) 11318data = r.json() 11319 11320print(data) 11321 </code></pre> 11322</div> 11323 11324<div class="node-code"> 11325 <pre><code class="javascript"> 11326'use strict'; 11327var request = require('request'); 11328 11329// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11330var url = 'https://www.alphavantage.co/query?function=REAL_GDP_PER_CAPITA&apikey=demo'; 11331 11332request.get({ 11333 url: url, 11334 json: true, 11335 headers: {'User-Agent': 'request'} 11336 }, (err, res, data) => { 11337 if (err) { 11338 console.log('Error:', err); 11339 } else if (res.statusCode !== 200) { 11340 console.log('Status:', res.statusCode); 11341 } else { 11342 // data is successfully parsed as a JSON object: 11343 console.log(data); 11344 } 11345}); 11346 </code></pre> 11347</div> 11348 11349<div class="php-code"> 11350 <pre><code class="php"> 11351<?php 11352// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11353$json = file_get_contents('https://www.alphavantage.co/query?function=REAL_GDP_PER_CAPITA&apikey=demo'); 11354 11355$data = json_decode($json,true); 11356 11357print_r($data); 11358 11359exit; 11360 </code></pre> 11361</div> 11362 11363<div class="cs-code"> 11364 <pre><code class="cs"> 11365using System; 11366using System.Collections.Generic; 11367using System.Net; 11368
11369// ------------------------------------------------------------------------- 11370// if using .NET Framework 11371// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11372// This requires including the reference to System.Web.Extensions in your project 11373using System.Web.Script.Serialization; 11374// ------------------------------------------------------------------------- 11375// if using .Net Core 11376// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11377using System.Text.Json; 11378// ------------------------------------------------------------------------- 11379 11380namespace ConsoleTests 11381{ 11382 internal class Program 11383 { 11384 private static void Main(string[] args) 11385 { 11386 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11387 string QUERY_URL = "https://www.alphavantage.co/query?function=REAL_GDP_PER_CAPITA&apikey=demo" 11388 Uri queryUri = new Uri(QUERY_URL); 11389 11390 using (WebClient client = new WebClient()) 11391 { 11392 // ------------------------------------------------------------------------- 11393 // if using .NET Framework (System.Web.Script.Serialization) 11394 11395 JavaScriptSerializer js = new JavaScriptSerializer(); 11396 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11397 11398 // ------------------------------------------------------------------------- 11399 // if using .NET Core (System.Text.Json) 11400 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11401 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11402 11403 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11404 11405 // ------------------------------------------------------------------------- 11406 11407 // do something with the json_data 11408 } 11409 } 11410 } 11411} 11412 </code></pre> 11413</div> 11414 11415 11416<div class="other-code" style="background-color: #f9f9f9;"> 11417 <br> 11418 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11419 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11420 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11421 <br> 11422</div> 11423 11424 <br> 11425 11426 <h4 id="treasury-yield">TREASURY_YIELD <span class="popular-label">Trending</span></h4> 11427 <br> 11428 <p>This API returns the daily, weekly, and monthly US treasury yield of a given maturity timeline (e.g., 5 year, 30 year, etc).</p> 11429 <p>Source: Board of Governors of the Federal Reserve System (US), Market Yield on U.S. Treasury Securities at 3-month, 2-year, 5-year, 7-year, 10-year, and 30-year Constant Maturities, Quoted on an Investment Basis, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 11430 <br> 11431 <h6><b>API Parameters</b></h6> 11432 <p><b>â Required: <code>function</code></b></p> 11433 <p>The function of your choice. In this case, <code>function=TREASURY_YIELD</code> </p> 11434 <p>â Optional: <code>interval</code></p> 11435 <p>By default, <code>interval=monthly</code>. Strings <code>daily</code>, <code>weekly</code>, and <code>monthly</code> are accepted.</p> 11436 <p>â Optional: <code>maturity</code></p> 11437 <p>
11437By default, <code>maturity=10year</code>. Strings <code>3month</code>, <code>2year</code>, <code>5year</code>, <code>7year</code>, <code>10year</code>, and <code>30year</code> are accepted.</p> 11438 <p>â Optional: <code>datatype</code></p> 11439 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11440 <p><b>â Required: <code>apikey</code></b></p> 11441 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11442 <br> 11443 11444 <h6><b>Examples (click for JSON output)</b></h6> 11445 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TREASURY_YIELD&interval=monthly&maturity=10year&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=TREASURY_YIELD&interval=monthly&maturity=10year&apikey=demo</code></a></p> 11446 <br> 11447 11448 <h6><b>Language-specific guides</b></h6> 11449 <div> 11450 <button class="python-btn">Python</button> 11451 <button class="node-btn">NodeJS</button> 11452 <button class="php-btn">PHP</button> 11453 <button class="cs-btn">C#/.NET</button> 11454 <button class="other-btn">â¨MCP & Other</button> 11455</div> 11456 11457<div class="python-code"> 11458 <pre><code class="python"> 11459import requests 11460 11461# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11462url = 'https://www.alphavantage.co/query?function=TREASURY_YIELD&interval=monthly&maturity=10year&apikey=demo' 11463r = requests.get(url) 11464data = r.json() 11465 11466print(data) 11467 </code></pre> 11468</div> 11469 11470<div class="node-code"> 11471 <pre><code class="javascript"> 11472'use strict'; 11473var request = require('request'); 11474 11475// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11476var url = 'https://www.alphavantage.co/query?function=TREASURY_YIELD&interval=monthly&maturity=10year&apikey=demo'; 11477 11478request.get({ 11479 url: url, 11480 json: true, 11481 headers: {'User-Agent': 'request'} 11482 }, (err, res, data) => { 11483 if (err) { 11484 console.log('Error:', err); 11485 } else if (res.statusCode !== 200) { 11486 console.log('Status:', res.statusCode); 11487 } else { 11488 // data is successfully parsed as a JSON object: 11489 console.log(data); 11490 } 11491}); 11492 </code></pre> 11493</div> 11494 11495<div class="php-code"> 11496 <pre><code class="php"> 11497<?php 11498// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11499$json = file_get_contents('https://www.alphavantage.co/query?function=TREASURY_YIELD&interval=monthly&maturity=10year&apikey=demo'); 11500 11501$data = json_decode($json,true); 11502 11503print_r($data); 11504 11505exit; 11506 </code></pre> 11507</div> 11508 11509<div class="cs-code"> 11510 <pre><code class="cs"> 11511using System; 11512using System.Collections.Generic; 11513using System.Net; 11514 11515// ------------------------------------------------------------------------- 11516// if using .NET Framework 11517// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11518// This requires including the reference to System.Web.Extensions in your project 11519using System.Web.Script.Serialization; 11520// ------------------------------------------------------------------------- 11521// if using .Net Core 11522// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11523using System.Text.Json; 11524// ------------------------------------------------------------------------- 11525 11526namespace ConsoleTests 11527{ 11528 internal class Program 11529 { 11530 private static void Main(string[] args) 11531 { 11532 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11533 string QUERY_URL = "https://www.alphavantage.co/query?function=TREASURY_YIELD&interval=monthly&maturity=10year&apikey=demo" 11534 Uri queryUri = new Uri(QUERY_URL); 11535 11536 using (WebClient client = new WebClient()) 11537 { 11538 // ------------------------------------------------------------------------- 11539 // if using .NET Framework (System.Web.Script.Serialization) 11540 11541 JavaScriptSerializer js = new JavaScriptSerializer(); 11542 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11543 11544 // ------------------------------------------------------------------------- 11545 // if using .NET Core (System.Text.Json) 11546 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11547 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11548 11549 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11550 11551 // ------------------------------------------------------------------------- 11552
11553 // do something with the json_data 11554 } 11555 } 11556 } 11557} 11558 </code></pre> 11559</div> 11560 11561 11562<div class="other-code" style="background-color: #f9f9f9;"> 11563 <br> 11564 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11565 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11566 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11567 <br> 11568</div> 11569 11570 <br> 11571 11572 <h4 id="interest-rate">FEDERAL_FUNDS_RATE</h4> 11573 <br> 11574 <p>This API returns the daily, weekly, and monthly federal funds rate (interest rate) of the United States.</p> 11575 <p>Source: Board of Governors of the Federal Reserve System (US), Federal Funds Effective Rate, retrieved from FRED, Federal Reserve Bank of St. Louis (https://fred.stlouisfed.org/series/FEDFUNDS). This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 11576 <br> 11577 <h6><b>API Parameters</b></h6> 11578 <p><b>â Required: <code>function</code></b></p> 11579 <p>The function of your choice. In this case, <code>function=FEDERAL_FUNDS_RATE</code> </p> 11580 <p>â Optional: <code>interval</code></p> 11581 <p>By default, <code>interval=monthly</code>. Strings <code>daily</code>, <code>weekly</code>, and <code>monthly</code> are accepted.</p> 11582 <p>â Optional: <code>datatype</code></p> 11583 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11584 <p><b>â Required: <code>apikey</code></b></p> 11585 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11586 <br> 11587 11588 <h6><b>Examples (click for JSON output)</b></h6> 11589 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=FEDERAL_FUNDS_RATE&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=FEDERAL_FUNDS_RATE&interval=monthly&apikey=demo</code></a></p> 11590 <br> 11591 11592 <h6><b>Language-specific guides</b></h6> 11593 <div> 11594 <button class="python-btn">Python</button> 11595 <button class="node-btn">NodeJS</button> 11596 <button class="php-btn">PHP</button> 11597 <button class="cs-btn">C#/.NET</button> 11598 <button class="other-btn">â¨MCP & Other</button> 11599</div> 11600 11601<div class="python-code"> 11602 <pre><code class="python"> 11603import requests 11604 11605# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11606url = 'https://www.alphavantage.co/query?function=FEDERAL_FUNDS_RATE&interval=monthly&apikey=demo' 11607r = requests.get(url) 11608data = r.json() 11609 11610print(data) 11611 </code></pre> 11612</div> 11613 11614<div class="node-code"> 11615 <pre><code class="javascript"> 11616'use strict'; 11617var request = require('request'); 11618 11619// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11620var url = 'https://www.alphavantage.co/query?function=FEDERAL_FUNDS_RATE&interval=monthly&apikey=demo'; 11621 11622request.get({ 11623 url: url, 11624 json: true, 11625 headers: {'User-Agent': 'request'} 11626 }, (err, res, data) => { 11627 if (err) { 11628 console.log('Error:', err); 11629 } else if (res.statusCode !== 200) { 11630 console.log('Status:', res.statusCode); 11631 } else { 11632 // data is successfully parsed as a JSON object: 11633 console.log(data); 11634 } 11635}); 11636 </code></pre> 11637</div> 11638 11639<div class="php-code"> 11640 <pre><code class="php"> 11641<?php 11642// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11643$json = file_get_contents('https://www.alphavantage.co/query?function=FEDERAL_FUNDS_RATE&interval=monthly&apikey=demo'); 11644 11645$data = json_decode($json,true); 11646 11647print_r($data); 11648 11649exit; 11650 </code></pre> 11651</div> 11652 11653<div class="cs-code"> 11654 <pre><code class="cs"> 11655using System; 11656using System.Collections.Generic; 11657using System.Net; 11658
11659// ------------------------------------------------------------------------- 11660// if using .NET Framework 11661// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11662// This requires including the reference to System.Web.Extensions in your project 11663using System.Web.Script.Serialization; 11664// ------------------------------------------------------------------------- 11665// if using .Net Core 11666// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11667using System.Text.Json; 11668// ------------------------------------------------------------------------- 11669 11670namespace ConsoleTests 11671{ 11672 internal class Program 11673 { 11674 private static void Main(string[] args) 11675 { 11676 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11677 string QUERY_URL = "https://www.alphavantage.co/query?function=FEDERAL_FUNDS_RATE&interval=monthly&apikey=demo" 11678 Uri queryUri = new Uri(QUERY_URL); 11679 11680 using (WebClient client = new WebClient()) 11681 { 11682 // ------------------------------------------------------------------------- 11683 // if using .NET Framework (System.Web.Script.Serialization) 11684 11685 JavaScriptSerializer js = new JavaScriptSerializer(); 11686 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11687 11688 // ------------------------------------------------------------------------- 11689 // if using .NET Core (System.Text.Json) 11690 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11691 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11692 11693 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11694 11695 // ------------------------------------------------------------------------- 11696 11697 // do something with the json_data 11698 } 11699 } 11700 } 11701} 11702 </code></pre> 11703</div> 11704 11705 11706<div class="other-code" style="background-color: #f9f9f9;"> 11707 <br> 11708 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11709 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11710 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11711 <br> 11712</div> 11713 11714 11715 <br> 11716 11717 <h4 id="cpi">CPI</h4> 11718 <br> 11719 <p>This API returns the monthly and semiannual consumer price index (CPI) of the United States. CPI is widely regarded as the barometer of inflation levels in the broader economy. </p> 11720 <p>Source: U.S. Bureau of Labor Statistics, Consumer Price Index for All Urban Consumers: All Items in U.S. City Average, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 11721 <br> 11722 <h6><b>API Parameters</b></h6> 11723 <p><b>â Required: <code>function</code></b></p> 11724 <p>The function of your choice. In this case, <code>function=CPI</code> </p> 11725 <p>â Optional: <code>interval</code></p> 11726 <p>By default, <code>interval=monthly</code>. Strings <code>monthly</code> and <code>semiannual</code> are accepted.</p> 11727 <p>â Optional: <code>datatype</code></p> 11728 <p>
11728By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11729 <p><b>â Required: <code>apikey</code></b></p> 11730 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11731 <br> 11732 11733 <h6><b>Examples (click for JSON output)</b></h6> 11734 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=demo</code></a></p> 11735 <br> 11736 11737 <h6><b>Language-specific guides</b></h6> 11738 <div> 11739 <button class="python-btn">Python</button> 11740 <button class="node-btn">NodeJS</button> 11741 <button class="php-btn">PHP</button> 11742 <button class="cs-btn">C#/.NET</button> 11743 <button class="other-btn">â¨MCP & Other</button> 11744</div> 11745 11746<div class="python-code"> 11747 <pre><code class="python"> 11748import requests 11749 11750# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11751url = 'https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=demo' 11752r = requests.get(url) 11753data = r.json() 11754 11755print(data) 11756 </code></pre> 11757</div> 11758 11759<div class="node-code"> 11760 <pre><code class="javascript"> 11761'use strict'; 11762var request = require('request'); 11763 11764// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11765var url = 'https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=demo'; 11766 11767request.get({ 11768 url: url, 11769 json: true, 11770 headers: {'User-Agent': 'request'} 11771 }, (err, res, data) => { 11772 if (err) { 11773 console.log('Error:', err); 11774 } else if (res.statusCode !== 200) { 11775 console.log('Status:', res.statusCode); 11776 } else { 11777 // data is successfully parsed as a JSON object: 11778 console.log(data); 11779 } 11780}); 11781 </code></pre> 11782</div> 11783 11784<div class="php-code"> 11785 <pre><code class="php"> 11786<?php 11787// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11788$json = file_get_contents('https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=demo'); 11789 11790$data = json_decode($json,true); 11791 11792print_r($data); 11793 11794exit; 11795 </code></pre> 11796</div> 11797 11798<div class="cs-code"> 11799 <pre><code class="cs"> 11800using System; 11801using System.Collections.Generic; 11802using System.Net; 11803 11804// ------------------------------------------------------------------------- 11805// if using .NET Framework 11806// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11807// This requires including the reference to System.Web.Extensions in your project 11808using System.Web.Script.Serialization; 11809// ------------------------------------------------------------------------- 11810// if using .Net Core 11811// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11812using System.Text.Json; 11813// ------------------------------------------------------------------------- 11814 11815namespace ConsoleTests 11816{ 11817 internal class Program 11818 { 11819 private static void Main(string[] args) 11820 { 11821 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11822 string QUERY_URL = "https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=demo" 11823 Uri queryUri = new Uri(QUERY_URL); 11824 11825 using (WebClient client = new WebClient()) 11826 { 11827 // ------------------------------------------------------------------------- 11828 // if using .NET Framework (System.Web.Script.Serialization) 11829 11830 JavaScriptSerializer js = new JavaScriptSerializer(); 11831 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11832 11833 // ------------------------------------------------------------------------- 11834 // if using .NET Core (System.Text.Json) 11835 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11836 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11837 11838 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11839 11840 // ------------------------------------------------------------------------- 11841
11842 // do something with the json_data 11843 } 11844 } 11845 } 11846} 11847 </code></pre> 11848</div> 11849 11850 11851<div class="other-code" style="background-color: #f9f9f9;"> 11852 <br> 11853 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11854 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11855 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11856 <br> 11857</div> 11858 11859 <br> 11860 11861 <h4 id="inflation">INFLATION</h4> 11862 <br> 11863 <p>This API returns the annual inflation rates (consumer prices) of the United States.</p> 11864 <p>Source: World Bank, Inflation, consumer prices for the United States, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 11865 <br> 11866 <h6><b>API Parameters</b></h6> 11867 <p><b>â Required: <code>function</code></b></p> 11868 <p>The function of your choice. In this case, <code>function=INFLATION</code> </p> 11869 <p>â Optional: <code>datatype</code></p> 11870 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 11871 <p><b>â Required: <code>apikey</code></b></p> 11872 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 11873 <br> 11874 11875 <h6><b>Examples (click for JSON output)</b></h6> 11876 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=INFLATION&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=INFLATION&apikey=demo</code></a></p> 11877 <br> 11878 11879 <h6><b>Language-specific guides</b></h6> 11880 <div> 11881 <button class="python-btn">Python</button> 11882 <button class="node-btn">NodeJS</button> 11883 <button class="php-btn">PHP</button> 11884 <button class="cs-btn">C#/.NET</button> 11885 <button class="other-btn">â¨MCP & Other</button> 11886</div> 11887 11888<div class="python-code"> 11889 <pre><code class="python"> 11890import requests 11891 11892# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11893url = 'https://www.alphavantage.co/query?function=INFLATION&apikey=demo' 11894r = requests.get(url) 11895data = r.json() 11896 11897print(data) 11898 </code></pre> 11899</div> 11900 11901<div class="node-code"> 11902 <pre><code class="javascript"> 11903'use strict'; 11904var request = require('request'); 11905 11906// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11907var url = 'https://www.alphavantage.co/query?function=INFLATION&apikey=demo'; 11908 11909request.get({ 11910 url: url, 11911 json: true, 11912 headers: {'User-Agent': 'request'} 11913 }, (err, res, data) => { 11914 if (err) { 11915 console.log('Error:', err); 11916 } else if (res.statusCode !== 200) { 11917 console.log('Status:', res.statusCode); 11918 } else { 11919 // data is successfully parsed as a JSON object: 11920 console.log(data); 11921 } 11922}); 11923 </code></pre> 11924</div> 11925 11926<div class="php-code"> 11927 <pre><code class="php"> 11928<?php 11929// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11930$json = file_get_contents('https://www.alphavantage.co/query?function=INFLATION&apikey=demo'); 11931 11932$data = json_decode($json,true); 11933 11934print_r($data); 11935 11936exit; 11937 </code></pre> 11938</div> 11939 11940<div class="cs-code"> 11941 <pre><code class="cs"> 11942using System; 11943using System.Collections.Generic; 11944using System.Net; 11945
11946// ------------------------------------------------------------------------- 11947// if using .NET Framework 11948// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 11949// This requires including the reference to System.Web.Extensions in your project 11950using System.Web.Script.Serialization; 11951// ------------------------------------------------------------------------- 11952// if using .Net Core 11953// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 11954using System.Text.Json; 11955// ------------------------------------------------------------------------- 11956 11957namespace ConsoleTests 11958{ 11959 internal class Program 11960 { 11961 private static void Main(string[] args) 11962 { 11963 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 11964 string QUERY_URL = "https://www.alphavantage.co/query?function=INFLATION&apikey=demo" 11965 Uri queryUri = new Uri(QUERY_URL); 11966 11967 using (WebClient client = new WebClient()) 11968 { 11969 // ------------------------------------------------------------------------- 11970 // if using .NET Framework (System.Web.Script.Serialization) 11971 11972 JavaScriptSerializer js = new JavaScriptSerializer(); 11973 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 11974 11975 // ------------------------------------------------------------------------- 11976 // if using .NET Core (System.Text.Json) 11977 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 11978 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 11979 11980 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 11981 11982 // ------------------------------------------------------------------------- 11983 11984 // do something with the json_data 11985 } 11986 } 11987 } 11988} 11989 </code></pre> 11990</div> 11991 11992 11993<div class="other-code" style="background-color: #f9f9f9;"> 11994 <br> 11995 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 11996 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 11997 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 11998 <br> 11999</div> 12000 12001 <br> 12002 12003 <br> 12004 <h4 id="retail-sales">RETAIL_SALES</h4> 12005 <br> 12006 <p>This API returns the monthly Advance Retail Sales: Retail Trade data of the United States.</p> 12007 <p>Source: U.S. Census Bureau, Advance Retail Sales: Retail Trade, retrieved from FRED, Federal Reserve Bank of St. Louis (https://fred.stlouisfed.org/series/RSXFSN). This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 12008 <br> 12009 <h6><b>API Parameters</b></h6> 12010 <p><b>â Required: <code>function</code></b></p> 12011 <p>The function of your choice. In this case, <code>function=RETAIL_SALES</code> </p> 12012 <p>â Optional: <code>datatype</code></p> 12013 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12014 <p><b>â Required: <code>apikey</code></b></p> 12015 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12016 <br> 12017 12018 <h6><b>Examples (click for JSON output)</b></h6> 12019 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=RETAIL_SALES&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=RETAIL_SALES&apikey=demo</code></a></p> 12020 <br> 12021 12022 <h6><b>Language-specific guides</b></h6> 12023 <div> 12024 <button class="python-btn">Python</button> 12025 <button class="node-btn">NodeJS</button> 12026 <button class="php-btn">PHP</button> 12027 <button class="cs-btn">C#/.NET</button> 12028 <button class="other-btn">â¨MCP & Other</button> 12029</div> 12030 12031<div class="python-code"> 12032 <pre><code class="python"> 12033import requests 12034 12035# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12036url = 'https://www.alphavantage.co/query?function=RETAIL_SALES&apikey=demo' 12037r = requests.get(url) 12038data = r.json() 12039 12040print(data) 12041 </code></pre> 12042</div> 12043 12044<div class="node-code"> 12045 <pre><code class="javascript"> 12046'use strict'; 12047var request = require('request'); 12048 12049// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12050var url = 'https://www.alphavantage.co/query?function=RETAIL_SALES&apikey=demo'; 12051 12052request.get({ 12053 url: url, 12054 json: true, 12055 headers: {'User-Agent': 'request'} 12056 }, (err, res, data) => { 12057 if (err) { 12058 console.log('Error:', err); 12059 } else if (res.statusCode !== 200) { 12060 console.log('Status:', res.statusCode); 12061 } else { 12062 // data is successfully parsed as a JSON object: 12063 console.log(data); 12064 } 12065}); 12066 </code></pre> 12067</div> 12068 12069<div class="php-code"> 12070 <pre><code class="php"> 12071<?php 12072// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12073$json = file_get_contents('https://www.alphavantage.co/query?function=RETAIL_SALES&apikey=demo'); 12074 12075$data = json_decode($json,true); 12076 12077print_r($data); 12078 12079exit; 12080 </code></pre> 12081</div> 12082 12083<div class="cs-code"> 12084 <pre><code class="cs"> 12085using System; 12086using System.Collections.Generic; 12087using System.Net; 12088
12089// ------------------------------------------------------------------------- 12090// if using .NET Framework 12091// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12092// This requires including the reference to System.Web.Extensions in your project 12093using System.Web.Script.Serialization; 12094// ------------------------------------------------------------------------- 12095// if using .Net Core 12096// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 12097using System.Text.Json; 12098// ------------------------------------------------------------------------- 12099 12100namespace ConsoleTests 12101{ 12102 internal class Program 12103 { 12104 private static void Main(string[] args) 12105 { 12106 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12107 string QUERY_URL = "https://www.alphavantage.co/query?function=RETAIL_SALES&apikey=demo" 12108 Uri queryUri = new Uri(QUERY_URL); 12109 12110 using (WebClient client = new WebClient()) 12111 { 12112 // ------------------------------------------------------------------------- 12113 // if using .NET Framework (System.Web.Script.Serialization) 12114 12115 JavaScriptSerializer js = new JavaScriptSerializer(); 12116 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 12117 12118 // ------------------------------------------------------------------------- 12119 // if using .NET Core (System.Text.Json) 12120 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 12121 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 12122 12123 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 12124 12125 // ------------------------------------------------------------------------- 12126 12127 // do something with the json_data 12128 } 12129 } 12130 } 12131} 12132 </code></pre> 12133</div> 12134 12135 12136<div class="other-code" style="background-color: #f9f9f9;"> 12137 <br> 12138 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 12139 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 12140 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 12141 <br> 12142</div> 12143 12144 <br> 12145 12146 12147 <h4 id="durable-goods">DURABLES</h4> 12148 <br> 12149 <p>This API returns the monthly manufacturers' new orders of durable goods in the United States.</p> 12150 <p>Source: U.S. Census Bureau, Manufacturers' New Orders: Durable Goods, retrieved from FRED, Federal Reserve Bank of St. Louis (https://fred.stlouisfed.org/series/UMDMNO). This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 12151 <br> 12152 <h6><b>API Parameters</b></h6> 12153 <p><b>â Required: <code>function</code></b></p> 12154 <p>The function of your choice. In this case, <code>function=DURABLES</code> </p> 12155 <p>â Optional: <code>datatype</code></p> 12156 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12157 <p><b>â Required: <code>apikey</code></b></p> 12158 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12159 <br> 12160 12161 <h6><b>Examples (click for JSON output)</b></h6> 12162 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DURABLES&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=DURABLES&apikey=demo</code></a></p> 12163 <br> 12164 12165 <h6><b>Language-specific guides</b></h6> 12166 <div> 12167 <button class="python-btn">Python</button> 12168 <button class="node-btn">NodeJS</button> 12169 <button class="php-btn">PHP</button> 12170 <button class="cs-btn">C#/.NET</button> 12171 <button class="other-btn">â¨MCP & Other</button> 12172</div> 12173 12174<div class="python-code"> 12175 <pre><code class="python"> 12176import requests 12177 12178# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12179url = 'https://www.alphavantage.co/query?function=DURABLES&apikey=demo' 12180r = requests.get(url) 12181data = r.json() 12182 12183print(data) 12184 </code></pre> 12185</div> 12186 12187<div class="node-code"> 12188 <pre><code class="javascript"> 12189'use strict'; 12190var request = require('request'); 12191 12192// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12193var url = 'https://www.alphavantage.co/query?function=DURABLES&apikey=demo'; 12194 12195request.get({ 12196 url: url, 12197 json: true, 12198 headers: {'User-Agent': 'request'} 12199 }, (err, res, data) => { 12200 if (err) { 12201 console.log('Error:', err); 12202 } else if (res.statusCode !== 200) { 12203 console.log('Status:', res.statusCode); 12204 } else { 12205 // data is successfully parsed as a JSON object: 12206 console.log(data); 12207 } 12208}); 12209 </code></pre> 12210</div> 12211 12212<div class="php-code"> 12213 <pre><code class="php"> 12214<?php 12215// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12216$json = file_get_contents('https://www.alphavantage.co/query?function=DURABLES&apikey=demo'); 12217 12218$data = json_decode($json,true); 12219 12220print_r($data); 12221 12222exit; 12223 </code></pre> 12224</div> 12225 12226<div class="cs-code"> 12227 <pre><code class="cs"> 12228using System; 12229using System.Collections.Generic; 12230using System.Net; 12231
12232// ------------------------------------------------------------------------- 12233// if using .NET Framework 12234// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12235// This requires including the reference to System.Web.Extensions in your project 12236using System.Web.Script.Serialization; 12237// ------------------------------------------------------------------------- 12238// if using .Net Core 12239// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 12240using System.Text.Json; 12241// ------------------------------------------------------------------------- 12242 12243namespace ConsoleTests 12244{ 12245 internal class Program 12246 { 12247 private static void Main(string[] args) 12248 { 12249 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12250 string QUERY_URL = "https://www.alphavantage.co/query?function=DURABLES&apikey=demo" 12251 Uri queryUri = new Uri(QUERY_URL); 12252 12253 using (WebClient client = new WebClient()) 12254 { 12255 // ------------------------------------------------------------------------- 12256 // if using .NET Framework (System.Web.Script.Serialization) 12257 12258 JavaScriptSerializer js = new JavaScriptSerializer(); 12259 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 12260 12261 // ------------------------------------------------------------------------- 12262 // if using .NET Core (System.Text.Json) 12263 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 12264 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 12265 12266 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 12267 12268 // ------------------------------------------------------------------------- 12269 12270 // do something with the json_data 12271 } 12272 } 12273 } 12274} 12275 </code></pre> 12276</div> 12277 12278 12279<div class="other-code" style="background-color: #f9f9f9;"> 12280 <br> 12281 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 12282 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 12283 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 12284 <br> 12285</div> 12286 12287 <br> 12288 12289 12290 <h4 id="unemployment">UNEMPLOYMENT</h4> 12291 <br> 12292 <p>This API returns the monthly unemployment data of the United States. The unemployment rate represents the number of unemployed as a percentage of the labor force. Labor force data are restricted to people 16 years of age and older, who currently reside in 1 of the 50 states or the District of Columbia, who do not reside in institutions (e.g., penal and mental facilities, homes for the aged), and who are not on active duty in the Armed Forces (<a href="https://fred.stlouisfed.org/series/UNRATE" target="_blank">source</a>).</p> 12293 <p>Source: U.S. Bureau of Labor Statistics, Unemployment Rate, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 12294 <br> 12295 <h6><b>API Parameters</b></h6> 12296 <p><b>â Required: <code>function</code></b></p> 12297 <p>The function of your choice. In this case, <code>function=UNEMPLOYMENT</code> </p> 12298 <p>â Optional: <code>datatype</code></p> 12299 <p>
12299By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12300 <p><b>â Required: <code>apikey</code></b></p> 12301 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12302 <br> 12303 12304 <h6><b>Examples (click for JSON output)</b></h6> 12305 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=UNEMPLOYMENT&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=UNEMPLOYMENT&apikey=demo</code></a></p> 12306 <br> 12307 12308 <h6><b>Language-specific guides</b></h6> 12309 <div> 12310 <button class="python-btn">Python</button> 12311 <button class="node-btn">NodeJS</button> 12312 <button class="php-btn">PHP</button> 12313 <button class="cs-btn">C#/.NET</button> 12314 <button class="other-btn">â¨MCP & Other</button> 12315</div> 12316 12317<div class="python-code"> 12318 <pre><code class="python"> 12319import requests 12320 12321# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12322url = 'https://www.alphavantage.co/query?function=UNEMPLOYMENT&apikey=demo' 12323r = requests.get(url) 12324data = r.json() 12325 12326print(data) 12327 </code></pre> 12328</div> 12329 12330<div class="node-code"> 12331 <pre><code class="javascript"> 12332'use strict'; 12333var request = require('request'); 12334 12335// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12336var url = 'https://www.alphavantage.co/query?function=UNEMPLOYMENT&apikey=demo'; 12337 12338request.get({ 12339 url: url, 12340 json: true, 12341 headers: {'User-Agent': 'request'} 12342 }, (err, res, data) => { 12343 if (err) { 12344 console.log('Error:', err); 12345 } else if (res.statusCode !== 200) { 12346 console.log('Status:', res.statusCode); 12347 } else { 12348 // data is successfully parsed as a JSON object: 12349 console.log(data); 12350 } 12351}); 12352 </code></pre> 12353</div> 12354 12355<div class="php-code"> 12356 <pre><code class="php"> 12357<?php 12358// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12359$json = file_get_contents('https://www.alphavantage.co/query?function=UNEMPLOYMENT&apikey=demo'); 12360 12361$data = json_decode($json,true); 12362 12363print_r($data); 12364 12365exit; 12366 </code></pre> 12367</div> 12368 12369<div class="cs-code"> 12370 <pre><code class="cs"> 12371using System; 12372using System.Collections.Generic; 12373using System.Net; 12374 12375// ------------------------------------------------------------------------- 12376// if using .NET Framework 12377// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12378// This requires including the reference to System.Web.Extensions in your project 12379using System.Web.Script.Serialization; 12380// ------------------------------------------------------------------------- 12381// if using .Net Core 12382// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 12383using System.Text.Json; 12384// ------------------------------------------------------------------------- 12385 12386namespace ConsoleTests 12387{ 12388 internal class Program 12389 { 12390 private static void Main(string[] args) 12391 { 12392 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12393 string QUERY_URL = "https://www.alphavantage.co/query?function=UNEMPLOYMENT&apikey=demo" 12394 Uri queryUri = new Uri(QUERY_URL); 12395 12396 using (WebClient client = new WebClient()) 12397 { 12398 // ------------------------------------------------------------------------- 12399 // if using .NET Framework (System.Web.Script.Serialization) 12400 12401 JavaScriptSerializer js = new JavaScriptSerializer(); 12402 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 12403 12404 // ------------------------------------------------------------------------- 12405 // if using .NET Core (System.Text.Json) 12406 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 12407 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 12408 12409 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 12410 12411 // ------------------------------------------------------------------------- 12412
12413 // do something with the json_data 12414 } 12415 } 12416 } 12417} 12418 </code></pre> 12419</div> 12420 12421 12422<div class="other-code" style="background-color: #f9f9f9;"> 12423 <br> 12424 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 12425 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 12426 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 12427 <br> 12428</div> 12429 12430 <br> 12431 12432 12433 <h4 id="nonfarm-payroll">NONFARM_PAYROLL</h4> 12434 <br> 12435 <p>This API returns the monthly US All Employees: Total Nonfarm (commonly known as Total Nonfarm Payroll), a measure of the number of U.S. workers in the economy that excludes proprietors, private household employees, unpaid volunteers, farm employees, and the unincorporated self-employed.</p> 12436 <p>Source: U.S. Bureau of Labor Statistics, All Employees, Total Nonfarm, retrieved from FRED, Federal Reserve Bank of St. Louis. This data feed uses the FRED® API but is <u>not</u> endorsed or certified by the Federal Reserve Bank of St. Louis. By using this data feed, you agree to be bound by the <a href="https://fred.stlouisfed.org/docs/api/terms_of_use.html" target="_blank">FRED® API Terms of Use</a>.</p> 12437 <br> 12438 <h6><b>API Parameters</b></h6> 12439 <p><b>â Required: <code>function</code></b></p> 12440 <p>The function of your choice. In this case, <code>function=NONFARM_PAYROLL</code> </p> 12441 <p>â Optional: <code>datatype</code></p> 12442 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12443 <p><b>â Required: <code>apikey</code></b></p> 12444 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12445 <br> 12446 12447 <h6><b>Examples (click for JSON output)</b></h6> 12448 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=NONFARM_PAYROLL&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?function=NONFARM_PAYROLL&apikey=demo</code></a></p> 12449 <br> 12450 12451 <h6><b>Language-specific guides</b></h6> 12452 <div> 12453 <button class="python-btn">Python</button> 12454 <button class="node-btn">NodeJS</button> 12455 <button class="php-btn">PHP</button> 12456 <button class="cs-btn">C#/.NET</button> 12457 <button class="other-btn">â¨MCP & Other</button> 12458</div> 12459 12460<div class="python-code"> 12461 <pre><code class="python"> 12462import requests 12463 12464# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12465url = 'https://www.alphavantage.co/query?function=NONFARM_PAYROLL&apikey=demo' 12466r = requests.get(url) 12467data = r.json() 12468 12469print(data) 12470 </code></pre> 12471</div> 12472 12473<div class="node-code"> 12474 <pre><code class="javascript"> 12475'use strict'; 12476var request = require('request'); 12477 12478// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12479var url = 'https://www.alphavantage.co/query?function=NONFARM_PAYROLL&apikey=demo'; 12480 12481request.get({ 12482 url: url, 12483 json: true, 12484 headers: {'User-Agent': 'request'} 12485 }, (err, res, data) => { 12486 if (err) { 12487 console.log('Error:', err); 12488 } else if (res.statusCode !== 200) { 12489 console.log('Status:', res.statusCode); 12490 } else { 12491 // data is successfully parsed as a JSON object: 12492 console.log(data); 12493 } 12494}); 12495 </code></pre> 12496</div> 12497 12498<div class="php-code"> 12499 <pre><code class="php"> 12500<?php 12501// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12502$json = file_get_contents('https://www.alphavantage.co/query?function=NONFARM_PAYROLL&apikey=demo'); 12503 12504$data = json_decode($json,true); 12505 12506print_r($data); 12507 12508exit; 12509 </code></pre> 12510</div> 12511 12512<div class="cs-code"> 12513 <pre><code class="cs"> 12514using System; 12515using System.Collections.Generic; 12516using System.Net; 12517
12518// ------------------------------------------------------------------------- 12519// if using .NET Framework 12520// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12521// This requires including the reference to System.Web.Extensions in your project 12522using System.Web.Script.Serialization; 12523// ------------------------------------------------------------------------- 12524// if using .Net Core 12525// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 12526using System.Text.Json; 12527// ------------------------------------------------------------------------- 12528 12529namespace ConsoleTests 12530{ 12531 internal class Program 12532 { 12533 private static void Main(string[] args) 12534 { 12535 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12536 string QUERY_URL = "https://www.alphavantage.co/query?function=NONFARM_PAYROLL&apikey=demo" 12537 Uri queryUri = new Uri(QUERY_URL); 12538 12539 using (WebClient client = new WebClient()) 12540 { 12541 // ------------------------------------------------------------------------- 12542 // if using .NET Framework (System.Web.Script.Serialization) 12543 12544 JavaScriptSerializer js = new JavaScriptSerializer(); 12545 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 12546 12547 // ------------------------------------------------------------------------- 12548 // if using .NET Core (System.Text.Json) 12549 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 12550 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 12551 12552 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 12553 12554 // ------------------------------------------------------------------------- 12555 12556 // do something with the json_data 12557 } 12558 } 12559 } 12560} 12561 </code></pre> 12562</div> 12563 12564 12565<div class="other-code" style="background-color: #f9f9f9;"> 12566 <br> 12567 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 12568 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 12569 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 12570 <br> 12571</div> 12572 12573 <br> 12574 12575 </section> 12576 12577 <section> 12578 <h2 id="technical-indicators">Technical Indicators</h2> 12579 <p>Technical indicator APIs for a given equity or currency exchange pair, derived from the underlying time series based stock API and forex data. All indicators are calculated from <u>adjusted</u> time series data to eliminate artificial price/volume perturbations from historical split and dividend events. </p> 12580 <br> 12581 12582 <h4 id="sma">SMA <span class="popular-label">Trending</span></h4> 12583 <br> 12584 <p>This API returns the simple moving average (SMA) values. See also: <a href="https://www.alphavantage.co/simple_moving_average_sma/" target="_blank">SMA explainer</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=SimpleMA.htm" target="_blank">mathematical reference</a>.</p> 12585 <br> 12586 <h6><b>API Parameters</b></h6> 12587 <p><b>â Required: <code>function</code></b></p> 12588 <p>The technical indicator of your choice. In this case, <code>function=SMA</code> </p> 12589 <p><b>â Required: <code>symbol</code></b></p> 12590 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 12591 <p><b>â Required: <code>interval</code></b></p> 12592 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 12593 <p>â Optional: <code>month</code></p> 12594 <p>
12594By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 12595 <p><b>â Required:<code>time_period</code></b></p> 12596 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 12597 <p><b>â Required: <code>series_type</code></b></p> 12598 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 12599 <p>â Optional: <code>datatype</code></p> 12600 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12601 <p>â Optional: <code>entitlement</code></p> 12602 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 12603 <p><b>â Required: <code>apikey</code></b></p> 12604 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12605 <br> 12606 12607 <h6><b>Examples (click for JSON output)</b></h6> 12608 Equity: 12609 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 12610 Forex (FX) or cryptocurrency pair: 12611 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SMA&symbol=USDEUR&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SMA&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 12612 <br> 12613 12614 12615 <h6><b>Language-specific guides</b></h6> 12616 <div> 12617 <button class="python-btn">Python</button> 12618 <button class="node-btn">NodeJS</button> 12619 <button class="php-btn">PHP</button> 12620 <button class="cs-btn">C#/.NET</button> 12621 <button class="other-btn">â¨MCP & Other</button> 12622</div> 12623 12624<div class="python-code"> 12625 <pre><code class="python"> 12626import requests 12627 12628# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12629url = 'https://www.alphavantage.co/query?function=SMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 12630r = requests.get(url) 12631data = r.json() 12632 12633print(data) 12634 </code></pre> 12635</div> 12636 12637<div class="node-code"> 12638 <pre><code class="javascript"> 12639'use strict'; 12640var request = require('request'); 12641 12642// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12643var url = 'https://www.alphavantage.co/query?function=SMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 12644 12645request.get({ 12646 url: url, 12647 json: true, 12648 headers: {'User-Agent': 'request'} 12649 }, (err, res, data) => { 12650 if (err) { 12651 console.log('Error:', err); 12652 } else if (res.statusCode !== 200) { 12653 console.log('Status:', res.statusCode); 12654 } else { 12655 // data is successfully parsed as a JSON object: 12656 console.log(data); 12657 } 12658}); 12659 </code></pre> 12660</div> 12661 12662<div class="php-code"> 12663 <pre><code class="php"> 12664<?php 12665// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12666$json = file_get_contents('https://www.alphavantage.co/query?function=SMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 12667 12668$data = json_decode($json,true); 12669 12670print_r($data); 12671 12672exit; 12673 </code></pre> 12674</div> 12675 12676<div class="cs-code"> 12677 <pre><code class="cs"> 12678using System; 12679using System.Collections.Generic; 12680using System.Net; 12681
12682// ------------------------------------------------------------------------- 12683// if using .NET Framework 12684// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12685// This requires including the reference to System.Web.Extensions in your project 12686using System.Web.Script.Serialization; 12687// ------------------------------------------------------------------------- 12688// if using .Net Core 12689// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 12690using System.Text.Json; 12691// ------------------------------------------------------------------------- 12692 12693namespace ConsoleTests 12694{ 12695 internal class Program 12696 { 12697 private static void Main(string[] args) 12698 { 12699 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12700 string QUERY_URL = "https://www.alphavantage.co/query?function=SMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 12701 Uri queryUri = new Uri(QUERY_URL); 12702 12703 using (WebClient client = new WebClient()) 12704 { 12705 // ------------------------------------------------------------------------- 12706 // if using .NET Framework (System.Web.Script.Serialization) 12707 12708 JavaScriptSerializer js = new JavaScriptSerializer(); 12709 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 12710 12711 // ------------------------------------------------------------------------- 12712 // if using .NET Core (System.Text.Json) 12713 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 12714 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 12715 12716 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 12717 12718 // ------------------------------------------------------------------------- 12719 12720 // do something with the json_data 12721 } 12722 } 12723 } 12724} 12725 </code></pre> 12726</div> 12727 12728 12729<div class="other-code" style="background-color: #f9f9f9;"> 12730 <br> 12731 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 12732 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 12733 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 12734 <br> 12735</div> 12736 12737 <br> 12738 12739 <h4 id="ema">EMA <span class="popular-label">Trending</span></h4> 12740 <br> 12741 <p>This API returns the exponential moving average (EMA) values. See also: <a href="https://www.alphavantage.co/exponential_moving_average_ema/" target="_blank">EMA explainer</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=ExpMA.htm" target="_blank">mathematical reference</a>.</p> 12742 <br> 12743 <h6><b>API Parameters</b></h6> 12744 <p><b>â Required: <code>function</code></b></p> 12745 <p>The technical indicator of your choice. In this case, <code>function=EMA</code> </p> 12746 <p><b>â Required: <code>symbol</code></b></p> 12747 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 12748 <p><b>â Required: <code>interval</code></b></p> 12749 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 12750 <p>â Optional: <code>month</code></p> 12751 <p>
12751By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 12752 <p><b>â Required:<code>time_period</code></b></p> 12753 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 12754 <p><b>â Required: <code>series_type</code></b></p> 12755 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 12756 <p>â Optional: <code>datatype</code></p> 12757 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12758 <p>â Optional: <code>entitlement</code></p> 12759 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 12760 <p><b>â Required: <code>apikey</code></b></p> 12761 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12762 <br> 12763 12764 <h6><b>Examples (click for JSON output)</b></h6> 12765 Equity: 12766 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 12767 Forex (FX) or cryptocurrency pair: 12768 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=EMA&symbol=USDEUR&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=EMA&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 12769 <br> 12770 12771 12772 <h6><b>Language-specific guides</b></h6> 12773 <div> 12774 <button class="python-btn">Python</button> 12775 <button class="node-btn">NodeJS</button> 12776 <button class="php-btn">PHP</button> 12777 <button class="cs-btn">C#/.NET</button> 12778 <button class="other-btn">â¨MCP & Other</button> 12779</div> 12780 12781<div class="python-code"> 12782 <pre><code class="python"> 12783import requests 12784 12785# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12786url = 'https://www.alphavantage.co/query?function=EMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 12787r = requests.get(url) 12788data = r.json() 12789 12790print(data) 12791 </code></pre> 12792</div> 12793 12794<div class="node-code"> 12795 <pre><code class="javascript"> 12796'use strict'; 12797var request = require('request'); 12798 12799// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12800var url = 'https://www.alphavantage.co/query?function=EMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 12801 12802request.get({ 12803 url: url, 12804 json: true, 12805 headers: {'User-Agent': 'request'} 12806 }, (err, res, data) => { 12807 if (err) { 12808 console.log('Error:', err); 12809 } else if (res.statusCode !== 200) { 12810 console.log('Status:', res.statusCode); 12811 } else { 12812 // data is successfully parsed as a JSON object: 12813 console.log(data); 12814 } 12815}); 12816 </code></pre> 12817</div> 12818 12819<div class="php-code"> 12820 <pre><code class="php"> 12821<?php 12822// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12823$json = file_get_contents('https://www.alphavantage.co/query?function=EMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 12824 12825$data = json_decode($json,true); 12826 12827print_r($data); 12828 12829exit; 12830 </code></pre> 12831</div> 12832 12833<div class="cs-code"> 12834 <pre><code class="cs"> 12835using System; 12836using System.Collections.Generic; 12837using System.Net; 12838
12839// ------------------------------------------------------------------------- 12840// if using .NET Framework 12841// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12842// This requires including the reference to System.Web.Extensions in your project 12843using System.Web.Script.Serialization; 12844// ------------------------------------------------------------------------- 12845// if using .Net Core 12846// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 12847using System.Text.Json; 12848// ------------------------------------------------------------------------- 12849 12850namespace ConsoleTests 12851{ 12852 internal class Program 12853 { 12854 private static void Main(string[] args) 12855 { 12856 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12857 string QUERY_URL = "https://www.alphavantage.co/query?function=EMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 12858 Uri queryUri = new Uri(QUERY_URL); 12859 12860 using (WebClient client = new WebClient()) 12861 { 12862 // ------------------------------------------------------------------------- 12863 // if using .NET Framework (System.Web.Script.Serialization) 12864 12865 JavaScriptSerializer js = new JavaScriptSerializer(); 12866 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 12867 12868 // ------------------------------------------------------------------------- 12869 // if using .NET Core (System.Text.Json) 12870 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 12871 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 12872 12873 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 12874 12875 // ------------------------------------------------------------------------- 12876 12877 // do something with the json_data 12878 } 12879 } 12880 } 12881} 12882 </code></pre> 12883</div> 12884 12885 12886<div class="other-code" style="background-color: #f9f9f9;"> 12887 <br> 12888 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 12889 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 12890 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 12891 <br> 12892</div> 12893 12894 <br> 12895 12896 <h4 id="wma">WMA</h4> 12897 <br> 12898 <p>This API returns the weighted moving average (WMA) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=WeightedMA.htm" target="_blank">mathematical reference</a>.</p> 12899 <br> 12900 <h6><b>API Parameters</b></h6> 12901 <p><b>â Required: <code>function</code></b></p> 12902 <p>The technical indicator of your choice. In this case, <code>function=WMA</code> </p> 12903 <p><b>â Required: <code>symbol</code></b></p> 12904 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 12905 <p><b>â Required: <code>interval</code></b></p> 12906 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 12907 <p>â Optional: <code>month</code></p> 12908 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 12909 <p><b>â Required:<code>time_period</code></b></p> 12910 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 12911 <p><b>â Required: <code>series_type</code></b></p> 12912 <p>
12912The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 12913 <p>â Optional: <code>datatype</code></p> 12914 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 12915 <p>â Optional: <code>entitlement</code></p> 12916 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 12917 <p><b>â Required: <code>apikey</code></b></p> 12918 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 12919 <br> 12920 12921 <h6><b>Examples (click for JSON output)</b></h6> 12922 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=WMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=WMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 12923 <br> 12924 12925 <h6><b>Language-specific guides</b></h6> 12926 <div> 12927 <button class="python-btn">Python</button> 12928 <button class="node-btn">NodeJS</button> 12929 <button class="php-btn">PHP</button> 12930 <button class="cs-btn">C#/.NET</button> 12931 <button class="other-btn">â¨MCP & Other</button> 12932</div> 12933 12934<div class="python-code"> 12935 <pre><code class="python"> 12936import requests 12937 12938# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12939url = 'https://www.alphavantage.co/query?function=WMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 12940r = requests.get(url) 12941data = r.json() 12942 12943print(data) 12944 </code></pre> 12945</div> 12946 12947<div class="node-code"> 12948 <pre><code class="javascript"> 12949'use strict'; 12950var request = require('request'); 12951 12952// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12953var url = 'https://www.alphavantage.co/query?function=WMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 12954 12955request.get({ 12956 url: url, 12957 json: true, 12958 headers: {'User-Agent': 'request'} 12959 }, (err, res, data) => { 12960 if (err) { 12961 console.log('Error:', err); 12962 } else if (res.statusCode !== 200) { 12963 console.log('Status:', res.statusCode); 12964 } else { 12965 // data is successfully parsed as a JSON object: 12966 console.log(data); 12967 } 12968}); 12969 </code></pre> 12970</div> 12971 12972<div class="php-code"> 12973 <pre><code class="php"> 12974<?php 12975// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 12976$json = file_get_contents('https://www.alphavantage.co/query?function=WMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 12977 12978$data = json_decode($json,true); 12979 12980print_r($data); 12981 12982exit; 12983 </code></pre> 12984</div> 12985 12986<div class="cs-code"> 12987 <pre><code class="cs"> 12988using System; 12989using System.Collections.Generic; 12990using System.Net; 12991 12992// ------------------------------------------------------------------------- 12993// if using .NET Framework 12994// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 12995// This requires including the reference to System.Web.Extensions in your project 12996using System.Web.Script.Serialization; 12997// ------------------------------------------------------------------------- 12998// if using .Net Core 12999// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13000using System.Text.Json; 13001// ------------------------------------------------------------------------- 13002 13003namespace ConsoleTests 13004{
13005 internal class Program 13006 { 13007 private static void Main(string[] args) 13008 { 13009 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13010 string QUERY_URL = "https://www.alphavantage.co/query?function=WMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 13011 Uri queryUri = new Uri(QUERY_URL); 13012 13013 using (WebClient client = new WebClient()) 13014 { 13015 // ------------------------------------------------------------------------- 13016 // if using .NET Framework (System.Web.Script.Serialization) 13017 13018 JavaScriptSerializer js = new JavaScriptSerializer(); 13019 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13020 13021 // ------------------------------------------------------------------------- 13022 // if using .NET Core (System.Text.Json) 13023 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13024 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13025 13026 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13027 13028 // ------------------------------------------------------------------------- 13029 13030 // do something with the json_data 13031 } 13032 } 13033 } 13034} 13035 </code></pre> 13036</div> 13037 13038 13039<div class="other-code" style="background-color: #f9f9f9;"> 13040 <br> 13041 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13042 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13043 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13044 <br> 13045</div> 13046 13047 <br> 13048 13049 <h4 id="dema">DEMA</h4> 13050 <br> 13051 <p>This API returns the double exponential moving average (DEMA) values. See also: <a href="http://www.investopedia.com/articles/trading/10/double-exponential-moving-average.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=DEMA.htm" target="_blank">mathematical reference</a>.</p> 13052 <br> 13053 <h6><b>API Parameters</b></h6> 13054 <p><b>â Required: <code>function</code></b></p> 13055 <p>The technical indicator of your choice. In this case, <code>function=DEMA</code> </p> 13056 <p><b>â Required: <code>symbol</code></b></p> 13057 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13058 <p><b>â Required: <code>interval</code></b></p> 13059 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 13060 <p>â Optional: <code>month</code></p> 13061 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13062 <p><b>â Required:<code>time_period</code></b></p> 13063 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 13064 <p><b>â Required: <code>series_type</code></b></p> 13065 <p>
13065The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 13066 <p>â Optional: <code>datatype</code></p> 13067 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13068 <p>â Optional: <code>entitlement</code></p> 13069 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13070 <p><b>â Required: <code>apikey</code></b></p> 13071 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13072 <br> 13073 13074 <h6><b>Examples (click for JSON output)</b></h6> 13075 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=DEMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 13076 <br> 13077 13078 <h6><b>Language-specific guides</b></h6> 13079 <div> 13080 <button class="python-btn">Python</button> 13081 <button class="node-btn">NodeJS</button> 13082 <button class="php-btn">PHP</button> 13083 <button class="cs-btn">C#/.NET</button> 13084 <button class="other-btn">â¨MCP & Other</button> 13085</div> 13086 13087<div class="python-code"> 13088 <pre><code class="python"> 13089import requests 13090 13091# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13092url = 'https://www.alphavantage.co/query?function=DEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 13093r = requests.get(url) 13094data = r.json() 13095 13096print(data) 13097 </code></pre> 13098</div> 13099 13100<div class="node-code"> 13101 <pre><code class="javascript"> 13102'use strict'; 13103var request = require('request'); 13104 13105// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13106var url = 'https://www.alphavantage.co/query?function=DEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 13107 13108request.get({ 13109 url: url, 13110 json: true, 13111 headers: {'User-Agent': 'request'} 13112 }, (err, res, data) => { 13113 if (err) { 13114 console.log('Error:', err); 13115 } else if (res.statusCode !== 200) { 13116 console.log('Status:', res.statusCode); 13117 } else { 13118 // data is successfully parsed as a JSON object: 13119 console.log(data); 13120 } 13121}); 13122 </code></pre> 13123</div> 13124 13125<div class="php-code"> 13126 <pre><code class="php"> 13127<?php 13128// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13129$json = file_get_contents('https://www.alphavantage.co/query?function=DEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 13130 13131$data = json_decode($json,true); 13132 13133print_r($data); 13134 13135exit; 13136 </code></pre> 13137</div> 13138 13139<div class="cs-code"> 13140 <pre><code class="cs"> 13141using System; 13142using System.Collections.Generic; 13143using System.Net; 13144 13145// ------------------------------------------------------------------------- 13146// if using .NET Framework 13147// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 13148// This requires including the reference to System.Web.Extensions in your project 13149using System.Web.Script.Serialization; 13150// ------------------------------------------------------------------------- 13151// if using .Net Core 13152// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13153using System.Text.Json; 13154// ------------------------------------------------------------------------- 13155 13156namespace ConsoleTests 13157{
13158 internal class Program 13159 { 13160 private static void Main(string[] args) 13161 { 13162 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13163 string QUERY_URL = "https://www.alphavantage.co/query?function=DEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 13164 Uri queryUri = new Uri(QUERY_URL); 13165 13166 using (WebClient client = new WebClient()) 13167 { 13168 // ------------------------------------------------------------------------- 13169 // if using .NET Framework (System.Web.Script.Serialization) 13170 13171 JavaScriptSerializer js = new JavaScriptSerializer(); 13172 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13173 13174 // ------------------------------------------------------------------------- 13175 // if using .NET Core (System.Text.Json) 13176 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13177 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13178 13179 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13180 13181 // ------------------------------------------------------------------------- 13182 13183 // do something with the json_data 13184 } 13185 } 13186 } 13187} 13188 </code></pre> 13189</div> 13190 13191 13192<div class="other-code" style="background-color: #f9f9f9;"> 13193 <br> 13194 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13195 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13196 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13197 <br> 13198</div> 13199 13200 <br> 13201 13202 <h4 id="tema">TEMA</h4> 13203 <br> 13204 <p>This API returns the triple exponential moving average (TEMA) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=TEMA.htm" target="_blank">mathematical reference</a>.</p> 13205 <br> 13206 <h6><b>API Parameters</b></h6> 13207 <p><b>â Required: <code>function</code></b></p> 13208 <p>The technical indicator of your choice. In this case, <code>function=TEMA</code> </p> 13209 <p><b>â Required: <code>symbol</code></b></p> 13210 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13211 <p><b>â Required: <code>interval</code></b></p> 13212 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 13213 <p>â Optional: <code>month</code></p> 13214 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13215 <p><b>â Required:<code>time_period</code></b></p> 13216 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 13217 <p><b>â Required: <code>series_type</code></b></p> 13218 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 13219 <p>â Optional: <code>datatype</code></p> 13220 <p>
13220By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13221 <p>â Optional: <code>entitlement</code></p> 13222 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13223 <p><b>â Required: <code>apikey</code></b></p> 13224 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13225 <br> 13226 13227 <h6><b>Examples (click for JSON output)</b></h6> 13228 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TEMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 13229 <br> 13230 13231 <h6><b>Language-specific guides</b></h6> 13232 <div> 13233 <button class="python-btn">Python</button> 13234 <button class="node-btn">NodeJS</button> 13235 <button class="php-btn">PHP</button> 13236 <button class="cs-btn">C#/.NET</button> 13237 <button class="other-btn">â¨MCP & Other</button> 13238</div> 13239 13240<div class="python-code"> 13241 <pre><code class="python"> 13242import requests 13243 13244# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13245url = 'https://www.alphavantage.co/query?function=TEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 13246r = requests.get(url) 13247data = r.json() 13248 13249print(data) 13250 </code></pre> 13251</div> 13252 13253<div class="node-code"> 13254 <pre><code class="javascript"> 13255'use strict'; 13256var request = require('request'); 13257 13258// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13259var url = 'https://www.alphavantage.co/query?function=TEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 13260 13261request.get({ 13262 url: url, 13263 json: true, 13264 headers: {'User-Agent': 'request'} 13265 }, (err, res, data) => { 13266 if (err) { 13267 console.log('Error:', err); 13268 } else if (res.statusCode !== 200) { 13269 console.log('Status:', res.statusCode); 13270 } else { 13271 // data is successfully parsed as a JSON object: 13272 console.log(data); 13273 } 13274}); 13275 </code></pre> 13276</div> 13277 13278<div class="php-code"> 13279 <pre><code class="php"> 13280<?php 13281// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13282$json = file_get_contents('https://www.alphavantage.co/query?function=TEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 13283 13284$data = json_decode($json,true); 13285 13286print_r($data); 13287 13288exit; 13289 </code></pre> 13290</div> 13291 13292<div class="cs-code"> 13293 <pre><code class="cs"> 13294using System; 13295using System.Collections.Generic; 13296using System.Net; 13297 13298// ------------------------------------------------------------------------- 13299// if using .NET Framework 13300// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 13301// This requires including the reference to System.Web.Extensions in your project 13302using System.Web.Script.Serialization; 13303// ------------------------------------------------------------------------- 13304// if using .Net Core 13305// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13306using System.Text.Json; 13307// ------------------------------------------------------------------------- 13308 13309namespace ConsoleTests 13310{ 13311 internal class Program 13312 { 13313 private static void Main(string[] args) 13314 { 13315 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
13316 string QUERY_URL = "https://www.alphavantage.co/query?function=TEMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 13317 Uri queryUri = new Uri(QUERY_URL); 13318 13319 using (WebClient client = new WebClient()) 13320 { 13321 // ------------------------------------------------------------------------- 13322 // if using .NET Framework (System.Web.Script.Serialization) 13323 13324 JavaScriptSerializer js = new JavaScriptSerializer(); 13325 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13326 13327 // ------------------------------------------------------------------------- 13328 // if using .NET Core (System.Text.Json) 13329 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13330 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13331 13332 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13333 13334 // ------------------------------------------------------------------------- 13335 13336 // do something with the json_data 13337 } 13338 } 13339 } 13340} 13341 </code></pre> 13342</div> 13343 13344 13345<div class="other-code" style="background-color: #f9f9f9;"> 13346 <br> 13347 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13348 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13349 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13350 <br> 13351</div> 13352 13353 <br> 13354 13355 <h4 id="trima">TRIMA</h4> 13356 <br> 13357 <p>This API returns the triangular moving average (TRIMA) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=TriangularMA.htm" target="_blank">mathematical reference</a>.</p> 13358 <br> 13359 <h6><b>API Parameters</b></h6> 13360 <p><b>â Required: <code>function</code></b></p> 13361 <p>The technical indicator of your choice. In this case, <code>function=TRIMA</code> </p> 13362 <p><b>â Required: <code>symbol</code></b></p> 13363 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13364 <p><b>â Required: <code>interval</code></b></p> 13365 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 13366 <p>â Optional: <code>month</code></p> 13367 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13368 <p><b>â Required:<code>time_period</code></b></p> 13369 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 13370 <p><b>â Required: <code>series_type</code></b></p> 13371 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 13372 <p>â Optional: <code>datatype</code></p> 13373 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13374 <p>â Optional: <code>entitlement</code></p> 13375 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
13375realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13376 <p><b>â Required: <code>apikey</code></b></p> 13377 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13378 <br> 13379 13380 <h6><b>Examples (click for JSON output)</b></h6> 13381 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TRIMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TRIMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 13382 <br> 13383 13384 <h6><b>Language-specific guides</b></h6> 13385 <div> 13386 <button class="python-btn">Python</button> 13387 <button class="node-btn">NodeJS</button> 13388 <button class="php-btn">PHP</button> 13389 <button class="cs-btn">C#/.NET</button> 13390 <button class="other-btn">â¨MCP & Other</button> 13391</div> 13392 13393<div class="python-code"> 13394 <pre><code class="python"> 13395import requests 13396 13397# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13398url = 'https://www.alphavantage.co/query?function=TRIMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 13399r = requests.get(url) 13400data = r.json() 13401 13402print(data) 13403 </code></pre> 13404</div> 13405 13406<div class="node-code"> 13407 <pre><code class="javascript"> 13408'use strict'; 13409var request = require('request'); 13410 13411// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13412var url = 'https://www.alphavantage.co/query?function=TRIMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 13413 13414request.get({ 13415 url: url, 13416 json: true, 13417 headers: {'User-Agent': 'request'} 13418 }, (err, res, data) => { 13419 if (err) { 13420 console.log('Error:', err); 13421 } else if (res.statusCode !== 200) { 13422 console.log('Status:', res.statusCode); 13423 } else { 13424 // data is successfully parsed as a JSON object: 13425 console.log(data); 13426 } 13427}); 13428 </code></pre> 13429</div> 13430 13431<div class="php-code"> 13432 <pre><code class="php"> 13433<?php 13434// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13435$json = file_get_contents('https://www.alphavantage.co/query?function=TRIMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 13436 13437$data = json_decode($json,true); 13438 13439print_r($data); 13440 13441exit; 13442 </code></pre> 13443</div> 13444 13445<div class="cs-code"> 13446 <pre><code class="cs"> 13447using System; 13448using System.Collections.Generic; 13449using System.Net; 13450 13451// ------------------------------------------------------------------------- 13452// if using .NET Framework 13453// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 13454// This requires including the reference to System.Web.Extensions in your project 13455using System.Web.Script.Serialization; 13456// ------------------------------------------------------------------------- 13457// if using .Net Core 13458// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13459using System.Text.Json; 13460// ------------------------------------------------------------------------- 13461 13462namespace ConsoleTests 13463{ 13464 internal class Program 13465 { 13466 private static void Main(string[] args) 13467 { 13468 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13469 string QUERY_URL = "https://www.alphavantage.co/query?function=TRIMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 13470 Uri queryUri = new Uri(QUERY_URL); 13471 13472 using (WebClient client = new WebClient()) 13473 { 13474 // ------------------------------------------------------------------------- 13475 // if using .NET Framework (System.Web.Script.Serialization) 13476 13477 JavaScriptSerializer js = new JavaScriptSerializer(); 13478 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13479 13480 // ------------------------------------------------------------------------- 13481 // if using .NET Core (System.Text.Json) 13482 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13483 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13484 13485 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13486 13487 // ------------------------------------------------------------------------- 13488
13489 // do something with the json_data 13490 } 13491 } 13492 } 13493} 13494 </code></pre> 13495</div> 13496 13497 13498<div class="other-code" style="background-color: #f9f9f9;"> 13499 <br> 13500 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13501 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13502 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13503 <br> 13504</div> 13505 13506 <br> 13507 13508 <h4 id="kama">KAMA</h4> 13509 <br> 13510 <p>This API returns the Kaufman adaptive moving average (KAMA) values.</p> 13511 <br> 13512 <h6><b>API Parameters</b></h6> 13513 <p><b>â Required: <code>function</code></b></p> 13514 <p>The technical indicator of your choice. In this case, <code>function=KAMA</code> </p> 13515 <p><b>â Required: <code>symbol</code></b></p> 13516 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13517 <p><b>â Required: <code>interval</code></b></p> 13518 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 13519 <p>â Optional: <code>month</code></p> 13520 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13521 <p><b>â Required:<code>time_period</code></b></p> 13522 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 13523 <p><b>â Required: <code>series_type</code></b></p> 13524 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 13525 <p>â Optional: <code>datatype</code></p> 13526 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13527 <p>â Optional: <code>entitlement</code></p> 13528 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13529 <p><b>â Required: <code>apikey</code></b></p> 13530 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13531 <br> 13532 13533 <h6><b>Examples (click for JSON output)</b></h6> 13534 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=KAMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=KAMA&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 13535 <br> 13536 13537 <h6><b>Language-specific guides</b></h6> 13538 <div> 13539 <button class="python-btn">Python</button> 13540 <button class="node-btn">NodeJS</button> 13541 <button class="php-btn">PHP</button> 13542 <button class="cs-btn">C#/.NET</button> 13543 <button class="other-btn">â¨MCP & Other</button> 13544</div> 13545 13546<div class="python-code"> 13547 <pre><code class="python"> 13548import requests 13549 13550# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13551url = 'https://www.alphavantage.co/query?function=KAMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 13552r = requests.get(url) 13553data = r.json() 13554 13555print(data) 13556 </code></pre> 13557</div> 13558 13559<div class="node-code"> 13560 <pre><code class="javascript"> 13561'use strict'; 13562var request = require('request'); 13563 13564// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13565var url = 'https://www.alphavantage.co/query?function=KAMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 13566 13567request.get({ 13568 url: url, 13569 json: true, 13570 headers: {'User-Agent': 'request'} 13571 }, (err, res, data) => { 13572 if (err) { 13573 console.log('Error:', err); 13574 } else if (res.statusCode !== 200) { 13575 console.log('Status:', res.statusCode); 13576 } else { 13577 // data is successfully parsed as a JSON object: 13578 console.log(data); 13579 } 13580}); 13581 </code></pre> 13582</div> 13583 13584<div class="php-code"> 13585 <pre><code class="php"> 13586<?php 13587// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13588$json = file_get_contents('https://www.alphavantage.co/query?function=KAMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 13589 13590$data = json_decode($json,true); 13591 13592print_r($data); 13593 13594exit; 13595 </code></pre> 13596</div> 13597 13598<div class="cs-code"> 13599 <pre><code class="cs"> 13600using System; 13601using System.Collections.Generic; 13602using System.Net; 13603
13604// ------------------------------------------------------------------------- 13605// if using .NET Framework 13606// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 13607// This requires including the reference to System.Web.Extensions in your project 13608using System.Web.Script.Serialization; 13609// ------------------------------------------------------------------------- 13610// if using .Net Core 13611// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13612using System.Text.Json; 13613// ------------------------------------------------------------------------- 13614 13615namespace ConsoleTests 13616{ 13617 internal class Program 13618 { 13619 private static void Main(string[] args) 13620 { 13621 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13622 string QUERY_URL = "https://www.alphavantage.co/query?function=KAMA&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 13623 Uri queryUri = new Uri(QUERY_URL); 13624 13625 using (WebClient client = new WebClient()) 13626 { 13627 // ------------------------------------------------------------------------- 13628 // if using .NET Framework (System.Web.Script.Serialization) 13629 13630 JavaScriptSerializer js = new JavaScriptSerializer(); 13631 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13632 13633 // ------------------------------------------------------------------------- 13634 // if using .NET Core (System.Text.Json) 13635 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13636 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13637 13638 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13639 13640 // ------------------------------------------------------------------------- 13641 13642 // do something with the json_data 13643 } 13644 } 13645 } 13646} 13647 </code></pre> 13648</div> 13649 13650 13651<div class="other-code" style="background-color: #f9f9f9;"> 13652 <br> 13653 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13654 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13655 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13656 <br> 13657</div> 13658 13659 <br> 13660 13661 <h4 id="mama">MAMA</h4> 13662 <br> 13663 <p>This API returns the MESA adaptive moving average (MAMA) values.</p> 13664 <br> 13665 <h6><b>API Parameters</b></h6> 13666 <p><b>â Required: <code>function</code></b></p> 13667 <p>The technical indicator of your choice. In this case, <code>function=MAMA</code> </p> 13668 <p><b>â Required: <code>symbol</code></b></p> 13669 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13670 <p><b>â Required: <code>interval</code></b></p> 13671 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 13672 <p>â Optional: <code>month</code></p> 13673 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13674 <p><b>â Required: <code>series_type</code></b></p> 13675 <p>
13675The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 13676 <p>â Optional: <code>fastlimit</code></p> 13677 <p>Positive floats are accepted. By default, <code>fastlimit=0.01</code>. </p> 13678 <p>â Optional: <code>slowlimit</code></p> 13679 <p>Positive floats are accepted. By default, <code>slowlimit=0.01</code>. </p> 13680 <p>â Optional: <code>datatype</code></p> 13681 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13682 <p>â Optional: <code>entitlement</code></p> 13683 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13684 <p><b>â Required: <code>apikey</code></b></p> 13685 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13686 <br> 13687 13688 <h6><b>Example (click for JSON output)</b></h6> 13689 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MAMA&symbol=IBM&interval=daily&series_type=close&fastlimit=0.02&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MAMA&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>fastlimit</b>=0.02&<b>apikey</b>=demo</code></a></p> 13690 <br> 13691 13692 <h6><b>Language-specific guides</b></h6> 13693 <div> 13694 <button class="python-btn">Python</button> 13695 <button class="node-btn">NodeJS</button> 13696 <button class="php-btn">PHP</button> 13697 <button class="cs-btn">C#/.NET</button> 13698 <button class="other-btn">â¨MCP & Other</button> 13699</div> 13700 13701<div class="python-code"> 13702 <pre><code class="python"> 13703import requests 13704 13705# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13706url = 'https://www.alphavantage.co/query?function=MAMA&symbol=IBM&interval=daily&series_type=close&fastlimit=0.02&apikey=demo' 13707r = requests.get(url) 13708data = r.json() 13709 13710print(data) 13711 </code></pre> 13712</div> 13713 13714<div class="node-code"> 13715 <pre><code class="javascript"> 13716'use strict'; 13717var request = require('request'); 13718 13719// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13720var url = 'https://www.alphavantage.co/query?function=MAMA&symbol=IBM&interval=daily&series_type=close&fastlimit=0.02&apikey=demo'; 13721 13722request.get({ 13723 url: url, 13724 json: true, 13725 headers: {'User-Agent': 'request'} 13726 }, (err, res, data) => { 13727 if (err) { 13728 console.log('Error:', err); 13729 } else if (res.statusCode !== 200) { 13730 console.log('Status:', res.statusCode); 13731 } else { 13732 // data is successfully parsed as a JSON object: 13733 console.log(data); 13734 } 13735}); 13736 </code></pre> 13737</div> 13738 13739<div class="php-code"> 13740 <pre><code class="php"> 13741<?php 13742// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13743$json = file_get_contents('https://www.alphavantage.co/query?function=MAMA&symbol=IBM&interval=daily&series_type=close&fastlimit=0.02&apikey=demo'); 13744 13745$data = json_decode($json,true); 13746 13747print_r($data); 13748 13749exit; 13750 </code></pre> 13751</div> 13752 13753<div class="cs-code"> 13754 <pre><code class="cs"> 13755using System; 13756using System.Collections.Generic; 13757using System.Net; 13758 13759// ------------------------------------------------------------------------- 13760// if using .NET Framework 13761// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 13762// This requires including the reference to System.Web.Extensions in your project 13763using System.Web.Script.Serialization; 13764// ------------------------------------------------------------------------- 13765// if using .Net Core
13766// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13767using System.Text.Json; 13768// ------------------------------------------------------------------------- 13769 13770namespace ConsoleTests 13771{ 13772 internal class Program 13773 { 13774 private static void Main(string[] args) 13775 { 13776 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13777 string QUERY_URL = "https://www.alphavantage.co/query?function=MAMA&symbol=IBM&interval=daily&series_type=close&fastlimit=0.02&apikey=demo" 13778 Uri queryUri = new Uri(QUERY_URL); 13779 13780 using (WebClient client = new WebClient()) 13781 { 13782 // ------------------------------------------------------------------------- 13783 // if using .NET Framework (System.Web.Script.Serialization) 13784 13785 JavaScriptSerializer js = new JavaScriptSerializer(); 13786 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13787 13788 // ------------------------------------------------------------------------- 13789 // if using .NET Core (System.Text.Json) 13790 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13791 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13792 13793 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13794 13795 // ------------------------------------------------------------------------- 13796 13797 // do something with the json_data 13798 } 13799 } 13800 } 13801} 13802 </code></pre> 13803</div> 13804 13805 13806<div class="other-code" style="background-color: #f9f9f9;"> 13807 <br> 13808 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13809 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13810 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13811 <br> 13812</div> 13813 13814 <br> 13815 13816 <h4 id="vwap">VWAP <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 13817 <br> 13818 <p>This API returns the volume weighted average price (VWAP) for <u>intraday</u> time series. See also: <a href="https://www.investopedia.com/terms/v/vwap.asp" target="_blank">Investopedia article</a>.</p> 13819 <br> 13820 <h6><b>API Parameters</b></h6> 13821 <p><b>â Required: <code>function</code></b></p> 13822 <p>The technical indicator of your choice. In this case, <code>function=VWAP</code> </p> 13823 <p><b>â Required: <code>symbol</code></b></p> 13824 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13825 <p><b>â Required: <code>interval</code></b></p> 13826 <p>Time interval between two consecutive data points in the time series. In keeping with mainstream investment literatures on VWAP, the following intraday intervals are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code></p> 13827 <p>â Optional: <code>month</code></p> 13828 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13829 <p>â Optional: <code>datatype</code></p> 13830 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13831 <p>â Optional: <code>entitlement</code></p> 13832 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
13832realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13833 <p><b>â Required: <code>apikey</code></b></p> 13834 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13835 <br> 13836 13837 <h6><b>Examples (click for JSON output)</b></h6> 13838 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=VWAP&symbol=IBM&interval=15min&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=VWAP&<b>symbol</b>=IBM&<b>interval</b>=15min&<b>apikey</b>=demo</code></a></p> 13839 <br> 13840 13841 <div class="premium-msg"> 13842 <p>ð¡ Tip: this is a premium API function. Subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to instantly unlock all premium APIs.</p> 13843 </div> 13844 <br> 13845 13846 13847 <h6><b>Language-specific guides</b></h6> 13848 <div> 13849 <button class="python-btn">Python</button> 13850 <button class="node-btn">NodeJS</button> 13851 <button class="php-btn">PHP</button> 13852 <button class="cs-btn">C#/.NET</button> 13853 <button class="other-btn">â¨MCP & Other</button> 13854</div> 13855 13856<div class="python-code"> 13857 <pre><code class="python"> 13858import requests 13859 13860# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13861url = 'https://www.alphavantage.co/query?function=VWAP&symbol=IBM&interval=15min&apikey=demo' 13862r = requests.get(url) 13863data = r.json() 13864 13865print(data) 13866 </code></pre> 13867</div> 13868 13869<div class="node-code"> 13870 <pre><code class="javascript"> 13871'use strict'; 13872var request = require('request'); 13873 13874// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13875var url = 'https://www.alphavantage.co/query?function=VWAP&symbol=IBM&interval=15min&apikey=demo'; 13876 13877request.get({ 13878 url: url, 13879 json: true, 13880 headers: {'User-Agent': 'request'} 13881 }, (err, res, data) => { 13882 if (err) { 13883 console.log('Error:', err); 13884 } else if (res.statusCode !== 200) { 13885 console.log('Status:', res.statusCode); 13886 } else { 13887 // data is successfully parsed as a JSON object: 13888 console.log(data); 13889 } 13890}); 13891 </code></pre> 13892</div> 13893 13894<div class="php-code"> 13895 <pre><code class="php"> 13896<?php 13897// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13898$json = file_get_contents('https://www.alphavantage.co/query?function=VWAP&symbol=IBM&interval=15min&apikey=demo'); 13899 13900$data = json_decode($json,true); 13901 13902print_r($data); 13903 13904exit; 13905 </code></pre> 13906</div> 13907 13908<div class="cs-code"> 13909 <pre><code class="cs"> 13910using System; 13911using System.Collections.Generic; 13912using System.Net; 13913 13914// ------------------------------------------------------------------------- 13915// if using .NET Framework 13916// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 13917// This requires including the reference to System.Web.Extensions in your project 13918using System.Web.Script.Serialization; 13919// ------------------------------------------------------------------------- 13920// if using .Net Core 13921// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 13922using System.Text.Json; 13923// ------------------------------------------------------------------------- 13924 13925namespace ConsoleTests 13926{ 13927 internal class Program 13928 { 13929 private static void Main(string[] args) 13930 { 13931 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 13932 string QUERY_URL = "https://www.alphavantage.co/query?function=VWAP&symbol=IBM&interval=15min&apikey=demo" 13933 Uri queryUri = new Uri(QUERY_URL); 13934 13935 using (WebClient client = new WebClient()) 13936 { 13937 // ------------------------------------------------------------------------- 13938 // if using .NET Framework (System.Web.Script.Serialization) 13939 13940 JavaScriptSerializer js = new JavaScriptSerializer(); 13941 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 13942 13943 // ------------------------------------------------------------------------- 13944 // if using .NET Core (System.Text.Json) 13945 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 13946 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 13947 13948 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 13949 13950 // ------------------------------------------------------------------------- 13951
13952 // do something with the json_data 13953 } 13954 } 13955 } 13956} 13957 </code></pre> 13958</div> 13959 13960 13961<div class="other-code" style="background-color: #f9f9f9;"> 13962 <br> 13963 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 13964 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 13965 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 13966 <br> 13967</div> 13968 13969 <br> 13970 13971 13972 <h4 id="t3">T3</h4> 13973 <br> 13974 <p>This API returns the Tilson moving average (T3) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=T3.htm" target="_blank">mathematical reference</a>.</p> 13975 <br> 13976 <h6><b>API Parameters</b></h6> 13977 <p><b>â Required: <code>function</code></b></p> 13978 <p>The technical indicator of your choice. In this case, <code>function=T3</code> </p> 13979 <p><b>â Required: <code>symbol</code></b></p> 13980 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 13981 <p><b>â Required: <code>interval</code></b></p> 13982 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 13983 <p>â Optional: <code>month</code></p> 13984 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 13985 <p><b>â Required:<code>time_period</code></b></p> 13986 <p>Number of data points used to calculate each moving average value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 13987 <p><b>â Required: <code>series_type</code></b></p> 13988 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 13989 <p>â Optional: <code>datatype</code></p> 13990 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 13991 <p>â Optional: <code>entitlement</code></p> 13992 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 13993 <p><b>â Required: <code>apikey</code></b></p> 13994 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 13995 <br> 13996 13997 <h6><b>Examples (click for JSON output)</b></h6> 13998 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=T3&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=T3&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 13999 <br> 14000 14001 <h6><b>Language-specific guides</b></h6> 14002 <div> 14003 <button class="python-btn">Python</button> 14004 <button class="node-btn">NodeJS</button> 14005 <button class="php-btn">PHP</button> 14006 <button class="cs-btn">C#/.NET</button> 14007 <button class="other-btn">â¨MCP & Other</button> 14008</div> 14009 14010<div class="python-code"> 14011 <pre><code class="python"> 14012import requests 14013 14014# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14015url = 'https://www.alphavantage.co/query?function=T3&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 14016r = requests.get(url) 14017data = r.json() 14018 14019print(data) 14020 </code></pre> 14021</div> 14022 14023<div class="node-code"> 14024 <pre><code class="javascript"> 14025'use strict'; 14026var request = require('request'); 14027 14028// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14029var url = 'https://www.alphavantage.co/query?function=T3&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 14030 14031request.get({ 14032 url: url, 14033 json: true, 14034 headers: {'User-Agent': 'request'} 14035 }, (err, res, data) => { 14036 if (err) { 14037 console.log('Error:', err); 14038 } else if (res.statusCode !== 200) { 14039 console.log('Status:', res.statusCode); 14040 } else { 14041 // data is successfully parsed as a JSON object: 14042 console.log(data); 14043 } 14044}); 14045 </code></pre> 14046</div> 14047 14048<div class="php-code"> 14049 <pre><code class="php"> 14050<?php 14051// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14052$json = file_get_contents('https://www.alphavantage.co/query?function=T3&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 14053 14054$data = json_decode($json,true); 14055 14056print_r($data); 14057 14058exit; 14059 </code></pre> 14060</div> 14061 14062<div class="cs-code"> 14063 <pre><code class="cs"> 14064using System; 14065using System.Collections.Generic; 14066using System.Net; 14067
14068// ------------------------------------------------------------------------- 14069// if using .NET Framework 14070// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 14071// This requires including the reference to System.Web.Extensions in your project 14072using System.Web.Script.Serialization; 14073// ------------------------------------------------------------------------- 14074// if using .Net Core 14075// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 14076using System.Text.Json; 14077// ------------------------------------------------------------------------- 14078 14079namespace ConsoleTests 14080{ 14081 internal class Program 14082 { 14083 private static void Main(string[] args) 14084 { 14085 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14086 string QUERY_URL = "https://www.alphavantage.co/query?function=T3&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 14087 Uri queryUri = new Uri(QUERY_URL); 14088 14089 using (WebClient client = new WebClient()) 14090 { 14091 // ------------------------------------------------------------------------- 14092 // if using .NET Framework (System.Web.Script.Serialization) 14093 14094 JavaScriptSerializer js = new JavaScriptSerializer(); 14095 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 14096 14097 // ------------------------------------------------------------------------- 14098 // if using .NET Core (System.Text.Json) 14099 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 14100 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 14101 14102 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 14103 14104 // ------------------------------------------------------------------------- 14105 14106 // do something with the json_data 14107 } 14108 } 14109 } 14110} 14111 </code></pre> 14112</div> 14113 14114 14115<div class="other-code" style="background-color: #f9f9f9;"> 14116 <br> 14117 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 14118 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 14119 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 14120 <br> 14121</div> 14122 14123 <br> 14124 14125 <h4 id="macd">MACD <span class="popular-label">Trending</span> <span class="premium-label">Premium</span></h4> 14126 <br> 14127 <p>This API returns the moving average convergence / divergence (MACD) values. See also: <a href="http://www.investopedia.com/articles/forex/05/macddiverge.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=MACD.htm" target="_blank">mathematical reference</a>.</p> 14128 <br> 14129 <h6><b>API Parameters</b></h6> 14130 <p><b>â Required: <code>function</code></b></p> 14131 <p>The technical indicator of your choice. In this case, <code>function=MACD</code> </p> 14132 <p><b>â Required: <code>symbol</code></b></p> 14133 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 14134 <p><b>â Required: <code>interval</code></b></p> 14135 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 14136 <p>â Optional: <code>month</code></p> 14137 <p>
14137By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 14138 <p><b>â Required: <code>series_type</code></b></p> 14139 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 14140 <p>â Optional: <code>fastperiod</code></p> 14141 <p>Positive integers are accepted. By default, <code>fastperiod=12</code>. </p> 14142 <p>â Optional: <code>slowperiod</code></p> 14143 <p>Positive integers are accepted. By default, <code>slowperiod=26</code>. </p> 14144 <p>â Optional: <code>signalperiod</code></p> 14145 <p>Positive integers are accepted. By default, <code>signalperiod=9</code>. </p> 14146 <p>â Optional: <code>datatype</code></p> 14147 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 14148 <p>â Optional: <code>entitlement</code></p> 14149 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 14150 <p><b>â Required: <code>apikey</code></b></p> 14151 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 14152 <br> 14153 14154 <h6><b>Examples (click for JSON output)</b></h6> 14155 Equity: 14156 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MACD&symbol=IBM&interval=daily&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MACD&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 14157 Forex (FX) or cryptocurrency pair: 14158 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MACD&symbol=USDEUR&interval=weekly&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MACD&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 14159 <br> 14160 14161 <div class="premium-msg"> 14162 <p>ð¡ Tip: this is a premium API function. Subscribe to a <a href="https://www.alphavantage.co/premium/" target="_blank">premium membership plan</a> to instantly unlock all premium APIs.</p> 14163 </div> 14164 <br> 14165 14166 14167 <h6><b>Language-specific guides</b></h6> 14168 <div> 14169 <button class="python-btn">Python</button> 14170 <button class="node-btn">NodeJS</button> 14171 <button class="php-btn">PHP</button> 14172 <button class="cs-btn">C#/.NET</button> 14173 <button class="other-btn">â¨MCP & Other</button> 14174</div> 14175 14176<div class="python-code"> 14177 <pre><code class="python"> 14178import requests 14179 14180# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14181url = 'https://www.alphavantage.co/query?function=MACD&symbol=IBM&interval=daily&series_type=open&apikey=demo' 14182r = requests.get(url) 14183data = r.json() 14184 14185print(data) 14186 </code></pre> 14187</div> 14188 14189<div class="node-code"> 14190 <pre><code class="javascript"> 14191'use strict'; 14192var request = require('request'); 14193 14194// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14195var url = 'https://www.alphavantage.co/query?function=MACD&symbol=IBM&interval=daily&series_type=open&apikey=demo'; 14196 14197request.get({ 14198 url: url, 14199 json: true, 14200 headers: {'User-Agent': 'request'} 14201 }, (err, res, data) => { 14202 if (err) { 14203 console.log('Error:', err); 14204 } else if (res.statusCode !== 200) { 14205 console.log('Status:', res.statusCode); 14206 } else { 14207 // data is successfully parsed as a JSON object: 14208 console.log(data); 14209 } 14210}); 14211 </code></pre> 14212</div> 14213 14214<div class="php-code"> 14215 <pre><code class="php"> 14216<?php 14217// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14218$json = file_get_contents('https://www.alphavantage.co/query?function=MACD&symbol=IBM&interval=daily&series_type=open&apikey=demo'); 14219 14220$data = json_decode($json,true); 14221 14222print_r($data); 14223 14224exit; 14225 </code></pre> 14226</div> 14227 14228<div class="cs-code"> 14229 <pre><code class="cs"> 14230using System; 14231using System.Collections.Generic; 14232using System.Net; 14233
14234// ------------------------------------------------------------------------- 14235// if using .NET Framework 14236// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 14237// This requires including the reference to System.Web.Extensions in your project 14238using System.Web.Script.Serialization; 14239// ------------------------------------------------------------------------- 14240// if using .Net Core 14241// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 14242using System.Text.Json; 14243// ------------------------------------------------------------------------- 14244 14245namespace ConsoleTests 14246{ 14247 internal class Program 14248 { 14249 private static void Main(string[] args) 14250 { 14251 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14252 string QUERY_URL = "https://www.alphavantage.co/query?function=MACD&symbol=IBM&interval=daily&series_type=open&apikey=demo" 14253 Uri queryUri = new Uri(QUERY_URL); 14254 14255 using (WebClient client = new WebClient()) 14256 { 14257 // ------------------------------------------------------------------------- 14258 // if using .NET Framework (System.Web.Script.Serialization) 14259 14260 JavaScriptSerializer js = new JavaScriptSerializer(); 14261 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 14262 14263 // ------------------------------------------------------------------------- 14264 // if using .NET Core (System.Text.Json) 14265 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 14266 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 14267 14268 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 14269 14270 // ------------------------------------------------------------------------- 14271 14272 // do something with the json_data 14273 } 14274 } 14275 } 14276} 14277 </code></pre> 14278</div> 14279 14280 14281<div class="other-code" style="background-color: #f9f9f9;"> 14282 <br> 14283 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 14284 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 14285 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 14286 <br> 14287</div> 14288 14289 <br> 14290 14291 <h4 id="macdext">MACDEXT</h4> 14292 <br> 14293 <p>This API returns the moving average convergence / divergence values with controllable moving average type. See also: <a href="http://www.investopedia.com/articles/forex/05/macddiverge.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=MACD.htm" target="_blank">mathematical reference</a>.</p> 14294 <br> 14295 <h6><b>API Parameters</b></h6> 14296 <p><b>â Required: <code>function</code></b></p> 14297 <p>The technical indicator of your choice. In this case, <code>function=MACDEXT</code> </p> 14298 <p><b>â Required: <code>symbol</code></b></p> 14299 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 14300 <p><b>â Required: <code>interval</code></b></p> 14301 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 14302 <p>â Optional: <code>month</code></p> 14303 <p>
14303By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 14304 <p><b>â Required: <code>series_type</code></b></p> 14305 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 14306 <p>â Optional: <code>fastperiod</code></p> 14307 <p>Positive integers are accepted. By default, <code>fastperiod=12</code>. </p> 14308 <p>â Optional: <code>slowperiod</code></p> 14309 <p>Positive integers are accepted. By default, <code>slowperiod=26</code>. </p> 14310 <p>â Optional: <code>signalperiod</code></p> 14311 <p>Positive integers are accepted. By default, <code>signalperiod=9</code>. </p> 14312 <p>â Optional: <code>fastmatype</code></p> 14313 <p>Moving average type for the faster moving average. By default, <code>fastmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14314 <p>â Optional: <code>slowmatype</code></p> 14315 <p>Moving average type for the slower moving average. By default, <code>slowmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14316 <p>â Optional: <code>signalmatype</code></p> 14317 <p>Moving average type for the signal moving average. By default, <code>signalmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14318 <p>â Optional: <code>datatype</code></p> 14319 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 14320 <p>â Optional: <code>entitlement</code></p> 14321 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 14322 <p><b>â Required: <code>apikey</code></b></p> 14323 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 14324 <br> 14325 14326 <h6><b>Examples (click for JSON output)</b></h6> 14327 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MACDEXT&symbol=IBM&interval=daily&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MACDEXT&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 14328 <br> 14329 14330 <h6><b>Language-specific guides</b></h6> 14331 <div> 14332 <button class="python-btn">Python</button> 14333 <button class="node-btn">NodeJS</button> 14334 <button class="php-btn">PHP</button> 14335 <button class="cs-btn">C#/.NET</button> 14336 <button class="other-btn">â¨MCP & Other</button> 14337</div> 14338 14339<div class="python-code"> 14340 <pre><code class="python"> 14341import requests 14342 14343# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14344url = 'https://www.alphavantage.co/query?function=MACDEXT&symbol=IBM&interval=daily&series_type=open&apikey=demo' 14345r = requests.get(url) 14346data = r.json() 14347 14348print(data) 14349 </code></pre> 14350</div> 14351 14352<div class="node-code"> 14353 <pre><code class="javascript"> 14354'use strict'; 14355var request = require('request'); 14356 14357// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14358var url = 'https://www.alphavantage.co/query?function=MACDEXT&symbol=IBM&interval=daily&series_type=open&apikey=demo'; 14359 14360request.get({ 14361 url: url, 14362 json: true, 14363 headers: {'User-Agent': 'request'} 14364 }, (err, res, data) => { 14365 if (err) { 14366 console.log('Error:', err); 14367 } else if (res.statusCode !== 200) { 14368 console.log('Status:', res.statusCode); 14369 } else { 14370 // data is successfully parsed as a JSON object: 14371 console.log(data); 14372 } 14373}); 14374 </code></pre> 14375</div> 14376 14377<div class="php-code"> 14378 <pre><code class="php"> 14379<?php 14380// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14381$json = file_get_contents('https://www.alphavantage.co/query?function=MACDEXT&symbol=IBM&interval=daily&series_type=open&apikey=demo'); 14382 14383$data = json_decode($json,true); 14384 14385print_r($data); 14386 14387exit; 14388 </code></pre> 14389</div> 14390 14391<div class="cs-code"> 14392 <pre><code class="cs"> 14393using System; 14394using System.Collections.Generic; 14395using System.Net; 14396
14397// ------------------------------------------------------------------------- 14398// if using .NET Framework 14399// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 14400// This requires including the reference to System.Web.Extensions in your project 14401using System.Web.Script.Serialization; 14402// ------------------------------------------------------------------------- 14403// if using .Net Core 14404// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 14405using System.Text.Json; 14406// ------------------------------------------------------------------------- 14407 14408namespace ConsoleTests 14409{ 14410 internal class Program 14411 { 14412 private static void Main(string[] args) 14413 { 14414 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14415 string QUERY_URL = "https://www.alphavantage.co/query?function=MACDEXT&symbol=IBM&interval=daily&series_type=open&apikey=demo" 14416 Uri queryUri = new Uri(QUERY_URL); 14417 14418 using (WebClient client = new WebClient()) 14419 { 14420 // ------------------------------------------------------------------------- 14421 // if using .NET Framework (System.Web.Script.Serialization) 14422 14423 JavaScriptSerializer js = new JavaScriptSerializer(); 14424 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 14425 14426 // ------------------------------------------------------------------------- 14427 // if using .NET Core (System.Text.Json) 14428 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 14429 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 14430 14431 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 14432 14433 // ------------------------------------------------------------------------- 14434 14435 // do something with the json_data 14436 } 14437 } 14438 } 14439} 14440 </code></pre> 14441</div> 14442 14443 14444<div class="other-code" style="background-color: #f9f9f9;"> 14445 <br> 14446 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 14447 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 14448 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 14449 <br> 14450</div> 14451 14452 14453 <br> 14454 14455 <h4 id="stoch">STOCH <span class="popular-label">Trending</span></h4> 14456 <br> 14457 <p>This API returns the stochastic oscillator (STOCH) values. See also: <a href="https://www.investopedia.com/terms/s/stochasticoscillator.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=StochasticOscillator.htm" target="_blank">mathematical reference</a>.</p> 14458 <br> 14459 <h6><b>API Parameters</b></h6> 14460 <p><b>â Required: <code>function</code></b></p> 14461 <p>The technical indicator of your choice. In this case, <code>function=STOCH</code> </p> 14462 <p><b>â Required: <code>symbol</code></b></p> 14463 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 14464 <p><b>â Required: <code>interval</code></b></p> 14465 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 14466 <p>â Optional: <code>month</code></p> 14467 <p>
14467By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 14468 <p>â Optional: <code>fastkperiod</code></p> 14469 <p>The time period of the fastk moving average. Positive integers are accepted. By default, <code>fastkperiod=5</code>. </p> 14470 <p>â Optional: <code>slowkperiod</code></p> 14471 <p>The time period of the slowk moving average. Positive integers are accepted. By default, <code>slowkperiod=3</code>. </p> 14472 <p>â Optional: <code>slowdperiod</code></p> 14473 <p>The time period of the slowd moving average. Positive integers are accepted. By default, <code>slowdperiod=3</code>. </p> 14474 <p>â Optional: <code>slowkmatype</code></p> 14475 <p>Moving average type for the slowk moving average. By default, <code>slowkmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14476 <p>â Optional: <code>slowdmatype</code></p> 14477 <p>Moving average type for the slowd moving average. By default, <code>slowdmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14478 <p>â Optional: <code>datatype</code></p> 14479 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 14480 <p>â Optional: <code>entitlement</code></p> 14481 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 14482 <p><b>â Required: <code>apikey</code></b></p> 14483 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 14484 <br> 14485 14486 <h6><b>Examples (click for JSON output)</b></h6> 14487 Equity: 14488 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=STOCH&symbol=IBM&interval=daily&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=STOCH&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>apikey</b>=demo</code></a></p> 14489 Forex (FX) or cryptocurrency pair: 14490 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=STOCH&symbol=USDEUR&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=STOCH&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 14491 <br> 14492 14493 14494 <h6><b>Language-specific guides</b></h6> 14495 <div> 14496 <button class="python-btn">Python</button> 14497 <button class="node-btn">NodeJS</button> 14498 <button class="php-btn">PHP</button> 14499 <button class="cs-btn">C#/.NET</button> 14500 <button class="other-btn">â¨MCP & Other</button> 14501</div> 14502 14503<div class="python-code"> 14504 <pre><code class="python"> 14505import requests 14506 14507# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14508url = 'https://www.alphavantage.co/query?function=STOCH&symbol=IBM&interval=daily&apikey=demo' 14509r = requests.get(url) 14510data = r.json() 14511 14512print(data) 14513 </code></pre> 14514</div> 14515 14516<div class="node-code"> 14517 <pre><code class="javascript"> 14518'use strict'; 14519var request = require('request'); 14520 14521// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14522var url = 'https://www.alphavantage.co/query?function=STOCH&symbol=IBM&interval=daily&apikey=demo'; 14523 14524request.get({ 14525 url: url, 14526 json: true, 14527 headers: {'User-Agent': 'request'} 14528 }, (err, res, data) => { 14529 if (err) { 14530 console.log('Error:', err); 14531 } else if (res.statusCode !== 200) { 14532 console.log('Status:', res.statusCode); 14533 } else { 14534 // data is successfully parsed as a JSON object: 14535 console.log(data); 14536 } 14537}); 14538 </code></pre> 14539</div> 14540 14541<div class="php-code"> 14542 <pre><code class="php"> 14543<?php 14544// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14545$json = file_get_contents('https://www.alphavantage.co/query?function=STOCH&symbol=IBM&interval=daily&apikey=demo'); 14546 14547$data = json_decode($json,true); 14548 14549print_r($data); 14550 14551exit; 14552 </code></pre> 14553</div> 14554 14555<div class="cs-code"> 14556 <pre><code class="cs"> 14557using System; 14558using System.Collections.Generic; 14559using System.Net; 14560
14561// ------------------------------------------------------------------------- 14562// if using .NET Framework 14563// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 14564// This requires including the reference to System.Web.Extensions in your project 14565using System.Web.Script.Serialization; 14566// ------------------------------------------------------------------------- 14567// if using .Net Core 14568// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 14569using System.Text.Json; 14570// ------------------------------------------------------------------------- 14571 14572namespace ConsoleTests 14573{ 14574 internal class Program 14575 { 14576 private static void Main(string[] args) 14577 { 14578 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14579 string QUERY_URL = "https://www.alphavantage.co/query?function=STOCH&symbol=IBM&interval=daily&apikey=demo" 14580 Uri queryUri = new Uri(QUERY_URL); 14581 14582 using (WebClient client = new WebClient()) 14583 { 14584 // ------------------------------------------------------------------------- 14585 // if using .NET Framework (System.Web.Script.Serialization) 14586 14587 JavaScriptSerializer js = new JavaScriptSerializer(); 14588 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 14589 14590 // ------------------------------------------------------------------------- 14591 // if using .NET Core (System.Text.Json) 14592 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 14593 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 14594 14595 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 14596 14597 // ------------------------------------------------------------------------- 14598 14599 // do something with the json_data 14600 } 14601 } 14602 } 14603} 14604 </code></pre> 14605</div> 14606 14607 14608<div class="other-code" style="background-color: #f9f9f9;"> 14609 <br> 14610 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 14611 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 14612 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 14613 <br> 14614</div> 14615 14616 <br> 14617 14618 <h4 id="stochf">STOCHF</h4> 14619 <br> 14620 <p>This API returns the stochastic fast (STOCHF) values. See also: <a href="http://www.investopedia.com/university/indicator_oscillator/ind_osc8.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=StochasticOscillator.htm" target="_blank">mathematical reference</a>.</p> 14621 <br> 14622 <h6><b>API Parameters</b></h6> 14623 <p><b>â Required: <code>function</code></b></p> 14624 <p>The technical indicator of your choice. In this case, <code>function=STOCHF</code> </p> 14625 <p><b>â Required: <code>symbol</code></b></p> 14626 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 14627 <p><b>â Required: <code>interval</code></b></p> 14628 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 14629 <p>â Optional: <code>month</code></p> 14630 <p>
14630By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 14631 <p>â Optional: <code>fastkperiod</code></p> 14632 <p>The time period of the fastk moving average. Positive integers are accepted. By default, <code>fastkperiod=5</code>. </p> 14633 <p>â Optional: <code>fastdperiod</code></p> 14634 <p>The time period of the fastd moving average. Positive integers are accepted. By default, <code>fastdperiod=3</code>. </p> 14635 <p>â Optional: <code>fastdmatype</code></p> 14636 <p>Moving average type for the fastd moving average. By default, <code>fastdmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14637 <p>â Optional: <code>datatype</code></p> 14638 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 14639 <p>â Optional: <code>entitlement</code></p> 14640 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 14641 <p><b>â Required: <code>apikey</code></b></p> 14642 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 14643 <br> 14644 14645 <h6><b>Examples (click for JSON output)</b></h6> 14646 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=STOCHF&symbol=IBM&interval=daily&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=STOCHF&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>apikey</b>=demo</code></a></p> 14647 <br> 14648 14649 <h6><b>Language-specific guides</b></h6> 14650 <div> 14651 <button class="python-btn">Python</button> 14652 <button class="node-btn">NodeJS</button> 14653 <button class="php-btn">PHP</button> 14654 <button class="cs-btn">C#/.NET</button> 14655 <button class="other-btn">â¨MCP & Other</button> 14656</div> 14657 14658<div class="python-code"> 14659 <pre><code class="python"> 14660import requests 14661 14662# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14663url = 'https://www.alphavantage.co/query?function=STOCHF&symbol=IBM&interval=daily&apikey=demo' 14664r = requests.get(url) 14665data = r.json() 14666 14667print(data) 14668 </code></pre> 14669</div> 14670 14671<div class="node-code"> 14672 <pre><code class="javascript"> 14673'use strict'; 14674var request = require('request'); 14675 14676// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14677var url = 'https://www.alphavantage.co/query?function=STOCHF&symbol=IBM&interval=daily&apikey=demo'; 14678 14679request.get({ 14680 url: url, 14681 json: true, 14682 headers: {'User-Agent': 'request'} 14683 }, (err, res, data) => { 14684 if (err) { 14685 console.log('Error:', err); 14686 } else if (res.statusCode !== 200) { 14687 console.log('Status:', res.statusCode); 14688 } else { 14689 // data is successfully parsed as a JSON object: 14690 console.log(data); 14691 } 14692}); 14693 </code></pre> 14694</div> 14695 14696<div class="php-code"> 14697 <pre><code class="php"> 14698<?php 14699// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14700$json = file_get_contents('https://www.alphavantage.co/query?function=STOCHF&symbol=IBM&interval=daily&apikey=demo'); 14701 14702$data = json_decode($json,true); 14703 14704print_r($data); 14705 14706exit; 14707 </code></pre> 14708</div> 14709 14710<div class="cs-code"> 14711 <pre><code class="cs"> 14712using System; 14713using System.Collections.Generic; 14714using System.Net; 14715
14716// ------------------------------------------------------------------------- 14717// if using .NET Framework 14718// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 14719// This requires including the reference to System.Web.Extensions in your project 14720using System.Web.Script.Serialization; 14721// ------------------------------------------------------------------------- 14722// if using .Net Core 14723// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 14724using System.Text.Json; 14725// ------------------------------------------------------------------------- 14726 14727namespace ConsoleTests 14728{ 14729 internal class Program 14730 { 14731 private static void Main(string[] args) 14732 { 14733 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14734 string QUERY_URL = "https://www.alphavantage.co/query?function=STOCHF&symbol=IBM&interval=daily&apikey=demo" 14735 Uri queryUri = new Uri(QUERY_URL); 14736 14737 using (WebClient client = new WebClient()) 14738 { 14739 // ------------------------------------------------------------------------- 14740 // if using .NET Framework (System.Web.Script.Serialization) 14741 14742 JavaScriptSerializer js = new JavaScriptSerializer(); 14743 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 14744 14745 // ------------------------------------------------------------------------- 14746 // if using .NET Core (System.Text.Json) 14747 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 14748 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 14749 14750 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 14751 14752 // ------------------------------------------------------------------------- 14753 14754 // do something with the json_data 14755 } 14756 } 14757 } 14758} 14759 </code></pre> 14760</div> 14761 14762 14763<div class="other-code" style="background-color: #f9f9f9;"> 14764 <br> 14765 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 14766 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 14767 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 14768 <br> 14769</div> 14770 14771 <br> 14772 14773 <h4 id="rsi">RSI <span class="popular-label">Trending</span></h4> 14774 <br> 14775 <p>This API returns the relative strength index (RSI) values. See also: <a href="https://www.alphavantage.co/relative_strength_index_rsi/" target="_blank">RSI explainer</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=RSI.htm" target="_blank">mathematical reference</a>.</p> 14776 <br> 14777 <h6><b>API Parameters</b></h6> 14778 <p><b>â Required: <code>function</code></b></p> 14779 <p>The technical indicator of your choice. In this case, <code>function=RSI</code> </p> 14780 <p><b>â Required: <code>symbol</code></b></p> 14781 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 14782 <p><b>â Required: <code>interval</code></b></p> 14783 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 14784 <p>â Optional: <code>month</code></p> 14785 <p>
14785By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 14786 <p><b>â Required:<code>time_period</code></b></p> 14787 <p>Number of data points used to calculate each RSI value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 14788 <p><b>â Required: <code>series_type</code></b></p> 14789 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 14790 <p>â Optional: <code>datatype</code></p> 14791 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 14792 <p>â Optional: <code>entitlement</code></p> 14793 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 14794 <p><b>â Required: <code>apikey</code></b></p> 14795 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 14796 <br> 14797 14798 <h6><b>Examples (click for JSON output)</b></h6> 14799 Equity: 14800 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=RSI&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=RSI&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 14801 Forex (FX) or cryptocurrency pair: 14802 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=RSI&symbol=USDEUR&interval=weekly&time_period=10&series_type=open&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=RSI&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=open&<b>apikey</b>=demo</code></a></p> 14803 <br> 14804 14805 14806 <h6><b>Language-specific guides</b></h6> 14807 <div> 14808 <button class="python-btn">Python</button> 14809 <button class="node-btn">NodeJS</button> 14810 <button class="php-btn">PHP</button> 14811 <button class="cs-btn">C#/.NET</button> 14812 <button class="other-btn">â¨MCP & Other</button> 14813</div> 14814 14815<div class="python-code"> 14816 <pre><code class="python"> 14817import requests 14818 14819# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14820url = 'https://www.alphavantage.co/query?function=RSI&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo' 14821r = requests.get(url) 14822data = r.json() 14823 14824print(data) 14825 </code></pre> 14826</div> 14827 14828<div class="node-code"> 14829 <pre><code class="javascript"> 14830'use strict'; 14831var request = require('request'); 14832 14833// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14834var url = 'https://www.alphavantage.co/query?function=RSI&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'; 14835 14836request.get({ 14837 url: url, 14838 json: true, 14839 headers: {'User-Agent': 'request'} 14840 }, (err, res, data) => { 14841 if (err) { 14842 console.log('Error:', err); 14843 } else if (res.statusCode !== 200) { 14844 console.log('Status:', res.statusCode); 14845 } else { 14846 // data is successfully parsed as a JSON object: 14847 console.log(data); 14848 } 14849}); 14850 </code></pre> 14851</div> 14852 14853<div class="php-code"> 14854 <pre><code class="php"> 14855<?php 14856// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14857$json = file_get_contents('https://www.alphavantage.co/query?function=RSI&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo'); 14858 14859$data = json_decode($json,true); 14860 14861print_r($data); 14862 14863exit; 14864 </code></pre> 14865</div> 14866 14867<div class="cs-code"> 14868 <pre><code class="cs"> 14869using System; 14870using System.Collections.Generic; 14871using System.Net; 14872
14873// ------------------------------------------------------------------------- 14874// if using .NET Framework 14875// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 14876// This requires including the reference to System.Web.Extensions in your project 14877using System.Web.Script.Serialization; 14878// ------------------------------------------------------------------------- 14879// if using .Net Core 14880// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 14881using System.Text.Json; 14882// ------------------------------------------------------------------------- 14883 14884namespace ConsoleTests 14885{ 14886 internal class Program 14887 { 14888 private static void Main(string[] args) 14889 { 14890 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14891 string QUERY_URL = "https://www.alphavantage.co/query?function=RSI&symbol=IBM&interval=weekly&time_period=10&series_type=open&apikey=demo" 14892 Uri queryUri = new Uri(QUERY_URL); 14893 14894 using (WebClient client = new WebClient()) 14895 { 14896 // ------------------------------------------------------------------------- 14897 // if using .NET Framework (System.Web.Script.Serialization) 14898 14899 JavaScriptSerializer js = new JavaScriptSerializer(); 14900 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 14901 14902 // ------------------------------------------------------------------------- 14903 // if using .NET Core (System.Text.Json) 14904 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 14905 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 14906 14907 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 14908 14909 // ------------------------------------------------------------------------- 14910 14911 // do something with the json_data 14912 } 14913 } 14914 } 14915} 14916 </code></pre> 14917</div> 14918 14919 14920<div class="other-code" style="background-color: #f9f9f9;"> 14921 <br> 14922 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 14923 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 14924 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 14925 <br> 14926</div> 14927 14928 <br> 14929 14930 <h4 id="stochrsi">STOCHRSI</h4> 14931 <br> 14932 <p>This API returns the stochastic relative strength index (STOCHRSI) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=StochRSI.htm" target="_blank">mathematical reference</a>.</p> 14933 <br> 14934 <h6><b>API Parameters</b></h6> 14935 <p><b>â Required: <code>function</code></b></p> 14936 <p>The technical indicator of your choice. In this case, <code>function=STOCHRSI</code> </p> 14937 <p><b>â Required: <code>symbol</code></b></p> 14938 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 14939 <p><b>â Required: <code>interval</code></b></p> 14940 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 14941 <p>â Optional: <code>month</code></p> 14942 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 14943 <p><b>â Required:<code>time_period</code></b></p> 14944 <p>Number of data points used to calculate each STOCHRSI value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 14945 <p><b>â Required: <code>series_type</code></b></p> 14946 <p>
14946The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 14947 <p>â Optional: <code>fastkperiod</code></p> 14948 <p>The time period of the fastk moving average. Positive integers are accepted. By default, <code>fastkperiod=5</code>. </p> 14949 <p>â Optional: <code>fastdperiod</code></p> 14950 <p>The time period of the fastd moving average. Positive integers are accepted. By default, <code>fastdperiod=3</code>. </p> 14951 <p>â Optional: <code>fastdmatype</code></p> 14952 <p>Moving average type for the fastd moving average. By default, <code>fastdmatype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 14953 <p>â Optional: <code>datatype</code></p> 14954 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 14955 <p>â Optional: <code>entitlement</code></p> 14956 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 14957 <p><b>â Required: <code>apikey</code></b></p> 14958 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 14959 <br> 14960 14961 <h6><b>Example (click for JSON output)</b></h6> 14962 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=STOCHRSI&symbol=IBM&interval=daily&time_period=10&series_type=close&fastkperiod=6&fastdmatype=1&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=STOCHRSI&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>series_type</b>=close&<b>fastkperiod</b>=6&<b>fastdmatype</b>=1&<b>apikey</b>=demo</code></a></p> 14963 <br> 14964 14965 <h6><b>Language-specific guides</b></h6> 14966 <div> 14967 <button class="python-btn">Python</button> 14968 <button class="node-btn">NodeJS</button> 14969 <button class="php-btn">PHP</button> 14970 <button class="cs-btn">C#/.NET</button> 14971 <button class="other-btn">â¨MCP & Other</button> 14972</div> 14973 14974<div class="python-code"> 14975 <pre><code class="python"> 14976import requests 14977 14978# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14979url = 'https://www.alphavantage.co/query?function=STOCHRSI&symbol=IBM&interval=daily&time_period=10&series_type=close&fastkperiod=6&fastdmatype=1&apikey=demo' 14980r = requests.get(url) 14981data = r.json() 14982 14983print(data) 14984 </code></pre> 14985</div> 14986 14987<div class="node-code"> 14988 <pre><code class="javascript"> 14989'use strict'; 14990var request = require('request'); 14991 14992// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 14993var url = 'https://www.alphavantage.co/query?function=STOCHRSI&symbol=IBM&interval=daily&time_period=10&series_type=close&fastkperiod=6&fastdmatype=1&apikey=demo'; 14994 14995request.get({ 14996 url: url, 14997 json: true, 14998 headers: {'User-Agent': 'request'} 14999 }, (err, res, data) => { 15000 if (err) { 15001 console.log('Error:', err); 15002 } else if (res.statusCode !== 200) { 15003 console.log('Status:', res.statusCode); 15004 } else { 15005 // data is successfully parsed as a JSON object: 15006 console.log(data); 15007 } 15008}); 15009 </code></pre> 15010</div> 15011 15012<div class="php-code"> 15013 <pre><code class="php"> 15014<?php 15015// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15016$json = file_get_contents('https://www.alphavantage.co/query?function=STOCHRSI&symbol=IBM&interval=daily&time_period=10&series_type=close&fastkperiod=6&fastdmatype=1&apikey=demo'); 15017 15018$data = json_decode($json,true); 15019 15020print_r($data); 15021 15022exit; 15023 </code></pre> 15024</div> 15025 15026<div class="cs-code"> 15027 <pre><code class="cs"> 15028using System; 15029using System.Collections.Generic; 15030using System.Net; 15031
15032// ------------------------------------------------------------------------- 15033// if using .NET Framework 15034// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15035// This requires including the reference to System.Web.Extensions in your project 15036using System.Web.Script.Serialization; 15037// ------------------------------------------------------------------------- 15038// if using .Net Core 15039// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15040using System.Text.Json; 15041// ------------------------------------------------------------------------- 15042 15043namespace ConsoleTests 15044{ 15045 internal class Program 15046 { 15047 private static void Main(string[] args) 15048 { 15049 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15050 string QUERY_URL = "https://www.alphavantage.co/query?function=STOCHRSI&symbol=IBM&interval=daily&time_period=10&series_type=close&fastkperiod=6&fastdmatype=1&apikey=demo" 15051 Uri queryUri = new Uri(QUERY_URL); 15052 15053 using (WebClient client = new WebClient()) 15054 { 15055 // ------------------------------------------------------------------------- 15056 // if using .NET Framework (System.Web.Script.Serialization) 15057 15058 JavaScriptSerializer js = new JavaScriptSerializer(); 15059 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15060 15061 // ------------------------------------------------------------------------- 15062 // if using .NET Core (System.Text.Json) 15063 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15064 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15065 15066 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15067 15068 // ------------------------------------------------------------------------- 15069 15070 // do something with the json_data 15071 } 15072 } 15073 } 15074} 15075 </code></pre> 15076</div> 15077 15078 15079<div class="other-code" style="background-color: #f9f9f9;"> 15080 <br> 15081 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 15082 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 15083 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 15084 <br> 15085</div> 15086 15087 15088 <br> 15089 15090 <h4 id="willr">WILLR</h4> 15091 <br> 15092 <p>This API returns the Williams' %R (WILLR) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=WilliamsR.htm" target="_blank">mathematical reference</a>.</p> 15093 <br> 15094 <h6><b>API Parameters</b></h6> 15095 <p><b>â Required: <code>function</code></b></p> 15096 <p>The technical indicator of your choice. In this case, <code>function=WILLR</code> </p> 15097 <p><b>â Required: <code>symbol</code></b></p> 15098 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 15099 <p><b>â Required: <code>interval</code></b></p> 15100 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 15101 <p>â Optional: <code>month</code></p> 15102 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 15103 <p><b>â Required:<code>time_period</code></b></p> 15104 <p>Number of data points used to calculate each WILLR value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 15105 <p>â Optional: <code>datatype</code></p> 15106 <p>
15106By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 15107 <p>â Optional: <code>entitlement</code></p> 15108 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 15109 <p><b>â Required: <code>apikey</code></b></p> 15110 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 15111 <br> 15112 15113 <h6><b>Example (click for JSON output)</b></h6> 15114 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=WILLR&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=WILLR&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 15115 <br> 15116 15117 <h6><b>Language-specific guides</b></h6> 15118 <div> 15119 <button class="python-btn">Python</button> 15120 <button class="node-btn">NodeJS</button> 15121 <button class="php-btn">PHP</button> 15122 <button class="cs-btn">C#/.NET</button> 15123 <button class="other-btn">â¨MCP & Other</button> 15124</div> 15125 15126<div class="python-code"> 15127 <pre><code class="python"> 15128import requests 15129 15130# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15131url = 'https://www.alphavantage.co/query?function=WILLR&symbol=IBM&interval=daily&time_period=10&apikey=demo' 15132r = requests.get(url) 15133data = r.json() 15134 15135print(data) 15136 </code></pre> 15137</div> 15138 15139<div class="node-code"> 15140 <pre><code class="javascript"> 15141'use strict'; 15142var request = require('request'); 15143 15144// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15145var url = 'https://www.alphavantage.co/query?function=WILLR&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 15146 15147request.get({ 15148 url: url, 15149 json: true, 15150 headers: {'User-Agent': 'request'} 15151 }, (err, res, data) => { 15152 if (err) { 15153 console.log('Error:', err); 15154 } else if (res.statusCode !== 200) { 15155 console.log('Status:', res.statusCode); 15156 } else { 15157 // data is successfully parsed as a JSON object: 15158 console.log(data); 15159 } 15160}); 15161 </code></pre> 15162</div> 15163 15164<div class="php-code"> 15165 <pre><code class="php"> 15166<?php 15167// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15168$json = file_get_contents('https://www.alphavantage.co/query?function=WILLR&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 15169 15170$data = json_decode($json,true); 15171 15172print_r($data); 15173 15174exit; 15175 </code></pre> 15176</div> 15177 15178<div class="cs-code"> 15179 <pre><code class="cs"> 15180using System; 15181using System.Collections.Generic; 15182using System.Net; 15183 15184// ------------------------------------------------------------------------- 15185// if using .NET Framework 15186// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15187// This requires including the reference to System.Web.Extensions in your project 15188using System.Web.Script.Serialization; 15189// ------------------------------------------------------------------------- 15190// if using .Net Core 15191// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15192using System.Text.Json; 15193// ------------------------------------------------------------------------- 15194 15195namespace ConsoleTests 15196{ 15197 internal class Program 15198 { 15199 private static void Main(string[] args) 15200 { 15201 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
15202 string QUERY_URL = "https://www.alphavantage.co/query?function=WILLR&symbol=IBM&interval=daily&time_period=10&apikey=demo" 15203 Uri queryUri = new Uri(QUERY_URL); 15204 15205 using (WebClient client = new WebClient()) 15206 { 15207 // ------------------------------------------------------------------------- 15208 // if using .NET Framework (System.Web.Script.Serialization) 15209 15210 JavaScriptSerializer js = new JavaScriptSerializer(); 15211 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15212 15213 // ------------------------------------------------------------------------- 15214 // if using .NET Core (System.Text.Json) 15215 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15216 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15217 15218 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15219 15220 // ------------------------------------------------------------------------- 15221 15222 // do something with the json_data 15223 } 15224 } 15225 } 15226} 15227 </code></pre> 15228</div> 15229 15230 15231<div class="other-code" style="background-color: #f9f9f9;"> 15232 <br> 15233 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 15234 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 15235 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 15236 <br> 15237</div> 15238 15239 <br> 15240 15241 <h4 id="adx">ADX <span class="popular-label">Trending</span></h4> 15242 <br> 15243 <p>This API returns the average directional movement index (ADX) values. See also: <a href="http://www.investopedia.com/articles/trading/07/adx-trend-indicator.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=ADX.htm" target="_blank">mathematical reference</a>.</p> 15244 <br> 15245 <h6><b>API Parameters</b></h6> 15246 <p><b>â Required: <code>function</code></b></p> 15247 <p>The technical indicator of your choice. In this case, <code>function=ADX</code> </p> 15248 <p><b>â Required: <code>symbol</code></b></p> 15249 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 15250 <p><b>â Required: <code>interval</code></b></p> 15251 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 15252 <p>â Optional: <code>month</code></p> 15253 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 15254 <p><b>â Required:<code>time_period</code></b></p> 15255 <p>Number of data points used to calculate each ADX value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 15256 <p>â Optional: <code>datatype</code></p> 15257 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 15258 <p>â Optional: <code>entitlement</code></p> 15259 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
15259realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 15260 <p><b>â Required: <code>apikey</code></b></p> 15261 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 15262 <br> 15263 15264 <h6><b>Example (click for JSON output)</b></h6> 15265 Equity: 15266 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ADX&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ADX&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 15267 Forex (FX) or cryptocurrency pair: 15268 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ADX&symbol=USDEUR&interval=weekly&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ADX&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 15269 <br> 15270 15271 15272 <h6><b>Language-specific guides</b></h6> 15273 <div> 15274 <button class="python-btn">Python</button> 15275 <button class="node-btn">NodeJS</button> 15276 <button class="php-btn">PHP</button> 15277 <button class="cs-btn">C#/.NET</button> 15278 <button class="other-btn">â¨MCP & Other</button> 15279</div> 15280 15281<div class="python-code"> 15282 <pre><code class="python"> 15283import requests 15284 15285# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15286url = 'https://www.alphavantage.co/query?function=ADX&symbol=IBM&interval=daily&time_period=10&apikey=demo' 15287r = requests.get(url) 15288data = r.json() 15289 15290print(data) 15291 </code></pre> 15292</div> 15293 15294<div class="node-code"> 15295 <pre><code class="javascript"> 15296'use strict'; 15297var request = require('request'); 15298 15299// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15300var url = 'https://www.alphavantage.co/query?function=ADX&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 15301 15302request.get({ 15303 url: url, 15304 json: true, 15305 headers: {'User-Agent': 'request'} 15306 }, (err, res, data) => { 15307 if (err) { 15308 console.log('Error:', err); 15309 } else if (res.statusCode !== 200) { 15310 console.log('Status:', res.statusCode); 15311 } else { 15312 // data is successfully parsed as a JSON object: 15313 console.log(data); 15314 } 15315}); 15316 </code></pre> 15317</div> 15318 15319<div class="php-code"> 15320 <pre><code class="php"> 15321<?php 15322// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15323$json = file_get_contents('https://www.alphavantage.co/query?function=ADX&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 15324 15325$data = json_decode($json,true); 15326 15327print_r($data); 15328 15329exit; 15330 </code></pre> 15331</div> 15332 15333<div class="cs-code"> 15334 <pre><code class="cs"> 15335using System; 15336using System.Collections.Generic; 15337using System.Net; 15338 15339// ------------------------------------------------------------------------- 15340// if using .NET Framework 15341// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15342// This requires including the reference to System.Web.Extensions in your project 15343using System.Web.Script.Serialization; 15344// ------------------------------------------------------------------------- 15345// if using .Net Core 15346// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15347using System.Text.Json; 15348// ------------------------------------------------------------------------- 15349 15350namespace ConsoleTests 15351{ 15352 internal class Program 15353 { 15354 private static void Main(string[] args) 15355 { 15356 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15357 string QUERY_URL = "https://www.alphavantage.co/query?function=ADX&symbol=IBM&interval=daily&time_period=10&apikey=demo" 15358 Uri queryUri = new Uri(QUERY_URL); 15359 15360 using (WebClient client = new WebClient()) 15361 { 15362 // ------------------------------------------------------------------------- 15363 // if using .NET Framework (System.Web.Script.Serialization) 15364 15365 JavaScriptSerializer js = new JavaScriptSerializer(); 15366 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15367 15368 // ------------------------------------------------------------------------- 15369 // if using .NET Core (System.Text.Json) 15370 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15371 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15372 15373 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15374 15375 // ------------------------------------------------------------------------- 15376
15377 // do something with the json_data 15378 } 15379 } 15380 } 15381} 15382 </code></pre> 15383</div> 15384 15385 15386<div class="other-code" style="background-color: #f9f9f9;"> 15387 <br> 15388 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 15389 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 15390 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 15391 <br> 15392</div> 15393 15394 <br> 15395 15396 <h4 id="adxr">ADXR</h4> 15397 <br> 15398 <p>This API returns the average directional movement index rating (ADXR) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=ADXR.htm" target="_blank">mathematical reference</a>.</p> 15399 <br> 15400 <h6><b>API Parameters</b></h6> 15401 <p><b>â Required: <code>function</code></b></p> 15402 <p>The technical indicator of your choice. In this case, <code>function=ADXR</code> </p> 15403 <p><b>â Required: <code>symbol</code></b></p> 15404 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 15405 <p><b>â Required: <code>interval</code></b></p> 15406 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 15407 <p>â Optional: <code>month</code></p> 15408 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 15409 <p><b>â Required:<code>time_period</code></b></p> 15410 <p>Number of data points used to calculate each ADXR value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 15411 <p>â Optional: <code>datatype</code></p> 15412 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 15413 <p>â Optional: <code>entitlement</code></p> 15414 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 15415 <p><b>â Required: <code>apikey</code></b></p> 15416 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 15417 <br> 15418 15419 <h6><b>Example (click for JSON output)</b></h6> 15420 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ADXR&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ADXR&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 15421 <br> 15422 15423 <h6><b>Language-specific guides</b></h6> 15424 <div> 15425 <button class="python-btn">Python</button> 15426 <button class="node-btn">NodeJS</button> 15427 <button class="php-btn">PHP</button> 15428 <button class="cs-btn">C#/.NET</button> 15429 <button class="other-btn">â¨MCP & Other</button> 15430</div> 15431 15432<div class="python-code"> 15433 <pre><code class="python"> 15434import requests 15435 15436# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15437url = 'https://www.alphavantage.co/query?function=ADXR&symbol=IBM&interval=daily&time_period=10&apikey=demo' 15438r = requests.get(url) 15439data = r.json() 15440 15441print(data) 15442 </code></pre> 15443</div> 15444 15445<div class="node-code"> 15446 <pre><code class="javascript"> 15447'use strict'; 15448var request = require('request'); 15449 15450// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15451var url = 'https://www.alphavantage.co/query?function=ADXR&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 15452 15453request.get({ 15454 url: url, 15455 json: true, 15456 headers: {'User-Agent': 'request'} 15457 }, (err, res, data) => { 15458 if (err) { 15459 console.log('Error:', err); 15460 } else if (res.statusCode !== 200) { 15461 console.log('Status:', res.statusCode); 15462 } else { 15463 // data is successfully parsed as a JSON object: 15464 console.log(data); 15465 } 15466}); 15467 </code></pre> 15468</div> 15469 15470<div class="php-code"> 15471 <pre><code class="php"> 15472<?php 15473// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15474$json = file_get_contents('https://www.alphavantage.co/query?function=ADXR&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 15475 15476$data = json_decode($json,true); 15477 15478print_r($data); 15479 15480exit; 15481 </code></pre> 15482</div> 15483 15484<div class="cs-code"> 15485 <pre><code class="cs"> 15486using System; 15487using System.Collections.Generic; 15488using System.Net; 15489
15490// ------------------------------------------------------------------------- 15491// if using .NET Framework 15492// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15493// This requires including the reference to System.Web.Extensions in your project 15494using System.Web.Script.Serialization; 15495// ------------------------------------------------------------------------- 15496// if using .Net Core 15497// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15498using System.Text.Json; 15499// ------------------------------------------------------------------------- 15500 15501namespace ConsoleTests 15502{ 15503 internal class Program 15504 { 15505 private static void Main(string[] args) 15506 { 15507 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15508 string QUERY_URL = "https://www.alphavantage.co/query?function=ADXR&symbol=IBM&interval=daily&time_period=10&apikey=demo" 15509 Uri queryUri = new Uri(QUERY_URL); 15510 15511 using (WebClient client = new WebClient()) 15512 { 15513 // ------------------------------------------------------------------------- 15514 // if using .NET Framework (System.Web.Script.Serialization) 15515 15516 JavaScriptSerializer js = new JavaScriptSerializer(); 15517 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15518 15519 // ------------------------------------------------------------------------- 15520 // if using .NET Core (System.Text.Json) 15521 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15522 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15523 15524 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15525 15526 // ------------------------------------------------------------------------- 15527 15528 // do something with the json_data 15529 } 15530 } 15531 } 15532} 15533 </code></pre> 15534</div> 15535 15536 15537<div class="other-code" style="background-color: #f9f9f9;"> 15538 <br> 15539 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 15540 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 15541 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 15542 <br> 15543</div> 15544 15545 <br> 15546 15547 <h4 id="apo">APO</h4> 15548 <br> 15549 <p>This API returns the absolute price oscillator (APO) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=PriceOscillator.htm" target="_blank">mathematical reference</a>.</p> 15550 <br> 15551 <h6><b>API Parameters</b></h6> 15552 <p><b>â Required: <code>function</code></b></p> 15553 <p>The technical indicator of your choice. In this case, <code>function=APO</code> </p> 15554 <p><b>â Required: <code>symbol</code></b></p> 15555 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 15556 <p><b>â Required: <code>interval</code></b></p> 15557 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 15558 <p>â Optional: <code>month</code></p> 15559 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 15560 <p><b>â Required: <code>series_type</code></b></p> 15561 <p>
15561The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 15562 <p>â Optional: <code>fastperiod</code></p> 15563 <p>Positive integers are accepted. By default, <code>fastperiod=12</code>. </p> 15564 <p>â Optional: <code>slowperiod</code></p> 15565 <p>Positive integers are accepted. By default, <code>slowperiod=26</code>. </p> 15566 <p>â Optional: <code>matype</code></p> 15567 <p>Moving average type. By default, <code>matype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 15568 <p>â Optional: <code>datatype</code></p> 15569 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 15570 <p>â Optional: <code>entitlement</code></p> 15571 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 15572 <p><b>â Required: <code>apikey</code></b></p> 15573 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 15574 <br> 15575 15576 <h6><b>Example (click for JSON output)</b></h6> 15577 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=APO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=APO&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>fastperiod</b>=10&<b>matype</b>=1&<b>apikey</b>=demo</code></a></p> 15578 <br> 15579 15580 <h6><b>Language-specific guides</b></h6> 15581 <div> 15582 <button class="python-btn">Python</button> 15583 <button class="node-btn">NodeJS</button> 15584 <button class="php-btn">PHP</button> 15585 <button class="cs-btn">C#/.NET</button> 15586 <button class="other-btn">â¨MCP & Other</button> 15587</div> 15588 15589<div class="python-code"> 15590 <pre><code class="python"> 15591import requests 15592 15593# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15594url = 'https://www.alphavantage.co/query?function=APO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo' 15595r = requests.get(url) 15596data = r.json() 15597 15598print(data) 15599 </code></pre> 15600</div> 15601 15602<div class="node-code"> 15603 <pre><code class="javascript"> 15604'use strict'; 15605var request = require('request'); 15606 15607// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15608var url = 'https://www.alphavantage.co/query?function=APO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo'; 15609 15610request.get({ 15611 url: url, 15612 json: true, 15613 headers: {'User-Agent': 'request'} 15614 }, (err, res, data) => { 15615 if (err) { 15616 console.log('Error:', err); 15617 } else if (res.statusCode !== 200) { 15618 console.log('Status:', res.statusCode); 15619 } else { 15620 // data is successfully parsed as a JSON object: 15621 console.log(data); 15622 } 15623}); 15624 </code></pre> 15625</div> 15626 15627<div class="php-code"> 15628 <pre><code class="php"> 15629<?php 15630// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15631$json = file_get_contents('https://www.alphavantage.co/query?function=APO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo'); 15632 15633$data = json_decode($json,true); 15634 15635print_r($data); 15636 15637exit; 15638 </code></pre> 15639</div> 15640 15641<div class="cs-code"> 15642 <pre><code class="cs"> 15643using System; 15644using System.Collections.Generic; 15645using System.Net; 15646
15647// ------------------------------------------------------------------------- 15648// if using .NET Framework 15649// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15650// This requires including the reference to System.Web.Extensions in your project 15651using System.Web.Script.Serialization; 15652// ------------------------------------------------------------------------- 15653// if using .Net Core 15654// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15655using System.Text.Json; 15656// ------------------------------------------------------------------------- 15657 15658namespace ConsoleTests 15659{ 15660 internal class Program 15661 { 15662 private static void Main(string[] args) 15663 { 15664 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15665 string QUERY_URL = "https://www.alphavantage.co/query?function=APO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo" 15666 Uri queryUri = new Uri(QUERY_URL); 15667 15668 using (WebClient client = new WebClient()) 15669 { 15670 // ------------------------------------------------------------------------- 15671 // if using .NET Framework (System.Web.Script.Serialization) 15672 15673 JavaScriptSerializer js = new JavaScriptSerializer(); 15674 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15675 15676 // ------------------------------------------------------------------------- 15677 // if using .NET Core (System.Text.Json) 15678 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15679 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15680 15681 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15682 15683 // ------------------------------------------------------------------------- 15684 15685 // do something with the json_data 15686 } 15687 } 15688 } 15689} 15690 </code></pre> 15691</div> 15692 15693 15694<div class="other-code" style="background-color: #f9f9f9;"> 15695 <br> 15696 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 15697 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 15698 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 15699 <br> 15700</div> 15701 15702 <br> 15703 15704 <h4 id="ppo">PPO</h4> 15705 <br> 15706 <p>This API returns the percentage price oscillator (PPO) values. See also: <a href="http://www.investopedia.com/articles/investing/051214/use-percentage-price-oscillator-elegant-indicator-picking-stocks.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=PriceOscillatorPct.htm" target="_blank">mathematical reference</a>.</p> 15707 <br> 15708 <h6><b>API Parameters</b></h6> 15709 <p><b>â Required: <code>function</code></b></p> 15710 <p>The technical indicator of your choice. In this case, <code>function=PPO</code> </p> 15711 <p><b>â Required: <code>symbol</code></b></p> 15712 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 15713 <p><b>â Required: <code>interval</code></b></p> 15714 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 15715 <p>â Optional: <code>month</code></p> 15716 <p>
15716By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 15717 <p><b>â Required: <code>series_type</code></b></p> 15718 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 15719 <p>â Optional: <code>fastperiod</code></p> 15720 <p>Positive integers are accepted. By default, <code>fastperiod=12</code>. </p> 15721 <p>â Optional: <code>slowperiod</code></p> 15722 <p>Positive integers are accepted. By default, <code>slowperiod=26</code>. </p> 15723 <p>â Optional: <code>matype</code></p> 15724 <p>Moving average type. By default, <code>matype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 15725 <p>â Optional: <code>datatype</code></p> 15726 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 15727 <p>â Optional: <code>entitlement</code></p> 15728 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 15729 <p><b>â Required: <code>apikey</code></b></p> 15730 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 15731 <br> 15732 15733 <h6><b>Example (click for JSON output)</b></h6> 15734 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=PPO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=PPO&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>fastperiod</b>=10&<b>matype</b>=1&<b>apikey</b>=demo</code></a></p> 15735 <br> 15736 15737 <h6><b>Language-specific guides</b></h6> 15738 <div> 15739 <button class="python-btn">Python</button> 15740 <button class="node-btn">NodeJS</button> 15741 <button class="php-btn">PHP</button> 15742 <button class="cs-btn">C#/.NET</button> 15743 <button class="other-btn">â¨MCP & Other</button> 15744</div> 15745 15746<div class="python-code"> 15747 <pre><code class="python"> 15748import requests 15749 15750# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15751url = 'https://www.alphavantage.co/query?function=PPO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo' 15752r = requests.get(url) 15753data = r.json() 15754 15755print(data) 15756 </code></pre> 15757</div> 15758 15759<div class="node-code"> 15760 <pre><code class="javascript"> 15761'use strict'; 15762var request = require('request'); 15763 15764// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15765var url = 'https://www.alphavantage.co/query?function=PPO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo'; 15766 15767request.get({ 15768 url: url, 15769 json: true, 15770 headers: {'User-Agent': 'request'} 15771 }, (err, res, data) => { 15772 if (err) { 15773 console.log('Error:', err); 15774 } else if (res.statusCode !== 200) { 15775 console.log('Status:', res.statusCode); 15776 } else { 15777 // data is successfully parsed as a JSON object: 15778 console.log(data); 15779 } 15780}); 15781 </code></pre> 15782</div> 15783 15784<div class="php-code"> 15785 <pre><code class="php"> 15786<?php 15787// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15788$json = file_get_contents('https://www.alphavantage.co/query?function=PPO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo'); 15789 15790$data = json_decode($json,true); 15791 15792print_r($data); 15793 15794exit; 15795 </code></pre> 15796</div> 15797 15798<div class="cs-code"> 15799 <pre><code class="cs"> 15800using System; 15801using System.Collections.Generic; 15802using System.Net; 15803
15804// ------------------------------------------------------------------------- 15805// if using .NET Framework 15806// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15807// This requires including the reference to System.Web.Extensions in your project 15808using System.Web.Script.Serialization; 15809// ------------------------------------------------------------------------- 15810// if using .Net Core 15811// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15812using System.Text.Json; 15813// ------------------------------------------------------------------------- 15814 15815namespace ConsoleTests 15816{ 15817 internal class Program 15818 { 15819 private static void Main(string[] args) 15820 { 15821 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15822 string QUERY_URL = "https://www.alphavantage.co/query?function=PPO&symbol=IBM&interval=daily&series_type=close&fastperiod=10&matype=1&apikey=demo" 15823 Uri queryUri = new Uri(QUERY_URL); 15824 15825 using (WebClient client = new WebClient()) 15826 { 15827 // ------------------------------------------------------------------------- 15828 // if using .NET Framework (System.Web.Script.Serialization) 15829 15830 JavaScriptSerializer js = new JavaScriptSerializer(); 15831 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15832 15833 // ------------------------------------------------------------------------- 15834 // if using .NET Core (System.Text.Json) 15835 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15836 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15837 15838 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15839 15840 // ------------------------------------------------------------------------- 15841 15842 // do something with the json_data 15843 } 15844 } 15845 } 15846} 15847 </code></pre> 15848</div> 15849 15850 15851<div class="other-code" style="background-color: #f9f9f9;"> 15852 <br> 15853 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 15854 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 15855 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 15856 <br> 15857</div> 15858 15859 <br> 15860 15861 <h4 id="mom">MOM</h4> 15862 <br> 15863 <p>This API returns the momentum (MOM) values. See also: <a href="http://www.investopedia.com/articles/technical/03/070203.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=Momentum.htm" target="_blank">mathematical reference</a>.</p> 15864 <br> 15865 <h6><b>API Parameters</b></h6> 15866 <p><b>â Required: <code>function</code></b></p> 15867 <p>The technical indicator of your choice. In this case, <code>function=MOM</code> </p> 15868 <p><b>â Required: <code>symbol</code></b></p> 15869 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 15870 <p><b>â Required: <code>interval</code></b></p> 15871 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 15872 <p>â Optional: <code>month</code></p> 15873 <p>
15873By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 15874 <p><b>â Required:<code>time_period</code></b></p> 15875 <p>Number of data points used to calculate each MOM value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 15876 <p><b>â Required: <code>series_type</code></b></p> 15877 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 15878 <p>â Optional: <code>datatype</code></p> 15879 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 15880 <p>â Optional: <code>entitlement</code></p> 15881 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 15882 <p><b>â Required: <code>apikey</code></b></p> 15883 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 15884 <br> 15885 15886 <h6><b>Example (click for JSON output)</b></h6> 15887 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MOM&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MOM&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 15888 <br> 15889 15890 <h6><b>Language-specific guides</b></h6> 15891 <div> 15892 <button class="python-btn">Python</button> 15893 <button class="node-btn">NodeJS</button> 15894 <button class="php-btn">PHP</button> 15895 <button class="cs-btn">C#/.NET</button> 15896 <button class="other-btn">â¨MCP & Other</button> 15897</div> 15898 15899<div class="python-code"> 15900 <pre><code class="python"> 15901import requests 15902 15903# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15904url = 'https://www.alphavantage.co/query?function=MOM&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo' 15905r = requests.get(url) 15906data = r.json() 15907 15908print(data) 15909 </code></pre> 15910</div> 15911 15912<div class="node-code"> 15913 <pre><code class="javascript"> 15914'use strict'; 15915var request = require('request'); 15916 15917// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15918var url = 'https://www.alphavantage.co/query?function=MOM&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'; 15919 15920request.get({ 15921 url: url, 15922 json: true, 15923 headers: {'User-Agent': 'request'} 15924 }, (err, res, data) => { 15925 if (err) { 15926 console.log('Error:', err); 15927 } else if (res.statusCode !== 200) { 15928 console.log('Status:', res.statusCode); 15929 } else { 15930 // data is successfully parsed as a JSON object: 15931 console.log(data); 15932 } 15933}); 15934 </code></pre> 15935</div> 15936 15937<div class="php-code"> 15938 <pre><code class="php"> 15939<?php 15940// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15941$json = file_get_contents('https://www.alphavantage.co/query?function=MOM&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'); 15942 15943$data = json_decode($json,true); 15944 15945print_r($data); 15946 15947exit; 15948 </code></pre> 15949</div> 15950 15951<div class="cs-code"> 15952 <pre><code class="cs"> 15953using System; 15954using System.Collections.Generic; 15955using System.Net; 15956
15957// ------------------------------------------------------------------------- 15958// if using .NET Framework 15959// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 15960// This requires including the reference to System.Web.Extensions in your project 15961using System.Web.Script.Serialization; 15962// ------------------------------------------------------------------------- 15963// if using .Net Core 15964// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 15965using System.Text.Json; 15966// ------------------------------------------------------------------------- 15967 15968namespace ConsoleTests 15969{ 15970 internal class Program 15971 { 15972 private static void Main(string[] args) 15973 { 15974 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 15975 string QUERY_URL = "https://www.alphavantage.co/query?function=MOM&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" 15976 Uri queryUri = new Uri(QUERY_URL); 15977 15978 using (WebClient client = new WebClient()) 15979 { 15980 // ------------------------------------------------------------------------- 15981 // if using .NET Framework (System.Web.Script.Serialization) 15982 15983 JavaScriptSerializer js = new JavaScriptSerializer(); 15984 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 15985 15986 // ------------------------------------------------------------------------- 15987 // if using .NET Core (System.Text.Json) 15988 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 15989 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 15990 15991 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 15992 15993 // ------------------------------------------------------------------------- 15994 15995 // do something with the json_data 15996 } 15997 } 15998 } 15999} 16000 </code></pre> 16001</div> 16002 16003 16004<div class="other-code" style="background-color: #f9f9f9;"> 16005 <br> 16006 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16007 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16008 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16009 <br> 16010</div> 16011 16012 <br> 16013 16014 <h4 id="bop">BOP</h4> 16015 <br> 16016 <p>This API returns the balance of power (BOP) values. </p> 16017 <br> 16018 <h6><b>API Parameters</b></h6> 16019 <p><b>â Required: <code>function</code></b></p> 16020 <p>The technical indicator of your choice. In this case, <code>function=BOP</code> </p> 16021 <p><b>â Required: <code>symbol</code></b></p> 16022 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16023 <p><b>â Required: <code>interval</code></b></p> 16024 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16025 <p>â Optional: <code>month</code></p> 16026 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16027 <p>â Optional: <code>datatype</code></p> 16028 <p>
16028By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16029 <p>â Optional: <code>entitlement</code></p> 16030 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16031 <p><b>â Required: <code>apikey</code></b></p> 16032 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16033 <br> 16034 16035 <h6><b>Example (click for JSON output)</b></h6> 16036 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=BOP&symbol=IBM&interval=daily&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=BOP&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>apikey</b>=demo</code></a></p> 16037 <br> 16038 16039 <h6><b>Language-specific guides</b></h6> 16040 <div> 16041 <button class="python-btn">Python</button> 16042 <button class="node-btn">NodeJS</button> 16043 <button class="php-btn">PHP</button> 16044 <button class="cs-btn">C#/.NET</button> 16045 <button class="other-btn">â¨MCP & Other</button> 16046</div> 16047 16048<div class="python-code"> 16049 <pre><code class="python"> 16050import requests 16051 16052# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16053url = 'https://www.alphavantage.co/query?function=BOP&symbol=IBM&interval=daily&apikey=demo' 16054r = requests.get(url) 16055data = r.json() 16056 16057print(data) 16058 </code></pre> 16059</div> 16060 16061<div class="node-code"> 16062 <pre><code class="javascript"> 16063'use strict'; 16064var request = require('request'); 16065 16066// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16067var url = 'https://www.alphavantage.co/query?function=BOP&symbol=IBM&interval=daily&apikey=demo'; 16068 16069request.get({ 16070 url: url, 16071 json: true, 16072 headers: {'User-Agent': 'request'} 16073 }, (err, res, data) => { 16074 if (err) { 16075 console.log('Error:', err); 16076 } else if (res.statusCode !== 200) { 16077 console.log('Status:', res.statusCode); 16078 } else { 16079 // data is successfully parsed as a JSON object: 16080 console.log(data); 16081 } 16082}); 16083 </code></pre> 16084</div> 16085 16086<div class="php-code"> 16087 <pre><code class="php"> 16088<?php 16089// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16090$json = file_get_contents('https://www.alphavantage.co/query?function=BOP&symbol=IBM&interval=daily&apikey=demo'); 16091 16092$data = json_decode($json,true); 16093 16094print_r($data); 16095 16096exit; 16097 </code></pre> 16098</div> 16099 16100<div class="cs-code"> 16101 <pre><code class="cs"> 16102using System; 16103using System.Collections.Generic; 16104using System.Net; 16105 16106// ------------------------------------------------------------------------- 16107// if using .NET Framework 16108// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 16109// This requires including the reference to System.Web.Extensions in your project 16110using System.Web.Script.Serialization; 16111// ------------------------------------------------------------------------- 16112// if using .Net Core 16113// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 16114using System.Text.Json; 16115// ------------------------------------------------------------------------- 16116 16117namespace ConsoleTests 16118{ 16119 internal class Program 16120 { 16121 private static void Main(string[] args) 16122 { 16123 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16124 string QUERY_URL = "https://www.alphavantage.co/query?function=BOP&symbol=IBM&interval=daily&apikey=demo" 16125 Uri queryUri = new Uri(QUERY_URL); 16126 16127 using (WebClient client = new WebClient()) 16128 { 16129 // ------------------------------------------------------------------------- 16130 // if using .NET Framework (System.Web.Script.Serialization) 16131 16132 JavaScriptSerializer js = new JavaScriptSerializer(); 16133 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 16134 16135 // ------------------------------------------------------------------------- 16136 // if using .NET Core (System.Text.Json) 16137 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 16138 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 16139 16140 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 16141 16142 // ------------------------------------------------------------------------- 16143
16144 // do something with the json_data 16145 } 16146 } 16147 } 16148} 16149 </code></pre> 16150</div> 16151 16152 16153<div class="other-code" style="background-color: #f9f9f9;"> 16154 <br> 16155 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16156 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16157 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16158 <br> 16159</div> 16160 16161 <br> 16162 16163 <h4 id="cci">CCI <span class="popular-label">Trending</span></h4> 16164 <br> 16165 <p>This API returns the commodity channel index (CCI) values. See also: <a href="http://www.investopedia.com/articles/trading/05/041805.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=CCI.htm" target="_blank">mathematical reference</a>.</p> 16166 <br> 16167 <h6><b>API Parameters</b></h6> 16168 <p><b>â Required: <code>function</code></b></p> 16169 <p>The technical indicator of your choice. In this case, <code>function=CCI</code> </p> 16170 <p><b>â Required: <code>symbol</code></b></p> 16171 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16172 <p><b>â Required: <code>interval</code></b></p> 16173 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16174 <p>â Optional: <code>month</code></p> 16175 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16176 <p><b>â Required:<code>time_period</code></b></p> 16177 <p>Number of data points used to calculate each CCI value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 16178 <p>â Optional: <code>datatype</code></p> 16179 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16180 <p>â Optional: <code>entitlement</code></p> 16181 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16182 <p><b>â Required: <code>apikey</code></b></p> 16183 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16184 <br> 16185 16186 <h6><b>Example (click for JSON output)</b></h6> 16187 Equity: 16188 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CCI&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CCI&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 16189 Forex (FX) or cryptocurrency pair: 16190 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CCI&symbol=USDEUR&interval=weekly&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CCI&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 16191 <br> 16192 16193 16194 <h6><b>Language-specific guides</b></h6> 16195 <div> 16196 <button class="python-btn">Python</button> 16197 <button class="node-btn">NodeJS</button> 16198 <button class="php-btn">PHP</button> 16199 <button class="cs-btn">C#/.NET</button> 16200 <button class="other-btn">â¨MCP & Other</button> 16201</div> 16202 16203<div class="python-code"> 16204 <pre><code class="python"> 16205import requests 16206 16207# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16208url = 'https://www.alphavantage.co/query?function=CCI&symbol=IBM&interval=daily&time_period=10&apikey=demo' 16209r = requests.get(url) 16210data = r.json() 16211 16212print(data) 16213 </code></pre> 16214</div> 16215 16216<div class="node-code"> 16217 <pre><code class="javascript"> 16218'use strict'; 16219var request = require('request'); 16220 16221// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16222var url = 'https://www.alphavantage.co/query?function=CCI&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 16223 16224request.get({ 16225 url: url, 16226 json: true, 16227 headers: {'User-Agent': 'request'} 16228 }, (err, res, data) => { 16229 if (err) { 16230 console.log('Error:', err); 16231 } else if (res.statusCode !== 200) { 16232 console.log('Status:', res.statusCode); 16233 } else { 16234 // data is successfully parsed as a JSON object: 16235 console.log(data); 16236 } 16237}); 16238 </code></pre> 16239</div> 16240 16241<div class="php-code"> 16242 <pre><code class="php"> 16243<?php 16244// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16245$json = file_get_contents('https://www.alphavantage.co/query?function=CCI&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 16246 16247$data = json_decode($json,true); 16248 16249print_r($data); 16250 16251exit; 16252 </code></pre> 16253</div> 16254 16255<div class="cs-code"> 16256 <pre><code class="cs"> 16257using System; 16258using System.Collections.Generic; 16259using System.Net; 16260
16261// ------------------------------------------------------------------------- 16262// if using .NET Framework 16263// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 16264// This requires including the reference to System.Web.Extensions in your project 16265using System.Web.Script.Serialization; 16266// ------------------------------------------------------------------------- 16267// if using .Net Core 16268// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 16269using System.Text.Json; 16270// ------------------------------------------------------------------------- 16271 16272namespace ConsoleTests 16273{ 16274 internal class Program 16275 { 16276 private static void Main(string[] args) 16277 { 16278 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16279 string QUERY_URL = "https://www.alphavantage.co/query?function=CCI&symbol=IBM&interval=daily&time_period=10&apikey=demo" 16280 Uri queryUri = new Uri(QUERY_URL); 16281 16282 using (WebClient client = new WebClient()) 16283 { 16284 // ------------------------------------------------------------------------- 16285 // if using .NET Framework (System.Web.Script.Serialization) 16286 16287 JavaScriptSerializer js = new JavaScriptSerializer(); 16288 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 16289 16290 // ------------------------------------------------------------------------- 16291 // if using .NET Core (System.Text.Json) 16292 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 16293 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 16294 16295 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 16296 16297 // ------------------------------------------------------------------------- 16298 16299 // do something with the json_data 16300 } 16301 } 16302 } 16303} 16304 </code></pre> 16305</div> 16306 16307 16308<div class="other-code" style="background-color: #f9f9f9;"> 16309 <br> 16310 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16311 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16312 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16313 <br> 16314</div> 16315 16316 <br> 16317 16318 <h4 id="cmo">CMO</h4> 16319 <br> 16320 <p>This API returns the Chande momentum oscillator (CMO) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=CMO.htm" target="_blank">mathematical reference</a>.</p> 16321 <br> 16322 <h6><b>API Parameters</b></h6> 16323 <p><b>â Required: <code>function</code></b></p> 16324 <p>The technical indicator of your choice. In this case, <code>function=CMO</code> </p> 16325 <p><b>â Required: <code>symbol</code></b></p> 16326 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16327 <p><b>â Required: <code>interval</code></b></p> 16328 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16329 <p>â Optional: <code>month</code></p> 16330 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16331 <p><b>â Required:<code>time_period</code></b></p> 16332 <p>Number of data points used to calculate each CMO value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 16333 <p><b>â Required: <code>series_type</code></b></p> 16334 <p>
16334The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 16335 <p>â Optional: <code>datatype</code></p> 16336 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16337 <p>â Optional: <code>entitlement</code></p> 16338 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16339 <p><b>â Required: <code>apikey</code></b></p> 16340 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16341 <br> 16342 16343 <h6><b>Example (click for JSON output)</b></h6> 16344 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=CMO&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=CMO&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 16345 <br> 16346 16347 <h6><b>Language-specific guides</b></h6> 16348 <div> 16349 <button class="python-btn">Python</button> 16350 <button class="node-btn">NodeJS</button> 16351 <button class="php-btn">PHP</button> 16352 <button class="cs-btn">C#/.NET</button> 16353 <button class="other-btn">â¨MCP & Other</button> 16354</div> 16355 16356<div class="python-code"> 16357 <pre><code class="python"> 16358import requests 16359 16360# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16361url = 'https://www.alphavantage.co/query?function=CMO&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo' 16362r = requests.get(url) 16363data = r.json() 16364 16365print(data) 16366 </code></pre> 16367</div> 16368 16369<div class="node-code"> 16370 <pre><code class="javascript"> 16371'use strict'; 16372var request = require('request'); 16373 16374// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16375var url = 'https://www.alphavantage.co/query?function=CMO&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo'; 16376 16377request.get({ 16378 url: url, 16379 json: true, 16380 headers: {'User-Agent': 'request'} 16381 }, (err, res, data) => { 16382 if (err) { 16383 console.log('Error:', err); 16384 } else if (res.statusCode !== 200) { 16385 console.log('Status:', res.statusCode); 16386 } else { 16387 // data is successfully parsed as a JSON object: 16388 console.log(data); 16389 } 16390}); 16391 </code></pre> 16392</div> 16393 16394<div class="php-code"> 16395 <pre><code class="php"> 16396<?php 16397// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16398$json = file_get_contents('https://www.alphavantage.co/query?function=CMO&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo'); 16399 16400$data = json_decode($json,true); 16401 16402print_r($data); 16403 16404exit; 16405 </code></pre> 16406</div> 16407 16408<div class="cs-code"> 16409 <pre><code class="cs"> 16410using System; 16411using System.Collections.Generic; 16412using System.Net; 16413 16414// ------------------------------------------------------------------------- 16415// if using .NET Framework 16416// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 16417// This requires including the reference to System.Web.Extensions in your project 16418using System.Web.Script.Serialization; 16419// ------------------------------------------------------------------------- 16420// if using .Net Core 16421// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 16422using System.Text.Json; 16423// ------------------------------------------------------------------------- 16424 16425namespace ConsoleTests 16426{
16427 internal class Program 16428 { 16429 private static void Main(string[] args) 16430 { 16431 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16432 string QUERY_URL = "https://www.alphavantage.co/query?function=CMO&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo" 16433 Uri queryUri = new Uri(QUERY_URL); 16434 16435 using (WebClient client = new WebClient()) 16436 { 16437 // ------------------------------------------------------------------------- 16438 // if using .NET Framework (System.Web.Script.Serialization) 16439 16440 JavaScriptSerializer js = new JavaScriptSerializer(); 16441 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 16442 16443 // ------------------------------------------------------------------------- 16444 // if using .NET Core (System.Text.Json) 16445 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 16446 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 16447 16448 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 16449 16450 // ------------------------------------------------------------------------- 16451 16452 // do something with the json_data 16453 } 16454 } 16455 } 16456} 16457 </code></pre> 16458</div> 16459 16460 16461<div class="other-code" style="background-color: #f9f9f9;"> 16462 <br> 16463 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16464 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16465 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16466 <br> 16467</div> 16468 16469 16470 <br> 16471 16472 <h4 id="roc">ROC</h4> 16473 <br> 16474 <p>This API returns the rate of change (ROC) values. See also: <a href="http://www.investopedia.com/articles/technical/092401.asp" target="_blank">Investopedia article</a>.</p> 16475 <br> 16476 <h6><b>API Parameters</b></h6> 16477 <p><b>â Required: <code>function</code></b></p> 16478 <p>The technical indicator of your choice. In this case, <code>function=ROC</code> </p> 16479 <p><b>â Required: <code>symbol</code></b></p> 16480 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16481 <p><b>â Required: <code>interval</code></b></p> 16482 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16483 <p>â Optional: <code>month</code></p> 16484 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16485 <p><b>â Required:<code>time_period</code></b></p> 16486 <p>Number of data points used to calculate each ROC value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 16487 <p><b>â Required: <code>series_type</code></b></p> 16488 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 16489 <p>â Optional: <code>datatype</code></p> 16490 <p>
16490By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16491 <p>â Optional: <code>entitlement</code></p> 16492 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16493 <p><b>â Required: <code>apikey</code></b></p> 16494 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16495 <br> 16496 16497 <h6><b>Example (click for JSON output)</b></h6> 16498 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ROC&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ROC&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 16499 <br> 16500 16501 <h6><b>Language-specific guides</b></h6> 16502 <div> 16503 <button class="python-btn">Python</button> 16504 <button class="node-btn">NodeJS</button> 16505 <button class="php-btn">PHP</button> 16506 <button class="cs-btn">C#/.NET</button> 16507 <button class="other-btn">â¨MCP & Other</button> 16508</div> 16509 16510<div class="python-code"> 16511 <pre><code class="python"> 16512import requests 16513 16514# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16515url = 'https://www.alphavantage.co/query?function=ROC&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo' 16516r = requests.get(url) 16517data = r.json() 16518 16519print(data) 16520 </code></pre> 16521</div> 16522 16523<div class="node-code"> 16524 <pre><code class="javascript"> 16525'use strict'; 16526var request = require('request'); 16527 16528// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16529var url = 'https://www.alphavantage.co/query?function=ROC&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo'; 16530 16531request.get({ 16532 url: url, 16533 json: true, 16534 headers: {'User-Agent': 'request'} 16535 }, (err, res, data) => { 16536 if (err) { 16537 console.log('Error:', err); 16538 } else if (res.statusCode !== 200) { 16539 console.log('Status:', res.statusCode); 16540 } else { 16541 // data is successfully parsed as a JSON object: 16542 console.log(data); 16543 } 16544}); 16545 </code></pre> 16546</div> 16547 16548<div class="php-code"> 16549 <pre><code class="php"> 16550<?php 16551// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16552$json = file_get_contents('https://www.alphavantage.co/query?function=ROC&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo'); 16553 16554$data = json_decode($json,true); 16555 16556print_r($data); 16557 16558exit; 16559 </code></pre> 16560</div> 16561 16562<div class="cs-code"> 16563 <pre><code class="cs"> 16564using System; 16565using System.Collections.Generic; 16566using System.Net; 16567 16568// ------------------------------------------------------------------------- 16569// if using .NET Framework 16570// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 16571// This requires including the reference to System.Web.Extensions in your project 16572using System.Web.Script.Serialization; 16573// ------------------------------------------------------------------------- 16574// if using .Net Core 16575// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 16576using System.Text.Json; 16577// ------------------------------------------------------------------------- 16578 16579namespace ConsoleTests 16580{ 16581 internal class Program 16582 { 16583 private static void Main(string[] args) 16584 { 16585 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
16586 string QUERY_URL = "https://www.alphavantage.co/query?function=ROC&symbol=IBM&interval=weekly&time_period=10&series_type=close&apikey=demo" 16587 Uri queryUri = new Uri(QUERY_URL); 16588 16589 using (WebClient client = new WebClient()) 16590 { 16591 // ------------------------------------------------------------------------- 16592 // if using .NET Framework (System.Web.Script.Serialization) 16593 16594 JavaScriptSerializer js = new JavaScriptSerializer(); 16595 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 16596 16597 // ------------------------------------------------------------------------- 16598 // if using .NET Core (System.Text.Json) 16599 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 16600 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 16601 16602 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 16603 16604 // ------------------------------------------------------------------------- 16605 16606 // do something with the json_data 16607 } 16608 } 16609 } 16610} 16611 </code></pre> 16612</div> 16613 16614 16615<div class="other-code" style="background-color: #f9f9f9;"> 16616 <br> 16617 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16618 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16619 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16620 <br> 16621</div> 16622 16623 16624 <br> 16625 16626 <h4 id="rocr">ROCR</h4> 16627 <br> 16628 <p>This API returns the rate of change ratio (ROCR) values. See also: <a href="http://www.investopedia.com/articles/technical/092401.asp" target="_blank">Investopedia article</a>.</p> 16629 <br> 16630 <h6><b>API Parameters</b></h6> 16631 <p><b>â Required: <code>function</code></b></p> 16632 <p>The technical indicator of your choice. In this case, <code>function=ROCR</code> </p> 16633 <p><b>â Required: <code>symbol</code></b></p> 16634 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16635 <p><b>â Required: <code>interval</code></b></p> 16636 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16637 <p>â Optional: <code>month</code></p> 16638 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16639 <p><b>â Required:<code>time_period</code></b></p> 16640 <p>Number of data points used to calculate each ROCR value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 16641 <p><b>â Required: <code>series_type</code></b></p> 16642 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 16643 <p>â Optional: <code>datatype</code></p> 16644 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16645 <p>â Optional: <code>entitlement</code></p> 16646 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
16646realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16647 <p><b>â Required: <code>apikey</code></b></p> 16648 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16649 <br> 16650 16651 <h6><b>Example (click for JSON output)</b></h6> 16652 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ROCR&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ROCR&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 16653 <br> 16654 16655 <h6><b>Language-specific guides</b></h6> 16656 <div> 16657 <button class="python-btn">Python</button> 16658 <button class="node-btn">NodeJS</button> 16659 <button class="php-btn">PHP</button> 16660 <button class="cs-btn">C#/.NET</button> 16661 <button class="other-btn">â¨MCP & Other</button> 16662</div> 16663 16664<div class="python-code"> 16665 <pre><code class="python"> 16666import requests 16667 16668# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16669url = 'https://www.alphavantage.co/query?function=ROCR&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo' 16670r = requests.get(url) 16671data = r.json() 16672 16673print(data) 16674 </code></pre> 16675</div> 16676 16677<div class="node-code"> 16678 <pre><code class="javascript"> 16679'use strict'; 16680var request = require('request'); 16681 16682// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16683var url = 'https://www.alphavantage.co/query?function=ROCR&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'; 16684 16685request.get({ 16686 url: url, 16687 json: true, 16688 headers: {'User-Agent': 'request'} 16689 }, (err, res, data) => { 16690 if (err) { 16691 console.log('Error:', err); 16692 } else if (res.statusCode !== 200) { 16693 console.log('Status:', res.statusCode); 16694 } else { 16695 // data is successfully parsed as a JSON object: 16696 console.log(data); 16697 } 16698}); 16699 </code></pre> 16700</div> 16701 16702<div class="php-code"> 16703 <pre><code class="php"> 16704<?php 16705// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16706$json = file_get_contents('https://www.alphavantage.co/query?function=ROCR&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'); 16707 16708$data = json_decode($json,true); 16709 16710print_r($data); 16711 16712exit; 16713 </code></pre> 16714</div> 16715 16716<div class="cs-code"> 16717 <pre><code class="cs"> 16718using System; 16719using System.Collections.Generic; 16720using System.Net; 16721 16722// ------------------------------------------------------------------------- 16723// if using .NET Framework 16724// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 16725// This requires including the reference to System.Web.Extensions in your project 16726using System.Web.Script.Serialization; 16727// ------------------------------------------------------------------------- 16728// if using .Net Core 16729// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 16730using System.Text.Json; 16731// ------------------------------------------------------------------------- 16732 16733namespace ConsoleTests 16734{ 16735 internal class Program 16736 { 16737 private static void Main(string[] args) 16738 { 16739 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16740 string QUERY_URL = "https://www.alphavantage.co/query?function=ROCR&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" 16741 Uri queryUri = new Uri(QUERY_URL); 16742 16743 using (WebClient client = new WebClient()) 16744 { 16745 // ------------------------------------------------------------------------- 16746 // if using .NET Framework (System.Web.Script.Serialization) 16747 16748 JavaScriptSerializer js = new JavaScriptSerializer(); 16749 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 16750 16751 // ------------------------------------------------------------------------- 16752 // if using .NET Core (System.Text.Json) 16753 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 16754 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 16755 16756 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 16757 16758 // ------------------------------------------------------------------------- 16759
16760 // do something with the json_data 16761 } 16762 } 16763 } 16764} 16765 </code></pre> 16766</div> 16767 16768 16769<div class="other-code" style="background-color: #f9f9f9;"> 16770 <br> 16771 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16772 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16773 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16774 <br> 16775</div> 16776 16777 16778 <br> 16779 16780 <h4 id="aroon">AROON <span class="popular-label">Trending</span></h4> 16781 <br> 16782 <p>This API returns the Aroon (AROON) values. See also: <a href="http://www.investopedia.com/articles/trading/06/aroon.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=Aroon.htm" target="_blank">mathematical reference</a>.</p> 16783 <br> 16784 <h6><b>API Parameters</b></h6> 16785 <p><b>â Required: <code>function</code></b></p> 16786 <p>The technical indicator of your choice. In this case, <code>function=AROON</code> </p> 16787 <p><b>â Required: <code>symbol</code></b></p> 16788 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16789 <p><b>â Required: <code>interval</code></b></p> 16790 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16791 <p>â Optional: <code>month</code></p> 16792 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16793 <p><b>â Required:<code>time_period</code></b></p> 16794 <p>Number of data points used to calculate each AROON value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 16795 <p>â Optional: <code>datatype</code></p> 16796 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16797 <p>â Optional: <code>entitlement</code></p> 16798 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16799 <p><b>â Required: <code>apikey</code></b></p> 16800 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16801 <br> 16802 16803 <h6><b>Example (click for JSON output)</b></h6> 16804 Equity: 16805 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=AROON&symbol=IBM&interval=daily&time_period=14&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=AROON&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=14&<b>apikey</b>=demo</code></a></p> 16806 Forex (FX) or cryptocurrency pair: 16807 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=AROON&symbol=USDEUR&interval=weekly&time_period=14&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=AROON&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=14&<b>apikey</b>=demo</code></a></p> 16808 <br> 16809 16810 <h6><b>Language-specific guides</b></h6> 16811 <div> 16812 <button class="python-btn">Python</button> 16813 <button class="node-btn">NodeJS</button> 16814 <button class="php-btn">PHP</button> 16815 <button class="cs-btn">C#/.NET</button> 16816 <button class="other-btn">â¨MCP & Other</button> 16817</div> 16818 16819<div class="python-code"> 16820 <pre><code class="python"> 16821import requests 16822 16823# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16824url = 'https://www.alphavantage.co/query?function=AROON&symbol=IBM&interval=daily&time_period=14&apikey=demo' 16825r = requests.get(url) 16826data = r.json() 16827 16828print(data) 16829 </code></pre> 16830</div> 16831 16832<div class="node-code"> 16833 <pre><code class="javascript"> 16834'use strict'; 16835var request = require('request'); 16836 16837// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16838var url = 'https://www.alphavantage.co/query?function=AROON&symbol=IBM&interval=daily&time_period=14&apikey=demo'; 16839 16840request.get({ 16841 url: url, 16842 json: true, 16843 headers: {'User-Agent': 'request'} 16844 }, (err, res, data) => { 16845 if (err) { 16846 console.log('Error:', err); 16847 } else if (res.statusCode !== 200) { 16848 console.log('Status:', res.statusCode); 16849 } else { 16850 // data is successfully parsed as a JSON object: 16851 console.log(data); 16852 } 16853}); 16854 </code></pre> 16855</div> 16856 16857<div class="php-code"> 16858 <pre><code class="php"> 16859<?php 16860// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16861$json = file_get_contents('https://www.alphavantage.co/query?function=AROON&symbol=IBM&interval=daily&time_period=14&apikey=demo'); 16862 16863$data = json_decode($json,true); 16864 16865print_r($data); 16866 16867exit; 16868 </code></pre> 16869</div> 16870 16871<div class="cs-code"> 16872 <pre><code class="cs"> 16873using System; 16874using System.Collections.Generic; 16875using System.Net; 16876
16877// ------------------------------------------------------------------------- 16878// if using .NET Framework 16879// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 16880// This requires including the reference to System.Web.Extensions in your project 16881using System.Web.Script.Serialization; 16882// ------------------------------------------------------------------------- 16883// if using .Net Core 16884// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 16885using System.Text.Json; 16886// ------------------------------------------------------------------------- 16887 16888namespace ConsoleTests 16889{ 16890 internal class Program 16891 { 16892 private static void Main(string[] args) 16893 { 16894 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16895 string QUERY_URL = "https://www.alphavantage.co/query?function=AROON&symbol=IBM&interval=daily&time_period=14&apikey=demo" 16896 Uri queryUri = new Uri(QUERY_URL); 16897 16898 using (WebClient client = new WebClient()) 16899 { 16900 // ------------------------------------------------------------------------- 16901 // if using .NET Framework (System.Web.Script.Serialization) 16902 16903 JavaScriptSerializer js = new JavaScriptSerializer(); 16904 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 16905 16906 // ------------------------------------------------------------------------- 16907 // if using .NET Core (System.Text.Json) 16908 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 16909 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 16910 16911 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 16912 16913 // ------------------------------------------------------------------------- 16914 16915 // do something with the json_data 16916 } 16917 } 16918 } 16919} 16920 </code></pre> 16921</div> 16922 16923 16924<div class="other-code" style="background-color: #f9f9f9;"> 16925 <br> 16926 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 16927 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 16928 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 16929 <br> 16930</div> 16931 16932 <br> 16933 16934 <h4 id="aroonosc">AROONOSC</h4> 16935 <br> 16936 <p>This API returns the Aroon oscillator (AROONOSC) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=AroonOscillator.htm" target="_blank">mathematical reference</a>.</p> 16937 <br> 16938 <h6><b>API Parameters</b></h6> 16939 <p><b>â Required: <code>function</code></b></p> 16940 <p>The technical indicator of your choice. In this case, <code>function=AROONOSC</code> </p> 16941 <p><b>â Required: <code>symbol</code></b></p> 16942 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 16943 <p><b>â Required: <code>interval</code></b></p> 16944 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 16945 <p>â Optional: <code>month</code></p> 16946 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 16947 <p><b>â Required:<code>time_period</code></b></p> 16948 <p>Number of data points used to calculate each AROONOSC value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 16949 <p>â Optional: <code>datatype</code></p> 16950 <p>
16950By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 16951 <p>â Optional: <code>entitlement</code></p> 16952 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 16953 <p><b>â Required: <code>apikey</code></b></p> 16954 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 16955 <br> 16956 16957 <h6><b>Example (click for JSON output)</b></h6> 16958 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=AROONOSC&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=AROONOSC&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 16959 <br> 16960 16961 <h6><b>Language-specific guides</b></h6> 16962 <div> 16963 <button class="python-btn">Python</button> 16964 <button class="node-btn">NodeJS</button> 16965 <button class="php-btn">PHP</button> 16966 <button class="cs-btn">C#/.NET</button> 16967 <button class="other-btn">â¨MCP & Other</button> 16968</div> 16969 16970<div class="python-code"> 16971 <pre><code class="python"> 16972import requests 16973 16974# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16975url = 'https://www.alphavantage.co/query?function=AROONOSC&symbol=IBM&interval=daily&time_period=10&apikey=demo' 16976r = requests.get(url) 16977data = r.json() 16978 16979print(data) 16980 </code></pre> 16981</div> 16982 16983<div class="node-code"> 16984 <pre><code class="javascript"> 16985'use strict'; 16986var request = require('request'); 16987 16988// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 16989var url = 'https://www.alphavantage.co/query?function=AROONOSC&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 16990 16991request.get({ 16992 url: url, 16993 json: true, 16994 headers: {'User-Agent': 'request'} 16995 }, (err, res, data) => { 16996 if (err) { 16997 console.log('Error:', err); 16998 } else if (res.statusCode !== 200) { 16999 console.log('Status:', res.statusCode); 17000 } else { 17001 // data is successfully parsed as a JSON object: 17002 console.log(data); 17003 } 17004}); 17005 </code></pre> 17006</div> 17007 17008<div class="php-code"> 17009 <pre><code class="php"> 17010<?php 17011// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17012$json = file_get_contents('https://www.alphavantage.co/query?function=AROONOSC&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 17013 17014$data = json_decode($json,true); 17015 17016print_r($data); 17017 17018exit; 17019 </code></pre> 17020</div> 17021 17022<div class="cs-code"> 17023 <pre><code class="cs"> 17024using System; 17025using System.Collections.Generic; 17026using System.Net; 17027 17028// ------------------------------------------------------------------------- 17029// if using .NET Framework 17030// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17031// This requires including the reference to System.Web.Extensions in your project 17032using System.Web.Script.Serialization; 17033// ------------------------------------------------------------------------- 17034// if using .Net Core 17035// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17036using System.Text.Json; 17037// ------------------------------------------------------------------------- 17038 17039namespace ConsoleTests 17040{ 17041 internal class Program 17042 { 17043 private static void Main(string[] args) 17044 { 17045 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
17046 string QUERY_URL = "https://www.alphavantage.co/query?function=AROONOSC&symbol=IBM&interval=daily&time_period=10&apikey=demo" 17047 Uri queryUri = new Uri(QUERY_URL); 17048 17049 using (WebClient client = new WebClient()) 17050 { 17051 // ------------------------------------------------------------------------- 17052 // if using .NET Framework (System.Web.Script.Serialization) 17053 17054 JavaScriptSerializer js = new JavaScriptSerializer(); 17055 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17056 17057 // ------------------------------------------------------------------------- 17058 // if using .NET Core (System.Text.Json) 17059 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17060 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17061 17062 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17063 17064 // ------------------------------------------------------------------------- 17065 17066 // do something with the json_data 17067 } 17068 } 17069 } 17070} 17071 </code></pre> 17072</div> 17073 17074 17075<div class="other-code" style="background-color: #f9f9f9;"> 17076 <br> 17077 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17078 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17079 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17080 <br> 17081</div> 17082 17083 17084 <br> 17085 17086 <h4 id="mfi">MFI</h4> 17087 <br> 17088 <p>This API returns the money flow index (MFI) values. See also: <a href="http://www.investopedia.com/articles/technical/03/072303.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=MoneyFlowIndex.htm" target="_blank">mathematical reference</a>.</p> 17089 <br> 17090 <h6><b>API Parameters</b></h6> 17091 <p><b>â Required: <code>function</code></b></p> 17092 <p>The technical indicator of your choice. In this case, <code>function=MFI</code> </p> 17093 <p><b>â Required: <code>symbol</code></b></p> 17094 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 17095 <p><b>â Required: <code>interval</code></b></p> 17096 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 17097 <p>â Optional: <code>month</code></p> 17098 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 17099 <p><b>â Required:<code>time_period</code></b></p> 17100 <p>Number of data points used to calculate each MFI value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 17101 <p>â Optional: <code>datatype</code></p> 17102 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 17103 <p>â Optional: <code>entitlement</code></p> 17104 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
17104realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 17105 <p><b>â Required: <code>apikey</code></b></p> 17106 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 17107 <br> 17108 17109 <h6><b>Example (click for JSON output)</b></h6> 17110 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MFI&symbol=IBM&interval=weekly&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MFI&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 17111 <br> 17112 17113 <h6><b>Language-specific guides</b></h6> 17114 <div> 17115 <button class="python-btn">Python</button> 17116 <button class="node-btn">NodeJS</button> 17117 <button class="php-btn">PHP</button> 17118 <button class="cs-btn">C#/.NET</button> 17119 <button class="other-btn">â¨MCP & Other</button> 17120</div> 17121 17122<div class="python-code"> 17123 <pre><code class="python"> 17124import requests 17125 17126# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17127url = 'https://www.alphavantage.co/query?function=MFI&symbol=IBM&interval=weekly&time_period=10&apikey=demo' 17128r = requests.get(url) 17129data = r.json() 17130 17131print(data) 17132 </code></pre> 17133</div> 17134 17135<div class="node-code"> 17136 <pre><code class="javascript"> 17137'use strict'; 17138var request = require('request'); 17139 17140// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17141var url = 'https://www.alphavantage.co/query?function=MFI&symbol=IBM&interval=weekly&time_period=10&apikey=demo'; 17142 17143request.get({ 17144 url: url, 17145 json: true, 17146 headers: {'User-Agent': 'request'} 17147 }, (err, res, data) => { 17148 if (err) { 17149 console.log('Error:', err); 17150 } else if (res.statusCode !== 200) { 17151 console.log('Status:', res.statusCode); 17152 } else { 17153 // data is successfully parsed as a JSON object: 17154 console.log(data); 17155 } 17156}); 17157 </code></pre> 17158</div> 17159 17160<div class="php-code"> 17161 <pre><code class="php"> 17162<?php 17163// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17164$json = file_get_contents('https://www.alphavantage.co/query?function=MFI&symbol=IBM&interval=weekly&time_period=10&apikey=demo'); 17165 17166$data = json_decode($json,true); 17167 17168print_r($data); 17169 17170exit; 17171 </code></pre> 17172</div> 17173 17174<div class="cs-code"> 17175 <pre><code class="cs"> 17176using System; 17177using System.Collections.Generic; 17178using System.Net; 17179 17180// ------------------------------------------------------------------------- 17181// if using .NET Framework 17182// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17183// This requires including the reference to System.Web.Extensions in your project 17184using System.Web.Script.Serialization; 17185// ------------------------------------------------------------------------- 17186// if using .Net Core 17187// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17188using System.Text.Json; 17189// ------------------------------------------------------------------------- 17190 17191namespace ConsoleTests 17192{ 17193 internal class Program 17194 { 17195 private static void Main(string[] args) 17196 { 17197 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17198 string QUERY_URL = "https://www.alphavantage.co/query?function=MFI&symbol=IBM&interval=weekly&time_period=10&apikey=demo" 17199 Uri queryUri = new Uri(QUERY_URL); 17200 17201 using (WebClient client = new WebClient()) 17202 { 17203 // ------------------------------------------------------------------------- 17204 // if using .NET Framework (System.Web.Script.Serialization) 17205 17206 JavaScriptSerializer js = new JavaScriptSerializer(); 17207 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17208 17209 // ------------------------------------------------------------------------- 17210 // if using .NET Core (System.Text.Json) 17211 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17212 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17213 17214 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17215 17216 // ------------------------------------------------------------------------- 17217
17218 // do something with the json_data 17219 } 17220 } 17221 } 17222} 17223 </code></pre> 17224</div> 17225 17226 17227<div class="other-code" style="background-color: #f9f9f9;"> 17228 <br> 17229 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17230 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17231 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17232 <br> 17233</div> 17234 17235 17236 <br> 17237 17238 <h4 id="trix">TRIX</h4> 17239 <br> 17240 <p>This API returns the 1-day rate of change of a triple smooth exponential moving average (TRIX) values. See also: <a href="http://www.investopedia.com/articles/technical/02/092402.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=TRIX.htm" target="_blank">mathematical reference</a>.</p> 17241 <br> 17242 <h6><b>API Parameters</b></h6> 17243 <p><b>â Required: <code>function</code></b></p> 17244 <p>The technical indicator of your choice. In this case, <code>function=TRIX</code> </p> 17245 <p><b>â Required: <code>symbol</code></b></p> 17246 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 17247 <p><b>â Required: <code>interval</code></b></p> 17248 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 17249 <p>â Optional: <code>month</code></p> 17250 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 17251 <p><b>â Required:<code>time_period</code></b></p> 17252 <p>Number of data points used to calculate each TRIX value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 17253 <p><b>â Required: <code>series_type</code></b></p> 17254 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 17255 <p>â Optional: <code>datatype</code></p> 17256 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 17257 <p>â Optional: <code>entitlement</code></p> 17258 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 17259 <p><b>â Required: <code>apikey</code></b></p> 17260 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 17261 <br> 17262 17263 <h6><b>Example (click for JSON output)</b></h6> 17264 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TRIX&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TRIX&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 17265 <br> 17266 17267 <h6><b>Language-specific guides</b></h6> 17268 <div> 17269 <button class="python-btn">Python</button> 17270 <button class="node-btn">NodeJS</button> 17271 <button class="php-btn">PHP</button> 17272 <button class="cs-btn">C#/.NET</button> 17273 <button class="other-btn">â¨MCP & Other</button> 17274</div> 17275 17276<div class="python-code"> 17277 <pre><code class="python"> 17278import requests 17279 17280# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17281url = 'https://www.alphavantage.co/query?function=TRIX&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo' 17282r = requests.get(url) 17283data = r.json() 17284 17285print(data) 17286 </code></pre> 17287</div> 17288 17289<div class="node-code"> 17290 <pre><code class="javascript"> 17291'use strict'; 17292var request = require('request'); 17293 17294// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17295var url = 'https://www.alphavantage.co/query?function=TRIX&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'; 17296 17297request.get({ 17298 url: url, 17299 json: true, 17300 headers: {'User-Agent': 'request'} 17301 }, (err, res, data) => { 17302 if (err) { 17303 console.log('Error:', err); 17304 } else if (res.statusCode !== 200) { 17305 console.log('Status:', res.statusCode); 17306 } else { 17307 // data is successfully parsed as a JSON object: 17308 console.log(data); 17309 } 17310}); 17311 </code></pre> 17312</div> 17313 17314<div class="php-code"> 17315 <pre><code class="php"> 17316<?php 17317// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17318$json = file_get_contents('https://www.alphavantage.co/query?function=TRIX&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'); 17319 17320$data = json_decode($json,true); 17321 17322print_r($data); 17323 17324exit; 17325 </code></pre> 17326</div> 17327 17328<div class="cs-code"> 17329 <pre><code class="cs"> 17330using System; 17331using System.Collections.Generic; 17332using System.Net; 17333
17334// ------------------------------------------------------------------------- 17335// if using .NET Framework 17336// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17337// This requires including the reference to System.Web.Extensions in your project 17338using System.Web.Script.Serialization; 17339// ------------------------------------------------------------------------- 17340// if using .Net Core 17341// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17342using System.Text.Json; 17343// ------------------------------------------------------------------------- 17344 17345namespace ConsoleTests 17346{ 17347 internal class Program 17348 { 17349 private static void Main(string[] args) 17350 { 17351 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17352 string QUERY_URL = "https://www.alphavantage.co/query?function=TRIX&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" 17353 Uri queryUri = new Uri(QUERY_URL); 17354 17355 using (WebClient client = new WebClient()) 17356 { 17357 // ------------------------------------------------------------------------- 17358 // if using .NET Framework (System.Web.Script.Serialization) 17359 17360 JavaScriptSerializer js = new JavaScriptSerializer(); 17361 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17362 17363 // ------------------------------------------------------------------------- 17364 // if using .NET Core (System.Text.Json) 17365 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17366 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17367 17368 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17369 17370 // ------------------------------------------------------------------------- 17371 17372 // do something with the json_data 17373 } 17374 } 17375 } 17376} 17377 </code></pre> 17378</div> 17379 17380 17381<div class="other-code" style="background-color: #f9f9f9;"> 17382 <br> 17383 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17384 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17385 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17386 <br> 17387</div> 17388 17389 17390 <br> 17391 17392 <h4 id="ultosc">ULTOSC</h4> 17393 <br> 17394 <p>This API returns the ultimate oscillator (ULTOSC) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=UltimateOsc.htm" target="_blank">mathematical reference</a>.</p> 17395 <br> 17396 <h6><b>API Parameters</b></h6> 17397 <p><b>â Required: <code>function</code></b></p> 17398 <p>The technical indicator of your choice. In this case, <code>function=ULTOSC</code> </p> 17399 <p><b>â Required: <code>symbol</code></b></p> 17400 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 17401 <p><b>â Required: <code>interval</code></b></p> 17402 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 17403 <p>â Optional: <code>month</code></p> 17404 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 17405 <p>â Optional: <code>timeperiod1</code></p> 17406 <p>The first time period for the indicator. Positive integers are accepted. By default, <code>timeperiod1=7</code>. </p> 17407 <p>â Optional: <code>timeperiod2</code></p> 17408 <p>The second time period for the indicator. Positive integers are accepted. By default, <code>timeperiod2=14</code>. </p> 17409 <p>â Optional: <code>timeperiod3</code></p> 17410 <p>The third time period for the indicator. Positive integers are accepted. By default, <code>timeperiod3=28</code>. </p> 17411 <p>â Optional: <code>datatype</code></p> 17412 <p>
17412By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 17413 <p>â Optional: <code>entitlement</code></p> 17414 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 17415 <p><b>â Required: <code>apikey</code></b></p> 17416 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 17417 <br> 17418 17419 <h6><b>Examples (click for JSON output)</b></h6> 17420 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ULTOSC&symbol=IBM&interval=daily&timeperiod1=8&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ULTOSC&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>timeperiod1</b>=8&<b>apikey</b>=demo</code></a></p> 17421 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ULTOSC&symbol=IBM&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ULTOSC&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>apikey</b>=demo</code></a></p> 17422 <br> 17423 17424 <h6><b>Language-specific guides</b></h6> 17425 <div> 17426 <button class="python-btn">Python</button> 17427 <button class="node-btn">NodeJS</button> 17428 <button class="php-btn">PHP</button> 17429 <button class="cs-btn">C#/.NET</button> 17430 <button class="other-btn">â¨MCP & Other</button> 17431</div> 17432 17433<div class="python-code"> 17434 <pre><code class="python"> 17435import requests 17436 17437# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17438url = 'https://www.alphavantage.co/query?function=ULTOSC&symbol=IBM&interval=daily&timeperiod1=8&apikey=demo' 17439r = requests.get(url) 17440data = r.json() 17441 17442print(data) 17443 </code></pre> 17444</div> 17445 17446<div class="node-code"> 17447 <pre><code class="javascript"> 17448'use strict'; 17449var request = require('request'); 17450 17451// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17452var url = 'https://www.alphavantage.co/query?function=ULTOSC&symbol=IBM&interval=daily&timeperiod1=8&apikey=demo'; 17453 17454request.get({ 17455 url: url, 17456 json: true, 17457 headers: {'User-Agent': 'request'} 17458 }, (err, res, data) => { 17459 if (err) { 17460 console.log('Error:', err); 17461 } else if (res.statusCode !== 200) { 17462 console.log('Status:', res.statusCode); 17463 } else { 17464 // data is successfully parsed as a JSON object: 17465 console.log(data); 17466 } 17467}); 17468 </code></pre> 17469</div> 17470 17471<div class="php-code"> 17472 <pre><code class="php"> 17473<?php 17474// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17475$json = file_get_contents('https://www.alphavantage.co/query?function=ULTOSC&symbol=IBM&interval=daily&timeperiod1=8&apikey=demo'); 17476 17477$data = json_decode($json,true); 17478 17479print_r($data); 17480 17481exit; 17482 </code></pre> 17483</div> 17484 17485<div class="cs-code"> 17486 <pre><code class="cs"> 17487using System; 17488using System.Collections.Generic; 17489using System.Net; 17490 17491// ------------------------------------------------------------------------- 17492// if using .NET Framework 17493// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17494// This requires including the reference to System.Web.Extensions in your project 17495using System.Web.Script.Serialization; 17496// ------------------------------------------------------------------------- 17497// if using .Net Core 17498// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17499using System.Text.Json; 17500// ------------------------------------------------------------------------- 17501 17502namespace ConsoleTests 17503{
17504 internal class Program 17505 { 17506 private static void Main(string[] args) 17507 { 17508 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17509 string QUERY_URL = "https://www.alphavantage.co/query?function=ULTOSC&symbol=IBM&interval=daily&timeperiod1=8&apikey=demo" 17510 Uri queryUri = new Uri(QUERY_URL); 17511 17512 using (WebClient client = new WebClient()) 17513 { 17514 // ------------------------------------------------------------------------- 17515 // if using .NET Framework (System.Web.Script.Serialization) 17516 17517 JavaScriptSerializer js = new JavaScriptSerializer(); 17518 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17519 17520 // ------------------------------------------------------------------------- 17521 // if using .NET Core (System.Text.Json) 17522 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17523 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17524 17525 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17526 17527 // ------------------------------------------------------------------------- 17528 17529 // do something with the json_data 17530 } 17531 } 17532 } 17533} 17534 </code></pre> 17535</div> 17536 17537 17538<div class="other-code" style="background-color: #f9f9f9;"> 17539 <br> 17540 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17541 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17542 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17543 <br> 17544</div> 17545 17546 <br> 17547 17548 <h4 id="dx">DX</h4> 17549 <br> 17550 <p>This API returns the directional movement index (DX) values. See also: <a href="http://www.investopedia.com/articles/technical/02/050602.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=DX.htm" target="_blank">mathematical reference</a>.</p> 17551 <br> 17552 <h6><b>API Parameters</b></h6> 17553 <p><b>â Required: <code>function</code></b></p> 17554 <p>The technical indicator of your choice. In this case, <code>function=DX</code> </p> 17555 <p><b>â Required: <code>symbol</code></b></p> 17556 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 17557 <p><b>â Required: <code>interval</code></b></p> 17558 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 17559 <p>â Optional: <code>month</code></p> 17560 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 17561 <p><b>â Required:<code>time_period</code></b></p> 17562 <p>Number of data points used to calculate each DX value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 17563 <p>â Optional: <code>datatype</code></p> 17564 <p>
17564By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 17565 <p>â Optional: <code>entitlement</code></p> 17566 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 17567 <p><b>â Required: <code>apikey</code></b></p> 17568 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 17569 <br> 17570 17571 <h6><b>Example (click for JSON output)</b></h6> 17572 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=DX&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=DX&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 17573 <br> 17574 17575 <h6><b>Language-specific guides</b></h6> 17576 <div> 17577 <button class="python-btn">Python</button> 17578 <button class="node-btn">NodeJS</button> 17579 <button class="php-btn">PHP</button> 17580 <button class="cs-btn">C#/.NET</button> 17581 <button class="other-btn">â¨MCP & Other</button> 17582</div> 17583 17584<div class="python-code"> 17585 <pre><code class="python"> 17586import requests 17587 17588# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17589url = 'https://www.alphavantage.co/query?function=DX&symbol=IBM&interval=daily&time_period=10&apikey=demo' 17590r = requests.get(url) 17591data = r.json() 17592 17593print(data) 17594 </code></pre> 17595</div> 17596 17597<div class="node-code"> 17598 <pre><code class="javascript"> 17599'use strict'; 17600var request = require('request'); 17601 17602// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17603var url = 'https://www.alphavantage.co/query?function=DX&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 17604 17605request.get({ 17606 url: url, 17607 json: true, 17608 headers: {'User-Agent': 'request'} 17609 }, (err, res, data) => { 17610 if (err) { 17611 console.log('Error:', err); 17612 } else if (res.statusCode !== 200) { 17613 console.log('Status:', res.statusCode); 17614 } else { 17615 // data is successfully parsed as a JSON object: 17616 console.log(data); 17617 } 17618}); 17619 </code></pre> 17620</div> 17621 17622<div class="php-code"> 17623 <pre><code class="php"> 17624<?php 17625// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17626$json = file_get_contents('https://www.alphavantage.co/query?function=DX&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 17627 17628$data = json_decode($json,true); 17629 17630print_r($data); 17631 17632exit; 17633 </code></pre> 17634</div> 17635 17636<div class="cs-code"> 17637 <pre><code class="cs"> 17638using System; 17639using System.Collections.Generic; 17640using System.Net; 17641 17642// ------------------------------------------------------------------------- 17643// if using .NET Framework 17644// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17645// This requires including the reference to System.Web.Extensions in your project 17646using System.Web.Script.Serialization; 17647// ------------------------------------------------------------------------- 17648// if using .Net Core 17649// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17650using System.Text.Json; 17651// ------------------------------------------------------------------------- 17652 17653namespace ConsoleTests 17654{ 17655 internal class Program 17656 { 17657 private static void Main(string[] args) 17658 { 17659 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
17660 string QUERY_URL = "https://www.alphavantage.co/query?function=DX&symbol=IBM&interval=daily&time_period=10&apikey=demo" 17661 Uri queryUri = new Uri(QUERY_URL); 17662 17663 using (WebClient client = new WebClient()) 17664 { 17665 // ------------------------------------------------------------------------- 17666 // if using .NET Framework (System.Web.Script.Serialization) 17667 17668 JavaScriptSerializer js = new JavaScriptSerializer(); 17669 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17670 17671 // ------------------------------------------------------------------------- 17672 // if using .NET Core (System.Text.Json) 17673 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17674 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17675 17676 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17677 17678 // ------------------------------------------------------------------------- 17679 17680 // do something with the json_data 17681 } 17682 } 17683 } 17684} 17685 </code></pre> 17686</div> 17687 17688 17689<div class="other-code" style="background-color: #f9f9f9;"> 17690 <br> 17691 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17692 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17693 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17694 <br> 17695</div> 17696 17697 17698 <br> 17699 17700 <h4 id="minusdi">MINUS_DI</h4> 17701 <br> 17702 <p>This API returns the minus directional indicator (MINUS_DI) values. See also: <a href="http://www.investopedia.com/articles/technical/02/050602.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=DI.htm" target="_blank">mathematical reference</a>.</p> 17703 <br> 17704 <h6><b>API Parameters</b></h6> 17705 <p><b>â Required: <code>function</code></b></p> 17706 <p>The technical indicator of your choice. In this case, <code>function=MINUS_DI</code> </p> 17707 <p><b>â Required: <code>symbol</code></b></p> 17708 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 17709 <p><b>â Required: <code>interval</code></b></p> 17710 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 17711 <p>â Optional: <code>month</code></p> 17712 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 17713 <p><b>â Required:<code>time_period</code></b></p> 17714 <p>Number of data points used to calculate each MINUS_DI value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 17715 <p>â Optional: <code>datatype</code></p> 17716 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 17717 <p>â Optional: <code>entitlement</code></p> 17718 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
17718realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 17719 <p><b>â Required: <code>apikey</code></b></p> 17720 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 17721 <br> 17722 17723 <h6><b>Example (click for JSON output)</b></h6> 17724 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MINUS_DI&symbol=IBM&interval=weekly&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MINUS_DI&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 17725 <br> 17726 17727 <h6><b>Language-specific guides</b></h6> 17728 <div> 17729 <button class="python-btn">Python</button> 17730 <button class="node-btn">NodeJS</button> 17731 <button class="php-btn">PHP</button> 17732 <button class="cs-btn">C#/.NET</button> 17733 <button class="other-btn">â¨MCP & Other</button> 17734</div> 17735 17736<div class="python-code"> 17737 <pre><code class="python"> 17738import requests 17739 17740# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17741url = 'https://www.alphavantage.co/query?function=MINUS_DI&symbol=IBM&interval=weekly&time_period=10&apikey=demo' 17742r = requests.get(url) 17743data = r.json() 17744 17745print(data) 17746 </code></pre> 17747</div> 17748 17749<div class="node-code"> 17750 <pre><code class="javascript"> 17751'use strict'; 17752var request = require('request'); 17753 17754// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17755var url = 'https://www.alphavantage.co/query?function=MINUS_DI&symbol=IBM&interval=weekly&time_period=10&apikey=demo'; 17756 17757request.get({ 17758 url: url, 17759 json: true, 17760 headers: {'User-Agent': 'request'} 17761 }, (err, res, data) => { 17762 if (err) { 17763 console.log('Error:', err); 17764 } else if (res.statusCode !== 200) { 17765 console.log('Status:', res.statusCode); 17766 } else { 17767 // data is successfully parsed as a JSON object: 17768 console.log(data); 17769 } 17770}); 17771 </code></pre> 17772</div> 17773 17774<div class="php-code"> 17775 <pre><code class="php"> 17776<?php 17777// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17778$json = file_get_contents('https://www.alphavantage.co/query?function=MINUS_DI&symbol=IBM&interval=weekly&time_period=10&apikey=demo'); 17779 17780$data = json_decode($json,true); 17781 17782print_r($data); 17783 17784exit; 17785 </code></pre> 17786</div> 17787 17788<div class="cs-code"> 17789 <pre><code class="cs"> 17790using System; 17791using System.Collections.Generic; 17792using System.Net; 17793 17794// ------------------------------------------------------------------------- 17795// if using .NET Framework 17796// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17797// This requires including the reference to System.Web.Extensions in your project 17798using System.Web.Script.Serialization; 17799// ------------------------------------------------------------------------- 17800// if using .Net Core 17801// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17802using System.Text.Json; 17803// ------------------------------------------------------------------------- 17804 17805namespace ConsoleTests 17806{ 17807 internal class Program 17808 { 17809 private static void Main(string[] args) 17810 { 17811 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17812 string QUERY_URL = "https://www.alphavantage.co/query?function=MINUS_DI&symbol=IBM&interval=weekly&time_period=10&apikey=demo" 17813 Uri queryUri = new Uri(QUERY_URL); 17814 17815 using (WebClient client = new WebClient()) 17816 { 17817 // ------------------------------------------------------------------------- 17818 // if using .NET Framework (System.Web.Script.Serialization) 17819 17820 JavaScriptSerializer js = new JavaScriptSerializer(); 17821 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17822 17823 // ------------------------------------------------------------------------- 17824 // if using .NET Core (System.Text.Json) 17825 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17826 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17827 17828 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17829 17830 // ------------------------------------------------------------------------- 17831
17832 // do something with the json_data 17833 } 17834 } 17835 } 17836} 17837 </code></pre> 17838</div> 17839 17840 17841<div class="other-code" style="background-color: #f9f9f9;"> 17842 <br> 17843 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17844 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17845 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17846 <br> 17847</div> 17848 17849 17850 <br> 17851 17852 <h4 id="plusdi">PLUS_DI</h4> 17853 <br> 17854 <p>This API returns the plus directional indicator (PLUS_DI) values. See also: <a href="http://www.investopedia.com/articles/technical/02/050602.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=DI.htm" target="_blank">mathematical reference</a>.</p> 17855 <br> 17856 <h6><b>API Parameters</b></h6> 17857 <p><b>â Required: <code>function</code></b></p> 17858 <p>The technical indicator of your choice. In this case, <code>function=PLUS_DI</code> </p> 17859 <p><b>â Required: <code>symbol</code></b></p> 17860 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 17861 <p><b>â Required: <code>interval</code></b></p> 17862 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 17863 <p>â Optional: <code>month</code></p> 17864 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 17865 <p><b>â Required:<code>time_period</code></b></p> 17866 <p>Number of data points used to calculate each PLUS_DI value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 17867 <p>â Optional: <code>datatype</code></p> 17868 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 17869 <p>â Optional: <code>entitlement</code></p> 17870 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 17871 <p><b>â Required: <code>apikey</code></b></p> 17872 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 17873 <br> 17874 17875 <h6><b>Example (click for JSON output)</b></h6> 17876 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=PLUS_DI&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=PLUS_DI&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 17877 <br> 17878 17879 <h6><b>Language-specific guides</b></h6> 17880 <div> 17881 <button class="python-btn">Python</button> 17882 <button class="node-btn">NodeJS</button> 17883 <button class="php-btn">PHP</button> 17884 <button class="cs-btn">C#/.NET</button> 17885 <button class="other-btn">â¨MCP & Other</button> 17886</div> 17887 17888<div class="python-code"> 17889 <pre><code class="python"> 17890import requests 17891 17892# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17893url = 'https://www.alphavantage.co/query?function=PLUS_DI&symbol=IBM&interval=daily&time_period=10&apikey=demo' 17894r = requests.get(url) 17895data = r.json() 17896 17897print(data) 17898 </code></pre> 17899</div> 17900 17901<div class="node-code"> 17902 <pre><code class="javascript"> 17903'use strict'; 17904var request = require('request'); 17905 17906// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17907var url = 'https://www.alphavantage.co/query?function=PLUS_DI&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 17908 17909request.get({ 17910 url: url, 17911 json: true, 17912 headers: {'User-Agent': 'request'} 17913 }, (err, res, data) => { 17914 if (err) { 17915 console.log('Error:', err); 17916 } else if (res.statusCode !== 200) { 17917 console.log('Status:', res.statusCode); 17918 } else { 17919 // data is successfully parsed as a JSON object: 17920 console.log(data); 17921 } 17922}); 17923 </code></pre> 17924</div> 17925 17926<div class="php-code"> 17927 <pre><code class="php"> 17928<?php 17929// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17930$json = file_get_contents('https://www.alphavantage.co/query?function=PLUS_DI&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 17931 17932$data = json_decode($json,true); 17933 17934print_r($data); 17935 17936exit; 17937 </code></pre> 17938</div> 17939 17940<div class="cs-code"> 17941 <pre><code class="cs"> 17942using System; 17943using System.Collections.Generic; 17944using System.Net; 17945
17946// ------------------------------------------------------------------------- 17947// if using .NET Framework 17948// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 17949// This requires including the reference to System.Web.Extensions in your project 17950using System.Web.Script.Serialization; 17951// ------------------------------------------------------------------------- 17952// if using .Net Core 17953// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 17954using System.Text.Json; 17955// ------------------------------------------------------------------------- 17956 17957namespace ConsoleTests 17958{ 17959 internal class Program 17960 { 17961 private static void Main(string[] args) 17962 { 17963 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 17964 string QUERY_URL = "https://www.alphavantage.co/query?function=PLUS_DI&symbol=IBM&interval=daily&time_period=10&apikey=demo" 17965 Uri queryUri = new Uri(QUERY_URL); 17966 17967 using (WebClient client = new WebClient()) 17968 { 17969 // ------------------------------------------------------------------------- 17970 // if using .NET Framework (System.Web.Script.Serialization) 17971 17972 JavaScriptSerializer js = new JavaScriptSerializer(); 17973 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 17974 17975 // ------------------------------------------------------------------------- 17976 // if using .NET Core (System.Text.Json) 17977 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 17978 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 17979 17980 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 17981 17982 // ------------------------------------------------------------------------- 17983 17984 // do something with the json_data 17985 } 17986 } 17987 } 17988} 17989 </code></pre> 17990</div> 17991 17992 17993<div class="other-code" style="background-color: #f9f9f9;"> 17994 <br> 17995 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 17996 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 17997 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 17998 <br> 17999</div> 18000 18001 18002 <br> 18003 18004 <h4 id="minusdm">MINUS_DM</h4> 18005 <br> 18006 <p>This API returns the minus directional movement (MINUS_DM) values. See also: <a href="http://www.investopedia.com/articles/technical/02/050602.asp" target="_blank">Investopedia article</a> </p> 18007 <br> 18008 <h6><b>API Parameters</b></h6> 18009 <p><b>â Required: <code>function</code></b></p> 18010 <p>The technical indicator of your choice. In this case, <code>function=MINUS_DM</code> </p> 18011 <p><b>â Required: <code>symbol</code></b></p> 18012 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18013 <p><b>â Required: <code>interval</code></b></p> 18014 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18015 <p>â Optional: <code>month</code></p> 18016 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18017 <p><b>â Required:<code>time_period</code></b></p> 18018 <p>Number of data points used to calculate each MINUS_DM value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 18019 <p>â Optional: <code>datatype</code></p> 18020 <p>
18020By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18021 <p>â Optional: <code>entitlement</code></p> 18022 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18023 <p><b>â Required: <code>apikey</code></b></p> 18024 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18025 <br> 18026 18027 <h6><b>Example (click for JSON output)</b></h6> 18028 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MINUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MINUS_DM&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 18029 <br> 18030 18031 <h6><b>Language-specific guides</b></h6> 18032 <div> 18033 <button class="python-btn">Python</button> 18034 <button class="node-btn">NodeJS</button> 18035 <button class="php-btn">PHP</button> 18036 <button class="cs-btn">C#/.NET</button> 18037 <button class="other-btn">â¨MCP & Other</button> 18038</div> 18039 18040<div class="python-code"> 18041 <pre><code class="python"> 18042import requests 18043 18044# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18045url = 'https://www.alphavantage.co/query?function=MINUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo' 18046r = requests.get(url) 18047data = r.json() 18048 18049print(data) 18050 </code></pre> 18051</div> 18052 18053<div class="node-code"> 18054 <pre><code class="javascript"> 18055'use strict'; 18056var request = require('request'); 18057 18058// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18059var url = 'https://www.alphavantage.co/query?function=MINUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 18060 18061request.get({ 18062 url: url, 18063 json: true, 18064 headers: {'User-Agent': 'request'} 18065 }, (err, res, data) => { 18066 if (err) { 18067 console.log('Error:', err); 18068 } else if (res.statusCode !== 200) { 18069 console.log('Status:', res.statusCode); 18070 } else { 18071 // data is successfully parsed as a JSON object: 18072 console.log(data); 18073 } 18074}); 18075 </code></pre> 18076</div> 18077 18078<div class="php-code"> 18079 <pre><code class="php"> 18080<?php 18081// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18082$json = file_get_contents('https://www.alphavantage.co/query?function=MINUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 18083 18084$data = json_decode($json,true); 18085 18086print_r($data); 18087 18088exit; 18089 </code></pre> 18090</div> 18091 18092<div class="cs-code"> 18093 <pre><code class="cs"> 18094using System; 18095using System.Collections.Generic; 18096using System.Net; 18097 18098// ------------------------------------------------------------------------- 18099// if using .NET Framework 18100// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 18101// This requires including the reference to System.Web.Extensions in your project 18102using System.Web.Script.Serialization; 18103// ------------------------------------------------------------------------- 18104// if using .Net Core 18105// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 18106using System.Text.Json; 18107// ------------------------------------------------------------------------- 18108 18109namespace ConsoleTests 18110{ 18111 internal class Program 18112 { 18113 private static void Main(string[] args) 18114 { 18115 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
18116 string QUERY_URL = "https://www.alphavantage.co/query?function=MINUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo" 18117 Uri queryUri = new Uri(QUERY_URL); 18118 18119 using (WebClient client = new WebClient()) 18120 { 18121 // ------------------------------------------------------------------------- 18122 // if using .NET Framework (System.Web.Script.Serialization) 18123 18124 JavaScriptSerializer js = new JavaScriptSerializer(); 18125 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 18126 18127 // ------------------------------------------------------------------------- 18128 // if using .NET Core (System.Text.Json) 18129 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 18130 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 18131 18132 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 18133 18134 // ------------------------------------------------------------------------- 18135 18136 // do something with the json_data 18137 } 18138 } 18139 } 18140} 18141 </code></pre> 18142</div> 18143 18144 18145<div class="other-code" style="background-color: #f9f9f9;"> 18146 <br> 18147 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 18148 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 18149 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 18150 <br> 18151</div> 18152 18153 18154 <br> 18155 18156 <h4 id="plusdm">PLUS_DM</h4> 18157 <br> 18158 <p>This API returns the plus directional movement (PLUS_DM) values. See also: <a href="http://www.investopedia.com/articles/technical/02/050602.asp" target="_blank">Investopedia article</a> </p> 18159 <br> 18160 <h6><b>API Parameters</b></h6> 18161 <p><b>â Required: <code>function</code></b></p> 18162 <p>The technical indicator of your choice. In this case, <code>function=PLUS_DM</code> </p> 18163 <p><b>â Required: <code>symbol</code></b></p> 18164 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18165 <p><b>â Required: <code>interval</code></b></p> 18166 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18167 <p>â Optional: <code>month</code></p> 18168 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18169 <p><b>â Required:<code>time_period</code></b></p> 18170 <p>Number of data points used to calculate each PLUS_DM value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 18171 <p>â Optional: <code>datatype</code></p> 18172 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18173 <p>â Optional: <code>entitlement</code></p> 18174 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
18174realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18175 <p><b>â Required: <code>apikey</code></b></p> 18176 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18177 <br> 18178 18179 <h6><b>Example (click for JSON output)</b></h6> 18180 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=PLUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=PLUS_DM&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 18181 <br> 18182 18183 <h6><b>Language-specific guides</b></h6> 18184 <div> 18185 <button class="python-btn">Python</button> 18186 <button class="node-btn">NodeJS</button> 18187 <button class="php-btn">PHP</button> 18188 <button class="cs-btn">C#/.NET</button> 18189 <button class="other-btn">â¨MCP & Other</button> 18190</div> 18191 18192<div class="python-code"> 18193 <pre><code class="python"> 18194import requests 18195 18196# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18197url = 'https://www.alphavantage.co/query?function=PLUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo' 18198r = requests.get(url) 18199data = r.json() 18200 18201print(data) 18202 </code></pre> 18203</div> 18204 18205<div class="node-code"> 18206 <pre><code class="javascript"> 18207'use strict'; 18208var request = require('request'); 18209 18210// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18211var url = 'https://www.alphavantage.co/query?function=PLUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 18212 18213request.get({ 18214 url: url, 18215 json: true, 18216 headers: {'User-Agent': 'request'} 18217 }, (err, res, data) => { 18218 if (err) { 18219 console.log('Error:', err); 18220 } else if (res.statusCode !== 200) { 18221 console.log('Status:', res.statusCode); 18222 } else { 18223 // data is successfully parsed as a JSON object: 18224 console.log(data); 18225 } 18226}); 18227 </code></pre> 18228</div> 18229 18230<div class="php-code"> 18231 <pre><code class="php"> 18232<?php 18233// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18234$json = file_get_contents('https://www.alphavantage.co/query?function=PLUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 18235 18236$data = json_decode($json,true); 18237 18238print_r($data); 18239 18240exit; 18241 </code></pre> 18242</div> 18243 18244<div class="cs-code"> 18245 <pre><code class="cs"> 18246using System; 18247using System.Collections.Generic; 18248using System.Net; 18249 18250// ------------------------------------------------------------------------- 18251// if using .NET Framework 18252// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 18253// This requires including the reference to System.Web.Extensions in your project 18254using System.Web.Script.Serialization; 18255// ------------------------------------------------------------------------- 18256// if using .Net Core 18257// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 18258using System.Text.Json; 18259// ------------------------------------------------------------------------- 18260 18261namespace ConsoleTests 18262{ 18263 internal class Program 18264 { 18265 private static void Main(string[] args) 18266 { 18267 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18268 string QUERY_URL = "https://www.alphavantage.co/query?function=PLUS_DM&symbol=IBM&interval=daily&time_period=10&apikey=demo" 18269 Uri queryUri = new Uri(QUERY_URL); 18270 18271 using (WebClient client = new WebClient()) 18272 { 18273 // ------------------------------------------------------------------------- 18274 // if using .NET Framework (System.Web.Script.Serialization) 18275 18276 JavaScriptSerializer js = new JavaScriptSerializer(); 18277 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 18278 18279 // ------------------------------------------------------------------------- 18280 // if using .NET Core (System.Text.Json) 18281 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 18282 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 18283 18284 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 18285 18286 // ------------------------------------------------------------------------- 18287
18288 // do something with the json_data 18289 } 18290 } 18291 } 18292} 18293 </code></pre> 18294</div> 18295 18296 18297<div class="other-code" style="background-color: #f9f9f9;"> 18298 <br> 18299 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 18300 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 18301 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 18302 <br> 18303</div> 18304 18305 18306 <br> 18307 18308 <h4 id="bbands">BBANDS <span class="popular-label">Trending</span></h4> 18309 <br> 18310 <p>This API returns the Bollinger bands (BBANDS) values. See also: <a href="http://www.investopedia.com/articles/technical/04/030304.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=Bollinger.htm" target="_blank">mathematical reference</a>.</p> 18311 <br> 18312 <h6><b>API Parameters</b></h6> 18313 <p><b>â Required: <code>function</code></b></p> 18314 <p>The technical indicator of your choice. In this case, <code>function=BBANDS</code> </p> 18315 <p><b>â Required: <code>symbol</code></b></p> 18316 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18317 <p><b>â Required: <code>interval</code></b></p> 18318 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18319 <p>â Optional: <code>month</code></p> 18320 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18321 <p><b>â Required:<code>time_period</code></b></p> 18322 <p>Number of data points used to calculate each BBANDS value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 18323 <p><b>â Required: <code>series_type</code></b></p> 18324 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 18325 <p>â Optional: <code>nbdevup</code></p> 18326 <p>The standard deviation multiplier of the upper band. Positive integers are accepted. By default, <code>nbdevup=2</code>. </p> 18327 <p>â Optional: <code>nbdevdn</code></p> 18328 <p>The standard deviation multiplier of the lower band. Positive integers are accepted. By default, <code>nbdevdn=2</code>. </p> 18329 <p>â Optional: <code>matype</code></p> 18330 <p>Moving average type of the time series. By default, <code>matype=0</code>. Integers 0 - 8 are accepted with the following mappings. 0 = Simple Moving Average (SMA), 1 = Exponential Moving Average (EMA), 2 = Weighted Moving Average (WMA), 3 = Double Exponential Moving Average (DEMA), 4 = Triple Exponential Moving Average (TEMA), 5 = Triangular Moving Average (TRIMA), 6 = T3 Moving Average, 7 = Kaufman Adaptive Moving Average (KAMA), 8 = MESA Adaptive Moving Average (MAMA). </p> 18331 <p>â Optional: <code>datatype</code></p> 18332 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18333 <p>â Optional: <code>entitlement</code></p> 18334 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
18334realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18335 <p><b>â Required: <code>apikey</code></b></p> 18336 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18337 <br> 18338 18339 <h6><b>Example (click for JSON output)</b></h6> 18340 Equity: 18341 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=BBANDS&symbol=IBM&interval=weekly&time_period=5&series_type=close&nbdevup=3&nbdevdn=3&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=BBANDS&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=5&<b>series_type</b>=close&<b>nbdevup</b>=3&<b>nbdevdn</b>=3&<b>apikey</b>=demo</code></a></p> 18342 Forex (FX) or cryptocurrency pair: 18343 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=BBANDS&symbol=USDEUR&interval=weekly&time_period=5&series_type=close&nbdevup=3&nbdevdn=3&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=BBANDS&<b>symbol</b>=USDEUR&<b>interval</b>=weekly&<b>time_period</b>=5&<b>series_type</b>=close&<b>nbdevup</b>=3&<b>nbdevdn</b>=3&<b>apikey</b>=demo</code></a></p> 18344 <br> 18345 18346 18347 <h6><b>Language-specific guides</b></h6> 18348 <div> 18349 <button class="python-btn">Python</button> 18350 <button class="node-btn">NodeJS</button> 18351 <button class="php-btn">PHP</button> 18352 <button class="cs-btn">C#/.NET</button> 18353 <button class="other-btn">â¨MCP & Other</button> 18354</div> 18355 18356<div class="python-code"> 18357 <pre><code class="python"> 18358import requests 18359 18360# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18361url = 'https://www.alphavantage.co/query?function=BBANDS&symbol=IBM&interval=weekly&time_period=5&series_type=close&nbdevup=3&nbdevdn=3&apikey=demo' 18362r = requests.get(url) 18363data = r.json() 18364 18365print(data) 18366 </code></pre> 18367</div> 18368 18369<div class="node-code"> 18370 <pre><code class="javascript"> 18371'use strict'; 18372var request = require('request'); 18373 18374// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18375var url = 'https://www.alphavantage.co/query?function=BBANDS&symbol=IBM&interval=weekly&time_period=5&series_type=close&nbdevup=3&nbdevdn=3&apikey=demo'; 18376 18377request.get({ 18378 url: url, 18379 json: true, 18380 headers: {'User-Agent': 'request'} 18381 }, (err, res, data) => { 18382 if (err) { 18383 console.log('Error:', err); 18384 } else if (res.statusCode !== 200) { 18385 console.log('Status:', res.statusCode); 18386 } else { 18387 // data is successfully parsed as a JSON object: 18388 console.log(data); 18389 } 18390}); 18391 </code></pre> 18392</div> 18393 18394<div class="php-code"> 18395 <pre><code class="php"> 18396<?php 18397// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18398$json = file_get_contents('https://www.alphavantage.co/query?function=BBANDS&symbol=IBM&interval=weekly&time_period=5&series_type=close&nbdevup=3&nbdevdn=3&apikey=demo'); 18399 18400$data = json_decode($json,true); 18401 18402print_r($data); 18403 18404exit; 18405 </code></pre> 18406</div> 18407 18408<div class="cs-code"> 18409 <pre><code class="cs"> 18410using System; 18411using System.Collections.Generic; 18412using System.Net; 18413 18414// ------------------------------------------------------------------------- 18415// if using .NET Framework 18416// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 18417// This requires including the reference to System.Web.Extensions in your project 18418using System.Web.Script.Serialization; 18419// ------------------------------------------------------------------------- 18420// if using .Net Core 18421// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 18422using System.Text.Json; 18423// ------------------------------------------------------------------------- 18424 18425namespace ConsoleTests 18426{ 18427 internal class Program 18428 { 18429 private static void Main(string[] args) 18430 { 18431 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
18432 string QUERY_URL = "https://www.alphavantage.co/query?function=BBANDS&symbol=IBM&interval=weekly&time_period=5&series_type=close&nbdevup=3&nbdevdn=3&apikey=demo" 18433 Uri queryUri = new Uri(QUERY_URL); 18434 18435 using (WebClient client = new WebClient()) 18436 { 18437 // ------------------------------------------------------------------------- 18438 // if using .NET Framework (System.Web.Script.Serialization) 18439 18440 JavaScriptSerializer js = new JavaScriptSerializer(); 18441 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 18442 18443 // ------------------------------------------------------------------------- 18444 // if using .NET Core (System.Text.Json) 18445 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 18446 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 18447 18448 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 18449 18450 // ------------------------------------------------------------------------- 18451 18452 // do something with the json_data 18453 } 18454 } 18455 } 18456} 18457 </code></pre> 18458</div> 18459 18460 18461<div class="other-code" style="background-color: #f9f9f9;"> 18462 <br> 18463 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 18464 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 18465 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 18466 <br> 18467</div> 18468 18469 <br> 18470 18471 <h4 id="midpoint">MIDPOINT</h4> 18472 <br> 18473 <p>This API returns the midpoint (MIDPOINT) values. MIDPOINT = (highest value + lowest value)/2. </p> 18474 <br> 18475 <h6><b>API Parameters</b></h6> 18476 <p><b>â Required: <code>function</code></b></p> 18477 <p>The technical indicator of your choice. In this case, <code>function=MIDPOINT</code> </p> 18478 <p><b>â Required: <code>symbol</code></b></p> 18479 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18480 <p><b>â Required: <code>interval</code></b></p> 18481 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18482 <p>â Optional: <code>month</code></p> 18483 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18484 <p><b>â Required:<code>time_period</code></b></p> 18485 <p>Number of data points used to calculate each MIDPOINT value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 18486 <p><b>â Required: <code>series_type</code></b></p> 18487 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 18488 <p>â Optional: <code>datatype</code></p> 18489 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18490 <p>â Optional: <code>entitlement</code></p> 18491 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
18491realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18492 <p><b>â Required: <code>apikey</code></b></p> 18493 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18494 <br> 18495 18496 <h6><b>Example (click for JSON output)</b></h6> 18497 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MIDPOINT&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MIDPOINT&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 18498 <br> 18499 18500 <h6><b>Language-specific guides</b></h6> 18501 <div> 18502 <button class="python-btn">Python</button> 18503 <button class="node-btn">NodeJS</button> 18504 <button class="php-btn">PHP</button> 18505 <button class="cs-btn">C#/.NET</button> 18506 <button class="other-btn">â¨MCP & Other</button> 18507</div> 18508 18509<div class="python-code"> 18510 <pre><code class="python"> 18511import requests 18512 18513# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18514url = 'https://www.alphavantage.co/query?function=MIDPOINT&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo' 18515r = requests.get(url) 18516data = r.json() 18517 18518print(data) 18519 </code></pre> 18520</div> 18521 18522<div class="node-code"> 18523 <pre><code class="javascript"> 18524'use strict'; 18525var request = require('request'); 18526 18527// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18528var url = 'https://www.alphavantage.co/query?function=MIDPOINT&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'; 18529 18530request.get({ 18531 url: url, 18532 json: true, 18533 headers: {'User-Agent': 'request'} 18534 }, (err, res, data) => { 18535 if (err) { 18536 console.log('Error:', err); 18537 } else if (res.statusCode !== 200) { 18538 console.log('Status:', res.statusCode); 18539 } else { 18540 // data is successfully parsed as a JSON object: 18541 console.log(data); 18542 } 18543}); 18544 </code></pre> 18545</div> 18546 18547<div class="php-code"> 18548 <pre><code class="php"> 18549<?php 18550// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18551$json = file_get_contents('https://www.alphavantage.co/query?function=MIDPOINT&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo'); 18552 18553$data = json_decode($json,true); 18554 18555print_r($data); 18556 18557exit; 18558 </code></pre> 18559</div> 18560 18561<div class="cs-code"> 18562 <pre><code class="cs"> 18563using System; 18564using System.Collections.Generic; 18565using System.Net; 18566 18567// ------------------------------------------------------------------------- 18568// if using .NET Framework 18569// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 18570// This requires including the reference to System.Web.Extensions in your project 18571using System.Web.Script.Serialization; 18572// ------------------------------------------------------------------------- 18573// if using .Net Core 18574// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 18575using System.Text.Json; 18576// ------------------------------------------------------------------------- 18577 18578namespace ConsoleTests 18579{ 18580 internal class Program 18581 { 18582 private static void Main(string[] args) 18583 { 18584 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18585 string QUERY_URL = "https://www.alphavantage.co/query?function=MIDPOINT&symbol=IBM&interval=daily&time_period=10&series_type=close&apikey=demo" 18586 Uri queryUri = new Uri(QUERY_URL); 18587 18588 using (WebClient client = new WebClient()) 18589 { 18590 // ------------------------------------------------------------------------- 18591 // if using .NET Framework (System.Web.Script.Serialization) 18592 18593 JavaScriptSerializer js = new JavaScriptSerializer(); 18594 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 18595 18596 // ------------------------------------------------------------------------- 18597 // if using .NET Core (System.Text.Json) 18598 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 18599 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 18600 18601 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 18602 18603 // ------------------------------------------------------------------------- 18604
18605 // do something with the json_data 18606 } 18607 } 18608 } 18609} 18610 </code></pre> 18611</div> 18612 18613 18614<div class="other-code" style="background-color: #f9f9f9;"> 18615 <br> 18616 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 18617 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 18618 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 18619 <br> 18620</div> 18621 18622 18623 <br> 18624 18625 <h4 id="midprice">MIDPRICE</h4> 18626 <br> 18627 <p>This API returns the midpoint price (MIDPRICE) values. MIDPRICE = (highest high + lowest low)/2. </p> 18628 <br> 18629 <h6><b>API Parameters</b></h6> 18630 <p><b>â Required: <code>function</code></b></p> 18631 <p>The technical indicator of your choice. In this case, <code>function=MIDPRICE</code> </p> 18632 <p><b>â Required: <code>symbol</code></b></p> 18633 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18634 <p><b>â Required: <code>interval</code></b></p> 18635 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18636 <p>â Optional: <code>month</code></p> 18637 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18638 <p><b>â Required:<code>time_period</code></b></p> 18639 <p>Number of data points used to calculate each MIDPRICE value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 18640 <p>â Optional: <code>datatype</code></p> 18641 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18642 <p>â Optional: <code>entitlement</code></p> 18643 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18644 <p><b>â Required: <code>apikey</code></b></p> 18645 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18646 <br> 18647 18648 <h6><b>Example (click for JSON output)</b></h6> 18649 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=MIDPRICE&symbol=IBM&interval=daily&time_period=10&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=MIDPRICE&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=10&<b>apikey</b>=demo</code></a></p> 18650 <br> 18651 18652 <h6><b>Language-specific guides</b></h6> 18653 <div> 18654 <button class="python-btn">Python</button> 18655 <button class="node-btn">NodeJS</button> 18656 <button class="php-btn">PHP</button> 18657 <button class="cs-btn">C#/.NET</button> 18658 <button class="other-btn">â¨MCP & Other</button> 18659</div> 18660 18661<div class="python-code"> 18662 <pre><code class="python"> 18663import requests 18664 18665# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18666url = 'https://www.alphavantage.co/query?function=MIDPRICE&symbol=IBM&interval=daily&time_period=10&apikey=demo' 18667r = requests.get(url) 18668data = r.json() 18669 18670print(data) 18671 </code></pre> 18672</div> 18673 18674<div class="node-code"> 18675 <pre><code class="javascript"> 18676'use strict'; 18677var request = require('request'); 18678 18679// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18680var url = 'https://www.alphavantage.co/query?function=MIDPRICE&symbol=IBM&interval=daily&time_period=10&apikey=demo'; 18681 18682request.get({ 18683 url: url, 18684 json: true, 18685 headers: {'User-Agent': 'request'} 18686 }, (err, res, data) => { 18687 if (err) { 18688 console.log('Error:', err); 18689 } else if (res.statusCode !== 200) { 18690 console.log('Status:', res.statusCode); 18691 } else { 18692 // data is successfully parsed as a JSON object: 18693 console.log(data); 18694 } 18695}); 18696 </code></pre> 18697</div> 18698 18699<div class="php-code"> 18700 <pre><code class="php"> 18701<?php 18702// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18703$json = file_get_contents('https://www.alphavantage.co/query?function=MIDPRICE&symbol=IBM&interval=daily&time_period=10&apikey=demo'); 18704 18705$data = json_decode($json,true); 18706 18707print_r($data); 18708 18709exit; 18710 </code></pre> 18711</div> 18712 18713<div class="cs-code"> 18714 <pre><code class="cs"> 18715using System; 18716using System.Collections.Generic; 18717using System.Net; 18718
18719// ------------------------------------------------------------------------- 18720// if using .NET Framework 18721// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 18722// This requires including the reference to System.Web.Extensions in your project 18723using System.Web.Script.Serialization; 18724// ------------------------------------------------------------------------- 18725// if using .Net Core 18726// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 18727using System.Text.Json; 18728// ------------------------------------------------------------------------- 18729 18730namespace ConsoleTests 18731{ 18732 internal class Program 18733 { 18734 private static void Main(string[] args) 18735 { 18736 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18737 string QUERY_URL = "https://www.alphavantage.co/query?function=MIDPRICE&symbol=IBM&interval=daily&time_period=10&apikey=demo" 18738 Uri queryUri = new Uri(QUERY_URL); 18739 18740 using (WebClient client = new WebClient()) 18741 { 18742 // ------------------------------------------------------------------------- 18743 // if using .NET Framework (System.Web.Script.Serialization) 18744 18745 JavaScriptSerializer js = new JavaScriptSerializer(); 18746 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 18747 18748 // ------------------------------------------------------------------------- 18749 // if using .NET Core (System.Text.Json) 18750 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 18751 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 18752 18753 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 18754 18755 // ------------------------------------------------------------------------- 18756 18757 // do something with the json_data 18758 } 18759 } 18760 } 18761} 18762 </code></pre> 18763</div> 18764 18765 18766<div class="other-code" style="background-color: #f9f9f9;"> 18767 <br> 18768 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 18769 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 18770 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 18771 <br> 18772</div> 18773 18774 18775 <br> 18776 18777 <h4 id="sar">SAR</h4> 18778 <br> 18779 <p>This API returns the parabolic SAR (SAR) values. See also: <a href="http://www.investopedia.com/articles/technical/02/042202.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=SAR.htm" target="_blank">mathematical reference</a>.</p> 18780 <br> 18781 <h6><b>API Parameters</b></h6> 18782 <p><b>â Required: <code>function</code></b></p> 18783 <p>The technical indicator of your choice. In this case, <code>function=SAR</code> </p> 18784 <p><b>â Required: <code>symbol</code></b></p> 18785 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18786 <p><b>â Required: <code>interval</code></b></p> 18787 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18788 <p>â Optional: <code>month</code></p> 18789 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18790 <p>â Optional: <code>acceleration</code></p> 18791 <p>The acceleration factor. Positive floats are accepted. By default, <code>acceleration=0.01</code>. </p> 18792 <p>â Optional: <code>maximum</code></p> 18793 <p>The acceleration factor maximum value. Positive floats are accepted. By default, <code>maximum=0.20</code>. </p> 18794 <p>â Optional: <code>datatype</code></p> 18795 <p>
18795By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18796 <p>â Optional: <code>entitlement</code></p> 18797 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18798 <p><b>â Required: <code>apikey</code></b></p> 18799 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18800 <br> 18801 18802 <h6><b>Example (click for JSON output)</b></h6> 18803 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=SAR&symbol=IBM&interval=weekly&acceleration=0.05&maximum=0.25&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=SAR&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>acceleration</b>=0.05&<b>maximum</b>=0.25&<b>apikey</b>=demo</code></a></p> 18804 <br> 18805 18806 <h6><b>Language-specific guides</b></h6> 18807 <div> 18808 <button class="python-btn">Python</button> 18809 <button class="node-btn">NodeJS</button> 18810 <button class="php-btn">PHP</button> 18811 <button class="cs-btn">C#/.NET</button> 18812 <button class="other-btn">â¨MCP & Other</button> 18813</div> 18814 18815<div class="python-code"> 18816 <pre><code class="python"> 18817import requests 18818 18819# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18820url = 'https://www.alphavantage.co/query?function=SAR&symbol=IBM&interval=weekly&acceleration=0.05&maximum=0.25&apikey=demo' 18821r = requests.get(url) 18822data = r.json() 18823 18824print(data) 18825 </code></pre> 18826</div> 18827 18828<div class="node-code"> 18829 <pre><code class="javascript"> 18830'use strict'; 18831var request = require('request'); 18832 18833// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18834var url = 'https://www.alphavantage.co/query?function=SAR&symbol=IBM&interval=weekly&acceleration=0.05&maximum=0.25&apikey=demo'; 18835 18836request.get({ 18837 url: url, 18838 json: true, 18839 headers: {'User-Agent': 'request'} 18840 }, (err, res, data) => { 18841 if (err) { 18842 console.log('Error:', err); 18843 } else if (res.statusCode !== 200) { 18844 console.log('Status:', res.statusCode); 18845 } else { 18846 // data is successfully parsed as a JSON object: 18847 console.log(data); 18848 } 18849}); 18850 </code></pre> 18851</div> 18852 18853<div class="php-code"> 18854 <pre><code class="php"> 18855<?php 18856// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18857$json = file_get_contents('https://www.alphavantage.co/query?function=SAR&symbol=IBM&interval=weekly&acceleration=0.05&maximum=0.25&apikey=demo'); 18858 18859$data = json_decode($json,true); 18860 18861print_r($data); 18862 18863exit; 18864 </code></pre> 18865</div> 18866 18867<div class="cs-code"> 18868 <pre><code class="cs"> 18869using System; 18870using System.Collections.Generic; 18871using System.Net; 18872 18873// ------------------------------------------------------------------------- 18874// if using .NET Framework 18875// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 18876// This requires including the reference to System.Web.Extensions in your project 18877using System.Web.Script.Serialization; 18878// ------------------------------------------------------------------------- 18879// if using .Net Core 18880// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 18881using System.Text.Json; 18882// ------------------------------------------------------------------------- 18883 18884namespace ConsoleTests 18885{ 18886 internal class Program 18887 { 18888 private static void Main(string[] args) 18889 { 18890 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
18891 string QUERY_URL = "https://www.alphavantage.co/query?function=SAR&symbol=IBM&interval=weekly&acceleration=0.05&maximum=0.25&apikey=demo" 18892 Uri queryUri = new Uri(QUERY_URL); 18893 18894 using (WebClient client = new WebClient()) 18895 { 18896 // ------------------------------------------------------------------------- 18897 // if using .NET Framework (System.Web.Script.Serialization) 18898 18899 JavaScriptSerializer js = new JavaScriptSerializer(); 18900 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 18901 18902 // ------------------------------------------------------------------------- 18903 // if using .NET Core (System.Text.Json) 18904 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 18905 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 18906 18907 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 18908 18909 // ------------------------------------------------------------------------- 18910 18911 // do something with the json_data 18912 } 18913 } 18914 } 18915} 18916 </code></pre> 18917</div> 18918 18919 18920<div class="other-code" style="background-color: #f9f9f9;"> 18921 <br> 18922 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 18923 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 18924 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 18925 <br> 18926</div> 18927 18928 <br> 18929 18930 <h4 id="trange">TRANGE</h4> 18931 <br> 18932 <p>This API returns the true range (TRANGE) values. See also: <a href="http://www.fmlabs.com/reference/default.htm?url=TR.htm" target="_blank">mathematical reference</a> </p> 18933 <br> 18934 <h6><b>API Parameters</b></h6> 18935 <p><b>â Required: <code>function</code></b></p> 18936 <p>The technical indicator of your choice. In this case, <code>function=TRANGE</code> </p> 18937 <p><b>â Required: <code>symbol</code></b></p> 18938 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 18939 <p><b>â Required: <code>interval</code></b></p> 18940 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 18941 <p>â Optional: <code>month</code></p> 18942 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 18943 <p>â Optional: <code>datatype</code></p> 18944 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 18945 <p>â Optional: <code>entitlement</code></p> 18946 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
18946realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 18947 <p><b>â Required: <code>apikey</code></b></p> 18948 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 18949 <br> 18950 18951 <h6><b>Example (click for JSON output)</b></h6> 18952 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=TRANGE&symbol=IBM&interval=daily&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=TRANGE&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>apikey</b>=demo</code></a></p> 18953 <br> 18954 18955 <h6><b>Language-specific guides</b></h6> 18956 <div> 18957 <button class="python-btn">Python</button> 18958 <button class="node-btn">NodeJS</button> 18959 <button class="php-btn">PHP</button> 18960 <button class="cs-btn">C#/.NET</button> 18961 <button class="other-btn">â¨MCP & Other</button> 18962</div> 18963 18964<div class="python-code"> 18965 <pre><code class="python"> 18966import requests 18967 18968# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18969url = 'https://www.alphavantage.co/query?function=TRANGE&symbol=IBM&interval=daily&apikey=demo' 18970r = requests.get(url) 18971data = r.json() 18972 18973print(data) 18974 </code></pre> 18975</div> 18976 18977<div class="node-code"> 18978 <pre><code class="javascript"> 18979'use strict'; 18980var request = require('request'); 18981 18982// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 18983var url = 'https://www.alphavantage.co/query?function=TRANGE&symbol=IBM&interval=daily&apikey=demo'; 18984 18985request.get({ 18986 url: url, 18987 json: true, 18988 headers: {'User-Agent': 'request'} 18989 }, (err, res, data) => { 18990 if (err) { 18991 console.log('Error:', err); 18992 } else if (res.statusCode !== 200) { 18993 console.log('Status:', res.statusCode); 18994 } else { 18995 // data is successfully parsed as a JSON object: 18996 console.log(data); 18997 } 18998}); 18999 </code></pre> 19000</div> 19001 19002<div class="php-code"> 19003 <pre><code class="php"> 19004<?php 19005// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19006$json = file_get_contents('https://www.alphavantage.co/query?function=TRANGE&symbol=IBM&interval=daily&apikey=demo'); 19007 19008$data = json_decode($json,true); 19009 19010print_r($data); 19011 19012exit; 19013 </code></pre> 19014</div> 19015 19016<div class="cs-code"> 19017 <pre><code class="cs"> 19018using System; 19019using System.Collections.Generic; 19020using System.Net; 19021 19022// ------------------------------------------------------------------------- 19023// if using .NET Framework 19024// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19025// This requires including the reference to System.Web.Extensions in your project 19026using System.Web.Script.Serialization; 19027// ------------------------------------------------------------------------- 19028// if using .Net Core 19029// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19030using System.Text.Json; 19031// ------------------------------------------------------------------------- 19032 19033namespace ConsoleTests 19034{ 19035 internal class Program 19036 { 19037 private static void Main(string[] args) 19038 { 19039 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19040 string QUERY_URL = "https://www.alphavantage.co/query?function=TRANGE&symbol=IBM&interval=daily&apikey=demo" 19041 Uri queryUri = new Uri(QUERY_URL); 19042 19043 using (WebClient client = new WebClient()) 19044 { 19045 // ------------------------------------------------------------------------- 19046 // if using .NET Framework (System.Web.Script.Serialization) 19047 19048 JavaScriptSerializer js = new JavaScriptSerializer(); 19049 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19050 19051 // ------------------------------------------------------------------------- 19052 // if using .NET Core (System.Text.Json) 19053 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19054 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19055 19056 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19057 19058 // ------------------------------------------------------------------------- 19059
19060 // do something with the json_data 19061 } 19062 } 19063 } 19064} 19065 </code></pre> 19066</div> 19067 19068 19069<div class="other-code" style="background-color: #f9f9f9;"> 19070 <br> 19071 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19072 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19073 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19074 <br> 19075</div> 19076 19077 <br> 19078 19079 <h4 id="atr">ATR</h4> 19080 <br> 19081 <p>This API returns the average true range (ATR) values. See also: <a href="http://www.investopedia.com/articles/trading/08/average-true-range.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=ATR.htm" target="_blank">mathematical reference</a></p> 19082 <br> 19083 <h6><b>API Parameters</b></h6> 19084 <p><b>â Required: <code>function</code></b></p> 19085 <p>The technical indicator of your choice. In this case, <code>function=ATR</code> </p> 19086 <p><b>â Required: <code>symbol</code></b></p> 19087 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19088 <p><b>â Required: <code>interval</code></b></p> 19089 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19090 <p>â Optional: <code>month</code></p> 19091 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19092 <p><b>â Required:<code>time_period</code></b></p> 19093 <p>Number of data points used to calculate each ATR value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 19094 <p>â Optional: <code>datatype</code></p> 19095 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 19096 <p>â Optional: <code>entitlement</code></p> 19097 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 19098 <p><b>â Required: <code>apikey</code></b></p> 19099 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 19100 <br> 19101 19102 <h6><b>Example (click for JSON output)</b></h6> 19103 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ATR&symbol=IBM&interval=daily&time_period=14&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ATR&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>time_period</b>=14&<b>apikey</b>=demo</code></a></p> 19104 <br> 19105 19106 <h6><b>Language-specific guides</b></h6> 19107 <div> 19108 <button class="python-btn">Python</button> 19109 <button class="node-btn">NodeJS</button> 19110 <button class="php-btn">PHP</button> 19111 <button class="cs-btn">C#/.NET</button> 19112 <button class="other-btn">â¨MCP & Other</button> 19113</div> 19114 19115<div class="python-code"> 19116 <pre><code class="python"> 19117import requests 19118 19119# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19120url = 'https://www.alphavantage.co/query?function=ATR&symbol=IBM&interval=daily&time_period=14&apikey=demo' 19121r = requests.get(url) 19122data = r.json() 19123 19124print(data) 19125 </code></pre> 19126</div> 19127 19128<div class="node-code"> 19129 <pre><code class="javascript"> 19130'use strict'; 19131var request = require('request'); 19132 19133// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19134var url = 'https://www.alphavantage.co/query?function=ATR&symbol=IBM&interval=daily&time_period=14&apikey=demo'; 19135 19136request.get({ 19137 url: url, 19138 json: true, 19139 headers: {'User-Agent': 'request'} 19140 }, (err, res, data) => { 19141 if (err) { 19142 console.log('Error:', err); 19143 } else if (res.statusCode !== 200) { 19144 console.log('Status:', res.statusCode); 19145 } else { 19146 // data is successfully parsed as a JSON object: 19147 console.log(data); 19148 } 19149}); 19150 </code></pre> 19151</div> 19152 19153<div class="php-code"> 19154 <pre><code class="php"> 19155<?php 19156// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19157$json = file_get_contents('https://www.alphavantage.co/query?function=ATR&symbol=IBM&interval=daily&time_period=14&apikey=demo'); 19158 19159$data = json_decode($json,true); 19160 19161print_r($data); 19162 19163exit; 19164 </code></pre> 19165</div> 19166 19167<div class="cs-code"> 19168 <pre><code class="cs"> 19169using System; 19170using System.Collections.Generic; 19171using System.Net; 19172
19173// ------------------------------------------------------------------------- 19174// if using .NET Framework 19175// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19176// This requires including the reference to System.Web.Extensions in your project 19177using System.Web.Script.Serialization; 19178// ------------------------------------------------------------------------- 19179// if using .Net Core 19180// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19181using System.Text.Json; 19182// ------------------------------------------------------------------------- 19183 19184namespace ConsoleTests 19185{ 19186 internal class Program 19187 { 19188 private static void Main(string[] args) 19189 { 19190 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19191 string QUERY_URL = "https://www.alphavantage.co/query?function=ATR&symbol=IBM&interval=daily&time_period=14&apikey=demo" 19192 Uri queryUri = new Uri(QUERY_URL); 19193 19194 using (WebClient client = new WebClient()) 19195 { 19196 // ------------------------------------------------------------------------- 19197 // if using .NET Framework (System.Web.Script.Serialization) 19198 19199 JavaScriptSerializer js = new JavaScriptSerializer(); 19200 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19201 19202 // ------------------------------------------------------------------------- 19203 // if using .NET Core (System.Text.Json) 19204 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19205 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19206 19207 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19208 19209 // ------------------------------------------------------------------------- 19210 19211 // do something with the json_data 19212 } 19213 } 19214 } 19215} 19216 </code></pre> 19217</div> 19218 19219 19220<div class="other-code" style="background-color: #f9f9f9;"> 19221 <br> 19222 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19223 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19224 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19225 <br> 19226</div> 19227 19228 <br> 19229 19230 <h4 id="natr">NATR</h4> 19231 <br> 19232 <p>This API returns the normalized average true range (NATR) values.</p> 19233 <br> 19234 <h6><b>API Parameters</b></h6> 19235 <p><b>â Required: <code>function</code></b></p> 19236 <p>The technical indicator of your choice. In this case, <code>function=NATR</code> </p> 19237 <p><b>â Required: <code>symbol</code></b></p> 19238 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19239 <p><b>â Required: <code>interval</code></b></p> 19240 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19241 <p>â Optional: <code>month</code></p> 19242 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19243 <p><b>â Required:<code>time_period</code></b></p> 19244 <p>Number of data points used to calculate each NATR value. Positive integers are accepted (e.g., <code>time_period=60</code>, <code>time_period=200</code>)</p> 19245 <p>â Optional: <code>datatype</code></p> 19246 <p>
19246By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 19247 <p>â Optional: <code>entitlement</code></p> 19248 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 19249 <p><b>â Required: <code>apikey</code></b></p> 19250 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 19251 <br> 19252 19253 <h6><b>Example (click for JSON output)</b></h6> 19254 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=NATR&symbol=IBM&interval=weekly&time_period=14&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=NATR&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>time_period</b>=14&<b>apikey</b>=demo</code></a></p> 19255 <br> 19256 19257 <h6><b>Language-specific guides</b></h6> 19258 <div> 19259 <button class="python-btn">Python</button> 19260 <button class="node-btn">NodeJS</button> 19261 <button class="php-btn">PHP</button> 19262 <button class="cs-btn">C#/.NET</button> 19263 <button class="other-btn">â¨MCP & Other</button> 19264</div> 19265 19266<div class="python-code"> 19267 <pre><code class="python"> 19268import requests 19269 19270# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19271url = 'https://www.alphavantage.co/query?function=NATR&symbol=IBM&interval=weekly&time_period=14&apikey=demo' 19272r = requests.get(url) 19273data = r.json() 19274 19275print(data) 19276 </code></pre> 19277</div> 19278 19279<div class="node-code"> 19280 <pre><code class="javascript"> 19281'use strict'; 19282var request = require('request'); 19283 19284// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19285var url = 'https://www.alphavantage.co/query?function=NATR&symbol=IBM&interval=weekly&time_period=14&apikey=demo'; 19286 19287request.get({ 19288 url: url, 19289 json: true, 19290 headers: {'User-Agent': 'request'} 19291 }, (err, res, data) => { 19292 if (err) { 19293 console.log('Error:', err); 19294 } else if (res.statusCode !== 200) { 19295 console.log('Status:', res.statusCode); 19296 } else { 19297 // data is successfully parsed as a JSON object: 19298 console.log(data); 19299 } 19300}); 19301 </code></pre> 19302</div> 19303 19304<div class="php-code"> 19305 <pre><code class="php"> 19306<?php 19307// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19308$json = file_get_contents('https://www.alphavantage.co/query?function=NATR&symbol=IBM&interval=weekly&time_period=14&apikey=demo'); 19309 19310$data = json_decode($json,true); 19311 19312print_r($data); 19313 19314exit; 19315 </code></pre> 19316</div> 19317 19318<div class="cs-code"> 19319 <pre><code class="cs"> 19320using System; 19321using System.Collections.Generic; 19322using System.Net; 19323 19324// ------------------------------------------------------------------------- 19325// if using .NET Framework 19326// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19327// This requires including the reference to System.Web.Extensions in your project 19328using System.Web.Script.Serialization; 19329// ------------------------------------------------------------------------- 19330// if using .Net Core 19331// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19332using System.Text.Json; 19333// ------------------------------------------------------------------------- 19334 19335namespace ConsoleTests 19336{ 19337 internal class Program 19338 { 19339 private static void Main(string[] args) 19340 { 19341 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
19342 string QUERY_URL = "https://www.alphavantage.co/query?function=NATR&symbol=IBM&interval=weekly&time_period=14&apikey=demo" 19343 Uri queryUri = new Uri(QUERY_URL); 19344 19345 using (WebClient client = new WebClient()) 19346 { 19347 // ------------------------------------------------------------------------- 19348 // if using .NET Framework (System.Web.Script.Serialization) 19349 19350 JavaScriptSerializer js = new JavaScriptSerializer(); 19351 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19352 19353 // ------------------------------------------------------------------------- 19354 // if using .NET Core (System.Text.Json) 19355 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19356 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19357 19358 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19359 19360 // ------------------------------------------------------------------------- 19361 19362 // do something with the json_data 19363 } 19364 } 19365 } 19366} 19367 </code></pre> 19368</div> 19369 19370 19371<div class="other-code" style="background-color: #f9f9f9;"> 19372 <br> 19373 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19374 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19375 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19376 <br> 19377</div> 19378 19379 <br> 19380 19381 <h4 id="ad">AD <span class="popular-label">Trending</span></h4> 19382 <br> 19383 <p>This API returns the Chaikin A/D line (AD) values. See also: <a href="http://www.investopedia.com/articles/active-trading/031914/understanding-chaikin-oscillator.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=AccumDist.htm" target="_blank">mathematical reference</a>.</p> 19384 <br> 19385 <h6><b>API Parameters</b></h6> 19386 <p><b>â Required: <code>function</code></b></p> 19387 <p>The technical indicator of your choice. In this case, <code>function=AD</code> </p> 19388 <p><b>â Required: <code>symbol</code></b></p> 19389 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19390 <p><b>â Required: <code>interval</code></b></p> 19391 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19392 <p>â Optional: <code>month</code></p> 19393 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19394 <p>â Optional: <code>datatype</code></p> 19395 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 19396 <p>â Optional: <code>entitlement</code></p> 19397 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
19397realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 19398 <p><b>â Required: <code>apikey</code></b></p> 19399 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 19400 <br> 19401 19402 <h6><b>Example (click for JSON output)</b></h6> 19403 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=AD&symbol=IBM&interval=daily&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=AD&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>apikey</b>=demo</code></a></p> 19404 <br> 19405 19406 <h6><b>Language-specific guides</b></h6> 19407 <div> 19408 <button class="python-btn">Python</button> 19409 <button class="node-btn">NodeJS</button> 19410 <button class="php-btn">PHP</button> 19411 <button class="cs-btn">C#/.NET</button> 19412 <button class="other-btn">â¨MCP & Other</button> 19413</div> 19414 19415<div class="python-code"> 19416 <pre><code class="python"> 19417import requests 19418 19419# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19420url = 'https://www.alphavantage.co/query?function=AD&symbol=IBM&interval=daily&apikey=demo' 19421r = requests.get(url) 19422data = r.json() 19423 19424print(data) 19425 </code></pre> 19426</div> 19427 19428<div class="node-code"> 19429 <pre><code class="javascript"> 19430'use strict'; 19431var request = require('request'); 19432 19433// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19434var url = 'https://www.alphavantage.co/query?function=AD&symbol=IBM&interval=daily&apikey=demo'; 19435 19436request.get({ 19437 url: url, 19438 json: true, 19439 headers: {'User-Agent': 'request'} 19440 }, (err, res, data) => { 19441 if (err) { 19442 console.log('Error:', err); 19443 } else if (res.statusCode !== 200) { 19444 console.log('Status:', res.statusCode); 19445 } else { 19446 // data is successfully parsed as a JSON object: 19447 console.log(data); 19448 } 19449}); 19450 </code></pre> 19451</div> 19452 19453<div class="php-code"> 19454 <pre><code class="php"> 19455<?php 19456// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19457$json = file_get_contents('https://www.alphavantage.co/query?function=AD&symbol=IBM&interval=daily&apikey=demo'); 19458 19459$data = json_decode($json,true); 19460 19461print_r($data); 19462 19463exit; 19464 </code></pre> 19465</div> 19466 19467<div class="cs-code"> 19468 <pre><code class="cs"> 19469using System; 19470using System.Collections.Generic; 19471using System.Net; 19472 19473// ------------------------------------------------------------------------- 19474// if using .NET Framework 19475// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19476// This requires including the reference to System.Web.Extensions in your project 19477using System.Web.Script.Serialization; 19478// ------------------------------------------------------------------------- 19479// if using .Net Core 19480// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19481using System.Text.Json; 19482// ------------------------------------------------------------------------- 19483 19484namespace ConsoleTests 19485{ 19486 internal class Program 19487 { 19488 private static void Main(string[] args) 19489 { 19490 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19491 string QUERY_URL = "https://www.alphavantage.co/query?function=AD&symbol=IBM&interval=daily&apikey=demo" 19492 Uri queryUri = new Uri(QUERY_URL); 19493 19494 using (WebClient client = new WebClient()) 19495 { 19496 // ------------------------------------------------------------------------- 19497 // if using .NET Framework (System.Web.Script.Serialization) 19498 19499 JavaScriptSerializer js = new JavaScriptSerializer(); 19500 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19501 19502 // ------------------------------------------------------------------------- 19503 // if using .NET Core (System.Text.Json) 19504 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19505 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19506 19507 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19508 19509 // ------------------------------------------------------------------------- 19510
19511 // do something with the json_data 19512 } 19513 } 19514 } 19515} 19516 </code></pre> 19517</div> 19518 19519 19520<div class="other-code" style="background-color: #f9f9f9;"> 19521 <br> 19522 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19523 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19524 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19525 <br> 19526</div> 19527 19528 <br> 19529 19530 <h4 id="adosc">ADOSC</h4> 19531 <br> 19532 <p>This API returns the Chaikin A/D oscillator (ADOSC) values. See also: <a href="http://www.investopedia.com/articles/active-trading/031914/understanding-chaikin-oscillator.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=AccumDist.htm" target="_blank">mathematical reference</a>.</p> 19533 <br> 19534 <h6><b>API Parameters</b></h6> 19535 <p><b>â Required: <code>function</code></b></p> 19536 <p>The technical indicator of your choice. In this case, <code>function=ADOSC</code> </p> 19537 <p><b>â Required: <code>symbol</code></b></p> 19538 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19539 <p><b>â Required: <code>interval</code></b></p> 19540 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19541 <p>â Optional: <code>month</code></p> 19542 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19543 <p>â Optional: <code>fastperiod</code></p> 19544 <p>The time period of the fast EMA. Positive integers are accepted. By default, <code>fastperiod=3</code>. </p> 19545 <p>â Optional: <code>slowperiod</code></p> 19546 <p>The time period of the slow EMA. Positive integers are accepted. By default, <code>slowperiod=10</code>. </p> 19547 <p>â Optional: <code>datatype</code></p> 19548 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 19549 <p>â Optional: <code>entitlement</code></p> 19550 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 19551 <p><b>â Required: <code>apikey</code></b></p> 19552 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 19553 <br> 19554 19555 <h6><b>Example(click for JSON output)</b></h6> 19556 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=ADOSC&symbol=IBM&interval=daily&fastperiod=5&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=ADOSC&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>fastperiod</b>=5&<b>apikey</b>=demo</code></a></p> 19557 <br> 19558 19559 <h6><b>Language-specific guides</b></h6> 19560 <div> 19561 <button class="python-btn">Python</button> 19562 <button class="node-btn">NodeJS</button> 19563 <button class="php-btn">PHP</button> 19564 <button class="cs-btn">C#/.NET</button> 19565 <button class="other-btn">â¨MCP & Other</button> 19566</div> 19567 19568<div class="python-code"> 19569 <pre><code class="python"> 19570import requests 19571 19572# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19573url = 'https://www.alphavantage.co/query?function=ADOSC&symbol=IBM&interval=daily&fastperiod=5&apikey=demo' 19574r = requests.get(url) 19575data = r.json() 19576 19577print(data) 19578 </code></pre> 19579</div> 19580 19581<div class="node-code"> 19582 <pre><code class="javascript"> 19583'use strict'; 19584var request = require('request'); 19585 19586// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19587var url = 'https://www.alphavantage.co/query?function=ADOSC&symbol=IBM&interval=daily&fastperiod=5&apikey=demo'; 19588 19589request.get({ 19590 url: url, 19591 json: true, 19592 headers: {'User-Agent': 'request'} 19593 }, (err, res, data) => { 19594 if (err) { 19595 console.log('Error:', err); 19596 } else if (res.statusCode !== 200) { 19597 console.log('Status:', res.statusCode); 19598 } else { 19599 // data is successfully parsed as a JSON object: 19600 console.log(data); 19601 } 19602}); 19603 </code></pre> 19604</div> 19605 19606<div class="php-code"> 19607 <pre><code class="php"> 19608<?php 19609// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19610$json = file_get_contents('https://www.alphavantage.co/query?function=ADOSC&symbol=IBM&interval=daily&fastperiod=5&apikey=demo'); 19611 19612$data = json_decode($json,true); 19613 19614print_r($data); 19615 19616exit; 19617 </code></pre> 19618</div> 19619 19620<div class="cs-code"> 19621 <pre><code class="cs"> 19622using System; 19623using System.Collections.Generic; 19624using System.Net; 19625
19626// ------------------------------------------------------------------------- 19627// if using .NET Framework 19628// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19629// This requires including the reference to System.Web.Extensions in your project 19630using System.Web.Script.Serialization; 19631// ------------------------------------------------------------------------- 19632// if using .Net Core 19633// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19634using System.Text.Json; 19635// ------------------------------------------------------------------------- 19636 19637namespace ConsoleTests 19638{ 19639 internal class Program 19640 { 19641 private static void Main(string[] args) 19642 { 19643 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19644 string QUERY_URL = "https://www.alphavantage.co/query?function=ADOSC&symbol=IBM&interval=daily&fastperiod=5&apikey=demo" 19645 Uri queryUri = new Uri(QUERY_URL); 19646 19647 using (WebClient client = new WebClient()) 19648 { 19649 // ------------------------------------------------------------------------- 19650 // if using .NET Framework (System.Web.Script.Serialization) 19651 19652 JavaScriptSerializer js = new JavaScriptSerializer(); 19653 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19654 19655 // ------------------------------------------------------------------------- 19656 // if using .NET Core (System.Text.Json) 19657 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19658 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19659 19660 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19661 19662 // ------------------------------------------------------------------------- 19663 19664 // do something with the json_data 19665 } 19666 } 19667 } 19668} 19669 </code></pre> 19670</div> 19671 19672 19673<div class="other-code" style="background-color: #f9f9f9;"> 19674 <br> 19675 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19676 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19677 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19678 <br> 19679</div> 19680 19681 <br> 19682 19683 <h4 id="obv">OBV <span class="popular-label">Trending</span></h4> 19684 <br> 19685 <p>This API returns the on balance volume (OBV) values. See also: <a href="http://www.investopedia.com/articles/technical/100801.asp" target="_blank">Investopedia article</a> and <a href="http://www.fmlabs.com/reference/default.htm?url=OBV.htm" target="_blank">mathematical reference</a>.</p> 19686 <br> 19687 <h6><b>API Parameters</b></h6> 19688 <p><b>â Required: <code>function</code></b></p> 19689 <p>The technical indicator of your choice. In this case, <code>function=OBV</code> </p> 19690 <p><b>â Required: <code>symbol</code></b></p> 19691 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19692 <p><b>â Required: <code>interval</code></b></p> 19693 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19694 <p>â Optional: <code>month</code></p> 19695 <p>
19695By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19696 <p>â Optional: <code>datatype</code></p> 19697 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 19698 <p>â Optional: <code>entitlement</code></p> 19699 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 19700 <p><b>â Required: <code>apikey</code></b></p> 19701 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 19702 <br> 19703 19704 <h6><b>Example (click for JSON output)</b></h6> 19705 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=OBV&symbol=IBM&interval=weekly&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=OBV&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>apikey</b>=demo</code></a></p> 19706 <br> 19707 19708 <h6><b>Language-specific guides</b></h6> 19709 <div> 19710 <button class="python-btn">Python</button> 19711 <button class="node-btn">NodeJS</button> 19712 <button class="php-btn">PHP</button> 19713 <button class="cs-btn">C#/.NET</button> 19714 <button class="other-btn">â¨MCP & Other</button> 19715</div> 19716 19717<div class="python-code"> 19718 <pre><code class="python"> 19719import requests 19720 19721# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19722url = 'https://www.alphavantage.co/query?function=OBV&symbol=IBM&interval=weekly&apikey=demo' 19723r = requests.get(url) 19724data = r.json() 19725 19726print(data) 19727 </code></pre> 19728</div> 19729 19730<div class="node-code"> 19731 <pre><code class="javascript"> 19732'use strict'; 19733var request = require('request'); 19734 19735// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19736var url = 'https://www.alphavantage.co/query?function=OBV&symbol=IBM&interval=weekly&apikey=demo'; 19737 19738request.get({ 19739 url: url, 19740 json: true, 19741 headers: {'User-Agent': 'request'} 19742 }, (err, res, data) => { 19743 if (err) { 19744 console.log('Error:', err); 19745 } else if (res.statusCode !== 200) { 19746 console.log('Status:', res.statusCode); 19747 } else { 19748 // data is successfully parsed as a JSON object: 19749 console.log(data); 19750 } 19751}); 19752 </code></pre> 19753</div> 19754 19755<div class="php-code"> 19756 <pre><code class="php"> 19757<?php 19758// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19759$json = file_get_contents('https://www.alphavantage.co/query?function=OBV&symbol=IBM&interval=weekly&apikey=demo'); 19760 19761$data = json_decode($json,true); 19762 19763print_r($data); 19764 19765exit; 19766 </code></pre> 19767</div> 19768 19769<div class="cs-code"> 19770 <pre><code class="cs"> 19771using System; 19772using System.Collections.Generic; 19773using System.Net; 19774 19775// ------------------------------------------------------------------------- 19776// if using .NET Framework 19777// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19778// This requires including the reference to System.Web.Extensions in your project 19779using System.Web.Script.Serialization; 19780// ------------------------------------------------------------------------- 19781// if using .Net Core 19782// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19783using System.Text.Json; 19784// ------------------------------------------------------------------------- 19785 19786namespace ConsoleTests 19787{
19788 internal class Program 19789 { 19790 private static void Main(string[] args) 19791 { 19792 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19793 string QUERY_URL = "https://www.alphavantage.co/query?function=OBV&symbol=IBM&interval=weekly&apikey=demo" 19794 Uri queryUri = new Uri(QUERY_URL); 19795 19796 using (WebClient client = new WebClient()) 19797 { 19798 // ------------------------------------------------------------------------- 19799 // if using .NET Framework (System.Web.Script.Serialization) 19800 19801 JavaScriptSerializer js = new JavaScriptSerializer(); 19802 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19803 19804 // ------------------------------------------------------------------------- 19805 // if using .NET Core (System.Text.Json) 19806 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19807 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19808 19809 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19810 19811 // ------------------------------------------------------------------------- 19812 19813 // do something with the json_data 19814 } 19815 } 19816 } 19817} 19818 </code></pre> 19819</div> 19820 19821 19822<div class="other-code" style="background-color: #f9f9f9;"> 19823 <br> 19824 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19825 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19826 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19827 <br> 19828</div> 19829 19830 <br> 19831 19832 <h4 id="httrendline">HT_TRENDLINE</h4> 19833 <br> 19834 <p>This API returns the Hilbert transform, instantaneous trendline (HT_TRENDLINE) values. </p> 19835 <br> 19836 <h6><b>API Parameters</b></h6> 19837 <p><b>â Required: <code>function</code></b></p> 19838 <p>The technical indicator of your choice. In this case, <code>function=HT_TRENDLINE</code> </p> 19839 <p><b>â Required: <code>symbol</code></b></p> 19840 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19841 <p><b>â Required: <code>interval</code></b></p> 19842 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19843 <p>â Optional: <code>month</code></p> 19844 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19845 <p><b>â Required: <code>series_type</code></b></p> 19846 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 19847 <p>â Optional: <code>datatype</code></p> 19848 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 19849 <p>â Optional: <code>entitlement</code></p> 19850 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
19850realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 19851 <p><b>â Required: <code>apikey</code></b></p> 19852 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 19853 <br> 19854 19855 <h6><b>Example (click for JSON output)</b></h6> 19856 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HT_TRENDLINE&symbol=IBM&interval=daily&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HT_TRENDLINE&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 19857 <br> 19858 19859 <h6><b>Language-specific guides</b></h6> 19860 <div> 19861 <button class="python-btn">Python</button> 19862 <button class="node-btn">NodeJS</button> 19863 <button class="php-btn">PHP</button> 19864 <button class="cs-btn">C#/.NET</button> 19865 <button class="other-btn">â¨MCP & Other</button> 19866</div> 19867 19868<div class="python-code"> 19869 <pre><code class="python"> 19870import requests 19871 19872# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19873url = 'https://www.alphavantage.co/query?function=HT_TRENDLINE&symbol=IBM&interval=daily&series_type=close&apikey=demo' 19874r = requests.get(url) 19875data = r.json() 19876 19877print(data) 19878 </code></pre> 19879</div> 19880 19881<div class="node-code"> 19882 <pre><code class="javascript"> 19883'use strict'; 19884var request = require('request'); 19885 19886// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19887var url = 'https://www.alphavantage.co/query?function=HT_TRENDLINE&symbol=IBM&interval=daily&series_type=close&apikey=demo'; 19888 19889request.get({ 19890 url: url, 19891 json: true, 19892 headers: {'User-Agent': 'request'} 19893 }, (err, res, data) => { 19894 if (err) { 19895 console.log('Error:', err); 19896 } else if (res.statusCode !== 200) { 19897 console.log('Status:', res.statusCode); 19898 } else { 19899 // data is successfully parsed as a JSON object: 19900 console.log(data); 19901 } 19902}); 19903 </code></pre> 19904</div> 19905 19906<div class="php-code"> 19907 <pre><code class="php"> 19908<?php 19909// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19910$json = file_get_contents('https://www.alphavantage.co/query?function=HT_TRENDLINE&symbol=IBM&interval=daily&series_type=close&apikey=demo'); 19911 19912$data = json_decode($json,true); 19913 19914print_r($data); 19915 19916exit; 19917 </code></pre> 19918</div> 19919 19920<div class="cs-code"> 19921 <pre><code class="cs"> 19922using System; 19923using System.Collections.Generic; 19924using System.Net; 19925 19926// ------------------------------------------------------------------------- 19927// if using .NET Framework 19928// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 19929// This requires including the reference to System.Web.Extensions in your project 19930using System.Web.Script.Serialization; 19931// ------------------------------------------------------------------------- 19932// if using .Net Core 19933// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 19934using System.Text.Json; 19935// ------------------------------------------------------------------------- 19936 19937namespace ConsoleTests 19938{ 19939 internal class Program 19940 { 19941 private static void Main(string[] args) 19942 { 19943 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 19944 string QUERY_URL = "https://www.alphavantage.co/query?function=HT_TRENDLINE&symbol=IBM&interval=daily&series_type=close&apikey=demo" 19945 Uri queryUri = new Uri(QUERY_URL); 19946 19947 using (WebClient client = new WebClient()) 19948 { 19949 // ------------------------------------------------------------------------- 19950 // if using .NET Framework (System.Web.Script.Serialization) 19951 19952 JavaScriptSerializer js = new JavaScriptSerializer(); 19953 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 19954 19955 // ------------------------------------------------------------------------- 19956 // if using .NET Core (System.Text.Json) 19957 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 19958 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 19959 19960 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 19961 19962 // ------------------------------------------------------------------------- 19963
19964 // do something with the json_data 19965 } 19966 } 19967 } 19968} 19969 </code></pre> 19970</div> 19971 19972 19973<div class="other-code" style="background-color: #f9f9f9;"> 19974 <br> 19975 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 19976 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 19977 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 19978 <br> 19979</div> 19980 19981 <br> 19982 19983 <h4 id="htsine">HT_SINE</h4> 19984 <br> 19985 <p>This API returns the Hilbert transform, sine wave (HT_SINE) values. </p> 19986 <br> 19987 <h6><b>API Parameters</b></h6> 19988 <p><b>â Required: <code>function</code></b></p> 19989 <p>The technical indicator of your choice. In this case, <code>function=HT_SINE</code> </p> 19990 <p><b>â Required: <code>symbol</code></b></p> 19991 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 19992 <p><b>â Required: <code>interval</code></b></p> 19993 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 19994 <p>â Optional: <code>month</code></p> 19995 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 19996 <p><b>â Required: <code>series_type</code></b></p> 19997 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 19998 <p>â Optional: <code>datatype</code></p> 19999 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 20000 <p>â Optional: <code>entitlement</code></p> 20001 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 20002 <p><b>â Required: <code>apikey</code></b></p> 20003 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 20004 <br> 20005 20006 <h6><b>Example (click for JSON output)</b></h6> 20007 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HT_SINE&symbol=IBM&interval=daily&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HT_SINE&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 20008 <br> 20009 20010 <h6><b>Language-specific guides</b></h6> 20011 <div> 20012 <button class="python-btn">Python</button> 20013 <button class="node-btn">NodeJS</button> 20014 <button class="php-btn">PHP</button> 20015 <button class="cs-btn">C#/.NET</button> 20016 <button class="other-btn">â¨MCP & Other</button> 20017</div> 20018 20019<div class="python-code"> 20020 <pre><code class="python"> 20021import requests 20022 20023# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20024url = 'https://www.alphavantage.co/query?function=HT_SINE&symbol=IBM&interval=daily&series_type=close&apikey=demo' 20025r = requests.get(url) 20026data = r.json() 20027 20028print(data) 20029 </code></pre> 20030</div> 20031 20032<div class="node-code"> 20033 <pre><code class="javascript"> 20034'use strict'; 20035var request = require('request'); 20036 20037// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20038var url = 'https://www.alphavantage.co/query?function=HT_SINE&symbol=IBM&interval=daily&series_type=close&apikey=demo'; 20039 20040request.get({ 20041 url: url, 20042 json: true, 20043 headers: {'User-Agent': 'request'} 20044 }, (err, res, data) => { 20045 if (err) { 20046 console.log('Error:', err); 20047 } else if (res.statusCode !== 200) { 20048 console.log('Status:', res.statusCode); 20049 } else { 20050 // data is successfully parsed as a JSON object: 20051 console.log(data); 20052 } 20053}); 20054 </code></pre> 20055</div> 20056 20057<div class="php-code"> 20058 <pre><code class="php"> 20059<?php 20060// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20061$json = file_get_contents('https://www.alphavantage.co/query?function=HT_SINE&symbol=IBM&interval=daily&series_type=close&apikey=demo'); 20062 20063$data = json_decode($json,true); 20064 20065print_r($data); 20066 20067exit; 20068 </code></pre> 20069</div> 20070 20071<div class="cs-code"> 20072 <pre><code class="cs"> 20073using System; 20074using System.Collections.Generic; 20075using System.Net; 20076
20077// ------------------------------------------------------------------------- 20078// if using .NET Framework 20079// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 20080// This requires including the reference to System.Web.Extensions in your project 20081using System.Web.Script.Serialization; 20082// ------------------------------------------------------------------------- 20083// if using .Net Core 20084// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 20085using System.Text.Json; 20086// ------------------------------------------------------------------------- 20087 20088namespace ConsoleTests 20089{ 20090 internal class Program 20091 { 20092 private static void Main(string[] args) 20093 { 20094 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20095 string QUERY_URL = "https://www.alphavantage.co/query?function=HT_SINE&symbol=IBM&interval=daily&series_type=close&apikey=demo" 20096 Uri queryUri = new Uri(QUERY_URL); 20097 20098 using (WebClient client = new WebClient()) 20099 { 20100 // ------------------------------------------------------------------------- 20101 // if using .NET Framework (System.Web.Script.Serialization) 20102 20103 JavaScriptSerializer js = new JavaScriptSerializer(); 20104 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 20105 20106 // ------------------------------------------------------------------------- 20107 // if using .NET Core (System.Text.Json) 20108 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 20109 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 20110 20111 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 20112 20113 // ------------------------------------------------------------------------- 20114 20115 // do something with the json_data 20116 } 20117 } 20118 } 20119} 20120 </code></pre> 20121</div> 20122 20123 20124<div class="other-code" style="background-color: #f9f9f9;"> 20125 <br> 20126 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 20127 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 20128 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 20129 <br> 20130</div> 20131 20132 <br> 20133 20134 <h4 id="httrendmode">HT_TRENDMODE</h4> 20135 <br> 20136 <p>This API returns the Hilbert transform, trend vs cycle mode (HT_TRENDMODE) values. </p> 20137 <br> 20138 <h6><b>API Parameters</b></h6> 20139 <p><b>â Required: <code>function</code></b></p> 20140 <p>The technical indicator of your choice. In this case, <code>function=HT_TRENDMODE</code> </p> 20141 <p><b>â Required: <code>symbol</code></b></p> 20142 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 20143 <p><b>â Required: <code>interval</code></b></p> 20144 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 20145 <p>â Optional: <code>month</code></p> 20146 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 20147 <p><b>â Required: <code>series_type</code></b></p> 20148 <p>
20148The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 20149 <p>â Optional: <code>datatype</code></p> 20150 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 20151 <p>â Optional: <code>entitlement</code></p> 20152 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 20153 <p><b>â Required: <code>apikey</code></b></p> 20154 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 20155 <br> 20156 20157 <h6><b>Example (click for JSON output)</b></h6> 20158 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HT_TRENDMODE&symbol=IBM&interval=weekly&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HT_TRENDMODE&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 20159 <br> 20160 20161 <h6><b>Language-specific guides</b></h6> 20162 <div> 20163 <button class="python-btn">Python</button> 20164 <button class="node-btn">NodeJS</button> 20165 <button class="php-btn">PHP</button> 20166 <button class="cs-btn">C#/.NET</button> 20167 <button class="other-btn">â¨MCP & Other</button> 20168</div> 20169 20170<div class="python-code"> 20171 <pre><code class="python"> 20172import requests 20173 20174# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20175url = 'https://www.alphavantage.co/query?function=HT_TRENDMODE&symbol=IBM&interval=weekly&series_type=close&apikey=demo' 20176r = requests.get(url) 20177data = r.json() 20178 20179print(data) 20180 </code></pre> 20181</div> 20182 20183<div class="node-code"> 20184 <pre><code class="javascript"> 20185'use strict'; 20186var request = require('request'); 20187 20188// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20189var url = 'https://www.alphavantage.co/query?function=HT_TRENDMODE&symbol=IBM&interval=weekly&series_type=close&apikey=demo'; 20190 20191request.get({ 20192 url: url, 20193 json: true, 20194 headers: {'User-Agent': 'request'} 20195 }, (err, res, data) => { 20196 if (err) { 20197 console.log('Error:', err); 20198 } else if (res.statusCode !== 200) { 20199 console.log('Status:', res.statusCode); 20200 } else { 20201 // data is successfully parsed as a JSON object: 20202 console.log(data); 20203 } 20204}); 20205 </code></pre> 20206</div> 20207 20208<div class="php-code"> 20209 <pre><code class="php"> 20210<?php 20211// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20212$json = file_get_contents('https://www.alphavantage.co/query?function=HT_TRENDMODE&symbol=IBM&interval=weekly&series_type=close&apikey=demo'); 20213 20214$data = json_decode($json,true); 20215 20216print_r($data); 20217 20218exit; 20219 </code></pre> 20220</div> 20221 20222<div class="cs-code"> 20223 <pre><code class="cs"> 20224using System; 20225using System.Collections.Generic; 20226using System.Net; 20227 20228// ------------------------------------------------------------------------- 20229// if using .NET Framework 20230// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 20231// This requires including the reference to System.Web.Extensions in your project 20232using System.Web.Script.Serialization; 20233// ------------------------------------------------------------------------- 20234// if using .Net Core 20235// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 20236using System.Text.Json; 20237// ------------------------------------------------------------------------- 20238 20239namespace ConsoleTests 20240{
20241 internal class Program 20242 { 20243 private static void Main(string[] args) 20244 { 20245 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20246 string QUERY_URL = "https://www.alphavantage.co/query?function=HT_TRENDMODE&symbol=IBM&interval=weekly&series_type=close&apikey=demo" 20247 Uri queryUri = new Uri(QUERY_URL); 20248 20249 using (WebClient client = new WebClient()) 20250 { 20251 // ------------------------------------------------------------------------- 20252 // if using .NET Framework (System.Web.Script.Serialization) 20253 20254 JavaScriptSerializer js = new JavaScriptSerializer(); 20255 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 20256 20257 // ------------------------------------------------------------------------- 20258 // if using .NET Core (System.Text.Json) 20259 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 20260 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 20261 20262 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 20263 20264 // ------------------------------------------------------------------------- 20265 20266 // do something with the json_data 20267 } 20268 } 20269 } 20270} 20271 </code></pre> 20272</div> 20273 20274 20275<div class="other-code" style="background-color: #f9f9f9;"> 20276 <br> 20277 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 20278 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 20279 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 20280 <br> 20281</div> 20282 20283 <br> 20284 20285 <h4 id="htdcperiod">HT_DCPERIOD</h4> 20286 <br> 20287 <p>This API returns the Hilbert transform, dominant cycle period (HT_DCPERIOD) values. </p> 20288 <br> 20289 <h6><b>API Parameters</b></h6> 20290 <p><b>â Required: <code>function</code></b></p> 20291 <p>The technical indicator of your choice. In this case, <code>function=HT_DCPERIOD</code> </p> 20292 <p><b>â Required: <code>symbol</code></b></p> 20293 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 20294 <p><b>â Required: <code>interval</code></b></p> 20295 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 20296 <p>â Optional: <code>month</code></p> 20297 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 20298 <p><b>â Required: <code>series_type</code></b></p> 20299 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 20300 <p>â Optional: <code>datatype</code></p> 20301 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 20302 <p>â Optional: <code>entitlement</code></p> 20303 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>
20303realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 20304 <p><b>â Required: <code>apikey</code></b></p> 20305 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 20306 <br> 20307 20308 <h6><b>Example (click for JSON output)</b></h6> 20309 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HT_DCPERIOD&symbol=IBM&interval=daily&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HT_DCPERIOD&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 20310 <br> 20311 20312 <h6><b>Language-specific guides</b></h6> 20313 <div> 20314 <button class="python-btn">Python</button> 20315 <button class="node-btn">NodeJS</button> 20316 <button class="php-btn">PHP</button> 20317 <button class="cs-btn">C#/.NET</button> 20318 <button class="other-btn">â¨MCP & Other</button> 20319</div> 20320 20321<div class="python-code"> 20322 <pre><code class="python"> 20323import requests 20324 20325# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20326url = 'https://www.alphavantage.co/query?function=HT_DCPERIOD&symbol=IBM&interval=daily&series_type=close&apikey=demo' 20327r = requests.get(url) 20328data = r.json() 20329 20330print(data) 20331 </code></pre> 20332</div> 20333 20334<div class="node-code"> 20335 <pre><code class="javascript"> 20336'use strict'; 20337var request = require('request'); 20338 20339// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20340var url = 'https://www.alphavantage.co/query?function=HT_DCPERIOD&symbol=IBM&interval=daily&series_type=close&apikey=demo'; 20341 20342request.get({ 20343 url: url, 20344 json: true, 20345 headers: {'User-Agent': 'request'} 20346 }, (err, res, data) => { 20347 if (err) { 20348 console.log('Error:', err); 20349 } else if (res.statusCode !== 200) { 20350 console.log('Status:', res.statusCode); 20351 } else { 20352 // data is successfully parsed as a JSON object: 20353 console.log(data); 20354 } 20355}); 20356 </code></pre> 20357</div> 20358 20359<div class="php-code"> 20360 <pre><code class="php"> 20361<?php 20362// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20363$json = file_get_contents('https://www.alphavantage.co/query?function=HT_DCPERIOD&symbol=IBM&interval=daily&series_type=close&apikey=demo'); 20364 20365$data = json_decode($json,true); 20366 20367print_r($data); 20368 20369exit; 20370 </code></pre> 20371</div> 20372 20373<div class="cs-code"> 20374 <pre><code class="cs"> 20375using System; 20376using System.Collections.Generic; 20377using System.Net; 20378 20379// ------------------------------------------------------------------------- 20380// if using .NET Framework 20381// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 20382// This requires including the reference to System.Web.Extensions in your project 20383using System.Web.Script.Serialization; 20384// ------------------------------------------------------------------------- 20385// if using .Net Core 20386// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 20387using System.Text.Json; 20388// ------------------------------------------------------------------------- 20389 20390namespace ConsoleTests 20391{ 20392 internal class Program 20393 { 20394 private static void Main(string[] args) 20395 { 20396 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20397 string QUERY_URL = "https://www.alphavantage.co/query?function=HT_DCPERIOD&symbol=IBM&interval=daily&series_type=close&apikey=demo" 20398 Uri queryUri = new Uri(QUERY_URL); 20399 20400 using (WebClient client = new WebClient()) 20401 { 20402 // ------------------------------------------------------------------------- 20403 // if using .NET Framework (System.Web.Script.Serialization) 20404 20405 JavaScriptSerializer js = new JavaScriptSerializer(); 20406 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 20407 20408 // ------------------------------------------------------------------------- 20409 // if using .NET Core (System.Text.Json) 20410 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 20411 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 20412 20413 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 20414 20415 // ------------------------------------------------------------------------- 20416
20417 // do something with the json_data 20418 } 20419 } 20420 } 20421} 20422 </code></pre> 20423</div> 20424 20425 20426<div class="other-code" style="background-color: #f9f9f9;"> 20427 <br> 20428 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 20429 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 20430 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 20431 <br> 20432</div> 20433 20434 <br> 20435 20436 <h4 id="htdcphase">HT_DCPHASE</h4> 20437 <br> 20438 <p>This API returns the Hilbert transform, dominant cycle phase (HT_DCPHASE) values. </p> 20439 <br> 20440 <h6><b>API Parameters</b></h6> 20441 <p><b>â Required: <code>function</code></b></p> 20442 <p>The technical indicator of your choice. In this case, <code>function=HT_DCPHASE</code> </p> 20443 <p><b>â Required: <code>symbol</code></b></p> 20444 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 20445 <p><b>â Required: <code>interval</code></b></p> 20446 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 20447 <p>â Optional: <code>month</code></p> 20448 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 20449 <p><b>â Required: <code>series_type</code></b></p> 20450 <p>The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 20451 <p>â Optional: <code>datatype</code></p> 20452 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 20453 <p>â Optional: <code>entitlement</code></p> 20454 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 20455 <p><b>â Required: <code>apikey</code></b></p> 20456 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 20457 <br> 20458 20459 <h6><b>Example (click for JSON output)</b></h6> 20460 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HT_DCPHASE&symbol=IBM&interval=daily&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HT_DCPHASE&<b>symbol</b>=IBM&<b>interval</b>=daily&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 20461 <br> 20462 20463 <h6><b>Language-specific guides</b></h6> 20464 <div> 20465 <button class="python-btn">Python</button> 20466 <button class="node-btn">NodeJS</button> 20467 <button class="php-btn">PHP</button> 20468 <button class="cs-btn">C#/.NET</button> 20469 <button class="other-btn">â¨MCP & Other</button> 20470</div> 20471 20472<div class="python-code"> 20473 <pre><code class="python"> 20474import requests 20475 20476# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20477url = 'https://www.alphavantage.co/query?function=HT_DCPHASE&symbol=IBM&interval=daily&series_type=close&apikey=demo' 20478r = requests.get(url) 20479data = r.json() 20480 20481print(data) 20482 </code></pre> 20483</div> 20484 20485<div class="node-code"> 20486 <pre><code class="javascript"> 20487'use strict'; 20488var request = require('request'); 20489 20490// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20491var url = 'https://www.alphavantage.co/query?function=HT_DCPHASE&symbol=IBM&interval=daily&series_type=close&apikey=demo'; 20492 20493request.get({ 20494 url: url, 20495 json: true, 20496 headers: {'User-Agent': 'request'} 20497 }, (err, res, data) => { 20498 if (err) { 20499 console.log('Error:', err); 20500 } else if (res.statusCode !== 200) { 20501 console.log('Status:', res.statusCode); 20502 } else { 20503 // data is successfully parsed as a JSON object: 20504 console.log(data); 20505 } 20506}); 20507 </code></pre> 20508</div> 20509 20510<div class="php-code"> 20511 <pre><code class="php"> 20512<?php 20513// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20514$json = file_get_contents('https://www.alphavantage.co/query?function=HT_DCPHASE&symbol=IBM&interval=daily&series_type=close&apikey=demo'); 20515 20516$data = json_decode($json,true); 20517 20518print_r($data); 20519 20520exit; 20521 </code></pre> 20522</div> 20523 20524<div class="cs-code"> 20525 <pre><code class="cs"> 20526using System; 20527using System.Collections.Generic; 20528using System.Net; 20529
20530// ------------------------------------------------------------------------- 20531// if using .NET Framework 20532// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 20533// This requires including the reference to System.Web.Extensions in your project 20534using System.Web.Script.Serialization; 20535// ------------------------------------------------------------------------- 20536// if using .Net Core 20537// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 20538using System.Text.Json; 20539// ------------------------------------------------------------------------- 20540 20541namespace ConsoleTests 20542{ 20543 internal class Program 20544 { 20545 private static void Main(string[] args) 20546 { 20547 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20548 string QUERY_URL = "https://www.alphavantage.co/query?function=HT_DCPHASE&symbol=IBM&interval=daily&series_type=close&apikey=demo" 20549 Uri queryUri = new Uri(QUERY_URL); 20550 20551 using (WebClient client = new WebClient()) 20552 { 20553 // ------------------------------------------------------------------------- 20554 // if using .NET Framework (System.Web.Script.Serialization) 20555 20556 JavaScriptSerializer js = new JavaScriptSerializer(); 20557 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 20558 20559 // ------------------------------------------------------------------------- 20560 // if using .NET Core (System.Text.Json) 20561 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 20562 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 20563 20564 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 20565 20566 // ------------------------------------------------------------------------- 20567 20568 // do something with the json_data 20569 } 20570 } 20571 } 20572} 20573 </code></pre> 20574</div> 20575 20576 20577<div class="other-code" style="background-color: #f9f9f9;"> 20578 <br> 20579 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 20580 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 20581 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 20582 <br> 20583</div> 20584 20585 <br> 20586 20587 <h4 id="htphasor">HT_PHASOR</h4> 20588 <br> 20589 <p>This API returns the Hilbert transform, phasor components (HT_PHASOR) values. </p> 20590 <br> 20591 <h6><b>API Parameters</b></h6> 20592 <p><b>â Required: <code>function</code></b></p> 20593 <p>The technical indicator of your choice. In this case, <code>function=HT_PHASOR</code> </p> 20594 <p><b>â Required: <code>symbol</code></b></p> 20595 <p>The name of the ticker of your choice. For example: <code>symbol=IBM</code> </p> 20596 <p><b>â Required: <code>interval</code></b></p> 20597 <p>Time interval between two consecutive data points in the time series. The following values are supported: <code>1min</code>, <code>5min</code>, <code>15min</code>, <code>30min</code>, <code>60min</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code></p> 20598 <p>â Optional: <code>month</code></p> 20599 <p>By default, this parameter is not set and the technical indicator values will be calculated based on the default length of the underlying intraday, daily, weekly, or monthly time series data. You can use the <code>month</code> parameter (in YYYY-MM format) to return technical indicators for a specific month in history. For example, <code>month=2009-01</code>. </p> 20600 <p><b>â Required: <code>series_type</code></b></p> 20601 <p>
20601The desired price type in the time series. Four types are supported: <code>close</code>, <code>open</code>, <code>high</code>, <code>low</code></p> 20602 <p>â Optional: <code>datatype</code></p> 20603 <p>By default, <code>datatype=json</code>. Strings <code>json</code> and <code>csv</code> are accepted with the following specifications: <code>json</code> returns the daily time series in JSON format; <code>csv</code> returns the time series as a CSV (comma separated value) file. </p> 20604 <p>â Optional: <code>entitlement</code></p> 20605 <p>This parameter controls the freshness of the data returned. By default, <code>entitlement</code> is not set and <u>historical</u> data is returned. Setting the parameter to <code>entitlement=realtime</code> will return <u>realtime</u> data during the US trading day. Setting the parameter to <code>entitlement=delayed</code> will return <u>15-minute delayed</u> data during the US trading day.</p> 20606 <p><b>â Required: <code>apikey</code></b></p> 20607 <p>Your API key. Claim your free API key <a href="https://www.alphavantage.co/support/#api-key" target="_blank">here</a>. </p> 20608 <br> 20609 20610 <h6><b>Example (click for JSON output)</b></h6> 20611 <p style="font-size:85%;"><a href="https://www.alphavantage.co/query?function=HT_PHASOR&symbol=IBM&interval=weekly&series_type=close&apikey=demo" target="_blank"><code style="text-decoration:underline;">https://www.alphavantage.co/query?<b>function</b>=HT_PHASOR&<b>symbol</b>=IBM&<b>interval</b>=weekly&<b>series_type</b>=close&<b>apikey</b>=demo</code></a></p> 20612 <br> 20613 20614 <h6><b>Language-specific guides</b></h6> 20615 <div> 20616 <button class="python-btn">Python</button> 20617 <button class="node-btn">NodeJS</button> 20618 <button class="php-btn">PHP</button> 20619 <button class="cs-btn">C#/.NET</button> 20620 <button class="other-btn">â¨MCP & Other</button> 20621</div> 20622 20623<div class="python-code"> 20624 <pre><code class="python"> 20625import requests 20626 20627# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20628url = 'https://www.alphavantage.co/query?function=HT_PHASOR&symbol=IBM&interval=weekly&series_type=close&apikey=demo' 20629r = requests.get(url) 20630data = r.json() 20631 20632print(data) 20633 </code></pre> 20634</div> 20635 20636<div class="node-code"> 20637 <pre><code class="javascript"> 20638'use strict'; 20639var request = require('request'); 20640 20641// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20642var url = 'https://www.alphavantage.co/query?function=HT_PHASOR&symbol=IBM&interval=weekly&series_type=close&apikey=demo'; 20643 20644request.get({ 20645 url: url, 20646 json: true, 20647 headers: {'User-Agent': 'request'} 20648 }, (err, res, data) => { 20649 if (err) { 20650 console.log('Error:', err); 20651 } else if (res.statusCode !== 200) { 20652 console.log('Status:', res.statusCode); 20653 } else { 20654 // data is successfully parsed as a JSON object: 20655 console.log(data); 20656 } 20657}); 20658 </code></pre> 20659</div> 20660 20661<div class="php-code"> 20662 <pre><code class="php"> 20663<?php 20664// replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20665$json = file_get_contents('https://www.alphavantage.co/query?function=HT_PHASOR&symbol=IBM&interval=weekly&series_type=close&apikey=demo'); 20666 20667$data = json_decode($json,true); 20668 20669print_r($data); 20670 20671exit; 20672 </code></pre> 20673</div> 20674 20675<div class="cs-code"> 20676 <pre><code class="cs"> 20677using System; 20678using System.Collections.Generic; 20679using System.Net; 20680 20681// ------------------------------------------------------------------------- 20682// if using .NET Framework 20683// https://docs.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8 20684// This requires including the reference to System.Web.Extensions in your project 20685using System.Web.Script.Serialization; 20686// ------------------------------------------------------------------------- 20687// if using .Net Core 20688// https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 20689using System.Text.Json; 20690// ------------------------------------------------------------------------- 20691 20692namespace ConsoleTests 20693{
20694 internal class Program 20695 { 20696 private static void Main(string[] args) 20697 { 20698 // replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key 20699 string QUERY_URL = "https://www.alphavantage.co/query?function=HT_PHASOR&symbol=IBM&interval=weekly&series_type=close&apikey=demo" 20700 Uri queryUri = new Uri(QUERY_URL); 20701 20702 using (WebClient client = new WebClient()) 20703 { 20704 // ------------------------------------------------------------------------- 20705 // if using .NET Framework (System.Web.Script.Serialization) 20706 20707 JavaScriptSerializer js = new JavaScriptSerializer(); 20708 dynamic json_data = js.Deserialize(client.DownloadString(queryUri), typeof(object)); 20709 20710 // ------------------------------------------------------------------------- 20711 // if using .NET Core (System.Text.Json) 20712 // using .NET Core libraries to parse JSON is more complicated. For an informative blog post 20713 // https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ 20714 20715 dynamic json_data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(client.DownloadString(queryUri)); 20716 20717 // ------------------------------------------------------------------------- 20718 20719 // do something with the json_data 20720 } 20721 } 20722 } 20723} 20724 </code></pre> 20725</div> 20726 20727 20728<div class="other-code" style="background-color: #f9f9f9;"> 20729 <br> 20730 <p>â Looking for more programming languages? The open-source community has developed over 1000 libraries for Alpha Vantage across 20+ programming languages and frameworks - you may want to <a href="https://github.com/search?q=alpha+vantage" target="_blank">give them a try</a>.</p> 20731 <p>â â¨Want to integrate stock market data into your LLMs or AI agents? Check out our official <a href="https://mcp.alphavantage.co/" target="_blank">MCP server</a>.</p> 20732 <p>â If you are a spreadsheet user (e.g., Excel or Google Sheets), please check out our dedicated <a href="https://www.alphavantage.co/spreadsheets/" target="_blank">spreadsheet add-ons</a>. </p> 20733 <br> 20734</div> 20735 20736 <br> 20737 20738 </section> 20739 20740 </article> 20741 <!-- END Main content -->
vendor: 109 bytes, lines 20741-20742
20741 20742<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>
20742<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
vendor: 1 bytes, line 20742
20742
20743<script src="/static/scripts/theDocs.all.min.js" type="text/javascript"></script>
vendor: 1 bytes, line 20743
20743
20744<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/highlight.min.js"></script>
vendor: 1 bytes, line 20744
20744
20745<script>hljs.initHighlightingOnLoad();</script>
20745 20746
20747<script> 20748 $('.python-code').css('display', 'block'); 20749 $('.node-code').css('display', 'none'); 20750 $('.php-code').css('display', 'none'); 20751 $('.cs-code').css('display', 'none'); 20752 $('.other-code').css('display', 'none'); 20753 $('.python-btn').addClass('code-btn-active').css('cursor','pointer'); 20754 $('.node-btn').addClass('code-btn-default').css('cursor','pointer'); 20755 $('.php-btn').addClass('code-btn-default').css('cursor','pointer'); 20756 $('.cs-btn').addClass('code-btn-default').css('cursor','pointer'); 20757 $('.other-btn').addClass('code-btn-default').css('cursor','pointer'); 20758 20759 $( ".python-btn" ).click(function() { 20760 $('.python-code').css('display', 'block'); 20761 $('.node-code').css('display', 'none'); 20762 $('.php-code').css('display', 'none'); 20763 $('.cs-code').css('display', 'none'); 20764 $('.other-code').css('display', 'none'); 20765 $('.python-btn').removeClass('code-btn-default').addClass('code-btn-active'); 20766 $('.node-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20767 $('.php-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20768 $('.cs-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20769 $('.other-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20770 }); 20771 20772 $( ".node-btn" ).click(function() { 20773 $('.python-code').css('display', 'none'); 20774 $('.node-code').css('display', 'block'); 20775 $('.php-code').css('display', 'none'); 20776 $('.cs-code').css('display', 'none'); 20777 $('.other-code').css('display', 'none'); 20778 $('.node-btn').removeClass('code-btn-default').addClass('code-btn-active'); 20779 $('.python-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20780 $('.php-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20781 $('.cs-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20782 $('.other-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20783 }); 20784 20785 $( ".php-btn" ).click(function() { 20786 $('.python-code').css('display', 'none'); 20787 $('.node-code').css('display', 'none'); 20788 $('.php-code').css('display', 'block'); 20789 $('.cs-code').css('display', 'none'); 20790 $('.other-code').css('display', 'none'); 20791 $('.php-btn').removeClass('code-btn-default').addClass('code-btn-active'); 20792 $('.node-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20793 $('.python-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20794 $('.cs-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20795 $('.other-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20796 }); 20797 20798 $( ".cs-btn" ).click(function() { 20799 $('.python-code').css('display', 'none'); 20800 $('.node-code').css('display', 'none'); 20801 $('.php-code').css('display', 'none'); 20802 $('.cs-code').css('display', 'block'); 20803 $('.other-code').css('display', 'none'); 20804 $('.cs-btn').removeClass('code-btn-default').addClass('code-btn-active'); 20805 $('.node-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20806 $('.php-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20807 $('.python-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20808 $('.other-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20809 }); 20810 20811 20812 $( ".other-btn" ).click(function() { 20813 $('.python-code').css('display', 'none'); 20814 $('.node-code').css('display', 'none'); 20815 $('.php-code').css('display', 'none'); 20816 $('.cs-code').css('display', 'none'); 20817 $('.other-code').css('display', 'block'); 20818 $('.other-btn').removeClass('code-btn-default').addClass('code-btn-active'); 20819 $('.node-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20820 $('.php-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20821 $('.python-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20822 $('.cs-btn').removeClass('code-btn-active').addClass('code-btn-default'); 20823 }); 20824 20825</script>
20825 20826 20827 </main> 20828 20829 20830 <!-- Footer --> 20831 <footer class="site-footer"> 20832 <div class="container-fluid"> 20833 <a id="scroll-up" href="#"><i class="fa fa-angle-up"></i></a> 20834 20835 <div class="row"> 20836 <div class="col-md-6 col-sm-6"> 20837 <p>Copyright © Alpha Vantage Inc. 2017-2026</p> 20838 </div> 20839 <div class="col-md-6 col-sm-6"> 20840 <ul class="footer-menu"> 20841 <li><a href="https://www.alphavantage.co/terms_of_service/" target="_blank">Terms of Service</a></li> 20842 <li><a href="https://www.alphavantage.co/privacy/" target="_blank">Privacy Policy</a></li> 20843 <li><a href="/cdn-cgi/l/email-protection#c7b4b2b7b7a8b5b387a6abb7afa6b1a6a9b3a6a0a2e9a4a8">Contact us</a></li> 20844 </ul> 20845 </div> 20846 </div> 20847 </div> 20848 </footer> 20849 <!-- END Footer -->
vendor: 114 bytes, lines 20849-20853
20849 20850 20851 20852 20853 <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>
20853<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"64572c4044354af7bd12ef6002904e0c","spa":2}' crossorigin="anonymous"></script>
20853 20854</body> 20855</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.