Exploring GPT-4-O: Enhanced Vision and Audio Capabilities for Technical Analysis
Discover how GPT-4-O's advanced vision and audio features can revolutionize technical analysis by automating chart interpretations and providing detailed insights.
File
Stock Chart Analysis with GPT4o Omni (Python Tutorial)
Added on 09/29/2024
Speakers
add Add new speaker

Speaker 1: A couple of hours ago, OpenAI released a new model called GPT-4-O. The O stands for Omni. So what this model allows you to do is to input text, audio, and images and generate audio, text, and image outputs in return. And so the note here is that GPT-4-O is especially better at vision and audio understanding compared to existing models. I suggest you watch all the demos here. There's a lot of great capabilities, but I just wanted to make something quickly to see if I even had access to this and it turns out I do. So what I wanted to do was test out either the audio or vision capabilities. Now, since yesterday, I just posted a video on programming my brokerage account and saving a different charge from that, I thought I would test the vision functionality of GPT-4-O. And so if you didn't watch my video yesterday, it looks like this. So I can run this and what this does, this is a Python program that interacts with the Interactive Brokers TWS API and is able to pull data on stocks. And so here you see I have a chart for Taiwan Semiconductor right here, but this also scans and automatically pulls up the most popular stocks for today. So you can see AMC and GME are very active. So I clicked GME and of course, Roaring Kitty came back to Twitter and GME just spiked right there. So what does this have to do with GPT-4-O? Well, I thought I would just throw on an AI feature to this little desktop app that I've created. And so one thing I did in the previous video is I added the screenshot functionality. And so what I can do is when I pull up my chart, so if I click on AMC here, it pulls up that chart. If I click on GME, it pulls up that chart and then I can pull up a particular timeframe, like the one hour. And so this is interacting with my brokerage account. And now what I want to do is take a screenshot. So I'm going to click screenshot. You'll see it saves the screenshot to my screenshots directory of how the chart looked. And then you see right here, what I'm doing is telling GPT-4-O to actually do technical analysis on that chart by just looking at it. And so you can see every time I take a screenshot now, it gives me a complete markdown description of that chart. So let's say I'm just saving charts throughout my day. I automatically get a log of some analysis in text format of that chart. And so I don't even necessarily have to look at it. It just pretend you're saving some type of journal. It's automatic for you. And so I took screenshot of GME and it says a short-term movement shows a significant spike in the price of GME. And it shows it peaked at 3820. And then it talks about the volume that's on that chart. It talks about a support and resistance level and the indicators that I had on the chart. So how does this actually work in Python code? Well, if you followed my tutorial yesterday, there is a function called take screenshot. So when I click this button, I'm automatically triggering and saving a screenshot to a particular directory. So all I did was add onto this function. So I had a chart file name and I was writing the image right there. So all I need to do is write a little call to GPT-4 that actually analyzes this chart. And so after I write the image to the file system, I have this little analyze chart function. So I created a new file here that I just called GPT-4-O technical analyst. Just like with my other OpenAI tutorials, you need to pass in an OpenAI key. You can set it as an environment variable. When you initialize the OpenAI client, you can give it a default organization, or in my case, I'm part of many organizations. So I need to pass in an organization ID to make sure I'm billing this to the right organization, which is mine. So I have this analyze chart function and all it does is accept the path to an image. And so since I'm saving each screenshot and timestamping it to a screenshots directory right here, as soon as I write that file name, I'm passing the path over to analyze chart. And to call the OpenAI GPT-4-O model, you just need to pass in the new model name, assuming you have access to it. So I have access to GPT-4-O and I just use the OpenAI client here to create a chat completion. And I can just give it a user role here and just say, analyze this chart, include the symbol and discuss the price action. You can make this more and more sophisticated if you want to focus on particular elements. So let's say you want to act as a trend follower or someone that's looking for a mean reversion, or you can really specify how you want the analysis to be done. Now, the key to using this, if you've used GPT-4 Vision, is you need to actually base64 encode the image. And so you can see in my chart path here, I have this function called encode image. And so what you do is import, you import base64 here and you can base64 encode that image. And once you do that, you can actually pass this as part of the message. And so instead of a normal URL you would request on the web, you can pass it this special data URL with a base64 encoded image. And then you just return back the response. And so it just returns a normal chat completion right there. And then you can see right here in my analyze chart, I'm returning the analysis as a text here and printing it out on the screen. And then I also output all of that text to a file, usually just basic Python, open a new text file, and I'm just saving it to a markdown file right here. And so you'll notice if I pull up one more chart here, let's just do this one more time. I can even probably make it analyze my drawings here. And so yesterday I added this ability to draw a trendline, for instance, on here. And so I can draw a little trendline here and see how it would interpret this in real time. So I'm gonna do a screenshot right there and you see it's saving a screenshot of AMC exactly as it looked with my trendline right in place. And you see right there, I have the analysis from GPT 4.0 in real time, displays price action for the symbol AMC. It appears to be a multi-hour chart. It's been on upward trajectory for most of the session. And then, yeah, you see it proceeds to give some analysis and let's see if it mentions, yeah, a strong upward trend initially with a pullback. And yeah, and so it's interpreting the chart just as I've drawn it right there. And let's see if it even mentions, yeah, it says after reaching 588. And so if you watched yesterday, I calculated the high of the day and had it automatically draw a horizontal line and it just detects that as well. So yeah, that's my first experience with GPT 4.0. You might say you were able to analyze images with GPT 4.0 Vision in the past, but one thing I'm noticing is the analysis provided by GPT 4.0 is already much better. So the quality of that analysis I just showed is far superior to what I had done with GPT 4.0 Vision in the past. Oh, and I forgot to show that I've actually been testing this out in other contexts. So I have like a heat map here. So for sector analysis right here, it can actually look at this heat map and describe it, this ETF chart from FinViz. And then also another chart I was looking at as well. And so just to show you the heat map example, yeah, you can see how it's able to look at this very sophisticated heat map, not that sophisticated, but there's lots of details and many different symbols on this heat map. It can do a lot faster than I can as a human. So you can see how it can pinpoint what's going on in energy, Tesla, Amazon, all those things are very small on this chart. And it's able to pick up all the individual percentage moves. And so if I look on technology here, you see Apple up by 2.05%. It read that off the chart, Nvidia. So it can actually see what's going on. So yeah, I expect a lot of this stuff. I know I had to make a program for this, but I expect all of it to be very integrated into your desktop. They just released a desktop application as well that can see your screen. And so you can imagine where we're headed here, where the big tech company is gonna be watching everything you're doing on your computer and analyzing it in real time. And so, yeah. So is this all gonna be obsolete? Do I need to teach anyone how to program? When GPT-4 can listen to you and answer all of your questions? Yeah, maybe we're all obsolete. Definitely all the technical analysts are kind of obsolete. We don't need anyone to talk about charts and visualizations necessarily if this thing gets really, really good over time. So yeah, I'm excited about the possibilities, but also it's kind of blows my mind some of the things that were shown in this demo. So I'll post this code somewhere. Hopefully this was interesting. I'll be having some fun with this and hopefully we'll share more in the coming weeks and months. All right, take it easy, bye.

ai AI Insights
Summary

Generate a brief summary highlighting the main points of the transcript.

Generate
Title

Generate a concise and relevant title for the transcript based on the main themes and content discussed.

Generate
Keywords

Identify and highlight the key words or phrases most relevant to the content of the transcript.

Generate
Enter your query
Sentiments

Analyze the emotional tone of the transcript to determine whether the sentiment is positive, negative, or neutral.

Generate
Quizzes

Create interactive quizzes based on the content of the transcript to test comprehension or engage users.

Generate
{{ secondsToHumanTime(time) }}
Back
Forward
{{ Math.round(speed * 100) / 100 }}x
{{ secondsToHumanTime(duration) }}
close
New speaker
Add speaker
close
Edit speaker
Save changes
close
Share Transcript