Working with AI/ML, not against it.
Image generated using Dall-E

Working with AI/ML, not against it.

"AI like GPT3/4 will take our jobs"

Whether or not AI will do that, I will let the economists and Pundits make the prediction.

I am here to speak about the obvious advantages of AI like GPT which I tested myself and I recommend my friends as well.

"AI is a friend, if you know how to leverage it, pretty much like Calculators and Computers that "took away our tedious jobs"

If you are someone trying to learn a new skill and are completely overwhelmed by the amount of SEO winning results on Google and Youtube, ChatGPT is here to help.

Allow me to explain how. In a recent conversation over a couple of beers, one of my friend was wondering how to switch to technology role. His key inhibition was that he had never done coding. My recommendations were the excellent courses on MIT opencourseware for helping beginners learn any skill from scratch, but later on, when I played around with ChatGPT, I found something interesting.

As long as I know the right questions to ask, I can learn anything.

"The important thing is not to stop questioning.?Curiosity has its own reason for existing"


As an example I asked ChatGPT to help me build a simple trading bot. This involved understanding two broad areas of concepts - Trading and Coding. While searching this on Google will send you down a rabbit hole. ChatGPT gave me exactly what I was looking for.

The conversation with CHATGPT

I started with asking how to calculate the Buy Price of a Stock or an Index.

No alt text provided for this image

Now this is a very simplistic view and doesn't consider assessing the impact of Black swan events, but it is a good start. One could further ask the AI to elaborate what each of these mean and CG will explain that as many times as you would like(limited by the number of queries per hour)

I went on further asking how to use the simplest technical indicators to identify the buy price of a stock and it recommended using the 50MA and 200MA strategy. Now keep in mind that this is one of the simplest techniques and will not work unless you are lucky. But we want ChatGPT to tell us that.

No alt text provided for this image

The next step was to convert this into a python code. So I asked ChatGPT to help me with that.

No alt text provided for this image

I ran the code in a Jupyter notebook to see how it works. The code returned the results starting from 2010 which can be controlled.

No alt text provided for this image

The code above only recommends the current trend of the selected index/stock.

In order to understand whether it is a feasible code or not, we have to run some tests, but as a beginner, one wouldn't know what these tests are, or more importantly what is needed to find out the accuracy of an algorithm. So we ask ChatGPT :

How to know if a trading algorithm is good or not?

Response :

There are several ways to evaluate the performance of a trading algorithm and determine if it is a good one or not:

  • Backtesting: This involves simulating the algorithm's performance on historical data and comparing its performance to a benchmark index or strategy.
  • Forward testing: This involves running the algorithm on live market data and comparing its performance to a benchmark index or strategy.
  • Out-of-sample testing: This involves running the algorithm on a separate dataset that was not used in the development or optimization of the algorithm.
  • Sharpe ratio: This is a measure of risk-adjusted return, which compares the return of the algorithm to the volatility of the returns. A higher Sharpe ratio indicates that the algorithm has a higher risk-adjusted return.
  • Profit factor: This is the ratio of total profit to total loss. A higher profit factor indicates that the algorithm has a higher profit potential.
  • Maximum drawdown: This is the maximum decline from a peak to a trough in the value of the algorithm. A lower maximum drawdown indicates that the algorithm is less risky.

It's important to note that a good trading algorithm is one that is able to achieve a balance between high returns and low risk, and also, it's important to conduct your own research and analysis, and consult with a financial advisor before making any investment decisions.


The AI clearly explained what different strategies one can use to test the code. And if one wants to know more about the different evaluation techniques, select one and include that in the code as well. The code was further elaborated to include expected profit by asking the following questions

  • Backtest the above code to return entry points into S&P500
  • Calculate Expected profit for the algorithm
  • update Backtesting and Expected profit logic in the code for recommending buy and sell signal.

The Final output looked something like this -

No alt text provided for this image

Right now, the code is just greek to me if I were a beginner. So I asked the AI to explain the code to me in plain English.

No alt text provided for this image


Conclusion


As clearly evident, the strategy is not sound because it cost me 700 USD over the last 13 years, but that was not the point of this article. In just under an hour, I was able to understand the basics of technical analyisis and Python coding. In the last couple of days I have tried ChatGPT to generate trading bot, simple UI based programs and so on within an hour. Of course ChatGPT also returned codes with error and I could get that fixed by ChatGPT itself by prompting the error itself. In fact, it also apologises before pointing out its mistake and then corrects the code.

In other words, the countless hours developers, researchers and students spend trying to learn a concept and write a code can be cut down drastically if the AI supports them. People already use AI like Grammarly and Autocorrect to save the time spent in proofreading a write up, AI like ChatGPT can just become a productivity tool for the industry.

This doesn't mean people need to be fired and replaced with AI. It means two things, people need to be reskilled to work alongside AI and more efficiency would mean less burnout for people while increasing the value that a person adds to the business.

This doesn't only apply to Coding and Research, but also day to day business like Planning, Logistics, Financial control etc. We are standing at the brink of a watershed moment similar to Industrial revolution. We may not like it but we have to embrace it if we want a better tomorrow.


Note : In case you didn't notice the Cover Image, it was also generated using AI.

Prabhav Gupta

Senior Product Manager @ Salesforce | MBA SPJIMR

2 年

I didn't try to get Python code but API spec code and it gave a solution. It is amazing. Great article by the way.

Nitin Pathania

Ex- Flipkart | Ex - PwC US | SPJIMR | IIT Delhi

2 年

When I try using it, I get servers are full, come back at later time or something like that. Dming you to know more :p

要查看或添加评论,请登录

Samrat Roy的更多文章

社区洞察

其他会员也浏览了