IB Portfolio Insights with Streamlit and Trading View Charts
In this article, I’ll guide you through the creation of a Streamlit app, demonstrating how to display our Interactive Brokers paper and live portfolios, along with comprehensive historical charts for each symbol, using TradingView charts.
First of all, we install all the needed libraries:
poetry add streamlit
poetry add plotly
poetry add lightweight_charts
poetry add streamlit-lightweight-charts
poetry add ib-insync
Home page
We’ll create a multi page app, as we’ll leverage all the code created in this article for our live trading bot.
Create a file named Home.py
:
import streamlit as st
with open('style.css') as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
And run it executing in the terminal:
poetry run streamlit run Home.py
Portfolio page
The primary aim of this article is to generate a portfolio page capable of seamlessly displaying either our paper or live portfolio from our Interactive Brokers account. To accomplish this, create a new page named 1_💼_Portfolio.py
within the pages
folder.