WB022: Smoothening the learning curve with ChatGPT

Share
WB022: Smoothening the learning curve with ChatGPT
Image source: this website

A few years ago, I completed a coding bootcamp where I learned how to build applications in various programming languages. I did the bootcamp because I've always enjoyed the journey of self-building things from scratch.

Programming languages are like spoken languages - the less you speak, the more you forget. Sadly, I've "given back" most of the coding language I have learned. Despite wanting to regain what I've lost, the anticipation of a steep re-learning experience has put me off.

Fast forward a few years later, I am motivated to start coding again because I need a skill to stand out in a competitive job market. The fear of the steep learning curve still exists, but thankfully there's ChatGPT to help.

Automating a tedious task using an API (and ChatGPT)

As an active investor, I regularly have to retrieve foreign exchange ("FX") rates for many currency pairs from Yahoo Finance. The current workflow is repetitive and tedious:

Assuming I spend 30 seconds on each currency, the total time spent on four currencies is 2 minutes. This does not seem like a lot of time, but I dread doing this task every month because it is repetitive. And this workflow is also not scalable if I need more currency pairs down the line.

I finally decided to automate this process using an Application Programming Interface ("API"), which "calls" Yahoo Finance for the data based on my specifications.

Because I'd forgotten how to make an API request in Python (a coding language), I asked ChatGPT this: "How do I write an API request in Python?"

ChatGPT gave the following response with explanations:

ChatGPT's responses jogged my memory on APIs, and I quickly customised its script to do the following:

  1. Pull daily FX rates for four currency pairs from Yahoo Finance
  2. Date range of Jan 31, 2024 to Nov 30, 2024
  3. Use the last available FX rate of the month as the month-end date
  4. Write the data to a comma-separated value ("CSV") file

The resulting CSV output looks like this:

And according to Python's time() function, the FX rates were retrieved and processed in less than a second.

Total processing time

My takeaway

I now understand why many people believe ChatGPT-like generative AI tools pose a significant threat to the incumbent "ask and answer" platforms like Google Search and Stack Overflow (for software developers). The latter was acquired for US$1.8billion by Amsterdam-listed Prosus N.V in 2021.

Pre-ChatGPT, you would first have to do a search (on these platforms), pick one of the many search results and then assess if the result is what you're looking for. The need to repeat this process to get an ideal result is inefficient, time consuming and tedious. And search results can be manipulated by search engine optimisation.

What I like about ChatGPT is that it helps programming amateurs like me efficiently bridge the coding knowledge gap that would otherwise be a bridge too far. I no longer fear the steep learning curve ahead.

That said, I don't think ChatGPT's answers should be taken at face value.

Like all things in life, it is important to have the curiosity to trust but verify things. While ChatGPT pointed me in the right direction, I still felt the urge to tweak its script to see what else I could do. In the process, I learned new things and jogged my memory on other things.

I believe blindly assuming ChatGPT (or a smart person) gives the right answer is a dangerous path to go down. You might start developing a bad habit of not using your own brain.

And like a spoken language, your brain will be worse off if you don't regularly put it to work.

--Ends