YouTube2Text

Build your own AI for algo-trading with Python — Transcript

by Algo-trading with Saleh · 2,344 words · 313 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Hey guys, so in this video I'm going to
  2. 0:02show you how to create your very own AI
  3. 0:04quant to help you write algo trading
  4. 0:06strategies with Python. With this setup,
  5. 0:08you'll be able to use whichever LLM
  6. 0:10model that you like, whether it be
  7. 0:12locally, such as the ones Olama provides
  8. 0:15for us, or the ones that are
  9. 0:16cloud-based, such as OpenAI or Cloud
  10. 0:19Sonet. Now, by the end of this video,
  11. 0:20you're going to have a setup that can
  12. 0:21help you write strategies, debug them,
  13. 0:24or even improve the results of it. So,
  14. 0:26it's going to be really cool. So, let's
  15. 0:27get right into it. In case you didn't
  16. 0:28know, recently I released the second
  17. 0:30generation of our own Jesse GPT. With
  18. 0:33the new model, you can use whichever
  19. 0:34model that you like, such as the Gro 3,
  20. 0:37GPT 4.1 or 3 Mini, or even the Deep Seek
  21. 0:41Chat or Cloud Sonnet 3.7. Now, if you
  22. 0:43want to use this one, simply sign up and
  23. 0:45you'll be able to use it. It has both a
  24. 0:47free and a premium plan. Now, of course,
  25. 0:49for more expensive models, you're going
  26. 0:50to need a premium plan. But here's the
  27. 0:52thing. Let's say you don't want to use
  28. 0:53this because of a privacy concern or
  29. 0:55maybe you don't like our pricing and you
  30. 0:57think it's too expensive. Well, that's
  31. 0:59when this new setup that I'm about to
  32. 1:00show you is going to be really helpful
  33. 1:02for you. We can do this setup in a
  34. 1:04couple of ways. You're going to need a
  35. 1:05software or whichever kind of
  36. 1:07application that allows you to use local
  37. 1:09models or to use the API keys of third
  38. 1:12party cloud providers. Now, the one that
  39. 1:14I use is called Jan.ai, which is pretty
  40. 1:16cool. It is open source and completely
  41. 1:18free and they provide installations for
  42. 1:21all the three major operating systems.
  43. 1:23Simply go to the download page and get
  44. 1:24the one right for your operating system.
  45. 1:26The setup is really easy, so I'm not
  46. 1:27going to walk you through it. Now,
  47. 1:28another really cool project that I found
  48. 1:30is called Open Web UI. It is completely
  49. 1:32open source and it allows you to do just
  50. 1:34the same thing, but I found the setup
  51. 1:36for this one not to be as easy as
  52. 1:38Jan.ai. So, I still suggest to go with
  53. 1:40that one. Now, once you install Jan.ai,
  54. 1:42I you're going to see a page like this
  55. 1:43which allows you to look for the model
  56. 1:45that you want to download. So let's say
  57. 1:47I want to get the llama tree model for
  58. 1:50example, right? I can simply look for it
  59. 1:52here and click the download button and
  60. 1:54it will be ready for me to use. It will
  61. 1:56even guide me to know which models I can
  62. 1:58run and which ones I can't. But the
  63. 2:00thing is you're not going to get the
  64. 2:01same kind of quality with local models
  65. 2:03that you're going to get with the edge
  66. 2:05cloud models such as gro or cloud set.
  67. 2:08So what we're going to do is to use the
  68. 2:10API key of these services. Now to
  69. 2:12generate an API key, you can use
  70. 2:14platforms such as Antropic or OpenAI
  71. 2:16directly. However, if you do that way,
  72. 2:19you're going to be limited only to the
  73. 2:20models that they offer you. But if you
  74. 2:22use another platform such as Open
  75. 2:23Router, you'll get access to all sorts
  76. 2:25of models. And the thing is, we have a
  77. 2:27new model like every week these days. So
  78. 2:29I think the best option is to actually
  79. 2:31go with this solution. So I'm going to
  80. 2:32show you how to do it with open router.
  81. 2:34Now I already have an account here. If
  82. 2:36you don't simply sign up, it doesn't
  83. 2:38even require anything. And one really
  84. 2:40cool thing about open router is that it
  85. 2:42actually allows you to charge your
  86. 2:44account using cryptocurrencies. Now, to
  87. 2:45me, that's really great because I won't
  88. 2:47have to give them my credit card
  89. 2:49information. All right. So, assuming you
  90. 2:50already have charge your account from
  91. 2:52the credits page. To create an API key,
  92. 2:54simply go to the keys page. And here you
  93. 2:56can see I've already created two API
  94. 2:58keys. And to create a new API key,
  95. 3:00simply click on this button. Give it a
  96. 3:02name. It could be anything you want. I'm
  97. 3:03going to name it YouTube test.
  98. 3:06And we can even specify a limit for it.
  99. 3:09Now I'm going to give it $1. Click on
  100. 3:11the create. And here's the API key that
  101. 3:14it has given me. Copy it. And now go to
  102. 3:16the Jan AI. Go to the settings page. And
  103. 3:19here you can see we have all sorts of
  104. 3:21options. Now I'm going to find the open
  105. 3:23router. And here I can paste my API key.
  106. 3:27Once you do that, you can simply add
  107. 3:29model. Click here. Go back to the open
  108. 3:31router to the models page. And here look
  109. 3:34up the model that you want. Now, as it
  110. 3:36happens, last night OpenAI released
  111. 3:38offer mini model. So, let's click on
  112. 3:40this one and copy the unique ID of that
  113. 3:44model. Go back to the NAI and paste it
  114. 3:47here. Click on add. And now, if I scroll
  115. 3:49down, I should be able to find it. So,
  116. 3:51now I should be able to find the key of
  117. 3:53the model that I just added. But here's
  118. 3:55the thing. I already have some credits
  119. 3:56left on my Antropic account. So, I'm
  120. 3:58going to use this one. Now, to start a
  121. 4:00new chat, go to the thread section.
  122. 4:03Click on the new button if you don't
  123. 4:05already have one. And here we can see
  124. 4:07the instruction section is empty. Now we
  125. 4:09can start chatting with it. So for
  126. 4:11example, I can ask it to write a golden
  127. 4:13cross strategy for me. Now if I press
  128. 4:15enter, you can see it immediately begins
  129. 4:18writing the code for me. But first it is
  130. 4:20explaining what a golden cross strategy
  131. 4:22is. What are the entry or the exit
  132. 4:24rules? And the code that it is giving
  133. 4:26me, it is already in Python. But this
  134. 4:28isn't really practical. I'm not going to
  135. 4:30be able to run a back test on this. And
  136. 4:33even if I do, it definitely won't be
  137. 4:35accurate. And even if it was accurate, I
  138. 4:37wouldn't have been able to run it live
  139. 4:39and actually make some money with it.
  140. 4:40Right now, what we need is a setup that
  141. 4:42can write the code using the Jesse
  142. 4:44framework syntax. Then we'll be able to
  143. 4:46run back tests, import data, optimize
  144. 4:49it, and even run it to live. Now, to do
  145. 4:51that, I'm going to use the exact
  146. 4:52instructions that I used to build a
  147. 4:54Jesse GPT on our website. Now again if
  148. 4:57you don't want to go through with the
  149. 4:58setup just sign up and use it as it is.
  150. 5:01You can even get it started for free.
  151. 5:03But again we need the instructions. Now
  152. 5:05where can we find it? Well I open
  153. 5:07sourced it on GitHub. So you can find
  154. 5:09the repository under our organization
  155. 5:12and it is called GPT instructions. You
  156. 5:15can also use this URL which I'm going to
  157. 5:16put down in the description section of
  158. 5:18the video. All right. So here's the
  159. 5:19readme file. But what I'm interested in
  160. 5:22is this instructions.mmd file. So click
  161. 5:24on it. Then click on the row so that we
  162. 5:27can copy and paste
  163. 5:29everything. Now by the way notice that
  164. 5:31this is a giant file. It has all sorts
  165. 5:34of strategy examples. It has a summary
  166. 5:37of the whole documentation of Jessie
  167. 5:38framework. So that's why it's really
  168. 5:41long which is also another reason why
  169. 5:43it's best to use a cloud version because
  170. 5:45if you try to use a local model with
  171. 5:48this much instruction at least the
  172. 5:50initial request is going to be really
  173. 5:52slow. So select all of it, copy it, and
  174. 5:55go back to jan.AI and paste it here. So
  175. 5:58now the instructions is not empty
  176. 6:00anymore. Now let's say I want to see the
  177. 6:03result of it for this exact request that
  178. 6:06I made here. Write me a golden cross
  179. 6:07strategy. So I can just go down and
  180. 6:09click on the retry button
  181. 6:11here. Now notice the strategy that it is
  182. 6:14writing for me this time has the exact
  183. 6:16syntax of the JC framework. It is
  184. 6:19Python. It's also much cleaner. So,
  185. 6:22here's a fast moving average, a slow
  186. 6:24one. Here are the inter rules of the
  187. 6:27strategy. Here's the position
  188. 6:30sizing.
  189. 6:32And here's when to liquidate the
  190. 6:34position. It also gave me a very short
  191. 6:36description of the strategy, but not too
  192. 6:38much. So, and that is the result of this
  193. 6:40instruction. I asked it to give me the
  194. 6:42code, nothing more, nothing less. Now,
  195. 6:44let's say this is good, but I wanted to
  196. 6:46add, let's say, the ADX indicator
  197. 6:48because I want to filter some bad trades
  198. 6:50because the thing with the trading
  199. 6:51strategy is that it tends to take too
  200. 6:53many trades and the trading fees usually
  201. 6:55eat our profits. So, I'm going to ask it
  202. 6:57to do that. If I press
  203. 6:59enter, all right, so it gave me the
  204. 7:02exact strategy, but this time it is also
  205. 7:05using the ADX. And inside my entry rule
  206. 7:09of the strategy, I can say it is
  207. 7:10checking to see if the trend is strong
  208. 7:13enough by saying whether or not the
  209. 7:15current ADX value is above the number
  210. 7:1725. Now, of course, I could also ask it
  211. 7:19to modify that number if I need to or
  212. 7:21even to prepare the strategy using the
  213. 7:24syntax for optimization so that we can
  214. 7:27find this number dynamically which would
  215. 7:29save us a lot of time. Now if you want
  216. 7:31to know what other types of things you
  217. 7:33can do with it, a good example is to
  218. 7:35look at the Jesse GPT page on our
  219. 7:37website here. The first one is asking it
  220. 7:39to write a golden cross strategy. The
  221. 7:41second one says prepare my strategy for
  222. 7:44optimization because I find the task of
  223. 7:47replacing some of the parameters of the
  224. 7:49strategy with the syntax that is
  225. 7:51required for Jessie sometimes to be a
  226. 7:53tedious task. But when I ask the AI to
  227. 7:55do it, it's really easy for it and it
  228. 7:57does it immediately. Even the smallest
  229. 7:59and cheapest model can take care of this
  230. 8:01type of task very good. I can also ask
  231. 8:03it to prepare my strategy for live
  232. 8:05trading because I want to make sure that
  233. 8:08the monitoring stuff are in place. I can
  234. 8:10also ask it to suggest other indicators
  235. 8:12to improve my already existing
  236. 8:14strategies. You get the idea. Just check
  237. 8:15out this page and you'll see all the
  238. 8:17tips and the latest stuff that I come up
  239. 8:19with. And if you can come up with some
  240. 8:21stuff that I haven't, let me know and
  241. 8:23maybe I add it to this page. But that's
  242. 8:25not all. Because all the instructions
  243. 8:27are here, you can easily customize it
  244. 8:29however you like. So let's say there's a
  245. 8:31syntax here that you don't like. It
  246. 8:33works for me, but for whatever reason,
  247. 8:35you want to improve it. Go nuts. Just
  248. 8:37maybe copy this whole file inside your
  249. 8:39editor of choice, such as VS Code, and
  250. 8:41add a section to it or modify an
  251. 8:44existing one. In fact, if it was really
  252. 8:45good, maybe submit a pull request to our
  253. 8:47repository, and I'll merge it so that
  254. 8:49the others can use it and take benefit
  255. 8:51from it. Another really cool thing that
  256. 8:52you can use this setup for is to convert
  257. 8:54the existing strategies on trading view
  258. 8:57which uses this syntax called pine
  259. 8:59script into python so you can back test
  260. 9:01it with Jesse. Now to do that we can
  261. 9:04simply look for now you can find them on
  262. 9:05the trading view website but another way
  263. 9:07is to simply search for it. So I'm going
  264. 9:10to say EMA
  265. 9:13strategy and there are so many of them
  266. 9:15but this one for example is using MACD
  267. 9:18and EMA. So let's click on it.
  268. 9:25Now you can see the result of the back
  269. 9:27test of trading view which by the way is
  270. 9:29not accurate. So never count on this.
  271. 9:32Trading view is great for charting but
  272. 9:34it is not for back testing. For back
  273. 9:36testing you want to use something
  274. 9:37accurate such as Jesse. But anyways if
  275. 9:40the strategy is profitable enough we can
  276. 9:43use this code. Just simply go here to
  277. 9:46source code and here it is. Now I can
  278. 9:49copy the entire thing. I can go back to
  279. 9:52Janai and create a new thread. And
  280. 9:54notice that the instructions are still
  281. 9:56here. But if they weren't, make sure to
  282. 9:58copy and paste them again. And I can
  283. 10:01simply ask it convert this
  284. 10:06strategy into Python code and then paste
  285. 10:10the whole thing. And now it's giving me
  286. 10:12the Python code. I can copy this whole
  287. 10:15thing, go to the JC framework and back
  288. 10:17test it with Python, which allows me to
  289. 10:19see the actual result of the strategy,
  290. 10:21not the fake ones on threading view.
  291. 10:23Now, by the way, they aren't really
  292. 10:24fake. It's just that it isn't accurate
  293. 10:26enough, especially in most cases, it has
  294. 10:29the issue of the look ahead bias, which
  295. 10:31in Jesse doesn't exist. All right, the
  296. 10:33possibilities are endless here. You can
  297. 10:35use everything locally on the cloud or
  298. 10:37use just GPT on our website. It doesn't
  299. 10:39really matter. I open sourced this setup
  300. 10:42because my goal for creating Jesse GPT
  301. 10:44was not to make money on top of it. I
  302. 10:46just wanted you guys to be able to do
  303. 10:47research faster and use Jesse more
  304. 10:50frequently. Especially for those who
  305. 10:52aren't even great with Python, this
  306. 10:54enables them to start a good trading
  307. 10:57today rather than months later. So, I
  308. 10:59hope you enjoyed this video. Thanks for
  309. 11:00watching and I'll see you in the next
  310. 11:02one.
  311. 11:07[Music]
  312. 11:08[Applause]
  313. 11:11[Music]

About this transcript

This page contains the full transcript of Build your own AI for algo-trading with Python by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 2,344 words across 313 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.