top of page

How to Analyze Trades and Visualize Data in Python - A Guide to developing AI trading journal

Updated: Mar 9

Hey data fans! Let's get into the details of organizing your data analysis code today. After reading this article, you'll be all set to create your own day trading journal analyzer.


Coding illustration

Who is this intended for?

If you're a day trader who knows their way around coding, that's awesome! I use Python for my code, but I bet you could achieve similar results with other programming languages. I've gotten help from ChatGPT, especially with the 4o model that can handle csv files (and python files for finding errors and fixing code problems) but you could probably also use Cassandra or Gemini-plus.

To make use of this analyzer, you'll need to have your day trading data exported as a csv file or at least accessible to your code. In my guide, I'll be using TopStepX's exported data for reference.

The whole idea behind creating this tool is to analyze your trading performance thoroughly and then use the insights to help you refine your trading strategy. The goal is to become a more savvy day trader who understands their strengths and knows how to steer clear of potential pitfalls.

I'm loving my analyzer and use it on a daily/weekly basis to identify gaps in my trading and look for strengths and weaknesses in various parameters - be it the time of trading, holding duration, asset type, etc.


What will this post include?

We'll break down key methods, best practices, and essential tips using examples from three scripts: Analysis.py, data_handling.py, and MachineLearning.py. Let's get started!


Examining the schema of your trade data export file for Developing an AI trading journal

Download the data locally and import it with your favorite spreadsheet software.

Check which columns and data types are available.

I'm using TopStepX's exported data and it has the following columns:

  • ContractName (full name, including the expiration month; for example: MNQU4)

  • EnteredAt (full timestamp in UTC timezone)

  • ExitedAt (full timestamp in UTC timezone)

  • EntryPrice

  • ExitPrice

  • Fees

  • PnL

  • Size

  • Type (Long/Short)

  • TradeDay



            Want to read more?

            Subscribe to daytraderjunkie.com to keep reading this exclusive post.

            • Youtube
            • Twitch
            • Instagram
            • Facebook
            • Twitter
            • TikTok
            bottom of page