Financial Data Streaming using Alpaca and Streamlit

Astarag Mohapatra
Analytics Vidhya
Published in
4 min readFeb 23, 2022

--

This tutorial aims to stream financial data, particularly Open, High, Low, Close, and Volume data using Alpaca stream API, and plot them using streamlit in real-time.

So the tutorial can be divided into three parts

  • Alpaca Streaming API v2
  • Watchdog for tracking the file changes as new data comes in and re-run streamlit. This functionality comes out of the box in streamlit.
  • Streamlit to plot the candlesticks charts for all the ticker symbols

The code for the tutorial can be found here

We will be generating candlestick plots for stocks in real-time

Real-time candlesticks plot for Bitcoin

Alpaca Streaming API

Alpaca offers simple, modern API-first solutions to enable anyone, either individuals or businesses, to connect applications and build algorithms to buy and sell stocks or crypto with zero commissions.

  • You need to have your API keys and secret keys by creating an account in Alpaca.

--

--

Astarag Mohapatra
Analytics Vidhya

Hi Astarag here, I am interested in topics about Deep learning and other topics. If you have any queries I am one comment away