Build a ChatGPT Trading Bot With Real Time News (Alpaca Markets API / JavaScript)
HTML-код
- Опубликовано: 27 июн 2024
- Enjoying my videos? Sign up for more content here: www.coopercodes.com/
📩 Join CodeLetter by Cooper Codes, the 3 minute tech newsletter: thecodeletter.com
Join the Cooper Codes Community: / discord (Weekly calls, free resources, tutoring, and more!)
In this video we create a stock trading bot that uses ChatGPT and the Alpaca Markets API to trade against live news! This video is a great project for anyone who is looking to use ChatGPT functionality (or any other OpenAI API call) to enhance their trading, alongside making buys / sells to the market through an API. We use WebSockets to connect to a live news event data source from Alpaca Markets, analyze the headlines of live news, and then make decisions to buy/sell stocks based off of ChatGPT's reaction to the breaking news. A great introduction to WebSockets, API trading, and ChatGPT API calls.
Final project code: github.com/coopercodes/ChatGP...
0:00 Intro
0:35 Trading system discussion
2:13 Setup Alpaca API and OpenAI API
4:10 Setup server.js / environment variables
6:32 Setup WebSocket to live news events
14:05 Create trading logic with ChatGPT API
25:15 Testing out buy / sell logic (Alongside other notes!)
28:17 Thank you so much for watching! Наука
This video offers valuable information to start with the Alpaca API.
Beautiful art!
Super creative idea- great video!
Thank you! Appreciate the comment 😁
This is insane, I actually built a full fledged python app on the same exact idea, except I'm scraping the actual new's article (capped at 2500 chracters) and feeding it into chatGPT and providing my own prompt (should I buy/sell) and expect a custom output. I'll then process that and pipeline that into alpaca. Super fun project!
I wrote mine in golang and can process all symbol in real-time.
@@braeder @hansellcruz777 How are your bots going so far?
@@babypandajr172 It does what I tell it too do. Goal was handle all data without crashing. IT handles all the data without crashing does it call out rockets yes and no.
Nice tech, easy to implement and user friendly.
Bump comment
Cool Trading bot app! Should be integrated with a Social-AI skills/services mart to get continuous feeds of leading triggers on companies adopting/automating the most performant AI/cloud tech. Maybe that could become an AGI distributed smart market of Skills and Biz.
Creative video. Thanks. Wish to have more videos
Thank you for the comment! More stuff on the way :)
This project looks 🔥
Will definitely watch the whole thing when I get home!
Really enjoyed making this one, thanks for the support!
@@CooperCodes Just watched it and followed along! Cool to learn something other than creating a type of web app.
I'm wondering if you encountered the error "position not found: {ticker}"? Seems to happen occasionaly which is weird because I can find the ticker in Alpaca app
Thanks for another great vid anyway
It could be that the ticker is for a crypto symbol, and I'm realizing I may have been wrong about buying/selling crypto (they may use different commands). It could also be that you're trying to sell a position of a stock you don't own, which I assumed which just null out (instead of error). If this is causing the error I would put a try / catch statement around the selling call. Hopefully this helps!
Check this link out for help there: erikmartinjordan.com/continue-execution-try-catch
@@CooperCodes I will take a look 😁
Really appreciate the follow-up btw!
nice video🔥🔥
Great video! I keep getting an error that fetch is not defined. I can see the new info in the console log, but the I get the fetch error and no trades occur.
I believe you need Node.JS 18 (or the latest version) for fetch to work. My bad! I should have mentioned this
keep getting error reading properties (reading'0') and it may have something to do with it not letting me use openai keys for free fsr but if i increase my limits will it work?
Why is it saying my current quota is exceeded and to check my billing plans and details for chatGPT? did the monetize their API?
Thank you for vid. Just check you delete those API keys. They are exposed now.
Yup they have been deactivated, thank you for the heads up :) And thank you for your comment and support.
Cool idea. I'm lost though. I know nothing about coding. We went from alpaca to a coding screen? What is the coding screen called? Im guessing just a python library?
is it a coding enviroment called VScode
I keep getting this error does anyone have any suggestions?
{
error: {
message: 'You exceeded your current quota, please check your plan and billing details.',
type: 'insufficient_quota',
param: null,
code: null
}
Even though I was under my OpenAI cap I was getting this error too, I just generated a new API key and everything began working again.
5:08 PM
7/5/2023
Did you hit the number of inputs per minute?
I Cant follow all the stuff that is going on brosss jaja, please stop, I need to finish my Solopreneur SaaS Xd.
Thanks for sharing, Saved for latter😶🌫
I tried this and it lost me $35k
oh really? How did this happen?
was is it really so bad
Details if true.