If you're looking for a free API that offers real-time and historical data on financial markets for stocks, options and forex, Alpha Vantage is a good choice. It offers detailed data in JSON and CSV formats and offers intraday, daily, weekly and monthly quotes. The API also includes more than 50 technical indicators and offers global market news and sentiment scores through AI-powered machine learning. It's free tier has usage limits, but you can pay $49.99/month and up for more usage.
Another option is Alpaca, an API-based service that lets developers and businesses add stock, options and crypto trading to their apps. It offers modern APIs with OAuth integration and commission-free stock trading. The service supports a variety of programming languages and includes tools like the Broker API for embedded trading and the Local Currency Trading API for app localization.
If you're looking for something more geared toward analytics, you might want to check out LSEG Data & Analytics. The service offers global market data, analytics and workflow solutions to more than 40,000 customers. It includes AI-powered analytics, real-time user-defined parameters and exclusive access to Reuters news across all major market sectors. It's built on Microsoft's cloud infrastructure and includes a Python scripting environment called CodeBook for creating analytics and workflows.