Cutting through the hyperbole of AI.
- Using ChatGPT, I create a python script for scraping, parsing and loading CFTC data.
- I end up with a database of historical data and a dashboard for simple analysis.
- Coding with LLMs is a different skill to writing code from scratch.
- Testing and communicating clearly with the LLM are crucial in achieving your goal.
I’ve been following Amir’s journey with Large Language Models (LLMs) with great interest. Purveyors of AI tools promise that you no longer have to be a software engineer to write code. Let’s put that claim to the test.
Background
It is six years since I last dusted off a Python script. My first experiments with Python started back in 2016 – as evidenced by a streaming chart of 10Y USD Swaps over on the Clarus blog. There were times when I convinced myself that I would eventually retire my Excel skills and move to Python full time. Good intentions and all that…
Still, I’ve maintained a strong interest in programming—just never professionally. And from what I’ve read about AI code-generation, I’m exactly the right person to benefit: technically inclined but not a developer. What could go wrong?
Write a python script….
The CFTC Weekly Swaps Report is a valuable resource that provides traded volumes in Rates, FX, Credit etc. Assuming that I should start somewhere familiar, I simply asked ChatGPT;
Write a python script to download the CFTC weekly swaps report history into a database so that I can run data analysis on the numbers
I’ve tried prompts like this before, but more as a curiosity than a serious task. AI-generated code looks plausible at first— but so do the AI-generated blogs generated by LLMs until you take the time to read them!
The first step that ChatGPT took was particularly impressive:

ChatGPT didn’t just return code—it asked clarifying questions and gave context. Like a good developer, it communicated clearly and helped me realize something important: I didn’t have Python or MySQL installed.
And it walked me through those installations, with infinite patience and zero judgment. Despite more than a few stupid questions from me!
Of course it worked….
When I ran the first script, I expected errors. And I got them. But the cause wasn’t obscure—it was pointing to the wrong CFTC URL. Once I corrected that, the script ran. Warnings flew, but no hard failures. I was impressed.
import pandas as pd
import requests
import mysql.connector
from bs4 import BeautifulSoup
from urllib.parse import urljoin
# MySQL connection settings
MYSQL_CONFIG = {
"host": "localhost",
"user": "root",
"password": "your_password_here", # <-- Change this
"database": "swaps_data"
}
# Constants
BASE_URL = "https://www.cftc.gov"
REPORTS_PAGE = "https://www.cftc.gov/MarketReports/SwapsReports/HistoricalSwapsReports/index.htm"
TABLE_NAME = "weekly_swaps"
At this point, I was both excited that I had a working script with such little effort, but disappointed that the LLM had made such a stupid mistake so early on. That one mistake aside, I was starting to think that LLMs might actually live up to the hype.
And then “we” ran into problems
Duly impressed, I thought “we” should step up the game:
I would like help retrieving the data from the database and showing results using plotly with data tables on a web page
(I have since given up being quite so verbose after I learned saying “please” costs ten of millions of dollars!). What followed was a recommendation, but one that got me thinking “hold on, this is starting to sound a bit complicated here”:

It sounded great (but did have the whiff of overkill) but I went ahead and tried to build it anyway! For the next couple of hours, I alternated between frustration and a strange camaraderie with my AI assistant. I even caught myself saying, “we need to create multiple tables from each sheet,” like we were teammates.
However, my responses were getting more and more curt (maybe I’m just not a great teammate!):
Show Tables 0 row(s) returned
I still have zero tables..
still zero tables…
Still zero tables returned..
You get the idea. I don’t think I helped matters by saying things like;
We want multiple tables created from each sheet. The list of sheets is on Table of Contents. but I think you are skipping the first ten rows on every sheet, not just the Table of Contents
Whilst “we” were collaborating, I really should have just been pasting the error messages themselves, providing actual data rather than opinion. That came increasingly hard when all I had was a spinning wheel in the browser. It didn’t prevent me from being clearly jubilant when I finally got multiple tables though:

It’s right – it really was AWESOME! Definitely emoji worthy I reckon 😛
Re-coding with Streamlit
Eventually, we concluded that I had data (by running some mySQL queries, another new experience for me), but that Dash couldn’t “render”. So we switched to Streamlit, a different package in Python.
I can’t stress enough how seamless the switch to Streamlit was. I’ve never heard of it, and yet ChatGPT enabled me to switch tools instantly. This highlights again what huge potential coding like this has.
I now had the beginnings of a rudimentary dashboard. From start to end, it took me three or four hours to get here:

From there it took only two prompts to discard this first version and create something more robust! I now knew exactly what I needed. First, the “Extract, Transform, Load” python script, which would both download and check the data. And then the Streamlit dashboard.
Et Voila – I created my first interactive data tool:

What Did I Learn?
This wasn’t just about building a data dashboard. It was about learning how to think and code with AI. Here are the key takeaways:
- You have two modes:
- Use AI to help you write code in a language you understand. Review and iterate.
- Or go hands-off: just run what it gives you and paste back the errors.
- Avoid the middle ground: Assuming you know what went wrong can actually slow things down. Let the AI debug based on facts, not your guesses.
- Clarify scope early: Define the first milestone together. Don’t let it run away building the whole solution before you test step one.
- Know when to stop: Just because AI can write more code doesn’t mean it should. Complexity is the enemy of usability.
- It’s okay to say no: Not every prompt needs to turn into a fully featured product.
- LLMs should guide more assertively: I’d love to see ChatGPT say: “Let’s build a prototype. Once that works, we can expand.”


Leave a Reply