How I Built an AI-Powered Investment Tool for Dummies
Are you “math-challenged”?
Eighty percent of the population considers themselves math-challenged, or worse, plain incompetent. If this describes you, this tutorial is especially for you. If you’re of the other kind, interested and good at math but have little or no knowledge of computer programming, this is for you, too.
If you’re reading this article, I assume you are either an investor, a financial planner or simply interested in discovering how to make ChatGPT work for you.
Well, you’re in luck! The above descriptions, all of them, apply to me, too. I’ve invested in the capital markets for over 65 years and have helped guide other investors for some 12 years in their pursuit of financial independence and retirement comfort. I’ve also been very good at math (or maths as the Brits like to say) since I was a child.
My father taught me that the Pythagorean Theorem could be applied in various situations to determine the lengths of sides of a square or rectangle. Heck, you could even determine the length of a shadow cast on the street by a tree! My dad used it extensively as a navigator in the Army Air Corp in WWII flying missions in the South Pacific.
Pythagorean Theorem: What is it?
It is a theorem attributed to Pythagoras that the square of the hypotenuse of a right triangle is equal to the sum of the squares of the other two sides.
A simpler definition is thus:
In a right triangle, the square of the longest side is equal to the sum of the squares of the shorter two sides. This is represented by the formula a2 + b2= c2. The easiest demonstration is this:
If side A=6, and side B=8, then X= the square root of the sum of 6 squared + 8 squared.
6 squared =36
8 squared =64
36+64= 100
The square root of 100 is 10. Therefore, side X, the hypotenuse, =10.
If one knows any of the two sides of a right triangle, this theorem can be used to deduce the length of the third side.
I used this knowledge to figure out all the sides of a beautiful cocktail table displayed in a window of a trendy furniture store, soon after we were married. Instead of paying $1600 for this table, I did the math, bought the materials and built it myself for way less.
My curiosity in all things led me to write my own “Basic” programming to run on the first, affordable, home computer sold by Radio Shack in the 1970’s. I ran all my invoicing for our rehabilitation clinic on this affordable consumer computer while my friends were only inserting manufactured cartridges and playing games on it.
Who Has Time for Programming?
Remember that 80% I discussed earlier who wouldn’t be bothered, for one reason or another, to learn math? Well that leaves some 20% proficient in the maths. Perhaps half of those would be able to learn programming. And my guess is that maybe only half of them would have the time and inclination to actually learn how to program a computer to do something useful. That leaves us with just 5% of the population competent and motivated enough to learn how to program for themselves.
This got me to thinking; what if there was a way to program a computer to do your bidding for you, without having a clue how to do it?
Those of you who are familiar with my work know that I’ve built and distributed any number of investment-focused applications, running on either Excel or Google Sheets, most of which run in real time. If you’re interested, you can take a look at them, here.
My curiosity about using ChatGPT was earlier fired up when I asked this large language model to construct a portfolio of stocks yielding 7% in diverse industries, from companies with long histories of growing their dividend. You can read more about this exploration, here.
For my next experiment, I fired up the old computer and asked ChatGPT to build me a compound interest calculator that any investor could use to input a principal amount, an interest rate and number of years to discover how much compound interest she would earn and what her total dollars accrued would be after the designated number of years.
And, after prompting the LLM (large language model) with my query, it spat out, in language that was easy to understand, step-by-step instructions on how to build such an application in Excel.
“Creating a compound interest calculator in Excel is straightforward and doesn’t require any programming. You can use built-in Excel functions and formulas to achieve this. Here’s a step-by-step guide:
1. **Open Excel**: Launch Microsoft Excel and open a new worksheet.
2. **Set Up Input Cells**:— In cell A1, label it as “Principal Amount.”— In cell A2, label it as “Annual Interest Rate (%).”— In cell A3, label it as “Time (years).”— In cell B1, enter the principal amount (e.g., 1000).— In cell B2, enter the annual interest rate as a percentage (e.g., 5%).— In cell B3, enter the time period in years (e.g., 5).
3. **Calculate Compound Interest**:— In cell A4, label it as “Compound Interest.”— In cell B4, enter the following formula to calculate compound interest:=B1*(1+(B2))^B3-B1
4. **Calculate Total Amount**:— In cell A5, label it as “Total Amount.”— In cell B5, enter the following formula to calculate the total amount:=B1*(1+(B2))^B3
5. **View Results**:— Cell B4 will display the compound interest.— Cell B5 will display the total amount after compound interest.
6. **Usage**:— You can now change the values in cells B1, B2, and B3 to calculate compound interest and the total amount for different scenarios.
Excel will automatically update the results whenever you change the input values. This provides a user-friendly way to perform compound interest calculations without any programming.”
*Author’s note: You can find the ^ character on the upper edge of the #6 key on your keyboard. Press Shift and 6 to use it.
I followed the directions carefully, and here is how it looked, reflecting three inputs I entered:
- $100,000 principal amount
- an annual interest rate of 5.40% (available with Marcus by Goldman)
- and a time period of 5 years.
Author’s algorithm
As you know, the simple interest on $100K at 5.4% would be $5400.00. Multiply that by 5 years and the simple interest would come to $27,000.00. Because of the compound interest formulas ChatGPT instructed us to insert, the compound interest over 5 years totals to $30,077.76, fully 11.40% more cash, all due to the magic of compounding.
*Note: On September 18, 2023, Marcus raised its rate on the high-yield account to 5.50%, including the 1.0% referral bonus plus its .10% bonus for AARP members.
Caveat
When I originally tested this calculator out with the programming given, I inputted $1000 at 5.0% and the result it gave was $.50 interest. That struck me as odd. I’m pretty good at doing lots of calculations in my head, not even needing a calculator for most tasks. My head told me that 5% of $1000 is $50 dollars, not 50 cents. Ever the scientist, I used my trusty calculator to check out my aging brain. The calculator agreed with me. I knew we had a programming problem.
Being self taught and conversant in Excel, I was able to determine the problem in pretty swift order. Instruction #3 and #4 above originally had a /100 (divide by 100) after the B2 notation. As soon as I corrected the algorithm by removing the/100, the calculator began accurately calculating.
Your Takeaway
Many years ago, when cash registers transitioned from the mechanical to computerized, it became apparent that cashiers at all manner of stores became dependent upon the machines for totals and quickly lost any aptitude they may have once had for anything mathematical. When I would question a register’s total now and then, the response I always received was, “that’s what the register says, it must be correct”. When I added up the figures for them on a purchase of a few items and pointed out the error, they would still stick with, “well, that’s what the register says, it must be right”. Even if the amount was off by many dollars!
Dependence upon machines leads to laziness like this. If I had left the formula the way it was originally delivered to me, some readers (hopefully not you) may have missed this error.
So here’s the message. ChatGPT is extremely powerful and represents the amalgam of trillions of facts compiled in a myriad of data bases for us to call upon at will. The uses it can be put to are only limited by our imaginations.
At the same time, because this technology is only in its infancy, it is imperative that we assess the products and results it gives us with a weary and critical eye. We must correct inaccuracies when we find them and not rely upon its answers with unwavering, uncritical thinking like so many lazy cashiers we encounter today.
Now, go have some fun and build yourself an interesting application.
If you’re interested in joining our subscribers and beginning your journey to increase your income, take advantage of a FREE, two-week trial to our investment newsletter, Retirement: One Dividend at a Time. Just email me today and ask, at [email protected]
If you enjoyed this article and found it educational and informative, please hit the “follow” link next to my name at the top of this article so you’ll automatically be notified of my newest work. In addition, subscribe to receive each new article automatically in your email.
Get Each New Article Delivered Right to Your Inbox
If you want to get notified whenever I post a new article about dividend growth investing and retirement, one dividend at a time, consider signing up for email updates here:
https://medium.com/@geoschneider1/subscribe
Tracking your portfolio, dividends and watch list in real time is the best way to monitor your holdings and future stocks and enhance your stock market total returns. My custom tracking applications can be found here.
Get a FREE two-week trial to our dividend growth investment newsletter, Retirement: One Dividend At A Time. My newsletter includes:
. Pertinent weekly articles,
. Buy/sell text alerts to trade at advantageous stock prices,
. An exclusive, subscriber chat forum,
. And a free portfolio tracking tool.
Just shoot me an email and ask:
Best,
George Schneider
Founder and publisher
Retirement: One Dividend At A Time
Disclaimer: This article is intended to provide information to interested parties. As I have no knowledge of individual investor circumstances, goals, and/or portfolio concentration or diversification, readers are expected to complete their own due diligence before purchasing any stocks mentioned or recommended.
Disclosure: I am long all RODAT Portfolio names. The Portfolio continues to build dividend income with reliable, dependable equities which have long histories of increasing the dividend.
Copyright ©2024, George Schneider
Subscribe to DDIntel Here.
Have a unique story to share? Submit to DDIntel here.
Join our creator ecosystem here.
DDIntel captures the more notable pieces from our main site and our popular DDI Medium publication. Check us out for more insightful work from our community.
DDI Official Telegram Channel: https://t.me/+tafUp6ecEys4YjQ1