Zapier and ChatGPT For Alpaca Trading Stocks Bot | Tutorial β
Let's build with Zapier and AI (100+ videos)π
2023-04-24
Transcript β
[00:00] welcome back to web Cafe AI where we do daily chat gbt videos in today's video we're going to look how to use Chad gbt and apopka's API for stock and crypto trading to develop a fully automatic bot when it comes to chat gbt trading stocks to start off go ahead and click the link in the description below and I want you to go ahead and sign up for alpauka here and that is going to be essentially the API and that's what's going to give us access to be able to trade either crypto or stocks and the different markets all right perfect once you have done that go ahead and add that to your zapier
[00:31] account and if you're not familiar with zapier go ahead and watch that video in the top right that's going to show you how to implement zapier and Chad gbt together so you know how to utilize it in this tutorial but all you need to do in this context is you're going to be able to add it by going to my apps and then you're going to go ahead and search alpaca and you would add alpaca right here add connection and then you're going to want to go ahead and add chat gbt as well and then once you have both added and connected and like I said go ahead and check that video up there if you've not done that yet go ahead and go to your
[01:03] zaps and let's go ahead and build out a zap that is for YouTube and that is going to be our Stock tradings app as always you can find the zap views in the description below so if you want to go ahead and copy this zap into your own portfolio go ahead and check that in the description below but let's go ahead and start today we're going to do trading and we're going to do uh gbt Plus stocks obviously as you saw this api's access to crypto as well but in this context we're going to be just using it for stocks and what we're going to do here is we're going to go ahead
[01:34] and make a simple trading bot here that essentially looks for news uh new uh new stories that have just been released and then gauges it from a scale to 0 to 100 and based off the number that it deems based on the article so let's say that it deems it as uh 50 out of 100 let's go ahead and sell the stock if it deems it as 80 and above let's go to buy the stock this will make more sense as we dive into it first step we're going to want to do here is get an RSS feed specifically ARS feed that gives us new
[02:06] new stories that are tailored for stocks so go ahead and check that out to do that we're just going to search in stock RSS feed and basically what RIS feed is it gives you access to live news story data also stuff like podcast for this video we're going to go ahead and use market watch and as you see here you have all these different news feeds and for the purposes of this video we're going to just do breaking news bulletins as we're kind of looking for new stories that just dropped and then Chad gbt can deem whether it's a good trade or a bad trade so go ahead and copy the RSS feed and go
[02:38] back to zapier let's go ahead and paste those through the event of new item and feed so in this context it'll be a new article we're going to paste the RSS feed that we just got and just for your reference when looking for RSS feeds as you saw in the previous searches a bunch to choose from we can kind of dive into that real quick let's go ahead and check out other RS feeds you could possibly choose as you know the amount of data that's given depends because obviously some websites have you know either you know a sign-in wall or a paywall obviously we want to look for websites that don't have this so you have access to the most amount of data
[03:09] available so for our sake here if we were to search we can go ahead and check out all these different RSS feeds and the reason I bring this up is because the market watch one is pretty uh General when it comes to the type of news stories that's occurring but as you see the NASDAQ RSS feed you can do IPOs you can do markets you can do options stocks cryptocurrencies Commodities a whole plethora of different RSS feeds so maybe you want an auto trader bot that's basically new stories for ETFs there you go you're going to want to grab this RSS
[03:39] feed and kind of go from there but without further Ado let's go ahead and continue from market watch RSS feed and build out a trading bot with chat gbt so you're going to go ahead and test this trigger and then essentially what it's looking for is a new item in the feed and for example we have a news story about Bed Bath and Beyond filing bankruptcy obviously from the headline itself we can tell this is pretty negative news possibly a good short that could occur here so what we're going to do next is we're going to go ahead and grab Chad gbt I'm gonna grab a couple things we're going to go ahead and rename this for ticker
[04:10] and we're gonna go do conversation continue and we're going to say based on this article uh headline when you semicolon parentheses and we're going to put in the title here we're going to say generate the stocks ticker and then we're gonna do just the ticker so there's no extra information here and we'll just go ahead and up our model to gbt 3.5 uh sorry four and then from here I'm gonna put in our memory key think of the memory key like
[04:40] the UI when you're talking to Java gbt it's like a new chat but it saves the previous data so understands what it said before plus how the output is structured so this context we're just going to remember keep stock and let's see if this works if it doesn't we can go ahead and fine tune our underlying message all right so it came out with the ticker of bbby let's go and see if that is accurate as you see that is accurate so we have our best band best Bath and Beyond if I can speak stock here and as you see we um the news play came out
[05:11] earlier today but we know it's really taking a beating right now so then from there essentially we're going to go ahead and do a couple things we're going to do another Chad gbt block and we're going to do conversation and we're going to go ahead and say based on this article headline semicolon parentheses I'm going to grab the particle headline and then we're going to go ahead and see if there's any other information we can
[05:41] grab real quick now in theory I could do another block here that would essentially be a web parser and this would essentially grab everything that's found within the article if there is no uh by wall or anything like that but for the purpose of this video I'm just going to do a based off headline so we're just going to do headline opinion or headline analysis and then from here we're going to go ahead and say based on this article headline uh generate
[06:12] a score of between 0 and 100 being a strong buy and zero being a strong sell and because of the fact that this is a little complex we're going to go ahead and up our model here to gbt 4. and then we're going to go ahead and fine tune our underlying chat to you are a stock expert and then we're going to go ahead and proceed with stock tip as
[06:44] our memory key so we can make sure we've attained our data within the chat and how our output occurs all right so as you see here giving the company is filing for a chapter 11 bankruptcy and planning to wind down its business and seat buyers I would give you a score of 20. what we can do this context is I could in theory leave this and have that much text but because of the fact this is all automatic and all going in the background you could have this as a debugging thing so you can kind of see why did I buy it and why did it sell but the purposes of this video I'm gonna go ahead and just say gen uh basically add a parameter here it says just generate
[07:15] the number score no text before or after and you'll see why when we create our next block here I hit that we're going to hit continue here we're going to change our underlying messaging because the fact that we wanted the different outputs and the way it's formatted and let's see if this works all right perfect so as you see here we got a score 15 which indicates a strong sell as we identified zero is strong so 100 being strong buy from here what we can do is we can add another block here and we're gonna go
[07:46] ahead and add a very simple block we're not too simple I'd say it's a little bit of if else statement here um I'm gonna do buy or sell question mark I'm gonna do a conversation continue continue and we're going to say based off this score I'm going to do semicolon and we're going to go ahead and grab the score that we just received and then we're going to add a context block our context line here context 0 is
[08:16] a strong cell for the stock and 100 is a strong by for the stock we're going to go ahead and say based on the score generates a an outputs of cell we're going to do quotation marks here as you see why we're going to need the exact word selling the exact word by for Alpacas API this is where you're going to be able to daily value if your score how large you
[08:49] want your parameters be when you want to sell so in this context we'll just say between 0 and 20 is a cell and generate an output of buy if and we're going to do this quotation marks again by if the score is 80 to 100 so maybe we want to really tighten it we don't want to do any uh 70 to 100 we could do 0 to 30. we're going to say generate output of cell if 0 to 20 is score and generate output it by the
[09:21] score is 800. we're going to Upward parameter or upper model here to dbt4 where you're going to go ahead and do score test as R and this could be a random 32 character string let's go and see if this works if it doesn't we can mess around with it basically we're looking for either the output of buy or sell no text or no other text being associated with it so as you see here since the score is 15 which Falls within the range of 0 to 20 the output is so let's go ahead and add a parameter here
[09:51] generate just sell or buy no text before or after let's see this is sufficient enough if not we might need to add a 3.5 block here which honestly wouldn't be that big of an issue so add one here to reset the chat here and if I have to add a 3.5 block that would be a good Learning lesson but we don't need to do that right perfect so cell is going to be the underlying thing we want to do here because the fact that the score is 15 which is pretty negative for the underlying stock perfect so we have set up our uh gbt comprehensive thinking
[10:24] on the underlying stock based off the headline what we can do now is we can set up our alpaca block now in theory before I jump to alpaca maybe you know this automatic maybe you want this sent to your phone uh you want to send to a selection you want to send to your email you could have this sent to your phone with a send SMS block which actually says Hey heads up you got a 15 score based off chat gbt analysis to buy or sell this ticker so you can be a little bit more manual rather than automatic but for now we're going to do alpaca to make this automatic so we're
[10:55] going to go ahead and say place an order I'm going to continue here and we're going to grab our symbol or a ticker it's going to be why in this context we're going to go ahead not use buy or sell because we don't know we're going to go ahead and grab the buy and sell that was created here because that's the analysis being occurred and then from there you're going to want to basically put in a fixed variable you could in theory add another comprehension block here if the score is zero set the quantity to 100 and now it's going to
[11:27] buy 100 stocks or sell 100 stocks or for now we're just going to do a fixed amount of 50 but as you see there the logic can occur where maybe you have you know a 95 score you want to make sure your quantities 300 you can set that in a new chat gbt block here from there you can set your type limit stop stop limit markets and you can set your day and just for disclaimer this is not Financial advice of course it's just simply showing you how to build a chat gbt powered trade Bots and from here you're going to want
[11:57] to go ahead and see if you want true or false for extend hours and from there you can go ahead and test that action and then obviously it's Sunday here where I'm from so I'm not going to be able to actually execute this and put an order in this news was earlier today as well all right perfect so essentially what it would do in this context is it would sell 50 shares of BBY in this context I'll be shorting BBY and then from there you'd be able to automatically have an order put through based off the analysis done on a headline that just was a new item in the RSS feed that you chose really cool
[12:29] stuff here let me know in the comments if you want me to do a full comprehensive video on setting up a more complex bot on this go ahead and like the video if you felt like you learned something here today it really helps us out here of Cafe AI without further Ado go and check out our other videos when it comes to daily chat gbt and how to apply that with your daily life or your business and I'll see you in the next video