Build a Trading Algo with AI | No Coding Required — Transcript
Full transcript
- 0:00I have been trading and investing since
- 0:022006.
- 0:04It's been a while and I've done all
- 0:06sorts of things in the market be it
- 0:08swing trading, intraday trading,
- 0:10investing, even mutual fund SIPs. But
- 0:13there's one thing that I've always
- 0:15wished I could do and that is algo
- 0:17trading. Although I understand what an
- 0:20algo is, I was never able to implement
- 0:23it on my own due to my inability to
- 0:26code. for anyone to develop an algo. To
- 0:28help me understand how I can develop my
- 0:31very first algo, I have my colleague
- 0:33Akshai here and he has promised me that
- 0:36he will teach me how to develop my very
- 0:38first algo using AI and of course using
- 0:41the APIs offered by your broker. So if
- 0:44you're like me wanting to learn how to
- 0:46develop an algo without knowing how to
- 0:49code, then go ahead, grab a cup of
- 0:51coffee, get your notebook and pen and
- 0:53we'll get started.
- 0:56All right, Akshai. Uh, so let's get
- 0:59started. Uh, but before we deep dive,
- 1:02tell me what is an ALGO?
- 1:05>> So, Karthik, an ALGO is basically a set
- 1:07of instructions, uh, trading
- 1:09instructions where you give it an input,
- 1:11which could be your data that you get
- 1:12from your broker and you get an output
- 1:15as a signal or you could automate it and
- 1:17it also places an order for you.
- 1:18>> Okay. Uh so depending on your use case
- 1:21an algo could be a fully automated algo
- 1:23or a semi-automated algo where you the
- 1:26trading is in basically in your control
- 1:27and you make a decision on the signal
- 1:30that you get.
- 1:30>> Can you very quickly give me an example
- 1:33of what an algo could be in terms of
- 1:36instructions? An algo can be something
- 1:38as simple as uh say buying like 200
- 1:41shares of Infosys if it if it uh if
- 1:44there's a moving average crossover
- 1:45happening or and even an RSI if there is
- 1:48an overbought and oversold level. Uh you
- 1:51could go long and short on any
- 1:53particular stock. So, not only can you
- 1:55take a decision on one stock, you could
- 1:57also use it to probably scan multiple
- 1:59stocks at the same time. And uh yeah,
- 2:01and basically refine your trading based
- 2:04on
- 2:05>> your correct me if I'm wrong. So, let's
- 2:07say I define my algo right now.
- 2:09>> I want to buy 100 shares of Reliance
- 2:13whenever HDFC moves above its 200 day
- 2:16moving average for whatever reason.
- 2:18>> Okay,
- 2:18>> that does that qualify as an algo? That
- 2:21is also technically possible
- 2:22[clears throat] if you have your rule
- 2:23set written in such a way that you know
- 2:26HDFC has to cross a particular level and
- 2:28you buy reliance for that.
- 2:29>> Okay. Because you said it's a bunch of
- 2:31instructions. It can it could be as
- 2:33wacky as this.
- 2:34>> But technically this is an algo also,
- 2:36right?
- 2:36>> Yes. Technically this would be an algo
- 2:38as well. So it just needs a set of
- 2:40instructions.
- 2:41>> Okay.
- 2:41>> Uh and if those instructions are met, if
- 2:43the rule set are met, it has a decision
- 2:45then to either go long or short on
- 2:47whatever decision you have made.
- 2:48>> Okay. All right. Aai. Now before we move
- 2:51ahead, I want you to reassure me once
- 2:53again that I don't have to know how to
- 2:56write a single line of code and yet
- 2:58build my first algo. Uh is that a
- 3:01definitive yes or a no?
- 3:02>> So I give a 100% promise that neither
- 3:06you nor I will be writing a single line
- 3:08of code.
- 3:08>> Okay.
- 3:09>> Uh we would orchestrate the entire algo
- 3:11using uh uh AI coding assistant that
- 3:14we'll be [clears throat] installing.
- 3:15>> Akshai. Now before we deep dive you also
- 3:17mentioned that there is something called
- 3:19as a semi-automated and fully automated
- 3:22algo. Now quickly can you please explain
- 3:25to me what do you mean by this and also
- 3:27tell me what is it that we are going to
- 3:29build today?
- 3:30>> Uh so an algo is basically your set of
- 3:32instructions that could give you a
- 3:34signal based on those instructions being
- 3:36met. Now in an automated algo uh the
- 3:39signals will be acted upon by the algo
- 3:41itself and to place the order but in a
- 3:43semi-automated uh case you would get the
- 3:45signals displayed to you as an alert and
- 3:47you would have to log into a trading
- 3:49terminal and then place the order
- 3:51manually yourself.
- 3:52>> All right. So basically in a
- 3:53semi-automated uh algo the end decision
- 3:56is upon me.
- 3:57>> Yes.
- 3:58>> So I the algo can suggest a signal but
- 4:00whether to take that signal and place
- 4:03the order the decision making is left to
- 4:05me.
- 4:05>> Yes. Whereas in a fully automated
- 4:07system, the algo takes that decision on
- 4:10on its own.
- 4:11>> Yeah.
- 4:11>> Right.
- 4:12>> Yeah.
- 4:12>> Super. And what are we going to build
- 4:14today?
- 4:15>> Uh so we would uh since we are doing
- 4:17this for the first time, I would suggest
- 4:19we start with a simple semi-automated
- 4:21system where
- 4:22>> uh we work on a daily time frame and
- 4:24generate a list of signals on list of
- 4:26stocks that are showing the signals for
- 4:28your trading idea. By the way, if you
- 4:31guys want us to demonstrate how you can
- 4:33generate a fully automated algo, then
- 4:35please do comment and maybe we can
- 4:38consider doing a separate video for
- 4:39that. Okay, Aai, now that you've given
- 4:42me some sense of what an algo is and how
- 4:44we are going to develop our first algo,
- 4:46uh can I define the algo that we want to
- 4:49develop and it's a fairly simple one.
- 4:52The idea is to scan all the top 100
- 4:54stocks of Nifty, basically the Nifty
- 4:56100, and generate a signal, bullish or a
- 5:00bearish signal, whenever the 6-day
- 5:02simple moving average crosses over a
- 5:0530-day simple moving average. Right? And
- 5:08when a signal is generated, I want the
- 5:10ALGO to list the signal in terms of its
- 5:14recency. Meaning if a signal if the
- 5:17crossover has happened yesterday in a
- 5:19particular stock I want the algo to give
- 5:22it the highest weightage
- 5:24>> as opposed to a signal that has happened
- 5:26let's say 2 weeks ago right so basically
- 5:29the most recent signal the algo assigns
- 5:33a higher weight so a this is the algo I
- 5:35have in mind can this be codified and we
- 5:39can put this in a form of algo and not
- 5:41just that I know we are using an AI tool
- 5:45Can we also do it in such a way that the
- 5:47entire algo is visually represented in a
- 5:51nice UI?
- 5:52>> Yeah. So that is actually a perfectly
- 5:54good example of uh first AL uh trading
- 5:57idea as well as how to visualize uh this
- 5:59trading idea in particular.
- 6:01>> Uh so yeah we can do it and I think we
- 6:03can get started with the process.
- 6:05>> Cool. So I'm fairly excited. Aai uh you
- 6:08please tell me what is the very first
- 6:10step that I need to take.
- 6:12>> Yeah. Uh so for the very first step we
- 6:14will install uh uh codeex which is
- 6:16CHGP's very own coding agent and we'll
- 6:19showcase its uh strengths in the sense
- 6:20that we would use it to install all the
- 6:23other tools that we need uh to build
- 6:25this algo. Yeah. So everything end to
- 6:27end would be done by the coding agent
- 6:28and we would uh in natural language uh
- 6:31prompt it to build our algo.
- 6:34>> All right. So as step number one we are
- 6:36installing codeex right?
- 6:37>> Yeah. Yeah. So let's start with
- 6:39installing uh codeex. Uh since it's a
- 6:41chatg product, we could just uh type
- 6:43chatgpt and codex on Google search and
- 6:46the first link is where we would have
- 6:49our download for our codeex. Yeah. So
- 6:51let's install it for Windows. Codex is
- 6:53also available for Mac OS as well. So
- 6:55since I'm using a Windows system, I'm
- 6:57just going to install it for Windows for
- 6:59now. Uh I'll run the Codex installer as
- 7:02well.
- 7:04And the installation should just take a
- 7:06couple of minutes.
- 7:10Now that we have Codex Karthik, I'll
- 7:12just open it and launch the app. A
- 7:14>> I'm looking at Codex for the very first
- 7:16time and to me it looks very similar to
- 7:18Chad GPT's uh user interface.
- 7:21>> Yeah, Karthik. So Codeex is basically a
- 7:25tool by the same uh company. Uh
- 7:28essentially it sits on your system and
- 7:30is able to interact and build files uh
- 7:32on your system directly. So it is a far
- 7:35more powerful tool than the chat GPD
- 7:37that we use on the browser.
- 7:39>> So Akai uh now that we've got codeex uh
- 7:42you've helped me understand the
- 7:44difference between what codeex is and
- 7:46chat GPT is uh so what is the next step?
- 7:50What should what should we do?
- 7:52>> Yeah. So with regards to building a
- 7:53semi-automated algo dashboard uh we have
- 7:56two prerequisites that we uh need to
- 7:58install. Uh the first tool that we'd
- 8:00like to install is Python which is the
- 8:02programming language
- 8:03>> on which you would write our rule set
- 8:05on.
- 8:06>> Uh the second tool that we'd like to
- 8:08install would be NodeJS.
- 8:10>> Okay.
- 8:10>> That would wrap around the algo and help
- 8:13visualize it in a cleaner and a more
- 8:15beautiful UI.
- 8:16>> Okay. So basically Python is our main
- 8:20programming language.
- 8:21>> Yeah.
- 8:21>> But just to clarify, we are not going to
- 8:23write a single line of code.
- 8:25>> Yeah. And uh Codex is going to do that
- 8:27for us. And we also have need this other
- 8:30tool called NodeJS to wrap a UI around
- 8:34whatever we are developing.
- 8:35>> Yes, that's exactly it.
- 8:36>> Okay, cool. Okay. So, how do we go about
- 8:39installing these uh utilities or tools?
- 8:42>> Yeah. So, let's use codeex itself to
- 8:46install everything that is required.
- 8:47It's a very simple prompt. It's like
- 8:48prompting how you would prompt in chart
- 8:50GPT. It's the same prompt that you would
- 8:52uh type here as well. Okay.
- 8:54>> So, let's start with Python first. So, a
- 8:56very simple prompt.
- 8:58>> Okay.
- 9:02[clears throat]
- 9:02>> A your prompt is can you install Python
- 9:05and add it to path?
- 9:07>> Yeah.
- 9:08>> What is this path and how would a
- 9:11non-programmer even know that this
- 9:13should be a specific instruction? So
- 9:16essentially adding it to path helps uh
- 9:19the operating system know that Python is
- 9:22available uh throughout the operating
- 9:24system. So any Python files we create uh
- 9:27if you were to open it it would open as
- 9:28a Python file and not as a text file.
- 9:31>> Okay. So for ease just add it to the
- 9:33path.
- 9:34>> Yeah.
- 9:34>> Right. Okay.
- 9:35>> Yeah. Okay.
- 9:37>> Uh yeah. So as you can see is launching.
- 9:40it has found the uh the installer itself
- 9:44>> and it has launched it by itself.
- 9:46>> Okay. So again it was a simple prompt
- 9:49that codeex is now taking over the
- 9:51system and doing
- 9:52>> I know I'm jumping ahead but when you
- 9:54said [clears throat] you need another
- 9:55utility called NodeJS
- 9:58>> is it going to be a similar path uh
- 10:00similar prompt wherein you say can you
- 10:02install NodeJS and add it to the path or
- 10:06or is it a different uh prompt
- 10:08>> here it would just be can you install
- 10:09NodeJS
- 10:10>> okay so no need of path
- 10:12>> no no need of path here Codex has
- 10:14finished installing Python let's go to
- 10:15the second utility ility which is
- 10:17NodeJS. So the same prompt again can
- 10:20install Node.
- 10:36Okay. So I see NodeJS is also being
- 10:38installed by Codeex. Uh as a quick
- 10:41summary so far we've first downloaded
- 10:43Codeex from Chad GPT. Then we asked
- 10:46Codex to download Python. And then after
- 10:50Python was installed, uh we asked Codex
- 10:53to install NodeJS.
- 10:55>> Yes.
- 10:55>> Right. Uh just for my uh understanding,
- 10:58this need not be in the same order. I
- 11:00can install NodeJS first and then do
- 11:02Python. Right.
- 11:03>> So there is no uh you know particular
- 11:06order for this. Uh so with this have we
- 11:10got all the prerequisites ready?
- 11:13>> Yeah. So we mostly have all the
- 11:14prerequisite that we need. Uh we have a
- 11:16little bit that we would also need to
- 11:18install which is uh your broker API.
- 11:21>> Okay.
- 11:21>> Uh so depending on which broker API you
- 11:23use, you could install the module for
- 11:25that API. Since we are using Zeroda
- 11:27Skite Connect here,
- 11:28>> okay,
- 11:28>> uh we would go ahead and prompt Codeex
- 11:30to install Zeroda Skite Connect module
- 11:32for us.
- 11:33>> Okay. Uh so this module that you're
- 11:35talking about Akai, uh is it again in
- 11:37the form of a prompt that we need to
- 11:39install?
- 11:40>> Yeah. So this module is for Python. Uh
- 11:42so very similar to how we installed
- 11:44Python and NodeJS, we can just prompt
- 11:47Codeex to install this module for us for
- 11:48Python.
- 11:49>> Okay.
- 11:50>> So I'll just go ahead and type that.
- 11:56A I see your prompt as can you install
- 11:59Kite Connect SDK for Python?
- 12:02>> Yeah.
- 12:02>> Uh I'm curious to know would codex know
- 12:05what kite connect is? Will it have the
- 12:07entire context uh for this particular
- 12:10installation?
- 12:11>> Yeah. So in this case since kite connect
- 12:13is a specific mod module uh built by
- 12:16zeroda itself uh codeex has context of
- 12:19what kite connect is uh and in this case
- 12:21is very easily able to install it by
- 12:23just this simple prompt. Yeah. Uh so
- 12:26yeah as you can see codex has installed
- 12:27kite connect python SDK.
- 12:30>> Okay. So now we have codeex we have
- 12:32python we have nodejs and we've also
- 12:34installed something called as kite
- 12:36connect python SDK.
- 12:38>> Yeah. uh we've still not yet developed
- 12:40our algo. What is the next step?
- 12:43>> Yeah. So uh now that we have installed
- 12:44kite connect successfully uh the next
- 12:47step is to uh create an application on
- 12:50zeroda's kite developer portal.
- 12:52>> Okay.
- 12:52>> Uh the application is something that
- 12:54zeroda would recognize and would then
- 12:57basically we create a connection between
- 12:59both.
- 13:00>> Okay. and we receive an incoming stream
- 13:02of data and also if we have to post
- 13:04requests for order placement or any
- 13:07other requests that we have uh we could
- 13:09do using this application. So Ashai the
- 13:11way I understand this is so on one side
- 13:14you've instructed codeex to install
- 13:17Python install NodeJS and also install
- 13:21the kite connect Python SDK so you've
- 13:24set up some sort of uh infrastructure
- 13:26there on the other side you spoke about
- 13:30uh setting up an application within the
- 13:32Zeroda environment
- 13:34>> right so I'm guessing once this
- 13:36application is set up you're going to
- 13:38link the two and start developing ing
- 13:40the algo is my thinking correct?
- 13:42>> Uh your so your thinking is called
- 13:44Karthik. Uh we just have to create an
- 13:47account on Zeroda Skype developer
- 13:49portal.
- 13:49>> Okay.
- 13:50>> Uh post which we'll be creating an
- 13:52application within it.
- 13:53>> Okay.
- 13:53>> This application is what Zeroda would
- 13:55recognize and uh there would be a stream
- 13:58of messages that would be sent back and
- 13:59forth between Zeroda and this ALGO that
- 14:01you'll be creating.
- 14:02>> Okay. Uh and this application is the
- 14:05algo that we would be creating, right?
- 14:06>> Yes, the application is the algo.
- 14:08>> Okay. All right. But uh that sounds
- 14:10exciting Akai. Although I've been using
- 14:12Zerodha for such a long time,
- 14:14>> I have never really logged into this
- 14:16developer account. Although I keep
- 14:18hearing developer account uh every now
- 14:20and then in the office. So yeah, so a
- 14:24little embarrassing but I I've never
- 14:25used it. So please please do show me how
- 14:28to set it up.
- 14:29>> Yeah, Karthik. So let's navigate to the
- 14:31Kite developer account.
- 14:32>> Okay.
- 14:32>> So as you can see here, since I already
- 14:34have an account, uh it's already
- 14:36prefilled my information. But uh if you
- 14:38are creating an account for the first
- 14:39time,
- 14:40>> I'm guessing it's a simple signup uh
- 14:42page.
- 14:43>> Exactly.
- 14:44>> Okay.
- 14:44>> Uh so for the first time, we could avoid
- 14:47the IP white list since it's not starred
- 14:49as well.
- 14:50>> Okay.
- 14:50>> We can avoid this section
- 14:52>> and fill the rest of the sections here.
- 14:54>> Okay. Because I don't know what IP
- 14:56whitelist means. Uh
- 14:58>> uh as you may have realized, I'm a
- 15:00complete tech idiot. So So I don't know
- 15:03what IP whitelist is. But you're saying
- 15:04I can ignore this for now. Yeah, you can
- 15:06ignore this for now and towards the end
- 15:08we'll probably discuss what the IP
- 15:10whitelisting bit is.
- 15:11>> Okay, go ahead.
- 15:12>> So yeah, uh after logging into our
- 15:14developer account, this is how the page
- 15:16looks. Okay,
- 15:16>> so you have a tab for your apps,
- 15:18billing, a profile, forum, uh where uh
- 15:22there are discussions happening
- 15:23regarding APIs.
- 15:24>> Okay.
- 15:25>> Uh for now, let's start with creating
- 15:26our app first.
- 15:27>> Okay.
- 15:28>> So let's create an app.
- 15:29>> Okay.
- 15:30>> Uh so we see a couple of types here. For
- 15:32now, we can ignore personal and
- 15:33publisher.
- 15:34>> Okay. Since our algo requires historical
- 15:36data, we would have to go with the
- 15:39connect type. So connect requires 500
- 15:41credits which is equivalent to 500
- 15:42rupees and this gives us access uh to
- 15:45historical data as well as live market
- 15:47data.
- 15:48>> Okay.
- 15:48>> Uh this is charged per month. So that's
- 15:51500 credits for 30 days.
- 15:53>> So this is 500 rupees uh equivalent to
- 15:55500 rupees per month. Okay. This is
- 15:57>> so yeah a so basically what you're
- 15:59saying is we need to use connect because
- 16:03uh it has access to historical data
- 16:05which is exactly what we need for this
- 16:08particular algo.
- 16:09>> Yeah
- 16:10>> because we are scanning uh the crossover
- 16:12for the nifty 100 stocks the 6 day
- 16:16simple moving average versus 30-day
- 16:17moving average and how back in history
- 16:20are we going back for this? Uh so for
- 16:23this pit for our current algo we are not
- 16:25going too far back in history. Okay.
- 16:27>> Uh but the available data that we have
- 16:29here can go scan as far back as the
- 16:32stock's inception.
- 16:33>> Okay.
- 16:34>> So um
- 16:35>> uh so it is going to give me all the
- 16:37historical data. Uh if I'm thinking
- 16:40right this will be particularly useful
- 16:43if I have to back test strategies.
- 16:45>> Yeah. So this would be particularly
- 16:47useful if you want to back test
- 16:48strategies at a larger time frame.
- 16:50>> Okay. So let's start with an application
- 16:52name. Is there any name that you'd want
- 16:54to give for this algo?
- 16:56>> I'll be super imaginative. I'll call it
- 16:58my first algo.
- 17:00>> All right, that works.
- 17:02>> So my first algo.
- 17:04>> Okay.
- 17:05>> Uh and
- 17:07I'll add the zeroda client ID. So this
- 17:11is your zeroda's client ID that you
- 17:14have.
- 17:14>> Okay.
- 17:15>> So I'll add that as well.
- 17:16>> Okay.
- 17:17>> Um so now before Yeah. So now the next
- 17:20field that is required is the redirect
- 17:22URL.
- 17:22>> One one second. There is an app icon. Is
- 17:25it uh needed?
- 17:27>> An app icon is technically not needed.
- 17:29>> It's uh depending on whether you want to
- 17:32add an application icon as well.
- 17:34>> You could do it.
- 17:35>> Okay.
- 17:35>> Uh but for now we could ignore the app
- 17:37icon and also the postback URL.
- 17:39>> Okay.
- 17:40>> Uh the next field that we'd have to fill
- 17:41up here is the redirect URL. Okay. So
- 17:43the redirect URL is basically when you
- 17:45log to your application uh you would
- 17:49need a request token. Uh we would come
- 17:52to this in the authentication bit. Uh
- 17:54but for now all you need to know is that
- 17:56the redirect URL can be anything simple.
- 17:58It could be uh in our case we could also
- 18:01put google.com.
- 18:03>> Okay.
- 18:04>> So a very simple redirect URL. So I'll
- 18:06add that here.
- 18:07>> Okay.
- 18:08>> Uh and then a description for this algo.
- 18:10So maybe I can add your uh trading idea
- 18:14itself. So maybe u moving
- 18:18average
- 18:20cross.
- 18:23So a very simple description here.
- 18:25>> Okay. So redirect URL you've said
- 18:27google.com. So u you will have to
- 18:30explain
- 18:32maybe at a later stage uh why this is
- 18:35needed and what what actually should go
- 18:38in there. But we'll pick it up later.
- 18:40>> Okay.
- 18:40>> Um All right. So, so far it's pretty
- 18:44straightforward.
- 18:45>> Yeah. So, let's go ahead and create our
- 18:47application.
- 18:49>> Uh you would have to enter the I
- 18:51understand prompt here.
- 18:55>> Okay.
- 18:56>> And once you do so it there is a prompt
- 18:59here saying insufficient balance.
- 19:01>> Okay.
- 19:01>> Uh which is where we'd have to go to a
- 19:03billing account.
- 19:04>> Okay.
- 19:04>> Uh let's just go to our my apps and
- 19:06confirm. So you can see here your my
- 19:08first ALGO is created
- 19:09>> but the status says here as pending.
- 19:11>> Pending. Okay.
- 19:12>> So let's quickly go to the billing
- 19:14section
- 19:15>> and add 500 credit. So there are a
- 19:17couple of ways that you could add
- 19:18credits.
- 19:18>> Okay. It's a straightforward payment. Uh
- 19:21>> exactly. So you have a straightforward
- 19:23payment uh section or you could directly
- 19:25link it to your kite account that you
- 19:27already have
- 19:28>> and uh depending on whether you have 500
- 19:31rupees available in that account or not.
- 19:32Okay.
- 19:32>> You could directly add credits from
- 19:34there as well.
- 19:34>> Okay. Uh so for this example, I'll just
- 19:36use a payment gateway and add credits.
- 19:39>> Okay.
- 19:43>> Yeah. So as you can see, payment is
- 19:45successful. Our credits have been added
- 19:46here.
- 19:47>> Uh let's quickly go back to my apps. Uh
- 19:50go to our first algo here and we can
- 19:53activate it right now. So I'll just
- 19:54click activate now.
- 19:55>> Okay.
- 19:56>> And similarly, I'll just put
- 20:01the I understand prompt.
- 20:03>> Okay.
- 20:04Uh yeah.
- 20:08So yes, we have activated our first Algo
- 20:10application.
- 20:11>> Okay.
- 20:11>> Uh it tells us when it expires, so 30
- 20:14days from now.
- 20:14>> Okay. [clears throat]
- 20:15>> And these are the app details here
- 20:18>> that we filled in earlier.
- 20:20>> Okay.
- 20:20>> Now this is our application and our
- 20:22application has uh a couple of
- 20:25credentials that are unique only to this
- 20:28application and these are credentials
- 20:30that technically you should not share
- 20:31with anyone else. Uh so on one side
- 20:34you've set up the uh codeex and python
- 20:36and nodejs infra. So that was let's look
- 20:39at it as part a part b you've come to
- 20:42the zeroda environment and you've set up
- 20:44a application.
- 20:46>> Yeah.
- 20:46>> Uh you've we've called it my first algo.
- 20:49>> Uh after successfully creating it uh we
- 20:52are looking at something called as an
- 20:54API key and I know that there is
- 20:57something else called as API secret.
- 21:00>> Yes. Right. So
- 21:03is this uh is the API key and the API
- 21:06secret like my login ID and password uh
- 21:10is that correct? Is my understanding
- 21:11correct?
- 21:12>> Yeah. So the API key and API secret
- 21:15basically allows Zerodha's ecosystem to
- 21:17recognize that this application is
- 21:19trying to connect to Zeroda's APIs.
- 21:22>> Okay.
- 21:22>> So your API key is like your username
- 21:25>> and your API secret is like your
- 21:26password.
- 21:27>> Okay. uh apart from these two
- 21:29credentials you have one more credential
- 21:31that you will request from Zeroda itself
- 21:34and that is your session that that is
- 21:36called an access token. So that access
- 21:37token keeps your session alive for 24
- 21:40hours.
- 21:41>> Okay. Okay.
- 21:42>> So for now for just this process uh
- 21:45let's quickly save the API key since we
- 21:47don't want to keep coming back and forth
- 21:49on the developer account.
- 21:50>> We can save the API key and the API
- 21:52secret in a text file and save it in a
- 21:54folder which where we'll be working on.
- 21:57>> Okay. So I'll quickly create a new
- 21:59folder.
- 22:02So I'm creating a new folder. Is there a
- 22:04name that you'd want to call this
- 22:05folder?
- 22:06>> Uh let's call this folder my first algo
- 22:09itself. Again very imaginative.
- 22:13>> Yeah.
- 22:13>> Right. So this folder is created on the
- 22:15desktop. Uh I'll just quickly open it.
- 22:18>> Uh the folder is completely empty right
- 22:20now.
- 22:20>> Okay. Okay. Uh what I'll do is I'll
- 22:22create a new text file
- 22:26and call it credentials.
- 22:29>> Yeah, since we are doing it at a
- 22:30beginner uh state.
- 22:32>> Okay.
- 22:32>> We'll save our credentials in a
- 22:33[clears throat] text file. Ideally, a
- 22:35more robust way of saving it would be an
- 22:37env file where it's not technically
- 22:39visible directly.
- 22:42>> Yeah. So, let's save the credentials in
- 22:43the cred the text file. So,
- 22:45[clears throat] our API key here
- 22:55and our API secret as well.
- 23:07So, I'm saving both and
- 23:09I [clears throat] have saved them to
- 23:10this text file in the my algo folder. My
- 23:13first Algo folder. Yeah, just to
- 23:15reconfirm
- 23:18for a non-programmer like me, the way I
- 23:20understand this is the API key and the
- 23:22API secret uh is as sacred as your
- 23:26bank's user ID password. So, utmost
- 23:29caution has to be exercised while uh
- 23:32saving it on system and um uh and even
- 23:36sharing it with others. Right.
- 23:37>> 100%. Yeah.
- 23:38>> Okay.
- 23:40>> So now I have saved the API key and the
- 23:42API secret in a text file.
- 23:44Now we are good to start developing our
- 23:46algo.
- 23:46>> So for the first step what we do is we'd
- 23:48go back to codeex again.
- 23:50>> Okay.
- 23:51>> Uh in the same chat or you could create
- 23:53a new chat.
- 23:54>> You could give it the location of where
- 23:56your folder is. So I'll just copy the
- 23:58location here.
- 23:59>> Okay.
- 24:00>> And
- 24:02uh and again a simple prompt I'll ask
- 24:04can
- 24:05>> can we start a fresh chat just to uh
- 24:07>> yes
- 24:08>> uh start from like a clean slate.
- 24:11>> Sure.
- 24:11>> Okay. So we could start a new chat
- 24:13directly. So in the same uh chat
- 24:16>> I could I'll just put a prompt saying
- 24:19can you
- 24:21in this folder?
- 24:31Yeah. So I'm prompting codeex to now
- 24:33work in the folder that we just created.
- 24:36>> Okay. [clears throat]
- 24:46All right. So as you can see codeex is
- 24:48now going to work in this folder and
- 24:50it's also told us that it currently
- 24:52contains a credentials.ext.
- 24:54>> Okay.
- 24:54>> Uh now for the final bit about of the
- 24:57application is uh our login for this
- 25:00application will have a separate URL.
- 25:02>> Okay.
- 25:02>> And that URL will remain constant
- 25:04throughout.
- 25:04>> Okay. So we would first ask Codex to
- 25:07generate that URL for us and and we'd go
- 25:10ahead and bookmark that URL for future
- 25:12use as well.
- 25:13>> Okay.
- 25:13>> So a simple prompt here again. Can you
- 25:17give me the guide? Okay.
- 25:21Um based on
- 25:27yeah so I'm asking Codeex to give me the
- 25:29login URL here.
- 25:30>> Okay.
- 25:39So is this step basically
- 25:42uh asking codeex to connect to kite?
- 25:44>> Yes. So this is a step that's basically
- 25:47asking codeex to connect to our
- 25:49application uh URL.
- 25:52>> So as you can see here uh much of the
- 25:55URL is the same. The only bit that will
- 25:58change across uh different applications
- 26:00is your API key here. Okay. So this is
- 26:02the API key that was there for my
- 26:03application.
- 26:04>> Okay.
- 26:05>> So I'll just copy this URL.
- 26:08I'll go back to my browser. Paste it
- 26:11here.
- 26:12>> Now this URL you could bookmark since
- 26:14this URL doesn't change.
- 26:16>> Okay.
- 26:17>> Uh yeah. So you have to authorize the
- 26:20application.
- 26:22Yeah. So now that I've logged in,
- 26:25>> uh it has taken me to google.com.
- 26:28>> Uh now I'll probably explain the
- 26:30redirect URL. So the redirect URL of
- 26:32this application takes me to google.com.
- 26:35>> Along with that URL, there is certain
- 26:37extra information that is given here.
- 26:39>> Okay.
- 26:39>> As you can see,
- 26:40>> right?
- 26:41>> Uh the information that we require is
- 26:42the request token here.
- 26:44>> Okay. Okay.
- 26:44>> Uh so the request token is this block of
- 26:47text here
- 26:48>> that is between the request token and
- 26:51the and that is there here.
- 26:53>> Okay. Okay.
- 26:53>> So let's just quickly that is the
- 26:56request token that is there.
- 26:58>> Okay. Now that we have reached the step,
- 27:00we can now finally start building the
- 27:01algo.
- 27:02>> Okay. Uh
- 27:03>> but what are you going to do with that
- 27:05request token? Do we have to paste it in
- 27:07the credential file or
- 27:09>> No, no, no. We would not be pasting it
- 27:10in the credential file.
- 27:11>> Now that we're building our UI uh in the
- 27:14UI itself, we'll add our login uh
- 27:16portal.
- 27:17>> Okay. A so what we've done so far is
- 27:20we've built the uh infrastructure, the
- 27:23railroads required to develop our first
- 27:26algo. All the things that we've done
- 27:27with codeex, all the things that we've
- 27:29done on the zeroda kite connect
- 27:31environment, they're all the basic uh
- 27:34you know background work
- 27:36>> but we've still not developed a single
- 27:38line of code or rather we've still not
- 27:40asked codeex to you know write a single
- 27:43line of code uh and start developing the
- 27:46algo. Uh so have we reached that point
- 27:49or is there something more that needs to
- 27:51be done?
- 27:52>> No, we have reached that point now. We
- 27:54have done with everything that was
- 27:55required. uh we can start building our
- 27:57algo right now.
- 27:58>> Okay.
- 27:58>> So let's go back to codeex and prompt it
- 28:00to start building our algo.
- 28:01>> Okay.
- 28:02>> So now we can start building our algo.
- 28:04>> Okay.
- 28:04>> So I already have a prompt to build the
- 28:07algo.
- 28:08>> Okay.
- 28:08>> So I'm just going to paste that here in
- 28:09chat and ask codeex to build the algo.
- 28:12>> Okay. Now Akai, now before you hit enter
- 28:15and uh CEX starts doing its thing, uh
- 28:19please take me through this prompt line
- 28:21by line. What is it uh that you've
- 28:24you're asking Codex to build? I'm
- 28:26guessing this is the uh the heart of the
- 28:29algo engine that we are building, right?
- 28:31>> Yes. Yes.
- 28:33>> Yeah. So, please uh take me through it
- 28:35line by line.
- 28:36>> So, the prompt is basically asking Codex
- 28:38to build a single Python file.
- 28:40>> Okay.
- 28:41>> Which would run which would be our algo
- 28:42that we'd run.
- 28:43>> Okay.
- 28:44>> Uh so, the first thing it would do is it
- 28:45would au authenticate
- 28:47>> using the API key and the API secret.
- 28:49>> Okay. I will also be giving it the
- 28:51request token that we had from the URL
- 28:53earlier
- 28:54>> uh to get the access token.
- 28:56>> Uh post the authentication it would
- 28:58download the nifty 100 constituents.
- 29:00>> Okay.
- 29:01>> And get the instrument symbols from uh
- 29:04zeroda's API uh for instruments.
- 29:07>> Okay.
- 29:07>> Uh post that the next line is that it
- 29:09fetches the daily historical data. It
- 29:11then calculates the SMA 6 and SMA 30 for
- 29:14the all the stocks that we are
- 29:16>> compiling. uh it would then detect a
- 29:18bullish and bearish crossover and then
- 29:20rank them by the most recent crossover
- 29:22dates.
- 29:23>> Okay.
- 29:23>> So this is what it's doing at the
- 29:24background. It's output that it will
- 29:27have is it would rank the stocks.
- 29:29>> Okay.
- 29:29>> It would show us the symbol. Uh it would
- 29:32show the signal type the crossover date
- 29:34based on recency.
- 29:35>> Okay.
- 29:36>> Uh and the close price SMA 6 and SMA 30
- 29:39as well.
- 29:39>> Yeah. So just to get my understanding
- 29:42correct
- 29:44you are essentially [clears throat] now
- 29:46connecting to the zeroda kite ecosystem
- 29:50uh and now I understand uh why you said
- 29:52we need kite connect because you're
- 29:54asking it to download historical data.
- 29:57>> Yeah.
- 29:57>> So on one hand it is fetching all the
- 30:00data then it's also doing the math
- 30:03required to identify the crossover.
- 30:05>> Yes.
- 30:05>> Right. And you're also specifying a
- 30:08certain format in which you want the
- 30:10output in.
- 30:12>> So, so yeah. So, this is the meat of the
- 30:14algo, right?
- 30:15>> Yes.
- 30:16>> Okay. So, yeah, super curious. Why don't
- 30:18you hit that enter button?
- 30:20>> Uh, so right before we hit it, I'll just
- 30:22give it the request token that is
- 30:23required.
- 30:24>> Okay.
- 30:25>> So, going back to the redirect URL that
- 30:26was there earlier, let's just copy the
- 30:28request token as well.
- 30:30>> Okay.
- 30:31>> And I'll copy this bit.
- 30:34let codeex know that this is the request
- 30:36token.
- 30:37>> Okay.
- 30:42>> And let's hit enter.
- 30:45>> Okay.
- 30:46>> While Codex does whatever it's supposed
- 30:48to do, Ashai, uh what if I have a
- 30:50different algo in mind? What if the user
- 30:52has a different algo?
- 30:53>> Yeah.
- 30:54>> Uh it could be based on uh technical
- 30:57analysis, it could be based on
- 30:59>> uh I don't know standard deviations or
- 31:01whatever. So how can they go about
- 31:05building an algo uh using whatever setup
- 31:09you've shown us?
- 31:10>> Yeah. So the the beauty of Python and
- 31:13along with Codex is that uh almost all
- 31:16of the technical indicators this
- 31:18includes even candlestick patterns uh
- 31:20and the entire vastness of the technical
- 31:22indicators everything is available as
- 31:24modules in Python.
- 31:25>> Okay.
- 31:26>> Uh and Codex is smart enough to have
- 31:28known what your context is. So if you
- 31:31give it if your idea requires
- 31:34candlestick patterns,
- 31:36>> if your prompt involves candlestick
- 31:37patterns, it knows where which module to
- 31:40pull.
- 31:40>> Okay.
- 31:40>> So if the module isn't installed, it'll
- 31:42go ahead and install it.
- 31:43>> Okay.
- 31:44>> Uh but the entire vastness of technical
- 31:46analysis is possible using codeex and
- 31:48Python.
- 31:48>> Okay. Now for example, let's say I have
- 31:50a different algo in mind.
- 31:52>> Uh I want to download the historical
- 31:54data of um of Niftyund stocks. I want to
- 31:59calculate the returns of these stocks
- 32:02>> then based on the returns I want to plot
- 32:05the standard deviation
- 32:07>> and I want to identify the return which
- 32:10is at let's say the third or third
- 32:12standard deviation
- 32:14>> plus three standard deviation short
- 32:16those
- 32:17>> and go long on the minus three standard
- 32:19deviations something as quantitative as
- 32:22this can also be codified and an algo
- 32:25can be developed right
- 32:26>> yes it can very easily be developed In
- 32:28fact, all of this can be done in the
- 32:29same natural language that you're
- 32:31speaking
- 32:32>> if you were to prompt it in the same
- 32:33way. Codex would be able to build it
- 32:35completely uh end to end.
- 32:38>> So technically this uh I I I remember
- 32:41reading this tweet somewhere.
- 32:44>> The most powerful language today,
- 32:45programming language today is English.
- 32:48>> Yeah.
- 32:48>> Right. So as far as I can creatively
- 32:51express my algo
- 32:53>> in plain simple English natural language
- 32:56I should be able to develop any algo.
- 32:58>> Yes. In [clears throat] fact the more
- 33:00detailed you are in your uh in in our
- 33:02earlier prompt that we had
- 33:04>> uh not only did we tell it what to do we
- 33:06also gave it how the output should look.
- 33:08>> So the more detail you add to your
- 33:10prompt in what you want the algo to do
- 33:12uh the better it is.
- 33:13>> Okay. So so far from whatever I've seen
- 33:17uh I think the uh the difficult part I I
- 33:21wouldn't even call it difficult but uh
- 33:23for most common people
- 33:25>> uh including uh like someone like me who
- 33:28has zero tech idea
- 33:30>> I think the the confusing or the
- 33:32difficult part is to set up the initial
- 33:35infrastructure needed uh this is right
- 33:38from in installing codeex
- 33:40>> python uh NodeJS and on the the side
- 33:44setting up the entire kite
- 33:46>> uh you know kite connect ecosystem once
- 33:49the infrastructure is set
- 33:51>> I think the other things are fairly easy
- 33:53to do right the the defining of the algo
- 33:56itself is fairly easy
- 33:57>> yes so once your infra is set up the
- 34:00rest of use the usage of API is actually
- 34:02very easy
- 34:02>> the API the documentation is already
- 34:04available everything is built around the
- 34:06ease of usage
- 34:08>> okay
- 34:09>> yeah so as you can see here the the
- 34:12codeex has built the script here.
- 34:13>> Okay,
- 34:14>> I'll quickly just open the script.
- 34:16>> Wait, so are you telling me this is my
- 34:18algo?
- 34:19>> Yeah. So, this file here
- 34:21>> is now your algo.
- 34:23>> Okay.
- 34:23>> So, it's an SMA scanner.
- 34:27>> Yeah. So, this is how your algo looks.
- 34:29>> Okay.
- 34:30>> It's a lot of lines.
- 34:32>> This is uh super scary to me. Uh you're
- 34:35just showing me
- 34:37>> lines and lines of code that C codeex
- 34:40has beautifully written. I have I have
- 34:42zero technical idea to even verify
- 34:46whether this is correct or wrong
- 34:48>> but a to me
- 34:51>> while this is fancy this is not usable
- 34:54to me uh I can't I can't I'm not capable
- 34:57enough to figure out if these lines are
- 35:00correct code you know I can't do it so
- 35:04>> unless and until you put this in a nice
- 35:06UI
- 35:09>> this is I I can't use this. So, can we
- 35:12wrap up uh wrap around it a nice UI?
- 35:15>> Yeah. So, now that we have built this,
- 35:17we could build the same thing
- 35:20>> in a more useful.
- 35:22>> Why don't you close this? It is scaring
- 35:23me.
- 35:23>> Yes. So, I'll start by doing that.
- 35:26>> So, yeah, you don't have to see these
- 35:27scary lines of code. Uh let's wrap the
- 35:30entire algo in a nice good UI.
- 35:33>> Okay.
- 35:33>> Uh so, we'll break down the UI in three
- 35:35prompts and we'll slowly build the
- 35:37entire dashboard that we are going for.
- 35:39>> Okay. Uh so let's start with the first
- 35:42prompt. Okay.
- 35:42>> I already have the prompts uh
- 35:44pre-written.
- 35:45>> So I'll just paste them here.
- 35:49>> Yeah. So this is the prompt. Uh as you
- 35:51can see here in the prompt, there are a
- 35:53couple of tools that we did not install
- 35:56uh initially.
- 35:57>> Okay.
- 35:58>> Um which is react and beat.
- 36:00>> Uh in this case, Codex would recognize
- 36:02that these tools are not available
- 36:04>> and it would install it by itself.
- 36:06>> One second. So uh so your prompt says
- 36:10build a React plus wheat front end. So
- 36:14for non-programmers like me, how would I
- 36:16even know that you need something like
- 36:19React and Wheat to build a UI
- 36:22>> or now that you've said it, is it a good
- 36:25practice to always prompt saying that
- 36:28build a UI using React and Wheat? Oh
- 36:31>> yeah. So the reason why I've chosen
- 36:33react and wheat is the front end looks
- 36:35really beautiful when you use uh
- 36:37JavaScript.
- 36:38>> Okay.
- 36:38>> Uh if you hadn't prompted Codeex uh to
- 36:41build it in using React and it would
- 36:44probably use a module from Python and do
- 36:46the same as well.
- 36:47>> Okay.
- 36:47>> Uh just that the front end would not
- 36:48look as beautiful as it would with this.
- 36:51>> Okay. Can I generalize it this way that
- 36:53whenever I'm trying to build a UI,
- 36:56>> I need to use React and Wheat to make it
- 37:00look beautiful. Is it a fair
- 37:02generalization?
- 37:02>> That is a fair generalization to use
- 37:05React and V to make the front [snorts]
- 37:06end more beautiful
- 37:08>> and as we build this app you will
- 37:10realize how uh goodlooking the UI can
- 37:13be.
- 37:13>> Right. It better be good-looking.
- 37:14>> Yeah. [laughter]
- 37:16>> Okay.
- 37:16>> So yeah so the front end which is the UI
- 37:19bit is using React and we
- 37:22>> for the back end we are using Python
- 37:23itself. Uh particularly a module called
- 37:26fast API. Again, uh since fast API
- 37:28wasn't installed at the start, uh Codex
- 37:30will recognize the lack of this module
- 37:32and install it by itself.
- 37:33>> Yeah, by the way, for all the people
- 37:36watching this, all the prompts we've
- 37:39used, we will put it up in the
- 37:40description. So, it's it will be easily
- 37:42available for you all. So, don't get
- 37:45stressed uh you know about not seeing
- 37:47the prompt fully clearly at this point.
- 37:50You can always check on the description.
- 37:52Why don't you hit that enter button and
- 37:54let's see what happens. Uh sure Karthik
- 37:58>> a so typically how long does it take CEX
- 38:01to build a nice UI?
- 38:03>> Um so depending on your tasks it could
- 38:06take uh a simple prawn could take a
- 38:08couple of seconds.
- 38:09>> Okay.
- 38:09>> Uh but if you're trying to build
- 38:11something large and has multiple moving
- 38:13parts then it could take uh anywhere
- 38:15from a couple of minutes to probably 10
- 38:18plus minutes as well.
- 38:19while this does whatever it's doing
- 38:23to I just wanted to touch upon the cost.
- 38:26So firstly we spent 500 rupees for
- 38:30against 500 credits for kite connect. So
- 38:32that's on the
- 38:33>> uh API side of things.
- 38:35>> Yes.
- 38:36>> Uh are you using I should have asked
- 38:38this before but are you using a free
- 38:40version or a paid version of Codex here?
- 38:42>> So CEX is available both to the free
- 38:44users and the paid user.
- 38:46>> Okay. The version I'm using here is the
- 38:48paid version. Okay.
- 38:49>> Uh so this is uh a pro version that I'm
- 38:52using.
- 38:52>> Okay.
- 38:53>> Uh but in the free version also you
- 38:56could use uh since uh codeex functions
- 38:59on the basis of credits which basically
- 39:02get replenished every week.
- 39:04>> Okay.
- 39:04>> Uh so on the basis of your usage if
- 39:06you're using it for something very
- 39:08heavy. Okay.
- 39:08>> Uh like building a UI as well,
- 39:10>> it would take a certain amount of
- 39:12credits. So if you do run out of
- 39:14credits, you'll probably have to wait
- 39:15for a particular duration for the
- 39:16credits to get replenished.
- 39:18>> Okay. So basically uh it makes sense to
- 39:21have a pro version of whichever LLM
- 39:23you're using, right?
- 39:24>> Yeah. In if your use case is going to be
- 39:27to build an algo and continuously
- 39:29develop on it.
- 39:31>> My suggestion is to have a paid version.
- 39:33>> Okay.
- 39:33>> As it helps in that.
- 39:35>> Okay. So also while we are doing this
- 39:37using codeex I think uh people can use
- 39:41any LLM be it anthropic be it
- 39:44>> gemini or uh whatever else right so it's
- 39:47not it's it is basically LLM agnostic
- 39:50>> yeah this is completely LLM agnostic you
- 39:52could use cloud work as well cloud code
- 39:54as well
- 39:55>> uh or any other LLM that you that you
- 39:58prefer to build the same
- 40:00>> okay but regardless of which LLM you use
- 40:03the framework is going to be the same.
- 40:05So you first install
- 40:07>> the prerequisites on one side and then
- 40:09do whatever is needed on the kite
- 40:12connect side and then start prompting it
- 40:14uh by by using natural language.
- 40:17>> Yeah, that is
- 40:18>> okay.
- 40:18>> Yeah, Karthik. So I think Codex has
- 40:20finished uh building our uh UI.
- 40:23>> Okay.
- 40:23>> So let's quickly launch it and see. So
- 40:26it says the app is running locally now
- 40:28at front end here.
- 40:29>> So I'll just copy this link and go to my
- 40:32browser and paste it. Okay.
- 40:37>> So, yeah, as you can see, it has built a
- 40:40login page with the API key, API secret,
- 40:43and request token here.
- 40:44>> Okay.
- 40:45>> Let's quickly fill those forms in and
- 40:47see how what happens post the login.
- 40:49>> Okay.
- 40:50>> Um, so I'll just go back to my
- 40:52credentials that I had saved.
- 40:58>> Yeah. So, I filled the API key and the
- 40:59API secret.
- 41:00>> Okay. Uh the request token has a shelf
- 41:03life of a couple of minutes.
- 41:05>> Okay.
- 41:05>> Uh so you have to use it in that time
- 41:07frame. So since we had our request token
- 41:10called a long while back,
- 41:12>> we'll call it again.
- 41:13>> Okay.
- 41:14>> So I'll just log in again.
- 41:19>> So you're logging into the developer
- 41:21account.
- 41:22>> Yes, I'm logging into my application uh
- 41:24which has my API key here.
- 41:26>> Yeah, basically your application is in
- 41:27the developer account here.
- 41:31So I'll just log in.
- 41:38Yeah. So it's again redirected us back
- 41:40to google.com.
- 41:42>> Uh but the request token is here. So
- 41:44I'll just copy the request token. So
- 41:46everything between the request token and
- 41:48>> the and here.
- 41:49>> Yeah, I remember that.
- 41:51>> Copy that.
- 41:52>> Okay.
- 41:53>> Um go back to our dashboard that is here
- 41:56and paste it here. Now let's see what
- 41:59happens when you click login.
- 42:02So as you can see [clears throat]
- 42:04uh we have logged in uh it has it in the
- 42:08prompt here that we had shared earlier.
- 42:10>> Okay.
- 42:11>> We had asked it to create a dashboard
- 42:13which wherein after login
- 42:16>> it creates a user tab for us
- 42:18>> and then it calls the API for our user
- 42:20profile.
- 42:20>> Okay. So it calls the username, user ID,
- 42:24the products that are there and the
- 42:25exchanges that are available for this
- 42:27account.
- 42:28>> So since this is my account, uh the
- 42:30details that it's showing here are my
- 42:32username, my user ID,
- 42:34>> the products that I have available and
- 42:36also the exchanges that I have available
- 42:38for me to trade on.
- 42:39>> Okay. But show me the signals, the
- 42:41bullish and the bearish signals. That's
- 42:43what we are working towards, right?
- 42:45>> Yes. Yes. So we'll reach there. So this
- 42:46was the first prom that has built this
- 42:48>> and now we know that the APIs are
- 42:50running. Yeah. So now let's go ahead and
- 42:52add a signals tab which will show us the
- 42:54signals that I've generated for your
- 42:57trading idea that you came up with.
- 42:58>> Okay.
- 42:59>> So I already have a prompt ready for it.
- 43:02I'll just share that with Codex and it
- 43:04should be able to build it.
- 43:09>> Okay. Uh can we go through this once?
- 43:11>> Yes. add a signals tab to the existing
- 43:14zeroda dashboard which basically is what
- 43:16you've built just now using codeex
- 43:19[clears throat]
- 43:19>> and um and basically the other bits is
- 43:24uh is to do the math right
- 43:26>> yeah is to do the math so the first part
- 43:28is to fetch the symbols that is the 100
- 43:31symbols
- 43:32>> uh then to get the historical candles
- 43:35for it
- 43:36>> then calculate the SMA 6 and the SMA 30
- 43:39>> uh the next part is it detects the
- 43:41bullish and bearish crossovers and then
- 43:43it ranks the stocks.
- 43:44>> This was done earlier for the Python
- 43:46file.
- 43:46>> Python. Yeah,
- 43:47>> a very similar prompt for this UI.
- 43:49>> Just that we are now mentioning that the
- 43:51UI it has to be built for a UI and not
- 43:53for a Python file.
- 43:54>> Okay. Okay.
- 43:55>> So now I'll just run this prompt as
- 43:56well.
- 44:10Uh so yeah, it looks like Codex has
- 44:13finished working through this prompt as
- 44:14well.
- 44:15>> Okay,
- 44:15>> let's check the signals it's generated.
- 44:17Let's go back to the UI. Um it's added a
- 44:21signals tab here to the side. Let's go
- 44:23there.
- 44:24>> So yeah, it has built a short SMA, long
- 44:27SMA, loop back, and also max is 100.
- 44:30Okay.
- 44:31>> So, let's just see what happens when I
- 44:32click the button here.
- 44:35>> So, yeah, Karthik, you can see it has
- 44:37generated signals here.
- 44:38>> Okay.
- 44:39>> It has ranked it by the crossover date
- 44:41as well.
- 44:42>> Okay.
- 44:42>> So, this is the most recent date
- 44:45>> uh to the last date that is available.
- 44:47So, it's ranked it by the recency as
- 44:50well.
- 44:50>> Okay. A So, the algo has generated a
- 44:55bunch of signals.
- 44:57Can we physically verify the validity of
- 45:00any of the signals? Maybe we can pick
- 45:02Asian paints.
- 45:04>> Uh it's supposed to be a bearish signal
- 45:06as of today, 30th of uh June.
- 45:10>> Can we check it on the kite chart?
- 45:12>> Yeah. So, let's just navigate to our
- 45:14kite portal.
- 45:15>> Okay.
- 45:16>> Uh I'll just
- 45:19go to Asian PES.
- 45:22So, this is Asian PES on a daily time
- 45:24frame.
- 45:25>> Okay. I'll just add a moving average
- 45:27crossover indicator.
- 45:30So, I'll go for a moving average double.
- 45:32>> Okay.
- 45:33>> And then let's change the
- 45:36>> the settings
- 45:37>> settings. Yes.
- 45:41I'll make this a six
- 45:44and 30.
- 45:45>> Okay.
- 45:49>> Yes. So, as you can see there is a
- 45:51crossover.
- 45:52>> It has Yeah, it has got a crossover. So
- 45:55basically all we have to do is now that
- 45:57we've built the algo and put a nice UI
- 46:00around it,
- 46:02>> I just have to run this on a daily basis
- 46:04and it's going to scan
- 46:06>> and tell me where the signals are
- 46:09>> generated. Yeah,
- 46:10>> and this is exactly what you mean by
- 46:12semi-automated because based on the
- 46:14signal here,
- 46:16>> I still have to go back to Kite or
- 46:18whatever my whoever my broker is and
- 46:21place an order to buy or sell, right?
- 46:24>> So, if the [clears throat] algo was
- 46:27automatically placing the order bases
- 46:30the signal, that would have been a
- 46:31full-fledged uh fully automated algo.
- 46:34>> Yeah.
- 46:35>> Right. So, uh so actually this is uh
- 46:38super interesting.
- 46:39Um
- 46:41what else should I know at this point?
- 46:43>> This session we have built a signal
- 46:45which is an SMA crossover.
- 46:46>> Okay,
- 46:46>> you could apply this to any of your
- 46:49particular trading uh idea. So you could
- 46:52>> you could also try volume breakouts,
- 46:54range breakouts.
- 46:55>> Okay,
- 46:55>> any idea you basically have you could do
- 46:57it across uh not just on a daily time
- 47:00frame,
- 47:01>> you could also scan it across intraday
- 47:03time frames as well.
- 47:04>> Okay,
- 47:04>> so there you get the signals uh coming
- 47:06in while the market is open. Okay.
- 47:09>> So for traders who are intraday traders
- 47:11could also benefit from using APIs as
- 47:13well.
- 47:14>> Okay. Uh and I'm guessing it doesn't
- 47:15matter what the underlying asset is it I
- 47:19can pretty much use the same thing
- 47:20across commodities as well.
- 47:22>> Yes. So like [clears throat] I had
- 47:23showed initially in my user tab if
- 47:26commodities is enabled for you.
- 47:27>> Okay.
- 47:28>> Uh you could do this across commodities
- 47:29as well. You could do this across BC as
- 47:32well. So you have your NSE BC MCX.
- 47:35>> Yeah.
- 47:35>> A this was very interesting.
- 47:38Now let me quickly summarize. I know
- 47:40I've done it several times throughout
- 47:41the video but um but I would like that
- 47:44uh summary at every uh logical uh you
- 47:48know points. So basically I've used
- 47:52codeex it could be any LLM that I can
- 47:54use
- 47:55>> and the as a first step or as a part a I
- 48:00I set up the infrastructure needed to
- 48:03build my algo
- 48:05>> uh which was to install Python which was
- 48:08to install NodeJS
- 48:10and then as part B I connected uh I set
- 48:13up my kite connect API
- 48:15>> ensured both of them are linked uh and
- 48:18then started uh coding my algo using
- 48:22codeex uh through a prompt.
- 48:25>> Yeah.
- 48:25>> Uh but of course the the scary Python
- 48:28lines I didn't want to deal with. So I
- 48:30asked uh Codex to build a beautiful uh
- 48:35UI right and you said you promised me it
- 48:39would build a nice
- 48:40>> beautiful UI which it has. Uh I can I
- 48:43can beautify this further. I think it
- 48:45all depends on the user's creativity,
- 48:48right? And now that this algo is done,
- 48:51all I have to do is run this algo on a
- 48:53daily basis and my uh and I'll get my
- 48:56signals to uh track, right?
- 48:59>> Yeah. And and pretty much any trading
- 49:02idea that you have can be
- 49:04>> developed as an algo using natural
- 49:07language, right?
- 49:08>> Yeah.
- 49:09>> Yeah. And I think I [clears throat] find
- 49:10this idea super powerful because if
- 49:13because it enables non-programmers like
- 49:16me to actually aspire to build algos.
- 49:20>> Yeah.
- 49:20>> Yeah. So any closing thoughts?
- 49:23>> No, I mean uh it all it took was a
- 49:26natural language prompt to build
- 49:27something so unique.
- 49:29>> Yeah.
- 49:29>> And in particular to your trading style.
- 49:32>> Yeah.
- 49:33>> Yeah. It's I mean we have come a long
- 49:34way from the AGO journey
- 49:36>> from from having to have done all that
- 49:39manually by yourself.
- 49:40>> Yeah.
- 49:41>> Going through the whole entire not only
- 49:43did you have to be a trader earlier, you
- 49:44had to be a programmer as well.
- 49:46>> Yeah.
- 49:46>> Now you just need to have the idea
- 49:48>> and orchestrate the entire algo using
- 49:51codeex. So
- 49:53>> yeah, absolutely. This is fantastic. I
- 49:55hope you found this video useful. Uh for
- 49:58me personally, there was a lot of
- 49:59learning. I hope you guys also uh
- 50:02learned something new through this
- 50:04video. Uh if you want us to make more
- 50:07videos on ALGO, please do let us know
- 50:10comment and we will read your comments
- 50:13and take your feedback into
- 50:14consideration. Also, we are doing
- 50:17physical events on uh helping people
- 50:19understand how to develop ALGOS. uh
- 50:22please do keep a track of all the
- 50:25physical events uh that we are posting
- 50:26on our social media and if it's
- 50:29happening in your city please do
- 50:30register and attend these events. Uh
- 50:33hopefully we get to see you offline. By
- 50:36the way, we also have a Hindi and a
- 50:37Canada varsity channel. Please do
- 50:40subscribe uh and check out those
- 50:42channels if you prefer learning in your
- 50:44regional language. I'll see you guys in
- 50:47the next video.
About this transcript
This page contains the full transcript of Build a Trading Algo with AI | No Coding Required by Zerodha Varsity, generated from the public captions YouTube serves with the video. The transcript has 9,115 words across 1,464 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.