marketstack is a JSON-based REST API for real-time, intraday and historical stock market data, supporting 125,000+ stock ticker symbols from 72+ worldwide stock exchanges. The API was built upon powerful apilayer cloud infrastructure, handling any volume with ease - from a few API requests per day all the way to millions of calls per minute.
If you like or are using this project please give it a star. Thanks!
- 125.000+ Stock Tickers
- 72+ Stock Exchanges
- 50+ Countries
An in-depth API documentation, including interactive code examples and extensive descriptions can be found at marketstack.com/documentation
Initialize MarketstackService:
var options = Options.Create(new MarketstackOptions() { ApiToken = "apiToken"});
var marketstackService = new MarketstackService(options, NullLogger<MarketstackService>.Instance);
GetExchanges:
var exchanges = await marketstackService.GetExchanges();
GetExchangeStocks:
var nasdaqMic = "XNAS";
var stocks = await marketstackService.GetExchangeStocks(nasdaqMic);
GetStockEodBars:
var appleSymbol = "AAPL";
var fromDate = DateTime.Now.AddDays(-200);
var toDate = DateTime.Now;
var bars = await marketstackService.GetStockEodBars(appleSymbol, fromDate, toDate);
Parallel Requests:
Parallel requests are supported using the Throttling Libary that allows limiting the number of requests per second.
var options = Options.Create(new MarketstackOptions() { ApiToken = apiKey, MaxRequestsPerSecond = 3, Https = true });
var marketstackService = new MarketstackService(options, NullLogger<MarketstackService>.Instance);
List<string> symbols = new List<string>() { "AAPL", "MSFT", "GOOG", "VOD", "NVDA", "NFLX", "PEP", "NOW", "VEEV", "MOH" };
var fromDate = new DateTime(2017, 9, 1);
var toDate = DateTime.Now;
var tasks = symbols.Select(async (symbol) => await marketstackService.GetStockEodBars(symbol, fromDate, toDate));
var stocksBars = await Task.WhenAll(tasks);
Before running the tests, the ApiToken should be set using:
setx ASPNETCORE_MarketstackApiToken {Your_Api_Token} /M
All usage of the marketstack website, API, and services is subject to the marketstack Terms & Conditions and all annexed legal documents and agreements.