Skip to content

Shiny5228/ibkr-trade-visualization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IBKR Trade Visualization

A tool for visualizing trade data from Interactive Brokers (IBKR). This project helps traders analyze their trading performance through intuitive and interactive visualizations in a streamlit web app. Currently only working for data exported via IBKR Activity Flex Query.

Table of Contents

Features

  • Import trade data from IBKR via Activity Flex Query Web Service.
  • Generate various visualizations to analyze trading performance.
  • User-friendly interface made with streamlit for exploring trade metrics.
  • Filter for time period, assets and symbols.

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/ibkr-trade-visualization.git
    cd ibkr-trade-visualization
  2. Install dependencies using pyproject.toml:

    uv sync --all-extras

Usage

  1. Generate IBKR Flex Query report.
  2. Configure .env with token and query id from IBKR.
  3. Explore the visualizations made with plotly in a streamlit web app to gain insights into your trading performance.
    streamlit run main.py

Generating IB Reports

To generate the required IBKR Flex Query report:

  1. Log in to your IBKR account.
  2. Navigate to Reports > Flex Queries.
  3. Create a new Flex Query with the following fields in Trades:
    • Execution At the top of the report
    • Account ID
    • Description
    • Asset Class
    • Underlying Symbol
    • Put/Call
    • Buy/Sell
    • Strike
    • Date/Time
    • Trade Date
    • Settle Date
    • Expiry
    • Open/Close
    • Notes
    • Cost Basis
    • Realized PnL
    • MTM P/L
    • IB Commission
    • FX Rate
    • Level of Detail
  4. At Delivery Configuration select Format: XML and Period: Year to Date.
  5. Set decimal for dates to None (no separator)
  6. Save the query and note the Query ID.
  7. Activate Web Services, see here: IBKR Web Services.
  8. Configure the TOKEN, QUERY_ID, and other required environment variables in a .env file.
  9. Run main.py

Contributing

Contributions are welcome!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or feedback, please open an issue in the repository.

About

Dashboard made with streamlit for visualizing profit and loss from trades made with IBKR

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages