YouTube2Text

Coding a HyperLiquid DEX Arbitrage Bot with Claude AI — Transcript

by ATJ Research · 33,131 words · 5,339 segments · language en · Watch on YouTube

Full transcript

  1. 0:06Hello everyone. So yeah, nice to be back
  2. 0:09and uh I hope everybody had a great
  3. 0:11weekend. So today we're going to code an
  4. 0:16arbitrage bot between Hyperlquid and
  5. 0:20MT5.
  6. 0:22So please give us or give me like a few
  7. 0:25more minutes. So the live stream will
  8. 0:27start at 1300. So, we still have uh like
  9. 0:31two or 3 minutes before the official
  10. 0:34start of the live stream. And in the
  11. 0:37meantime, I will just prepare a few
  12. 0:38things so we can have a smooth start.
  13. 0:56So I hope that everybody's doing well
  14. 0:58and I see that you know some of you are
  15. 0:59already on the live stream. So thank you
  16. 1:01for coming early and yeah today's um
  17. 1:06very exciting topic because finally um I
  18. 1:10can show you like the strategy that I'm
  19. 1:13trading on a day-to-day basis. So right
  20. 1:17now like this is my specialty and uh
  21. 1:21yeah excited to show you you know some
  22. 1:26good training strategies. Hey bro, nice
  23. 1:29to see you. This one build will be nice
  24. 1:30to see. Yes. So I'm also very excited.
  25. 1:35All right so we have one minute to go
  26. 1:37and then I guess we can uh officially
  27. 1:40start.
  28. 1:42And so guys, uh before I forget, um so
  29. 1:46I've also added a project description
  30. 1:49for all of you here. So if you come late
  31. 1:51to the live stream or you just want to
  32. 1:53review what we're trying to build or
  33. 1:56review,
  34. 1:57uh I'm going to add this link here. And
  35. 2:01in this link, you will find exactly the
  36. 2:04goal of our project. And you can also
  37. 2:06find it in the description uh below.
  38. 2:22This will be the same strategy you use
  39. 2:24in your gold strategy. Yes, it is quite
  40. 2:26similar. So, uh, when I showed you the
  41. 2:28gold strategy, we were trading, uh, GC
  42. 2:32futures on Interactive Brokers and we
  43. 2:34were hedging that with XUSD MT5. And,
  44. 2:38uh, so in today's video, we're going to
  45. 2:41do the same concept. So, for example,
  46. 2:44let me show you an example here. It
  47. 2:45doesn't have to be gold, but it can be
  48. 2:49uh, it can be gold, right? So, here, if
  49. 2:51we go to hyperlquid, and now it's like
  50. 2:541300. So I can like do an official start
  51. 2:58for everybody. Uh so just to answer that
  52. 3:01question on hyperlquid you can trade
  53. 3:03perpetual futures on real world assets
  54. 3:07which means that you can speculate on
  55. 3:09the price of u you know real world uh
  56. 3:13commodities for example such as gold.
  57. 3:15And so here what you see is you have
  58. 3:18gold USDC. So this uh crypto you know
  59. 3:23asset
  60. 3:25is basically mirroring the price of gold
  61. 3:28and so you can speculate on the price
  62. 3:30here and what you'll find is that uh
  63. 3:32there will be some pricing discrepancies
  64. 3:35between hyperlquid and the real price of
  65. 3:38gold and that's what we're going to you
  66. 3:40know try to capitalize on and create an
  67. 3:42arbitrage trigger uh strategy and so the
  68. 3:48concept that I'm going to show doesn't
  69. 3:49only apply to gold but it will be
  70. 3:51applied on anything that is tradable
  71. 3:55right so if we look at the different you
  72. 3:58know assets on hyperlquid so
  73. 4:02the amount of assets you can trade
  74. 4:04hyperlit is humongous right so you have
  75. 4:07perpetual futures offered directly by
  76. 4:08hyperlquid and then you also have this
  77. 4:11hip 3 protocols where you know you have
  78. 4:14like various deployers who can deploy
  79. 4:16their own exchange or like their own
  80. 4:18assets and they're built on top of the
  81. 4:21hyperlquid technology, right? So you can
  82. 4:24have like silver, WTI, SP, brand oil,
  83. 4:27XYZ gold and all of these assets in
  84. 4:30theory can be arbitrageed. And so what I
  85. 4:35mean by humongous like offering is that
  86. 4:37this is like the XYZ deployer and on
  87. 4:40Hyperlid we have multiple deployers who
  88. 4:42can deploy the same asset. So for
  89. 4:43example, gold on hyperlquid can mean a
  90. 4:46lot of things. Gold can mean like gold
  91. 4:48USDC offered by the deployer XYZ. It can
  92. 4:52also mean it's gold offered by FLX,
  93. 4:57right? It can also mean that we're
  94. 4:59trading
  95. 5:01um
  96. 5:03not this one. Some of them don't offer
  97. 5:04it, right? But uh some of them do. I
  98. 5:07think we have gold by the deployer
  99. 5:10cache, right? So we have a lot a lot of
  100. 5:12deployers and we also have like um Paxg,
  101. 5:16right? So PEXG is like a crypto token
  102. 5:18that uh
  103. 5:21uh you know it's basically sort of like
  104. 5:23a stable coin or like a stable gold
  105. 5:25right. So uh Paxg can be considered like
  106. 5:28something similar. So you can also like
  107. 5:30trade Paxg. So all of these things uh
  108. 5:33we're going to have a look at. And so
  109. 5:35what I'm going to show you on the live
  110. 5:36stream today is like not how to create a
  111. 5:39specific arbitrage strategy for this
  112. 5:41symbol and this symbol. We're going to
  113. 5:43create a framework that where we can
  114. 5:45apply many many strategies where we try
  115. 5:48to you know find the uh pricing
  116. 5:52discrepancies between assets and then
  117. 5:54write a script that will hedge all those
  118. 5:56things. So yeah so um officially we can
  119. 6:00start now. So I actually you know took a
  120. 6:02lot of time to answer that question but
  121. 6:04so again let me just officially inform
  122. 6:06everybody who just arrived to the
  123. 6:07stream. Thank you for coming and uh so
  124. 6:11in the descriptions or in the comments I
  125. 6:13added an article what we're going to
  126. 6:15build and let me go through that article
  127. 6:18so you guys uh will understand what I
  128. 6:20mean by that and like I explained it in
  129. 6:22the you know uh a few minutes ago but
  130. 6:26let me show it on this article.
  131. 6:29So in this project I will attempt to
  132. 6:30code a dex arbitrage bot on hyperlquid
  133. 6:33which is this platform here. And so the
  134. 6:36goal is to identify arbitrage
  135. 6:37opportunities and to create a train bot
  136. 6:39that capitalize on such opportunities.
  137. 6:42I'm going to look at price discrepancies
  138. 6:44on hyperlquid and hedge the price
  139. 6:46difference with the underlying CFD
  140. 6:48assets, thus making money on the spread.
  141. 6:51And so on this chart here, what you'll
  142. 6:53find is the historical price data on the
  143. 6:57S&P 500 index. And what I've done here
  144. 7:00is I've exported the historical data
  145. 7:02from Hyperlquid and Metatrader 5. So
  146. 7:06these are one minute snapshots. Uh I
  147. 7:08assume these are one minute snapshots.
  148. 7:10And you see that uh the hyperlquid price
  149. 7:13MT5 price look sort of the same, right?
  150. 7:17But the important note here is sort of
  151. 7:21it's not the same. So we see that for
  152. 7:24example right now MT5 price is above the
  153. 7:27hyperlquid price which means that if we
  154. 7:30take the difference between the two
  155. 7:31curves we will calculate the spread
  156. 7:34between these two assets and so
  157. 7:39the spread is basically just a price
  158. 7:41difference and so what we can do for
  159. 7:43example is when the price difference is
  160. 7:45low let's say like here in this example
  161. 7:48the difference between hyperlquid and
  162. 7:50MT5 on S&P 500 was -6 $6, right? So, we
  163. 7:54could in theory buy at -6, which means
  164. 7:57buying hyperlquid, selling MT5 at the
  165. 7:59same time, and then, for example, try to
  166. 8:01exit at -3 or minus 2. And so, we would
  167. 8:06make money on the spread here. And so,
  168. 8:08this is the main goal of the strategy.
  169. 8:12And we have one question. Taking margin
  170. 8:14into account, what do you think would be
  171. 8:15the minimum for something like this? Um
  172. 8:18so the great uh news for uh this type of
  173. 8:22strategy is that compared to futures
  174. 8:24where you have like a minimum contract
  175. 8:26size right in futures for example one
  176. 8:27MGC contract is 10 units of gold which
  177. 8:30is quite a lot uh on hyperlquid
  178. 8:34uh there is no minimum contract size so
  179. 8:36you can trade like any small amount that
  180. 8:38you want like the minimum like size you
  181. 8:40can open is $10 right and uh on MT5 for
  182. 8:44example if you look at gold for example
  183. 8:46today I'm going to show you an example
  184. 8:48uh with the broker Capital Point
  185. 8:50Trading. Uh it's basically IC Markets
  186. 8:52Offshore. So the minimum contract size
  187. 8:55on MT5 is 0.01 which is one unit of
  188. 8:59gold. So right now uh I've tried to
  189. 9:03teach uh like one of my fan members this
  190. 9:05strategy and uh so it's my brother and
  191. 9:09he start basically start with $500 and
  192. 9:12$500. So, I would say a minimum amount
  193. 9:14you can start with in theory is let's
  194. 9:16say $1,000 US to trade his strategy. And
  195. 9:19like he's been doing like quite good
  196. 9:21returns. Um,
  197. 9:24and
  198. 9:26he's making a few dollars like like
  199. 9:28every week uh for the past few weeks.
  200. 9:30So, uh, so yeah, I think like around
  201. 9:33$1,000 in total should be enough to like
  202. 9:36get started with the strategy. Uh so
  203. 9:40like back to uh our uh yeah to our post
  204. 9:45here. So uh again the two things you
  205. 9:48will need you will need a hyperlquid
  206. 9:49platform and you will need an MT5
  207. 9:52platform and we're also going to code
  208. 9:55the script in our PyCharm ID with the
  209. 9:57help of cloth right and so these are the
  210. 10:01three things that we will need and also
  211. 10:03to connect to you know hyperlquid we
  212. 10:06will also need to create something like
  213. 10:08uh API keys so because this is a bit
  214. 10:11sensitive right I've already done it
  215. 10:13ahead of time so uh to
  216. 10:17uh let me just close this. Right. So my
  217. 10:20API keys are saved in API
  218. 10:22credentials.py.
  219. 10:24And so when I work with those, it's
  220. 10:26basically me just copying the secret
  221. 10:28keys from the API key from Hyperlquid,
  222. 10:30right? And then uh like maybe sometime
  223. 10:33later, right, if people like actually
  224. 10:35want to deploy the strategy themselves,
  225. 10:36I will maybe like release a very short
  226. 10:38course or short video tutorial how to
  227. 10:40exactly set up the API keys. But
  228. 10:42basically when you for example I'm going
  229. 10:45to write like API test right here you
  230. 10:48generate some key for your wallet agent.
  231. 10:51So basically it's an agent that is able
  232. 10:53to place trades on your hypo account.
  233. 10:55You click on authorize wallet and here
  234. 10:57you will have like this secret code that
  235. 10:59will be your API key and you will use
  236. 11:02that code like to access your hyperquate
  237. 11:05account. So with this you can like place
  238. 11:07orders, get market data and so I did
  239. 11:10that already. So then once you close it
  240. 11:14and save the key uh
  241. 11:17it will then you know be active. So in
  242. 11:19this case I didn't like activate the key
  243. 11:21because then you guys would have access
  244. 11:23to my account right so
  245. 11:27um yeah so these are the requirements
  246. 11:30and then for MT5 Python right I will use
  247. 11:33the normal uh Python library. So we'll
  248. 11:35just use Python to connect this to this
  249. 11:38MT5 platform to create our you know
  250. 11:41hedge between those exchanges. And so
  251. 11:43why am I using MT5 right? MT5 is
  252. 11:47actually you know quite costefficient
  253. 11:48because they're CFDs. They provide
  254. 11:50leverage. They're also relatively cheap
  255. 11:52for intraday trading. So I believe that
  256. 11:54MT5 like is quite suitable for this type
  257. 11:56of strategy. You could in theory use
  258. 11:58futures or interactive brokers but for
  259. 12:00simplicity reasons I just decide you
  260. 12:02know to use these platforms. And this is
  261. 12:03what I've been using like for the past
  262. 12:06uh past one or two years. So I always
  263. 12:09use like MT5 as you know my platform
  264. 12:12where I h the positions but you could
  265. 12:14use other uh accounts as I've mentioned.
  266. 12:16So basically uh this is it. And so for
  267. 12:19my members you know you know who are
  268. 12:21watching uh I will also upload the code
  269. 12:23when it's tested and ready. So you guys
  270. 12:25can also you know try the strategy
  271. 12:27yourselves uh once it is ready. So uh I
  272. 12:31guess this is it for like the
  273. 12:33introductional project and let's now
  274. 12:36start coding right. So let's begin and I
  275. 12:40guess it will take a few hours to have
  276. 12:41like some results but it's better to
  277. 12:44start now.
  278. 12:51Okay. So now how do we start?
  279. 12:55I think to start we first need like to
  280. 12:58create
  281. 13:00um
  282. 13:01like a connector to hyperquent 5 so you
  283. 13:03can extract data. So before we can
  284. 13:05research analyze or write an algorithm
  285. 13:08we first need the ability to connect to
  286. 13:12the exchange right and test all the
  287. 13:14various um endpoints such as get
  288. 13:17historic data, get the order book data,
  289. 13:20submit trades and all of these things.
  290. 13:22And for MT5, we already know how to do
  291. 13:24that because, you know, I've done a lot
  292. 13:25of content on this. But here, let's go
  293. 13:29to our folder here. And here I've
  294. 13:33created a folder called Exchange
  295. 13:36Connectors. So in exchange connectors,
  296. 13:38we'll create our Python classes that
  297. 13:40will be able to communicate with the
  298. 13:43exchange. So here, let's start with
  299. 13:47uh Hyperlquid.
  300. 13:50And so in hyperlquid I'm going to create
  301. 13:52init.py
  302. 13:56and I'm going to now start uh writing
  303. 13:59you know some some skeleton what this
  304. 14:02class should do and then I will tell
  305. 14:05clot like to you know finish filling out
  306. 14:08those functions. So
  307. 14:11I'm going to create a class called
  308. 14:13hyperlquid client. And so I'm going to
  309. 14:18uh define
  310. 14:21in itself and um
  311. 14:29so this is going to be our hyperlquid
  312. 14:31client class.
  313. 14:34Um
  314. 14:36will the created code perform back test
  315. 14:37or will it only be for actual execution?
  316. 14:40uh I will also show you how to perform
  317. 14:42back test uh historically so we can like
  318. 14:44extract historical data but today we
  319. 14:47will be mainly focused on actual trading
  320. 14:50and execution right so hopefully I'll
  321. 14:53also try to find some actual trading
  322. 14:55opportunities today and open a hedge
  323. 14:58because because it's an arbitrage uh the
  324. 15:03it is an almost like risk-free trade if
  325. 15:06we capture the a good price so today
  326. 15:08it's more about just trying to capture
  327. 15:10real-time opportunities and then once
  328. 15:13this bot is running then in another live
  329. 15:15stream we can for example look at the
  330. 15:16historical data and see how a strategy
  331. 15:19performed uh in the past and then we can
  332. 15:21try to optimize the parameters to get
  333. 15:24the optimum results.
  334. 15:27So uh
  335. 15:36uh
  336. 15:38here I'm going to uh
  337. 15:42write a function called get account data
  338. 15:48and then I will just you know document
  339. 15:50this function and um tell like give
  340. 15:55cloud some instructions what I expect
  341. 15:57from this class. So here I want an
  342. 16:00output to be a dictionary
  343. 16:03and then I will write this function will
  344. 16:06return
  345. 16:09data from the account such as
  346. 16:19so here return example.
  347. 16:24So what I want when what do I want like
  348. 16:26when I um get accounted I want to know
  349. 16:31uh if you look at our hyperlink account
  350. 16:34I want to know things like uh what is
  351. 16:37how much money do I have right so what
  352. 16:39are my balances what's the portfolio
  353. 16:41value right so how much do I have on my
  354. 16:43account basically so here I will write
  355. 16:47balance
  356. 16:52let's say we have 10,000
  357. 16:54Right. we then I want to know the equity
  358. 16:56which is the you know floating uh amount
  359. 17:00our equity which is for 11,000 and then
  360. 17:04free margin right so our available money
  361. 17:08uh on our account which for example is
  362. 17:11let's say like 2,000 right and so now uh
  363. 17:17I will also
  364. 17:19write a quick description above
  365. 17:24the Following
  366. 17:29class
  367. 17:31uses
  368. 17:33hyperlquid
  369. 17:37websockets
  370. 17:41to communicate
  371. 17:45with the hyperlquid exchange
  372. 17:50API.
  373. 17:53The API credentials
  374. 17:56uh can be found in config
  375. 18:01slash
  376. 18:03API credentials.py.
  377. 18:10So this is just a quick description and
  378. 18:12let's try to prompt cloud now to create
  379. 18:15us you know the first function to get
  380. 18:17the account data from hyperlquid.
  381. 18:20Uh,
  382. 18:33please uh
  383. 18:41implement the function
  384. 18:44get account data. Uh
  385. 18:56please use the details that are
  386. 19:00specified in the file. So let's try to
  387. 19:04prompt cloud. We'll see what happens and
  388. 19:08um hopefully we'll have a very fast
  389. 19:11function, you know, that will connect to
  390. 19:13our exchange.
  391. 19:15So right now uh for today's like uh
  392. 19:19trading and testing uh right now there
  393. 19:22is about $1,040 US uh like in live funds
  394. 19:26on my HyperL account and I also have
  395. 19:29like 1,000 euro on my MT5 account.
  396. 19:32Right. So we're going to test like small
  397. 19:34positions on our live accounts
  398. 19:38because personally I just you know like
  399. 19:40to do live trading, right? because you
  400. 19:41get live market data, real execution
  401. 19:44testing, right? Because when you test
  402. 19:45something on the demo account, you never
  403. 19:47know what the real execution uh like uh
  404. 19:52result is, right? Because the liquidity
  405. 19:54is all simulated. So that's why I prefer
  406. 19:57to test like on small accounts.
  407. 20:20So, one second. I'm just getting
  408. 20:21something out of my bag.
  409. 20:25My lips are a bit dry, so I'm just going
  410. 20:27to use some lip balm. Apologies.
  411. 20:32All right.
  412. 20:48So now uh Claude has created a draft to
  413. 20:51create uh a hyperlquid uh class that
  414. 20:55uses websockets to connect to
  415. 20:57hyperlquid. So by the way just so you
  416. 20:59guys know what we're actually like
  417. 21:00working with. If we go to the
  418. 21:02documentation, right? So we were to do
  419. 21:04it without AI. If you go to the AI sorry
  420. 21:07API section here, you will find the
  421. 21:10documentation for the Hyperlquid API.
  422. 21:14And so Hyperlquid for example has some
  423. 21:17Python uh Python like uh library
  424. 21:21implemented which is the Hyperlink
  425. 21:22Python SDK. Uh but what we're going to
  426. 21:25use is the following websocket uh
  427. 21:29documentation here. So we're going to
  428. 21:31create our own websocket client uh using
  429. 21:34cloud AI.
  430. 21:42So now I'm just reading through this and
  431. 21:45uh
  432. 21:49let's override this part here.
  433. 22:02And so what I'm also going to do is uh
  434. 22:12I'm going to add another file called
  435. 22:14test endpoints. And in this file I'm
  436. 22:16just going to work with this hyperlquid
  437. 22:18class to you know test the output of you
  438. 22:23know the new implement function. So here
  439. 22:25I told Claude to you know get account
  440. 22:27data from uh
  441. 22:31yeah to get account data from my uh
  442. 22:34account. And so let's just try to run
  443. 22:37it.
  444. 22:48So when we initialize our hyperquid
  445. 22:51sorry hyperlquid uh websocket client all
  446. 22:53you need to provide is like your
  447. 22:55hyperlquid wallet account which is your
  448. 22:56wallet and it uh basically tells um our
  449. 23:02bot like please look at like this wallet
  450. 23:06address here right um so now let me run
  451. 23:11this
  452. 23:14so from
  453. 23:17uh
  454. 23:23from the current folder import uh
  455. 23:28hyperlquid
  456. 23:30client
  457. 23:35and so I'm going to instantiate this
  458. 23:38class HL client is equal to hyperlquid
  459. 23:40client and then I'm going to do while
  460. 23:43true
  461. 23:45print
  462. 23:48HLC client dot get account data
  463. 23:54and then
  464. 23:59I'm going to sleep one second. Right. So
  465. 24:03let me try this if it works.
  466. 24:16Uh attempted.
  467. 24:19Okay.
  468. 24:25Actually, what I'm going to do instead
  469. 24:27is add some import error. I'm just going
  470. 24:30to run this script in in here. So here
  471. 24:33I'm going to from time import sleep
  472. 24:37and let's just try to run the script
  473. 24:39here. I just want to make sure that it
  474. 24:41works. And
  475. 24:43so right now um I'm getting error like
  476. 24:47state margin summary uh there's a key
  477. 24:50error. So it seems that probably we have
  478. 24:52connected but the dictionary that we've
  479. 24:55uh got returned does not work. So here
  480. 25:08let me print
  481. 25:11the margin summary
  482. 25:18and
  483. 25:20let's see
  484. 25:26actual state and let's see if we
  485. 25:28actually get any type of output. Right?
  486. 25:30So this is actually what I'm interested
  487. 25:32in.
  488. 25:35So as you can see uh our websocket class
  489. 25:38uh is working. Right? So here uh we
  490. 25:41receive a dictionary
  491. 25:45right. So this entire line here receive
  492. 25:47like a response with all the data that's
  493. 25:50available on our hyperlook platform. And
  494. 25:53so right now we're actually receiving
  495. 25:560000. So I have to investigate that but
  496. 26:00we are receiving data now. So now I
  497. 26:04think I need to modify
  498. 26:07some changes.
  499. 26:11Also what I see that this class is doing
  500. 26:13right it only like uh opens a websocket
  501. 26:16connection right it sends some data it
  502. 26:18waits for some response and then it
  503. 26:22closes the connection. But what I want
  504. 26:24to create instead I think is like to
  505. 26:26have a persistent websocket connection
  506. 26:29that always streams the data and saves
  507. 26:32the data inside uh
  508. 26:36uh you know our inside like our class.
  509. 26:39So for example
  510. 26:47I can say like self account data is is
  511. 26:50none right and I can also like self dot
  512. 26:52open orders.
  513. 26:56So I can also say like self dot
  514. 26:59possessions is equal to none and then
  515. 27:02like self dot uh
  516. 27:10market data is equal to not. So here for
  517. 27:13example I want to save all the data that
  518. 27:15I return from the websocket client into
  519. 27:18this data here. And so instead of just
  520. 27:21calling this function open and closing
  521. 27:23the websocket connection, I want to have
  522. 27:26like a persistent class.
  523. 27:29So here I'm going to provide like extra
  524. 27:31information for cloud
  525. 27:34uh
  526. 27:40make the websocket uh connection
  527. 27:45persistent.
  528. 27:46Subscribe to
  529. 27:49account data, open
  530. 27:53or orders, positions,
  531. 27:55market data,
  532. 28:01etc. and save them.
  533. 28:04And save
  534. 28:07the
  535. 28:10output to
  536. 28:16self.count data.
  537. 28:21So self do open orders
  538. 28:25etc. Right? So uh I want to create like
  539. 28:27a persistent connection with our
  540. 28:28websocket client and receive data all
  541. 28:31the time and then so when we run this
  542. 28:34loop here so we have while true and we
  543. 28:35sleep uh once per second we will then
  544. 28:38have like a constant stream of data
  545. 28:40coming to our site.
  546. 28:42So now uh
  547. 28:47I tell clot
  548. 28:52make the websocket uh connection
  549. 28:58persistent.
  550. 29:02I've added new
  551. 29:06or I'm just going to copy this actually.
  552. 29:17So in hyper liquid client
  553. 29:23make the connection persistent. So I'm
  554. 29:25prompting claude like to implement like
  555. 29:27this new type of logic.
  556. 29:29Hello thank you for content. Thank you
  557. 29:31Mr. Bessmer and welcome to live stream.
  558. 29:43So now we're prompting cloth and um
  559. 29:47basically we're trying you know to wait
  560. 29:50for this new output.
  561. 29:52So guys, as you can see like
  562. 29:54implementing the class like in my
  563. 29:56opinion like working initially with the
  564. 29:58APIs, right? And trying to figure out
  565. 30:00where I find what data and how to send
  566. 30:02like the transactions for me is the most
  567. 30:05uh like difficult task like or not
  568. 30:08difficult takes the most time because
  569. 30:09you have to like test the inputs and
  570. 30:11outputs make sure that all uh the data
  571. 30:14formats formats are like synchronized
  572. 30:16with other exchanges. But then once we
  573. 30:19are done with implementing the hyper
  574. 30:20client and MT5 then the actual
  575. 30:23implementation of train strategy and the
  576. 30:25back test is pretty easy.
  577. 30:30Just wanted to give you a small hint.
  578. 30:31Writing hints in file comments may not
  579. 30:33be that efficient while working II
  580. 30:34coding agents. All right. Um
  581. 30:40do you have like any uh suggestion or
  582. 30:42like some uh articles how to do it
  583. 30:44efficiently? Because uh so far what I've
  584. 30:48done is I've just you know structured my
  585. 30:50clients like into like the skeletons and
  586. 30:52then like I've documented every function
  587. 30:54like step by step and so far like I've
  588. 30:57seen like not many like issues on my
  589. 31:00side or so far like I haven't been
  590. 31:02complaining with the results but I'm
  591. 31:05like open to like any more uh optimized
  592. 31:08suggestions.
  593. 31:14So now we've we are using threading. So
  594. 31:16maybe I should have implemented or given
  595. 31:20the information I want to use the
  596. 31:21threading uh part. So now we are using
  597. 31:25threading and then we're just listening
  598. 31:27and then saving all the data and keeping
  599. 31:30a persistent connection. So everything
  600. 31:33that I actually wanted
  601. 31:36is actually done.
  602. 31:39Is this latence arbitrage? Oh, we're
  603. 31:41just actually arbitrageing prices
  604. 31:43between exchanges.
  605. 31:51Keeping your files really small,
  606. 31:52emitting separate dogs, usually NFD
  607. 31:54files, and asking direct do
  608. 31:57better.
  609. 32:04Interesting. Um,
  610. 32:06I would have to like um like try it
  611. 32:09maybe off stream and see how that works.
  612. 32:11But I'll take your uh advice into
  613. 32:14consideration and maybe in the next
  614. 32:16stream I'll try, you know, to implement
  615. 32:19some of your suggestions.
  616. 32:21Um,
  617. 32:23so thanks anyways.
  618. 32:29So basically
  619. 32:31what I need here now is done. So thank
  620. 32:34you cloth and let's try to run this
  621. 32:38script again. So now instead of uh like
  622. 32:42calling the function right we are just
  623. 32:44calling the subscriptions on everything
  624. 32:46that we want.
  625. 32:48And so now instead of uh like calling
  626. 32:52the function we can just call the
  627. 32:55individual
  628. 32:57like attributes right of the class. So
  629. 32:59we can just call account data open
  630. 33:00orders and positions.
  631. 33:02So here I can for example print
  632. 33:07account data
  633. 33:10and then
  634. 33:14I will just print this
  635. 33:19and then I can just try to also get
  636. 33:24positions
  637. 33:26and then I can try to get open orders.
  638. 33:36Okay. So now let me try to run this.
  639. 33:39Something's telling me that there might
  640. 33:40be some error
  641. 33:45or there's none. But the thing is here
  642. 33:46in account data receiving balance your
  643. 33:48zero equity zero free margin zero. So
  644. 33:50probably it's not taking like the
  645. 33:52correct account or it just returning
  646. 33:54none values. But we are connecting.
  647. 33:57Uh [sighs] how has this year been for
  648. 33:58the bots? So this year actually pretty
  649. 34:00great. So you know I've been trading
  650. 34:02Hyperlquid since start of new year. So
  651. 34:04in December I decided you know to
  652. 34:06explore crypto exchanges and was like a
  653. 34:08really nice project because I fully
  654. 34:10migrated uh my trading mainly to
  655. 34:12hyperlquid.
  656. 34:14So everything's been doing quite great.
  657. 34:17And so another question I thought the
  658. 34:18main issue with cross HR was you can't
  659. 34:20have the same wallet in different
  660. 34:21exchanges. How do you uh account for
  661. 34:24transaction costs? So there's no one to
  662. 34:27tell you, you know, that you can't have
  663. 34:29multiple accounts on multiple exchanges,
  664. 34:31right? Um so if you're allowed to have
  665. 34:35different accounts on multiple
  666. 34:37exchanges, then that's fine because then
  667. 34:40if then if you actually have those two
  668. 34:43accounts and you see price
  669. 34:44discrepancies, then it's like pretty
  670. 34:48good. And to answer a question regarding
  671. 34:51the transaction costs uh on hyperlquid
  672. 34:55like uh if you trade crypto right uh it
  673. 34:58can be a bit expensive to try arbitrage
  674. 35:00but the beauty with uh like the RWA real
  675. 35:05world assets is that for example if you
  676. 35:07look at silver for example right if you
  677. 35:11look at the
  678. 35:13uh fee structure here the fee structure
  679. 35:15is 0.003%.
  680. 35:18which is very very low actually right so
  681. 35:22if if we look at uh like the calculator
  682. 35:25right and we compute the current price
  683. 35:27of silver which is 78 time 0.3
  684. 35:34uh the commission per one unit of silver
  685. 35:38is
  686. 35:4002
  687. 35:42it's almost nothing basically right
  688. 35:44compared to my MT5 broker if I write X
  689. 35:47AGUSD here the spread is actually 10
  690. 35:51times larger
  691. 35:54uh
  692. 35:55than the commission on on this platform.
  693. 35:58So it's it's it's actually really cheap
  694. 36:00and that's why I love it. And so on
  695. 36:02hyperlquid right you have these cheaps
  696. 36:04assets. If you look at other exchanges,
  697. 36:06right? Um for example, lighter, now that
  698. 36:09we talk about um
  699. 36:14like commission fees, right? So this is
  700. 36:16for example another deck and I want to
  701. 36:17create like another video in the future
  702. 36:19on lighter. The commission is actually
  703. 36:22zero, right, for uh the normal retail
  704. 36:25account. So here, as you can see, taker
  705. 36:28and maker have 0% commission, which is
  706. 36:31actually amazing.
  707. 36:36So what are exchanges do you look at for
  708. 36:37mispricing? How do you take profits? Uh
  709. 36:41so in my in the descriptions uh I've
  710. 36:44already provided a brief strategy
  711. 36:46description how strategy works. So if
  712. 36:47you want to learn more like about how
  713. 36:50like in detail how strategy works,
  714. 36:52please check out the descriptions and
  715. 36:53you'll find exactly you know the
  716. 36:55mechanism how we're going to trade.
  717. 36:58And so another question for a spread
  718. 37:00calculation will you only use uh
  719. 37:03hyperlquid MT5 or will you or HPMT5 or
  720. 37:07will you normalize the value and
  721. 37:09regardless of spread will you not use
  722. 37:10that score to measure it.
  723. 37:12So uh there is actually no need to
  724. 37:16normalize the values because uh in a
  725. 37:18like classic statistical arbitrage uh
  726. 37:22you have actually the same underlying
  727. 37:23assets. So the pricing is basically uh
  728. 37:28the same right. So if we trade silver on
  729. 37:30hyperlquid the price is 78 and we also
  730. 37:33have silver on MT5 which is 78 right. So
  731. 37:36what we can use here is for example use
  732. 37:39standard deviation to like enter and
  733. 37:42exit the price or you can just set a
  734. 37:46fixed absolute amount right and then
  735. 37:48also try to run it in the back test. So
  736. 37:51there are many like uh approaches in
  737. 37:54today's live stream. I'm going to use a
  738. 37:56static fixed amount right. So I'm just
  739. 37:58going to look at the historical spread.
  740. 38:01Then I'm going to you know eyeball the
  741. 38:04potential entry and exit levels and this
  742. 38:06is going to be used um for the first
  743. 38:09version of training strategy and then we
  744. 38:11come to next topic which is back testing
  745. 38:13optimization. uh I think using Bowlinger
  746. 38:16bands or Z scores is the way to go to
  747. 38:20you know optimize a training strategy.
  748. 38:22So this is uh like my plan for this
  749. 38:25arbitrage project.
  750. 38:30So now uh
  751. 38:35let's have a look at uh
  752. 38:40this part here.
  753. 38:43So now our function get account data is
  754. 38:46no longer necessary because uh
  755. 38:52now we are just keeping persistent
  756. 38:54connection and all the data is being
  757. 38:57saved inside
  758. 38:59our variables here right so we can just
  759. 39:03just check out the value and they should
  760. 39:06be fine
  761. 39:09and another question and the sense that
  762. 39:11if the price reaches the spread
  763. 39:12threshold fault and continues to
  764. 39:14fluctuate, move in or out of the
  765. 39:15threshold, will map entries be made or
  766. 39:17just one at a time. So, right now again,
  767. 39:20uh we're going to use just a single
  768. 39:23entry level. Um
  769. 39:26but uh
  770. 39:29it's definitely like a good idea to
  771. 39:31implement like multiple entry levels,
  772. 39:32right? So, you can have like a very
  773. 39:34close one and one further away. So again
  774. 39:37maybe in future iterations uh or
  775. 39:41revisional strategy we can also try to
  776. 39:42implement like multiple entry levels and
  777. 39:45I do support multiple entry levels. Uh I
  778. 39:48believe that uh like when we look at the
  779. 39:50back test later uh this approach should
  780. 39:53be more profitable.
  781. 40:04Um,
  782. 40:06okay. So, let's look at the subscription
  783. 40:10section here. So, here we're subscribing
  784. 40:12to web data 2 and all mids.
  785. 40:16Let me look at the API documentation.
  786. 40:18So, uh here if you see like the
  787. 40:20websockets, right? You can subscribe to
  788. 40:24all of these
  789. 40:26uh endpoints here. And so, they will all
  790. 40:30return you some data that you can use.
  791. 40:34And so I'm just checking what we're
  792. 40:36using right now
  793. 40:38just to confirm what hyperlquid is
  794. 40:40doing.
  795. 40:42So here web two that aggregate
  796. 40:44information about user use primary for a
  797. 40:46front end format.
  798. 40:48So uh
  799. 40:52I guess this is fine.
  800. 41:11So what I'm going to do here is like
  801. 41:14here we have our handle function handle
  802. 41:17which is here and uh
  803. 41:22what I can do is I can in theory like uh
  804. 41:27print the websocket message
  805. 41:31and here we will have our message. So we
  806. 41:35can actually check for the exact values
  807. 41:37that our hyperlquid client is returning.
  808. 41:40And so hopefully uh so now as you can
  809. 41:44see hyperlquid is actually returning all
  810. 41:47this data to us which we can like
  811. 41:50investigate right and like the format of
  812. 41:52the data can also be found in the return
  813. 41:56values. Right? So are the data type
  814. 41:58definitions and here we see the data
  815. 42:01type which um is being returned.
  816. 42:22So assume
  817. 42:24that um
  818. 42:31I just need to go through the
  819. 42:33information here one by one and see
  820. 42:39if I'll find
  821. 42:41what I need. So here there's a
  822. 42:42cumulative ledger which is 10 1.2
  823. 42:59And if you look at our hyperate account,
  824. 43:01there is 141.21.
  825. 43:05So, uh
  826. 43:09give it also,41.
  827. 43:17So I think I have found the value that
  828. 43:20we need.
  829. 43:22So here we have
  830. 43:27I think that we need so our balance
  831. 43:31or equity is actually this value here
  832. 43:34and that's why I think that's the
  833. 43:37mistake here. So, uh,
  834. 43:47so what I'm going to do is I'm actually
  835. 43:52going to copy that value
  836. 43:55and we're going to use that one.
  837. 44:02So, the channel is actually web two
  838. 44:04data.
  839. 44:07So actually I'm going to print it in
  840. 44:10this section here. Let's rerun this.
  841. 44:19And so it's actually a lot and a lot of
  842. 44:22data.
  843. 44:30So the thing is I'm asking myself if
  844. 44:33like instead of using web data 3 to get
  845. 44:36uh
  846. 44:38the account data if there is actually
  847. 44:42a different way to get the balances but
  848. 44:44I think this is it
  849. 44:47unless we also check just the clearing
  850. 44:50house state which in theory can has data
  851. 44:55in regards to our free margin and like
  852. 44:58the balance and equity
  853. 45:15So let me also have a look at the
  854. 45:17clearing house state.
  855. 45:22Let's uh I'm just looking. So we're
  856. 45:25going to subscribe also to
  857. 45:36I'm going to cl
  858. 45:39instead of
  859. 45:46web data too.
  860. 45:49Can you use clearing house state to
  861. 45:53scrape account
  862. 45:56information?
  863. 46:21All right. So
  864. 46:25hopefully this will be done like within
  865. 46:26like 30 minutes or what hour because as
  866. 46:28you see it is a lot of data and it's
  867. 46:31like a bit different compared like to
  868. 46:33let's say MT5 or interactive brokers uh
  869. 46:36but it's just you know understanding the
  870. 46:39output of the data and so in my previous
  871. 46:42project I actually have my own like
  872. 46:44hyperlquid client class implemented
  873. 46:46using the hyper python SDK but I also
  874. 46:49had to edit this you know class myself
  875. 46:52And like it took me like a week actually
  876. 46:54to implement this class. So assuming we
  877. 46:56finish just the hyper client
  878. 46:58implementation with cloud within let's
  879. 47:01say half a day. Um
  880. 47:04it saves me about like five times the
  881. 47:07amount and like we'll see you know how
  882. 47:09it goes. So
  883. 47:12now I've asked uh cloth to like use
  884. 47:16clearing house state instead of
  885. 47:21the web two data.
  886. 47:23And so let me try to run this thing
  887. 47:26again.
  888. 47:31Okay.
  889. 47:35Right,
  890. 47:45let me open the window here. It's quite
  891. 47:47a warm summer day now.
  892. 47:50So,
  893. 47:53see, we have like how hot is it today?
  894. 47:58It's like 26 degrees today and we have
  895. 48:01no AC. So, it's quite hot, I would say.
  896. 48:14So I need to get the channel
  897. 48:17and I need to get the clearing house
  898. 48:19state. So we have subscription response.
  899. 48:31So I think like right now I'm a little
  900. 48:33bit stuck with the hyperlquid client and
  901. 48:37that is that um
  902. 48:40I'm trying to hand or I told clot to
  903. 48:43handle the data but uh it is not using
  904. 48:47the data that I need. So instead uh of
  905. 48:50um
  906. 48:52like telling clot to already consume the
  907. 48:54data, I'm just going to subscribe to all
  908. 48:57the various uh channels that I need and
  909. 48:59then I'm going to review dictionary by
  910. 49:01dictionary what outputs I want in my
  911. 49:04hyperlquid class.
  912. 49:10So I think I'm going to do that instead.
  913. 49:16So what uh do we actually need here? So
  914. 49:19we will need.
  915. 49:34So we will need a clearing house state.
  916. 49:35Let's start with the clearing house
  917. 49:38state. I think that's the best thing to
  918. 49:40start with. So instead of subscribing to
  919. 49:44web to data, let's subscribe to the
  920. 49:47clearing house state and uh try to run
  921. 49:50this.
  922. 49:56For love of God, get your mic off access
  923. 49:58so we don't hear disgusting saliva
  924. 49:59noises every other second. Apologies
  925. 50:02wearing that.
  926. 50:04Tell me if it's better.
  927. 50:18All right. So
  928. 50:28now we have the
  929. 50:34clearing house state.
  930. 50:44And let's print.
  931. 50:46So here
  932. 50:48we have
  933. 50:51the user.
  934. 50:55That's fine here.
  935. 51:06And let's also add the web two data. Now
  936. 51:48So
  937. 51:54well actually CL suggested some changes
  938. 51:57and they didn't write. So I was actually
  939. 51:58trying to edit some stuff here.
  940. 53:05Okay, it seems like we still have an
  941. 53:07issue with the account data, but let's
  942. 53:09just actually skip that. So I have to
  943. 53:12you know investigate that. Uh there was
  944. 53:14like this value that I checked but let's
  945. 53:16just try to you know subscribe to
  946. 53:18positions instead. So right now in
  947. 53:20hyperlquid what I'm going to do now is
  948. 53:23I'm going to open the position on silver
  949. 53:26let's say and I'm going to scrape the
  950. 53:28data from the positions.
  951. 53:31And so now to open a position on silver.
  952. 53:39Let's say I want to so I'm just going to
  953. 53:42create a test position.
  954. 53:46And let's say I just want to short. So
  955. 53:49here I'm going to short one silver at
  956. 53:54the current mid price.
  957. 53:57And so let's add liquid adding orders.
  958. 53:59So, we're just adding an order to the
  959. 54:01order book for the midpric and then
  960. 54:04we're going to place the order. Mic is
  961. 54:07better. Thank you. All right. Thanks a
  962. 54:09lot.
  963. 54:12So, now I just need to add my two factor
  964. 54:15authentication to, you know, submit this
  965. 54:18order.
  966. 54:20And here we do 597. It's 21.
  967. 54:34Okay. So, let's check.
  968. 54:39Let's submit again.
  969. 54:55And now we are at top of book here and
  970. 54:58we're just trying to get filled.
  971. 55:09Okay, let's update our order again.
  972. 55:14Actually,
  973. 55:22just cancel this. Try to set another
  974. 55:27trade at a mid price and hopefully we'll
  975. 55:30get filled here.
  976. 56:02So now uh yeah, our open position is
  977. 56:05still open at 78099.
  978. 56:09It's quite difficult to get filled
  979. 56:12like always when you want to place an
  980. 56:13order, you never get filled at special
  981. 56:15limits. So hopefully
  982. 56:25Okay, so now we've created a position
  983. 56:28and so we are
  984. 56:31one silver uh short on on Hyperlquid.
  985. 56:36Let's check our liquidation price. So it
  986. 56:39shouldn't be that far.
  987. 56:45And so our liquidation price is at 1,97
  988. 56:50which is which is fine. So now
  989. 56:54uh
  990. 56:57we can actually try to get the data from
  991. 57:00our silver position in the clearing
  992. 57:02house.
  993. 57:08So let's try to go to the clearing house
  994. 57:11section. Uh,
  995. 57:20hey man, I just joined membership. Glad
  996. 57:21to be here. Thank you very much for
  997. 57:23subscribing and hopefully you can learn
  998. 57:26a lot of new things and you can like
  999. 57:28follow me on my arbitrage trading live
  1000. 57:31streams and yeah, hopefully
  1001. 57:34uh yeah, we'll make lots of money
  1002. 57:36together.
  1003. 57:40So here we need to get the channel
  1004. 57:42clearing house state.
  1005. 57:45I just tell CL to do it. So
  1006. 57:49let's just see. So we're subscribing.
  1007. 57:54Uh, can you uh
  1008. 57:58please send uh subscribe
  1009. 58:03request for the clearing house state and
  1010. 58:09save
  1011. 58:11open positions
  1012. 58:16in the handle function.
  1013. 58:54nebulizing.
  1014. 59:11Okay,
  1015. 59:12let's update the changes.
  1016. 59:54So let's see at the clearing house
  1017. 59:57channel. So in this channel what we're
  1018. 59:59doing is we're subscribing to you know
  1019. 1:00:02um the clearing house which contains
  1020. 1:00:05data about our open position. Uh it also
  1021. 1:00:08calculates the free margins and
  1022. 1:00:09liquidation prices. So maybe if we run
  1023. 1:00:12this
  1024. 1:00:14we will then save the data in positions
  1025. 1:00:17which we do. So self.position
  1026. 1:00:19positions is equal state get asset
  1027. 1:00:21positions. So let's try to get this.
  1028. 1:00:32And so let's also see.
  1029. 1:00:39So in this section here, let's print out
  1030. 1:00:41the message for a clearing house.
  1031. 1:01:03So now if we look at this message,
  1032. 1:01:08oh I forgot to add one very important
  1033. 1:01:10thing and that's my mistake. The reason
  1034. 1:01:12why I'm receiving zero all the time also
  1035. 1:01:14in positions is actually I am connecting
  1036. 1:01:17to the wrong decks.
  1037. 1:01:19So maybe to explain what's happening
  1038. 1:01:21here is like we have perpetual futures
  1039. 1:01:23on hyperlquid but if we go to hip 3
  1040. 1:01:25deployments I need to subscribe to the
  1041. 1:01:28xyz uh
  1042. 1:01:32uh hip 3 deployment right. So uh
  1043. 1:01:42so in hyper
  1044. 1:01:45liquid client
  1045. 1:01:50I want to connect to the DEXYZ.
  1046. 1:01:55Can you add this
  1047. 1:02:02Z and subscribe to XYZ positions?
  1048. 1:02:08Can you add this?
  1049. 1:02:32Yes, correct.
  1050. 1:02:55So, we're adding our like separate DEX
  1051. 1:02:58environment which is XYZ because now
  1052. 1:03:01we're trading silver on XYZ and right
  1053. 1:03:04now we are 8 cents in profit which is
  1054. 1:03:06nice considering it's just a
  1055. 1:03:22and so yeah, let's do this.
  1056. 1:03:36Okay, so the changes have been applied.
  1057. 1:03:39Let's run it again.
  1058. 1:03:43And now it seems that it is actually
  1059. 1:03:47working. So if you look at this line
  1060. 1:03:49here guys, right? So here we have
  1061. 1:03:51specified the DEX to be XYZ.
  1062. 1:03:54Here we have our value from the open
  1063. 1:03:57position.
  1064. 1:04:00Right? And so so far
  1065. 1:04:05we have all the data that we need.
  1066. 1:04:11So here here's our XYZ position. We are
  1067. 1:04:14one short and
  1068. 1:04:24this is all we need. So now what I'm
  1069. 1:04:26going to do is instead of printing out
  1070. 1:04:28all the states right here in our uh
  1071. 1:04:33terminal, what I'm going to do is I'm
  1072. 1:04:34just going to dump out the files in a
  1073. 1:04:36JSON file so I can also review the
  1074. 1:04:39output of the data separately. So
  1075. 1:04:46uh down here I'm going to create a
  1076. 1:04:49function called define generate snapshot
  1077. 1:04:55and then here I can tell uh clots to
  1078. 1:04:59dump uh
  1079. 1:05:04current class
  1080. 1:05:07attributes
  1081. 1:05:09into a JSON. and file.
  1082. 1:05:19So now uh I go back to cloth and then I
  1083. 1:05:23tell clot
  1084. 1:05:25uh
  1085. 1:05:27can you implement generate
  1086. 1:05:30snapshot
  1087. 1:05:33uh function and dump uh class data into
  1088. 1:05:41a JSON file. when the function is
  1089. 1:05:45called.
  1090. 1:05:52Hello there. Which clause subs
  1091. 1:05:53subscription do you have? What's your
  1092. 1:05:55usage looking like? Do you mind showing?
  1093. 1:05:57Uh,
  1094. 1:05:59sure. Uh, let me open my cloud desktop.
  1095. 1:06:02So it's all
  1096. 1:06:04uh synchronized or like I'm using like
  1097. 1:06:09the same subscription for uh the
  1098. 1:06:11browser, the desktop and so on. So right
  1099. 1:06:14now I'm using the max uh which it cost
  1100. 1:06:18me like $100 uh per month
  1101. 1:06:21and uh let me also look at the current
  1102. 1:06:27usage and consumption.
  1103. 1:06:36So right here for a current session I
  1104. 1:06:38only use 10% and it resets in 3 hours.
  1105. 1:06:40So actually I have a lot of time to
  1106. 1:06:45yeah to still work with it which is
  1107. 1:06:47great. So I I believe that within 3
  1108. 1:06:49hours I will not use this entire limit.
  1109. 1:06:52And I think there's also like a weekly
  1110. 1:06:55limit or a monthly limit and I'm not
  1111. 1:06:57like not like close. So everything is
  1112. 1:06:59like really good for this subscription.
  1113. 1:07:02Maybe I should actually downgrade now
  1114. 1:07:04that I think about it. But I believe
  1115. 1:07:05that I'll be coding a lot with AI. So
  1116. 1:07:08let's see how much I can stretch it.
  1117. 1:07:14So use it a lot. Have you ever hit
  1118. 1:07:16limits? So far no.
  1119. 1:07:19But I have a friend who use it a lot a
  1120. 1:07:21lot in a corporate environment. So in a
  1121. 1:07:24company and like he used up I don't know
  1122. 1:07:26what he said. Maybe I'm making up, but
  1123. 1:07:28over 50% of the entire team's uh tokens,
  1124. 1:07:31right? So, uh he told me that he uses it
  1125. 1:07:34a lot and I still have a lot to learn
  1126. 1:07:37from him.
  1127. 1:07:40I think of getting 100 or 200, but can't
  1128. 1:07:42decide. Uh I think the best approach is
  1129. 1:07:44to like like start with a lower tier and
  1130. 1:07:46if you reach a limit, you can always
  1131. 1:07:48upgrade, right? So uh maybe I would
  1132. 1:07:51suggest you to just try you know small
  1133. 1:07:54and if you need it more you'll you'll
  1134. 1:07:56like realize very soon right
  1135. 1:08:07I have 20 and I hit the limits quite
  1136. 1:08:09fast. So in that case if you hit the
  1137. 1:08:11limits uh then probably you know if it's
  1138. 1:08:15worth it then you can uh always like
  1139. 1:08:18increase I guess
  1140. 1:08:25then I guess uh if you don't know if you
  1141. 1:08:27go 200 or 200 just just try the 100
  1142. 1:08:30right and then you'll find out if you
  1143. 1:08:31need more I think just use as much as
  1144. 1:08:34you need.
  1145. 1:08:38Okay. So now we've created uh the
  1146. 1:08:41generate snapshot uh which will dump the
  1147. 1:08:45data into a JSON file. So now I can
  1148. 1:08:48print the data uh or output the data in
  1149. 1:08:50my JSON file uh which is
  1150. 1:09:03okay. I also want to tell CL in generate
  1151. 1:09:08generate snapshot. I want you to
  1152. 1:09:12overwrite the old file and not create
  1153. 1:09:18new JSON files.
  1154. 1:09:46Okay. Uh so let's run this script now.
  1155. 1:09:53And so if I refresh this
  1156. 1:10:09Which was the first strategy you built?
  1157. 1:10:11Or are you like asking what I'm building
  1158. 1:10:12right now? Uh, I'm building like an
  1159. 1:10:14arbitrage bot between Hyperlquid and MT5
  1160. 1:10:17right now. We're still stuck with the
  1161. 1:10:20implementation of the Hyperlink
  1162. 1:10:21websocket client, but in the
  1163. 1:10:23descriptions, you can read more about
  1164. 1:10:24the strategy if you're interested to
  1165. 1:10:26find out more.
  1166. 1:10:38Okay. So here, let me open this in
  1167. 1:10:41explorer. Oh, I forgot one thing like
  1168. 1:10:44I'm trying to script, but I still need
  1169. 1:10:46to
  1170. 1:10:48uh
  1171. 1:10:50generate the snapshot.
  1172. 1:10:52So here I'm generating the snapshot.
  1173. 1:10:58Let me run this again.
  1174. 1:11:05And here what you can see is
  1175. 1:11:08uh
  1176. 1:11:12here we have some data on the balance
  1177. 1:11:14equity and free margin. I don't think
  1178. 1:11:16that this looks correct but I'll review
  1179. 1:11:18it later. But what we can see here is
  1180. 1:11:21that we can see our silver position.
  1181. 1:11:24Right. So now I can actually review
  1182. 1:11:27the things here and here we have the
  1183. 1:11:31market data. Okay. So positions have
  1184. 1:11:34been implemented. Now we need to get uh
  1185. 1:11:38market data on on silver let's say
  1186. 1:11:42right. So let's say how do we get the
  1187. 1:11:44current bid and ask for silver USDC. And
  1188. 1:11:48also if you want to use other symbols we
  1189. 1:11:50can also try to use other symbols.
  1190. 1:11:55And so if you look at the API docs uh in
  1191. 1:11:58subscriptions uh
  1192. 1:12:11there should be a message
  1193. 1:12:16called BBO which stands for best bid
  1194. 1:12:19offer. So this gives us the top of book
  1195. 1:12:21prices for a certain asset.
  1196. 1:12:26So um
  1197. 1:12:38so I'm going to tell clot to uh
  1198. 1:12:48I'm going to create a function called
  1199. 1:12:50define
  1200. 1:12:52uh subscribe
  1201. 1:12:54best bit offer. So in this function uh I
  1202. 1:12:58have a symbol and uh I will say this
  1203. 1:13:03function
  1204. 1:13:04will subscribe
  1205. 1:13:10to the best bit offer
  1206. 1:13:14for
  1207. 1:13:16the specified
  1208. 1:13:20asset.
  1209. 1:13:27And here the type the subscription is
  1210. 1:13:32basically
  1211. 1:13:34type
  1212. 1:13:37uh
  1213. 1:13:40so this is the format of our
  1214. 1:13:42subscription.
  1215. 1:13:43So now I can tell cloud uh please
  1216. 1:13:47implement
  1217. 1:13:48subscribe
  1218. 1:13:51BBO function
  1219. 1:13:54and handle
  1220. 1:13:57uh the BBO messages and save them
  1221. 1:14:05in market data as a dictionary.
  1222. 1:14:16So now we like uh are able to subscribe
  1223. 1:14:20to the uh
  1224. 1:14:23to the open trades, right? So right now
  1225. 1:14:24we're 26 cents in profit. And so now
  1226. 1:14:28we're trying to get the current market
  1227. 1:14:31market data. Then what we have to do is
  1228. 1:14:33we also need to get to the open order.
  1229. 1:14:35So check our open orders. And then this
  1230. 1:14:37is all we need like to extract like data
  1231. 1:14:40from our hybrid client. And then after
  1232. 1:14:42that we will test some trading
  1233. 1:14:44endpoints. So we'll send market limit
  1234. 1:14:46orders and so on. And once that is done
  1235. 1:14:50we can then you know try to compare the
  1236. 1:14:53price data with Metatrader 5.
  1237. 1:15:05Please make a video on C++ algorithm. Uh
  1238. 1:15:07I'm sorry I don't code in C++ so I can't
  1239. 1:15:10like help you with that unfortunately.
  1240. 1:16:04Okay. So now
  1241. 1:16:11this should be implemented and we should
  1242. 1:16:12be able to uh get data
  1243. 1:16:16from hyperlquid
  1244. 1:16:18and hopefully we can subscribe to
  1245. 1:16:20something like Bitcoin. then I will uh
  1246. 1:16:22specify
  1247. 1:16:23uh the XYZ silver that you want to
  1248. 1:16:27implement. So let's look at the changes.
  1249. 1:16:32So here in subscribbo we provide the
  1250. 1:16:36symbol and hopefully that will then
  1251. 1:16:40subscribe to the top of book of our
  1252. 1:16:42asset. So when we go down here and we
  1253. 1:16:46create our hyperlquid class, we can try
  1254. 1:16:49to subscribe to the market data.
  1255. 1:17:00So you buy in hyperlquid and compare
  1256. 1:17:02with NT5 like we can transfer with each
  1257. 1:17:04other platforms. No, you cannot transfer
  1258. 1:17:06funds from these platforms because these
  1259. 1:17:08are not spot assets. These are both
  1260. 1:17:10derivatives. But when you see, you know,
  1261. 1:17:12some price discrepancies, you can buy
  1262. 1:17:14and sell on the initial platform. And
  1263. 1:17:16then when the prices like balance out
  1264. 1:17:19over time, you can then close both
  1265. 1:17:21positions for uh net profit. So this is
  1266. 1:17:24what we're doing.
  1267. 1:17:33[cough]
  1268. 1:17:40So here we're subscribing to our best
  1269. 1:17:42bit offer and now I need to
  1270. 1:17:45get the list of tradable symbols.
  1271. 1:17:50So right now I don't know exactly what
  1272. 1:17:53the symbol name
  1273. 1:17:55on hyperlquid is. I think it's called
  1274. 1:17:57XYZ silver.
  1275. 1:18:24So here I'll print uh market data which
  1276. 1:18:27will have the current data for a market.
  1277. 1:18:30Here I can remove my print statements
  1278. 1:18:33above here. So I need to save clearing
  1279. 1:18:35house messages anymore because I dumped
  1280. 1:18:37the data inside a JSON file which I can
  1281. 1:18:40review later.
  1282. 1:18:43And uh
  1283. 1:18:46oh here's the
  1284. 1:18:48here's a coin. So let me try to use XYZ
  1285. 1:18:51silver. So this is what it's called. So
  1286. 1:18:54here our symbol
  1287. 1:18:57is called XYZ silver.
  1288. 1:19:06And now I can try to run this like that.
  1289. 1:19:12And so what we can see now here is if
  1290. 1:19:14you look at the market data, right? So
  1291. 1:19:16we got the market data printed out and
  1292. 1:19:20we look at our snapshot.
  1293. 1:19:23So here you see the market data. So we
  1294. 1:19:25have the current bid price and also size
  1295. 1:19:29of the bid and also we have the ask
  1296. 1:19:31price as well as the size of the ask. So
  1297. 1:19:33right now we're able to uh monitor the
  1298. 1:19:38life prices of XYZ silver
  1299. 1:19:45and so now what we also need to do is we
  1300. 1:19:49need to uh subscribe to let's say open
  1301. 1:19:53orders and then I believe uh we can then
  1302. 1:19:56move on to the trading endpoint. So then
  1303. 1:19:58we will try to open close uh modify uh
  1304. 1:20:02positions for our hyperlquid class and
  1305. 1:20:05then this will be like the minimum
  1306. 1:20:09requirement implementation to you know
  1307. 1:20:12run our arbitrage strategy and then
  1308. 1:20:15so now let me also try to like implement
  1309. 1:20:18open orders and then eventually I'll get
  1310. 1:20:20the account data running but for the
  1311. 1:20:22arbitrage bots to work we just need
  1312. 1:20:24these three things and also like how to
  1313. 1:20:27extract the historical OHLC data which
  1314. 1:20:30we can also like check.
  1315. 1:20:38Okay. So to get the open orders.
  1316. 1:20:54So here what hyperlquid is saying open
  1317. 1:20:56orders is an info input not a
  1318. 1:20:58subscription. So pull via post
  1319. 1:21:01uh
  1320. 1:21:04which is kind of weird
  1321. 1:21:07uh because
  1322. 1:21:15uh in documentation we can actually
  1323. 1:21:17subscribe to open orders like this.
  1324. 1:21:22So let me like discuss this with Claude
  1325. 1:21:34states that open orders cannot be
  1326. 1:21:39subscribed
  1327. 1:21:42to. But according to the documentation,
  1328. 1:21:47you can subscribe with
  1329. 1:21:53Can you review this?
  1330. 1:21:58What about swaps? I'm trading gold MT4,
  1331. 1:22:00but swaps either profits a lot. Uh yeah,
  1332. 1:22:04so swaps and funding rates is one of the
  1333. 1:22:06strategies that like we can deploy,
  1334. 1:22:08right? that will be a funding rate
  1335. 1:22:09arbitrage. But
  1336. 1:22:13but yeah, so right now we're just mainly
  1337. 1:22:15focusing on the price discrepancies, but
  1338. 1:22:17to some extent uh this arbitrage bot
  1339. 1:22:20could be considered as a funding rate
  1340. 1:22:22arbitrage bot because we're also like
  1341. 1:22:24going to make money on the funding
  1342. 1:22:26rates. So this is also quite possible.
  1343. 1:22:40Okay, I told Claude to fix this and it
  1344. 1:22:43seems that Claude understands that we
  1345. 1:22:46can actually like fix that.
  1346. 1:23:03Do you want to make this edit to edit
  1347. 1:23:06thepy? Uh, yes.
  1348. 1:24:05So now the open orders have been
  1349. 1:24:06implemented. So we can try to check if
  1350. 1:24:09you're also like receiving uh data for
  1351. 1:24:12open orders.
  1352. 1:24:16So now if I rerun this script here and
  1353. 1:24:19let's try to do that.
  1354. 1:24:23So right now uh
  1355. 1:24:26we have zero open orders as you can see.
  1356. 1:24:29Let me also print some type of separator
  1357. 1:24:32here.
  1358. 1:24:42You could also ask cloth something like
  1359. 1:24:44review this whole project. What else is
  1360. 1:24:45missing? What features could I add? Etc.
  1361. 1:24:47I do it from time to time or features.
  1362. 1:24:49Yeah. So the thing about telling cloth
  1363. 1:24:51to like just review my entire project.
  1364. 1:24:54Uh I think it can be a bit dangerous
  1365. 1:24:57because then you like lo lose overview
  1366. 1:25:00of your entire project. And like I like
  1367. 1:25:02to be in control and I like to like know
  1368. 1:25:04exactly what I'm building. So more like
  1369. 1:25:07I'm instructing Claude to do a certain
  1370. 1:25:09task, feature, whatever. But something
  1371. 1:25:11like look at my entire project and tell
  1372. 1:25:13me what could be done better. I mean it
  1373. 1:25:16could work, but then you're sort of
  1374. 1:25:19giving up your like own input how to how
  1375. 1:25:22to code that
  1376. 1:25:26is funding rates is kind of fo. Can you
  1377. 1:25:29can you explain that what you mean by
  1378. 1:25:31that?
  1379. 1:25:34Okay. So now uh our script is running.
  1380. 1:25:36So here in HL snapshots uh
  1381. 1:25:40we have our open orders right and right
  1382. 1:25:43now the open orders are empty and that
  1383. 1:25:46is correct because right now we have no
  1384. 1:25:50open orders on our platform.
  1385. 1:25:53And
  1386. 1:25:57so now I can actually place an open
  1387. 1:25:59order. Let's say like I'm going to place
  1388. 1:26:02a cell limit at 100 for example, right?
  1389. 1:26:05It will not get filled but I'm just
  1390. 1:26:08going to place it there. So,
  1391. 1:26:11so we can check if the order will become
  1392. 1:26:15visible.
  1393. 1:26:17So, again it's prompting my 2FA.
  1394. 1:26:21So, let's just add in
  1395. 1:26:24the 2FA verification. So, now my open
  1396. 1:26:27order is here, right? So here in open
  1397. 1:26:29orders we can see silver and so what we
  1398. 1:26:32can then see is that our silver position
  1399. 1:26:35is now visible right. So this is our
  1400. 1:26:38open order
  1401. 1:26:40and so now we have also successfully
  1402. 1:26:43implemented the open order endp point.
  1403. 1:26:51Okay. So now what I'm thinking is let's
  1404. 1:26:54extract the historical OLC data.
  1405. 1:27:02So I think for the OLC data what we can
  1406. 1:27:04do is we don't need to use websockets
  1407. 1:27:06but all that we need is to actually just
  1408. 1:27:09call the info endpoint.
  1409. 1:27:16And in info endpoint we're able to like
  1410. 1:27:20retrieve the OLC data. So maybe we will
  1411. 1:27:24find OLC here or like the history
  1412. 1:27:29historical
  1413. 1:27:32data which is actually here.
  1414. 1:27:44So here I'm going to create a function
  1415. 1:27:47maybe somewhere down here.
  1416. 1:27:53I'm going to call it get OLC history.
  1417. 1:28:06Yeah sure. But just for feature ideas
  1418. 1:28:08then choose one of them take control.
  1419. 1:28:09You know it's not implement it just
  1420. 1:28:11suggest some features if you get me.
  1421. 1:28:14like sort of sort of like right now I'm
  1422. 1:28:17building something and I have like um
  1423. 1:28:20exact idea how I want it to look. So
  1424. 1:28:24right now I'm like
  1425. 1:28:26coding and like more like letting cloud
  1426. 1:28:29assist me with the implementation of
  1427. 1:28:31functions and uh in the classes but
  1428. 1:28:37yeah so this is basically my approach in
  1429. 1:28:40coding and like uh so maybe I don't like
  1430. 1:28:44quite get you uh so probably sorry about
  1431. 1:28:47that if I like didn't really understand
  1432. 1:28:49what you mean by that.
  1433. 1:28:54This function returns historical
  1434. 1:29:01or you shall see data from hyper liquid
  1435. 1:29:05from a specific
  1436. 1:29:09from the
  1437. 1:29:11specific asset. So here uh what we're
  1438. 1:29:15going to do is we're going to provide
  1439. 1:29:17the symbol.
  1440. 1:29:20So it's the asset name. So symbol then
  1441. 1:29:23the start date time then the end date
  1442. 1:29:26time
  1443. 1:29:28and also the time frame.
  1444. 1:29:33So now uh what we can do is uh
  1445. 1:29:43return a dictionary
  1446. 1:29:45with the fields uh
  1447. 1:29:49time, open, high, low, close and volume.
  1448. 1:30:01So please implement get OC history.
  1449. 1:30:32So now that once we get the OSC history
  1450. 1:30:35calculated I can actually show you how I
  1451. 1:30:38created the chart right. Uh so if you
  1452. 1:30:41look at the article right where I
  1453. 1:30:43explained that we're going to arbitrage
  1454. 1:30:46or compare the pricing between multiple
  1455. 1:30:48assets here we can like extract the
  1456. 1:30:51historical data and see the historical
  1457. 1:30:54spread you know how much the prices
  1458. 1:30:55deviate. So once we get like this
  1459. 1:30:58endpoint done then we can for example
  1460. 1:31:01open a quick notebook and I'm going to
  1461. 1:31:02show you how to compare the pricing
  1462. 1:31:05discrepancies.
  1463. 1:31:32Okay, thank you.
  1464. 1:31:35Can we use this on MT5 platform? So
  1465. 1:31:39yeah, the strategy that I'm doing here
  1466. 1:31:40right now is an arbitrage between
  1467. 1:31:42Hyperlquid and MT5. So you will need
  1468. 1:31:45both platforms for a strategy to work,
  1469. 1:31:47right? So in this example, I am using
  1470. 1:31:50MT5.
  1471. 1:31:57Okay. So let's now try to extract the
  1472. 1:32:00historical OHLC data.
  1473. 1:32:38Uh okay. So,
  1474. 1:32:42please write
  1475. 1:32:45a simple test script that exports OHLC
  1476. 1:32:52data and
  1477. 1:32:56uses the get OLC
  1478. 1:33:00history function.
  1479. 1:33:03So I tell cloud now to you know the
  1480. 1:33:05function that I've created the get os
  1481. 1:33:08history uh and this script will call
  1482. 1:33:11this function and then we can review the
  1483. 1:33:14results of this.
  1484. 1:33:37Oh, and also let me check the get OLC
  1485. 1:33:40history function. Uh,
  1486. 1:33:50all right. So here, uh, we have our test
  1487. 1:33:53oc history function. So
  1488. 1:33:57here I'm going to create a new folder.
  1489. 1:33:59I'm going to call it uh maybe our
  1490. 1:34:03analysis folder where we're going to
  1491. 1:34:04analyze uh the data and we're going to
  1492. 1:34:08perform our back test there. So let me
  1493. 1:34:10just put this file here.
  1494. 1:34:13And here I'm going to uh
  1495. 1:34:23test my function.
  1496. 1:34:41So it seems that we've received some
  1497. 1:34:44error here. So client is equal to
  1498. 1:34:46hyperlquid client.
  1499. 1:34:59I've received this error when
  1500. 1:35:04uh using testl.py
  1501. 1:35:43So let's see what claude will now
  1502. 1:35:45suggest that we change here.
  1503. 1:35:50And then here I'm going to create a
  1504. 1:35:51notebook. Uh
  1505. 1:35:54I'm going to call this mode calculate
  1506. 1:35:56historical
  1507. 1:35:59spread. Right? So here we're going to
  1508. 1:36:02import the Metatrader 5 uh platform,
  1509. 1:36:05export the OLC from Metatrader 5 and
  1510. 1:36:08we're going to compare the historical
  1511. 1:36:10spread uh using our client.
  1512. 1:36:19So from exchange connectors hyperlient
  1513. 1:36:23import hyperclient.
  1514. 1:36:33Okay, let's see if Claude found a fix
  1515. 1:36:36for this bug.
  1516. 1:37:02Okay. And let's try to run this and see
  1517. 1:37:04if something
  1518. 1:37:06if this fix up.
  1519. 1:37:11So problem here is that we received zero
  1520. 1:37:15candles for a one minute chart data.
  1521. 1:37:16Maybe the history is too long. I'm not
  1522. 1:37:18sure if Hyperliquid
  1523. 1:37:20saves this much into the past. No.
  1524. 1:37:39uh test oc.py
  1525. 1:37:43still returns an empty oc data frame.
  1526. 1:37:56So what we can do worst case is try to
  1527. 1:37:58look at the documentation
  1528. 1:38:01and when we go
  1529. 1:38:05to the info endpoint
  1530. 1:38:08uh
  1531. 1:38:13let's see how to retrieve the the
  1532. 1:38:15history
  1533. 1:38:22maybe because using today they tried 245
  1534. 1:38:2526
  1535. 1:38:27uh yeah that could uh be it in theory.
  1536. 1:38:31So let me try to uh run this fix one
  1537. 1:38:35more time and if not I'm going to maybe
  1538. 1:38:38look at the starting and ending dates or
  1539. 1:38:41I can just manually write the date for
  1540. 1:38:44example for
  1541. 1:38:48for that
  1542. 1:39:15All right, let's
  1543. 1:39:18apply the changes
  1544. 1:39:26and also Yeah.
  1545. 1:39:39Okay, so BTC apparently works.
  1546. 1:39:50So, so let's try to do BTC.
  1547. 1:39:54So,
  1548. 1:39:56yeah. So, that's interesting. So the OLC
  1549. 1:39:58data no
  1550. 1:40:02raw payload
  1551. 1:40:07actually this is quite interesting.
  1552. 1:40:11So we actually receive data here.
  1553. 1:40:18So actually it works but then when we
  1554. 1:40:20save the output guys you see like here's
  1555. 1:40:23the raw payload right? So we receive the
  1556. 1:40:26open high low close data but they're
  1557. 1:40:28just not getting saved properly.
  1558. 1:40:32So anyways I'm going to take a quick
  1559. 1:40:35bathroom breaks. I'll be back like in a
  1560. 1:40:37few minutes and then we can continue
  1561. 1:40:39from there. So just one Good.
  1562. 1:44:39All right, guys. Uh, I'm back now and
  1563. 1:44:44yeah, let's continue with uh
  1564. 1:44:52exporting the historical HLC data. So
  1565. 1:44:56um
  1566. 1:45:04so in both cases we're receiving the
  1567. 1:45:07payload here.
  1568. 1:45:13Let's see fetching symbol get OC history
  1569. 1:45:21and here we get the data.
  1570. 1:45:42Bro, I have a serious question. Why most
  1571. 1:45:44strategies and bots only get like max uh
  1572. 1:45:47ROI annually?
  1573. 1:45:54Uh 50 crazy is like super crazy. I don't
  1574. 1:45:57know what exactly what are you talking
  1575. 1:45:59about. Uh
  1576. 1:46:01and I I don't think most bots make 50%
  1577. 1:46:04in the in the first place. So
  1578. 1:46:08they have like some reference you know
  1579. 1:46:10or something like that because to be
  1580. 1:46:14honest 50% is is like great right when
  1581. 1:46:16you if you make that per year.
  1582. 1:46:22Okay. So, I think uh
  1583. 1:46:31so let's uh
  1584. 1:46:40so if you make 7% ROI monthly that's
  1585. 1:46:43great too. So I don't know like uh yeah
  1586. 1:46:46there's
  1587. 1:46:47not much to discuss to discuss in the
  1588. 1:46:51like in this case
  1589. 1:46:547% is great even 1% per month is great u
  1590. 1:46:58I think it's all about setting the
  1591. 1:47:00correct expectations S.
  1592. 1:47:23So here we have get OS history. Uh
  1593. 1:47:30so here we have the payload and then
  1594. 1:47:32here we return
  1595. 1:47:34the the data.
  1596. 1:47:41It should be fine.
  1597. 1:47:44And so in this
  1598. 1:48:05So in both cases we're receiving
  1599. 1:48:10the data. So I it's just about how we
  1600. 1:48:12save them or format them.
  1601. 1:48:28Okay, so this is interesting. So the
  1602. 1:48:30return function returns none. But when I
  1603. 1:48:32call get OS history, I get a payload
  1604. 1:48:36with the data. So the problem is
  1605. 1:48:39actually
  1606. 1:48:46uh with the return I tested the
  1607. 1:48:50output
  1608. 1:48:52of get OLC
  1609. 1:48:57history.
  1610. 1:48:59I see that data is
  1611. 1:49:04returned but the output is not. I assume
  1612. 1:49:09that it is an issue with the return
  1613. 1:49:17of the hyper liquid client class.
  1614. 1:49:41So
  1615. 1:49:46there's a better than CSV. It's called
  1616. 1:49:48tune or something. I forgot about it.
  1617. 1:49:49Handles that better. Yeah. So right now
  1618. 1:49:52just in CSV file just to you know save
  1619. 1:49:55the data and verify it myself. If you
  1620. 1:49:57have a large you know data sample or you
  1621. 1:49:59know data set of course a database is
  1622. 1:50:02better. But this is just a very fast way
  1623. 1:50:05to debug and verify the data or use for
  1624. 1:50:08like local development. So it should be
  1625. 1:50:12okay in such cases.
  1626. 1:50:30Great. So
  1627. 1:50:34cloth suggested some fix. So let's try
  1628. 1:50:37to apply that.
  1629. 1:50:54And so now let me run this. So now we
  1630. 1:50:58see that we have some output
  1631. 1:51:01here in OLC data. So this is the output
  1632. 1:51:06for
  1633. 1:51:08yeah.
  1634. 1:51:11So this is data frame that's
  1635. 1:51:13successfully saved. And
  1636. 1:51:17so now instead of like I can try to
  1637. 1:51:20query let me try to query one minute
  1638. 1:51:23data for the past 24 * 7 days and see if
  1639. 1:51:28we get some output.
  1640. 1:51:37Okay. So here we have our OLC data and
  1641. 1:51:40we try to export as much as we can. It
  1642. 1:51:43seems like it hyperlquid only returns
  1643. 1:51:45data for the past three days for the one
  1644. 1:51:48minute uh data frame. If I want longer
  1645. 1:51:50history then probably I would have to
  1646. 1:51:52look at some different data feed
  1647. 1:51:55providers. But for now uh let's just uh
  1648. 1:51:58use uh what we have. So finally at least
  1649. 1:52:04we're able to extract the data. And so
  1650. 1:52:09what I can do now is
  1651. 1:52:11in the analysis section uh I can tell
  1652. 1:52:15claude
  1653. 1:52:17and calculate uh
  1654. 1:52:23historical
  1655. 1:52:25spread
  1656. 1:52:27and b
  1657. 1:52:30compute the spread between
  1658. 1:52:34uh
  1659. 1:52:37XYZ silver
  1660. 1:52:40and XA XY silver on Hyper Liquid and X
  1661. 1:52:46AG USD on Meta Trader 5. Use one minute
  1662. 1:52:54historical
  1663. 1:52:57HLC data for the
  1664. 1:53:02to run the analysis.
  1665. 1:53:06So now I tell clot to you know go to
  1666. 1:53:08this file calculate historical spread to
  1667. 1:53:11uh yeah use our uh function that we've
  1668. 1:53:16created in hyperlquid so it can extract
  1669. 1:53:19historical OLC data and then I'm
  1670. 1:53:21connecting to my Metatrader 5 account
  1671. 1:53:24and so on this platform what I can do is
  1672. 1:53:26I can like extract OSC data from this
  1673. 1:53:29provider and so what I'm going to do now
  1674. 1:53:31is I'm going to combine these two data
  1675. 1:53:33frames and then comput the historical
  1676. 1:53:35spread and then you guys mentioned like
  1677. 1:53:38can we compute a Z score and like
  1678. 1:53:39compute the levels. Yes, now we can
  1679. 1:53:41actually do that and then uh we can like
  1680. 1:53:44try to you know set the entry and exit
  1681. 1:53:46levels for our strategy.
  1682. 1:54:23So now we're just uh waiting for clots
  1683. 1:54:26to compute a spread uh in our Jupyter
  1684. 1:54:28notebook and uh
  1685. 1:54:32hopefully
  1686. 1:54:34there will be no errors.
  1687. 1:54:48Okay. So now it's suggested to you know
  1688. 1:54:53suggested some code in our notebook. So
  1689. 1:54:55we can try to run this now and uh let's
  1690. 1:55:00see what the output is. AB1212 hello
  1691. 1:55:03nice to be on stream. Hi.
  1692. 1:55:06So far CL everything's fine.
  1693. 1:55:17And so here now we have our
  1694. 1:55:27things that we need. So,
  1695. 1:55:35so let's let's run this notebook and see
  1696. 1:55:39if
  1697. 1:55:43it is able to extract the historical
  1698. 1:55:45data. So, again, we're taking the
  1699. 1:55:47historical OLC data, so the price on
  1700. 1:55:50Hyperlquid, and we're comparing that
  1701. 1:55:53with XAGUSD on FD5. And like we can run
  1702. 1:55:56that for any symbol between hyperlquid
  1703. 1:55:59MT5. So it doesn't have to be silver.
  1704. 1:56:01And then so if that works we can also
  1705. 1:56:05have a look at other assets and then
  1706. 1:56:07once that is done we can then try to you
  1707. 1:56:09know look for assets that have a high
  1708. 1:56:12standard deviation which means we can
  1709. 1:56:13try to make money on the price
  1710. 1:56:15discrepancies. And um let's see. I think
  1711. 1:56:20one problem I have right now is that uh
  1712. 1:56:23we still need to install Jupiter server
  1713. 1:56:25which I don't have in this project right
  1714. 1:56:27now. So let's just uh wait until it's
  1715. 1:56:30installed and then uh we can then try to
  1716. 1:56:35uh run our Jupyter notebook.
  1717. 1:57:04Okay. So now our packages have been
  1718. 1:57:08installed. So uh I think we can try to
  1719. 1:57:12run this now hopefully.
  1720. 1:57:34Okay, everything works. It just seems
  1721. 1:57:36that our initialized function for MT5
  1722. 1:57:39doesn't work. Uh let me try
  1723. 1:57:45uh
  1724. 1:57:49to ignore the MT5 path for now and just
  1725. 1:57:52uh
  1726. 1:57:54call normal initialize without any
  1727. 1:57:57parameters.
  1728. 1:58:01So that should start up our platform
  1729. 1:58:03which now we see that it works and here
  1730. 1:58:06we are now joining
  1731. 1:58:10the data.
  1732. 1:58:15Okay, it seems that maybe there is
  1733. 1:58:21let's have a look at price. I think
  1734. 1:58:22something's a bit wrong. So
  1735. 1:58:26you have XYZ sell from X and X AG USD.
  1736. 1:58:30Let's try like 72 hours maybe.
  1737. 1:58:40I think maybe there is like some uh time
  1738. 1:58:43offset probably
  1739. 1:58:46that uh
  1740. 1:58:50could be it.
  1741. 1:58:55Right.
  1742. 1:59:02I feel like yes, this is 1018 and this
  1743. 1:59:05is 7. Uh MT5 is 3 hours ahead of
  1744. 1:59:09hyperlquid.
  1745. 1:59:11Uh
  1746. 1:59:15MT5 OLC price is 3 hours ahead of
  1747. 1:59:21Hyperlid.
  1748. 1:59:22Can you adjust the time zone offset?
  1749. 1:59:35It's an unre question, boss, but how
  1750. 1:59:36much do you think the average trader
  1751. 1:59:37needs to retire and live comfortably? I
  1752. 1:59:39know it depends on the person. So, uh,
  1753. 1:59:42what about you?
  1754. 1:59:45So I think in trading you have you know
  1755. 1:59:49your
  1756. 1:59:51like everyday spending right so you need
  1757. 1:59:53to pay rent food entertainment stuff
  1758. 1:59:55like that so if you for example spend
  1759. 1:59:59between 1 or 2,000 euro per month right
  1760. 2:00:02which u in the western world most people
  1761. 2:00:05do and earn per month then I think in
  1762. 2:00:08trading it's
  1763. 2:00:10like safe to at least
  1764. 2:00:14have at least like double the amount,
  1765. 2:00:16right? So, if you you know spend 2,000,
  1766. 2:00:19maybe you want to like make 4,000 per
  1767. 2:00:21month, which means that you your annual
  1768. 2:00:24like uh income from trading should be
  1769. 2:00:27around 50 or 60,000 uh euro. And
  1770. 2:00:31in trading, it's also not guaranteed,
  1771. 2:00:33right? There's the risk factor that your
  1772. 2:00:35strategies will not working, especially
  1773. 2:00:36for like a manual trader or like a swing
  1774. 2:00:39trader. when it comes like to arbitrage
  1775. 2:00:41trading the profits are a little bit
  1776. 2:00:43more consistent but then again like the
  1777. 2:00:45liquidity on exchanges or or the
  1778. 2:00:47competition may like change over time.
  1779. 2:00:50So I think uh in trading I would say you
  1780. 2:00:53need to make at least like double the
  1781. 2:00:55amount of what you spend because then
  1782. 2:00:57you can like reinvest your profits make
  1783. 2:00:59make your account grow because in
  1784. 2:01:00trading it's also like tough to trade if
  1785. 2:01:02you're always like break even every
  1786. 2:01:04month after all your expenses. So I
  1787. 2:01:09think that's my answer and uh how much
  1788. 2:01:12money you need to make is then like
  1789. 2:01:14relative to the size because then you
  1790. 2:01:16cannot you know afford to overleverage
  1791. 2:01:19right because when your capital is low
  1792. 2:01:21and your expenses are high then you are
  1793. 2:01:24more inclined to you know risk a lot
  1794. 2:01:26which then is better your psychology
  1795. 2:01:27because then when you have a draw down
  1796. 2:01:29or a bad period it actually is going
  1797. 2:01:32quite against you. So yeah, that's my
  1798. 2:01:35answer to this to this question.
  1799. 2:01:39Okay. Um
  1800. 2:01:41let's apply these changes.
  1801. 2:01:47any preference strats look at in crypto
  1802. 2:01:49trading with small capital like 10 or
  1803. 2:01:5120k like personally uh I think having a
  1804. 2:01:55small capital can be a big advantage in
  1805. 2:01:57trading when it comes like to market
  1806. 2:01:59making right or arbitrage trading
  1807. 2:02:02because uh for example the big players
  1808. 2:02:04the banks the big hedge funds
  1809. 2:02:06institutions they have lots of money so
  1810. 2:02:09uh their strategies with a big capital
  1811. 2:02:12might not be that viable on assets where
  1812. 2:02:16liquidity is Oh, because if you add
  1813. 2:02:18liquidity to a market where there are
  1814. 2:02:20not many traders, you are not maximizing
  1815. 2:02:23your capital. But luckily on hyperlquid
  1816. 2:02:27what you have is for example very low
  1817. 2:02:29liquidity assets. Let's go for example
  1818. 2:02:32to the deployer Felix and for example
  1819. 2:02:34here if you look at let's say silver
  1820. 2:02:37USDH right here the current funding rate
  1821. 2:02:41is minus 58%. Which is amazing. You
  1822. 2:02:44could buy silver USDH right now
  1823. 2:02:47and sell silver on MT5 and make a
  1824. 2:02:51profit. You know what guys? I'm going to
  1825. 2:02:52do this. I'm going to place a manual
  1826. 2:02:54trade and prove to you that I'm going to
  1827. 2:02:56make money by the end of the stream or
  1828. 2:02:58tomorrow.
  1829. 2:02:59Okay? So, watch me. I'm going to uh so
  1830. 2:03:04on silver USD, if you look at the price
  1831. 2:03:06of silver right now, it's 77.6 on
  1832. 2:03:08hyperlquid and on MT5 it's 77.6. 62
  1833. 2:03:1577. Okay, now
  1834. 2:03:19the price is evening out, right? As was
  1835. 2:03:22I was trying to explain something. 77.62
  1836. 2:03:2877.62.
  1837. 2:03:29Right now it's the same. Let's try
  1838. 2:03:31something else. Let's look at
  1839. 2:03:35some of the funny rates. USA 100 USDH.
  1840. 2:03:41This one might work but the spread is
  1841. 2:03:42high.
  1842. 2:03:4675 is a good second venue. Yes, correct.
  1843. 2:03:49So just I want what I want to tell you
  1844. 2:03:52is uh yeah when your capital is low you
  1845. 2:03:55can try to apply strategies on markets
  1846. 2:03:58where the liquidity is also low and so
  1847. 2:04:00your return or your capital efficiency
  1848. 2:04:02is much higher on these markets. So I'm
  1849. 2:04:06now just browsing uh through some
  1850. 2:04:08markets to show you know some good
  1851. 2:04:11examples where we can try to do a manual
  1852. 2:04:13hedge. So we're going to like manually
  1853. 2:04:16trade the arbitrage strategy.
  1854. 2:04:18So here we see GBP USDC has a current
  1855. 2:04:22funding rate of - 59%. Here the price is
  1856. 2:04:251.35
  1857. 2:04:30and if you look at GBP USD on MP5 it's
  1858. 2:04:341.350
  1859. 2:04:371.3
  1860. 2:04:40right so we could
  1861. 2:04:44try to buy like at 1.35
  1862. 2:04:50I would have to add liquidity at the
  1863. 2:04:52order so look at you have like bit at
  1864. 2:04:541.347,
  1865. 2:04:56right? Let me whip out the calculator.
  1866. 2:04:59We have a bit at 1.347
  1867. 2:05:04and the current MT5 price is 1.35.
  1868. 2:05:13So, right now the price difference
  1869. 2:05:16between Hyperliquid and MT5 is 0.003,
  1870. 2:05:18003 which what might not sound like a
  1871. 2:05:21lot but we're talking about forex right
  1872. 2:05:23in forex the contract size is computed
  1873. 2:05:26in lots so for example if you have like
  1874. 2:05:30100,000
  1875. 2:05:32uh in liquidity right because we are
  1876. 2:05:35talking about leverage assets one lot on
  1877. 2:05:38GBPUSD would make you 300 US dollars
  1878. 2:05:41assuming you get filled$100,000 and
  1879. 2:05:43because the leverage is so high on forex
  1880. 2:05:45right you have 50 to1 leverage on
  1881. 2:05:47hyperlquid
  1882. 2:05:48And CFD brokers they give you 1 to 30, 1
  1883. 2:05:51to 50, 1 to 100. You can easily compete
  1884. 2:05:55at this price, right? So here, even
  1885. 2:05:57though liquidity is low, you guys can
  1886. 2:06:00put your bids on top of book here and
  1887. 2:06:02try to increase like improve the
  1888. 2:06:06liquidity by adding the orders here and
  1889. 2:06:07then you'll get rewarded uh easily. Also
  1890. 2:06:11another thing is that there is this
  1891. 2:06:12funding rate mechanism which means that
  1892. 2:06:16uh when the price is quite low right uh
  1893. 2:06:22we will also make money on the funding
  1894. 2:06:24rate because when the funding rate is
  1895. 2:06:26negative long positions make money and
  1896. 2:06:30so right now uh it's 1.3512
  1897. 2:06:35there is 1,000 GBP available
  1898. 2:06:44and we have 1.35. I'm going to try to
  1899. 2:06:47get filled. So guys, uh the difference
  1900. 2:06:50between like um being a market maker,
  1901. 2:06:53market taker is the one that if I place
  1902. 2:06:56my bid here, it's not guaranteed to get
  1903. 2:06:59filled, right? It's not guaranteed to
  1904. 2:07:01get filled. And so
  1905. 2:07:04in order to like show you right now, I
  1906. 2:07:06would have to like buy at 1.35,
  1907. 2:07:09right? Or I can try to place a limit
  1908. 2:07:11order 1.348,
  1909. 2:07:13for example, compete at top of book, get
  1910. 2:07:15filled, and hedge this position with
  1911. 2:07:17MT5.
  1912. 2:07:19And this is like what I'm trying to
  1913. 2:07:20achieve. I'm trying to create a script
  1914. 2:07:23that takes a current market price,
  1915. 2:07:25quotes the bit price here, then I sell
  1916. 2:07:27on MT5, and then I will make money on
  1917. 2:07:29the spread and the funding rates. So
  1918. 2:07:31this is an example and be and to answer
  1919. 2:07:34your question uh if your capital is low
  1920. 2:07:38then these are strats that you should be
  1921. 2:07:39looking for strats where the market is
  1922. 2:07:43not very competitive because with low
  1923. 2:07:45capital you don't need you know to
  1924. 2:07:48compete with other big market makers and
  1925. 2:07:50this is like what we're going to focus
  1926. 2:07:52on when we try to run the arbitrage
  1927. 2:07:56strategies right so for example if I
  1928. 2:07:58have an account with $100,000 right So,
  1929. 2:08:01it's a basically a big capital. I would
  1930. 2:08:04not be able to trade this strategy in
  1931. 2:08:06GBB USD because a daily volume
  1932. 2:08:10on this symbol is $100,000 uh US
  1933. 2:08:12dollars. I would never get filled,
  1934. 2:08:14right? my 100K account uh would ideally
  1935. 2:08:18want to open a position that's for
  1936. 2:08:20example a million dollars or even like
  1937. 2:08:22$3 million because again the point of
  1938. 2:08:25this arbitrage is to utilize leverage
  1939. 2:08:33so yeah um
  1940. 2:08:41so let's now get back to
  1941. 2:08:47yeah exporting the OC data.
  1942. 2:08:50So I will rerun the code now. So there
  1943. 2:08:54was like this time zone offset and then
  1944. 2:08:57you can continue.
  1945. 2:09:05Be right back.
  1946. 2:09:40All right. Um,
  1947. 2:09:43so great question. So, we're going to
  1948. 2:09:45maybe also look at liquidity, right?
  1949. 2:09:47This is what traders don't look at very
  1950. 2:09:49often. Um, so what strategies are
  1951. 2:09:53suitable for lowly capitalized accounts
  1952. 2:09:55and what strategies are good for highly
  1953. 2:09:57capitalized accounts? And so traders who
  1954. 2:10:00have low amount capital should actually
  1955. 2:10:03have a higher return than traders with a
  1956. 2:10:06bigger capital. And it does make sense,
  1957. 2:10:08right? So you can look for these
  1958. 2:10:10opportunities on those low liquidity
  1959. 2:10:12markets and make good money. So this is
  1960. 2:10:16will actually help you to like kickstart
  1961. 2:10:18a small account into a reasonably sized
  1962. 2:10:21account.
  1963. 2:10:28Okay. So, I reran the script. Uh,
  1964. 2:10:33uh, I think Claude did not adjust time
  1965. 2:10:37zone offset or maybe let me run the
  1966. 2:10:39scripts one more time.
  1967. 2:10:42So, here we're going to export prices
  1968. 2:10:45from
  1969. 2:10:47hyperlquid,
  1970. 2:10:49then from MT5.
  1971. 2:10:54How are you accounting for funding rate,
  1972. 2:10:55spread, slippage, etc.? uh unless you uh
  1973. 2:10:59unless you're a maker.
  1974. 2:11:01So uh again, so we're doing like market
  1975. 2:11:04making on hyperlquid side. So we're
  1976. 2:11:06adding liquidity. So we're going to
  1977. 2:11:08always send maker orders and then we're
  1978. 2:11:10going to hedge the trade on MT5, right?
  1979. 2:11:14And so to account for the funding rates,
  1980. 2:11:17the funding rates in most cases will be
  1981. 2:11:19in our favor because when hyperl prices
  1982. 2:11:22are undervalued relative to you know
  1983. 2:11:26uh the real market price, the funding
  1984. 2:11:29rate for long positions will be in our
  1985. 2:11:31favor. So we will also make not money on
  1986. 2:11:34the spread but we'll make money on the
  1987. 2:11:36funding rates. So in reality the outcome
  1988. 2:11:39of our arbitrage
  1989. 2:11:42will be actually better because we're
  1990. 2:11:44having two types of edge which is a
  1991. 2:11:45funding rate and the spread and as you
  1992. 2:11:48said uh so the spread because we're
  1993. 2:11:50market making it means we're making
  1994. 2:11:52money on the spread on hyperlquid side.
  1995. 2:11:54So the pricing on hyperlquid is in our
  1996. 2:11:57favor and then we're paying the spread
  1997. 2:11:59and the commissions right on MT5 site.
  1998. 2:12:01So one exchange spread would offset the
  1999. 2:12:05spread on another one. So overall we're
  2000. 2:12:09just looking for a good price fill and
  2001. 2:12:10slippage is always like a risk uh for
  2002. 2:12:13us. So we can always um you know have
  2003. 2:12:16slippage, execution risk, uh maybe some
  2004. 2:12:20like connection risk. Sometimes you know
  2005. 2:12:22my broker gave me like a six second
  2006. 2:12:25execution delay. I was like very
  2007. 2:12:27disappointed but it can happen. So there
  2008. 2:12:30is also like risk on the execution side
  2009. 2:12:32on both platforms.
  2010. 2:12:41[clears throat]
  2011. 2:12:42Okay. So it rewrote my I think okay yeah
  2012. 2:12:48this is fine.
  2013. 2:12:54So this is amazing guys. So now we were
  2014. 2:12:56able to extract the historical prices
  2015. 2:12:58from Hyper Hyperlquid NFTt5 and so this
  2016. 2:13:01is the data for today right? So here we
  2017. 2:13:04can see the historical OLC prices on
  2018. 2:13:07hyperl5
  2019. 2:13:09again this is just a one minute snapshot
  2020. 2:13:11so the data is not like fully accurate.
  2021. 2:13:14If you want to have like a fully
  2022. 2:13:15accurate um price monitoring system we
  2023. 2:13:18would for example save one minute
  2024. 2:13:20snapshots of the top of book and then
  2025. 2:13:22compare them. But for like general
  2026. 2:13:25qualitative analysis uh
  2027. 2:13:29we see that uh
  2028. 2:13:33when we look at the spread this is the
  2029. 2:13:35difference right now right so right now
  2030. 2:13:37for example you can see is that the
  2031. 2:13:39spread between hyperlquid and FT5 is
  2032. 2:13:42like between 0.1 and zero so as a rule
  2033. 2:13:47of thumb when
  2034. 2:13:50uh when the price is above zero Right?
  2035. 2:13:53We can look for short opportunities. So
  2036. 2:13:56we would short hyperlquid asset and long
  2037. 2:14:00the MT5 asset. And when the spread is
  2038. 2:14:03below zero, right, this just short
  2039. 2:14:06spike, but maybe we could have trade
  2040. 2:14:07that too. When the spread is below zero,
  2041. 2:14:09we can look for buy opportunities. So we
  2042. 2:14:12could buy uh on Hyperlquid and sell on
  2043. 2:14:16MT5. And then again, what are the
  2044. 2:14:18funding rates? they would be usually in
  2045. 2:14:19our favor because
  2046. 2:14:22the funding rate mechanisms on
  2047. 2:14:24hyperlquid encourage like market
  2048. 2:14:26balance. So we'll also get rewarded for
  2049. 2:14:28that
  2050. 2:14:30free skill strategy like that quickly.
  2051. 2:14:34Well guys, you always like come to my
  2052. 2:14:36stream and tell me like fees kill this,
  2053. 2:14:38it doesn't work. How about we just
  2054. 2:14:41finish this and then let's look at the
  2055. 2:14:43fees if they actually kill the strategy
  2056. 2:14:45or not. Right? Because the assumption
  2057. 2:14:47that something doesn't work because just
  2058. 2:14:49saying fee skill or strategy already
  2059. 2:14:54creates like a wall that you will never
  2060. 2:14:57even attempt to explore it right and
  2061. 2:15:02so again what are the fees right instead
  2062. 2:15:04of saying fees will kill the strategy
  2063. 2:15:07what are the fees on hyperlquid and so
  2064. 2:15:10for example if you look at
  2065. 2:15:12the S&P 500 right US USDC.
  2066. 2:15:18So right now the market price on the
  2067. 2:15:20SP500 USDC index is 7,542.
  2068. 2:15:27What are the fees? They are 0.003%.
  2069. 2:15:31Right? So it's time 0.00
  2070. 2:15:35times
  2071. 2:15:36003 because we're in percentages. And so
  2072. 2:15:40the commission on one side on hyperlquid
  2073. 2:15:44for SB500 is 20 cents. All right. If you
  2074. 2:15:48multiply it by two because it's a round
  2075. 2:15:51turn, we pay 45 cents. Okay. And so
  2076. 2:15:55let's try to run the analysis
  2077. 2:15:58on XYZ SP 500 and US 500.
  2078. 2:16:07So my tip to you guys is don't assume
  2079. 2:16:10that things don't work. And even if
  2080. 2:16:11you're like 99% right, right?
  2081. 2:16:15If you keep digging and keep looking for
  2082. 2:16:17these arbitrage opportunities, one day
  2083. 2:16:18you'll find something that actually
  2084. 2:16:20works. And then
  2085. 2:16:23uh you'll find out, oh maybe I should
  2086. 2:16:26have checked out, right? Because you
  2087. 2:16:27never know what opportunities lie ahead
  2088. 2:16:29of you. And so as I said the spread on
  2089. 2:16:32SP500 hyperlquid right ranges today
  2090. 2:16:36between minus 1.4 and let's say 2.3
  2091. 2:16:40right it's a range of $3 US and so I
  2092. 2:16:44told you on hyperlquid the fee is 45. So
  2093. 2:16:47if you capture $2 you pay4 cents in
  2094. 2:16:51commissions you're left with $1.5
  2095. 2:16:54profit. Maybe also pay something on FT5,
  2096. 2:16:57right? What is the spread on US 500?
  2097. 2:17:02The spread here is 50 cents. Right? So
  2098. 2:17:06even with all the spread commission so
  2099. 2:17:08on by doing simple calculations and
  2100. 2:17:10mathematics uh in theory
  2101. 2:17:13this strategy should profit. So if I
  2102. 2:17:15write a strategy that always enters at
  2103. 2:17:18short 2.0 zero, right? And exits at
  2104. 2:17:20zero, I will pay one, let's say, worst
  2105. 2:17:23case scenario, and I will make $1 on the
  2106. 2:17:27spread. And sometimes the spread can be
  2107. 2:17:29can spike like up to three or four,
  2108. 2:17:31right? This is just today. And for
  2109. 2:17:34example, last weekend the spread was
  2110. 2:17:35even as low as - 6. All right.
  2111. 2:17:40So now we're getting like into more the
  2112. 2:17:42analysis why the strategy works. And now
  2113. 2:17:46all we need to do is for example write a
  2114. 2:17:47script buy at minus 4 or sell at two for
  2115. 2:17:51example. Uh okay let's go to the uh
  2116. 2:17:55other questions. Have you ever used meta
  2117. 2:17:57API? Uh
  2118. 2:18:00no. You mean like Metatrader API? I I'm
  2119. 2:18:03using like the Python integration for
  2120. 2:18:04MetaTrader 5. Um but right now uh so
  2121. 2:18:08right now I'm showing you an example MT5
  2122. 2:18:10but I am uh in communication with a
  2123. 2:18:13brokerage that offers CFD trading. So
  2124. 2:18:15all the assets that use MT5 through a
  2125. 2:18:18websocket uh interface, right? So I will
  2126. 2:18:20also have like a websocket API for CFDs
  2127. 2:18:24where I can run this not on a Windows
  2128. 2:18:27machine but for example in a Linux
  2129. 2:18:29cloud. And in general I prefer
  2130. 2:18:32websockets over over REST or like MT5
  2131. 2:18:37Python integration.
  2132. 2:18:42Also exchanges don't pay out every 1
  2133. 2:18:44hour anymore. I think funding is every
  2134. 2:18:46eight hours
  2135. 2:18:48guys. again like you have not you like
  2136. 2:18:52I'm sorry index fader like um this is
  2137. 2:18:55not trying to hate but more like advice
  2138. 2:18:58don't assume that something is a certain
  2139. 2:19:01way because obviously on hyperlquid the
  2140. 2:19:04funding rate is charged every hour right
  2141. 2:19:08so I think it's all about making good
  2142. 2:19:10research not having assumptions that
  2143. 2:19:12actually block you in creating like
  2144. 2:19:16profitable trading strategies because
  2145. 2:19:17with that mindset it's very difficult to
  2146. 2:19:21actually build something profitable.
  2147. 2:19:24So yeah
  2148. 2:19:27uh yeah hello hello sir hi welcome to
  2149. 2:19:30the stream HFD trading you could be
  2150. 2:19:32slaughtered for sure in fees when big
  2151. 2:19:34capital because you would h risk okay um
  2152. 2:19:40did you try lighter um
  2153. 2:19:43okay
  2154. 2:19:46unfortunately these are not the real
  2155. 2:19:48market making strategies I know he keeps
  2156. 2:19:50saying that but that's not the way it is
  2157. 2:19:52uh maybe we can come to the topic what
  2158. 2:19:54is Market making guys like market making
  2159. 2:19:58is just adding liquidity to the order
  2160. 2:20:02book. It's allowing other participants
  2161. 2:20:05on the exchange to get a price fill at
  2162. 2:20:08any point in time. So what we can do is
  2163. 2:20:11we just add our resting limit orders for
  2164. 2:20:14our participants to buy at a certain
  2165. 2:20:16price and that essentially is market.
  2166. 2:20:20Maybe what index fader is referring to
  2167. 2:20:22market making is like providing a
  2168. 2:20:24constant bided ass spread 24/7
  2169. 2:20:27which is like what most people assume
  2170. 2:20:29but on the most basic level market
  2171. 2:20:32making is just providing liquidity to
  2172. 2:20:35the orbook and that's all and how you do
  2173. 2:20:39it it's like uh you know up to a person
  2174. 2:20:43who who does it.
  2175. 2:20:45So okay. So this was like in our
  2176. 2:20:48discussion round and um
  2177. 2:20:53so finally I was able to show you the
  2178. 2:20:56spread by exporting the history data
  2179. 2:20:59from MT5 and hyperlquid and let's now
  2180. 2:21:04proceed with
  2181. 2:21:07writing the code.
  2182. 2:21:09So let's go back to our hyperlquid
  2183. 2:21:12client and um
  2184. 2:21:18so we have positions, we have orders, we
  2185. 2:21:20have market data. Now we need to
  2186. 2:21:23implement
  2187. 2:21:25uh trading endpoints. So send market
  2188. 2:21:28order, limit order, cancel or amend
  2189. 2:21:30order. So we're going to uh add these
  2190. 2:21:34order types.
  2191. 2:21:52Okay.
  2192. 2:21:55So, let's now continue with uh
  2193. 2:22:03the trading endpoints.
  2194. 2:22:08So in trading there are always uh
  2195. 2:22:13like uh two types for us right there are
  2196. 2:22:16market orders and there are limit
  2197. 2:22:17orders. So market order we are not going
  2198. 2:22:20to be using them because we just want to
  2199. 2:22:22add liquidity to the order book
  2200. 2:22:26and uh
  2201. 2:22:30so that's it. So
  2202. 2:22:33define but I'm still going to implement
  2203. 2:22:35all the functions. So
  2204. 2:22:37uh define send market order, right? Then
  2205. 2:22:43we're going to create define send limit
  2206. 2:22:46order.
  2207. 2:22:51Uh we will also need to provide the
  2208. 2:22:54symbol.
  2209. 2:22:57So the symbol
  2210. 2:23:00uh the side which is buy or sell and
  2211. 2:23:02then we add the volume
  2212. 2:23:04and then we add the time in force right
  2213. 2:23:08time in force means like fill or fill or
  2214. 2:23:10kill immediate or cancel and and so on.
  2215. 2:23:13And for limit orders we add symbol side.
  2216. 2:23:17Oh so like amount right how much we want
  2217. 2:23:19to buy or sell. For limit orders, we
  2218. 2:23:22want to provide the price uh
  2219. 2:23:26and again time and force
  2220. 2:23:32and then next uh I want to add a
  2221. 2:23:35function called uh amend order which
  2222. 2:23:38will update our limit order. So here I
  2223. 2:23:41think we need just need to provide the
  2224. 2:23:43order ID and then the new amount and
  2225. 2:23:46then the new price right to amend our
  2226. 2:23:51existing limit order.
  2227. 2:23:53And then we want to do define cancel
  2228. 2:23:55order
  2229. 2:23:57uh
  2230. 2:23:59which cancels our order. And then the
  2231. 2:24:01last one maybe this is like for a kill
  2232. 2:24:03switch define cancel all orders. Right?
  2233. 2:24:07So here these are our trading endpoints
  2234. 2:24:09that we're going to implement and once
  2235. 2:24:11that is done we can start writing our
  2236. 2:24:15actual trading strategy.
  2237. 2:24:18Uh in a market making strategy you'd be
  2238. 2:24:21hedge also you'd be fulfilling trades at
  2239. 2:24:23near light speed depending okay
  2240. 2:24:26guys I think I'm going to mute index
  2241. 2:24:28fader because it's actually disrupting
  2242. 2:24:30the chat. It's not like I don't want to
  2243. 2:24:32argue with him, but I want, you know, to
  2244. 2:24:35focus on the main power of strategy and
  2245. 2:24:38it's not arguing what marketmaking is.
  2246. 2:24:42Uh the point of today's live stream is
  2247. 2:24:45to create a profitable trading bot
  2248. 2:24:47between hyperlquid MT5 and whether you
  2249. 2:24:50call it market making or not uh you can
  2250. 2:24:53open a Reddit post and discuss it there.
  2251. 2:24:55So,
  2252. 2:24:57so I'm just going to focus on that. So
  2253. 2:25:00index fader sorry if you keep uh talking
  2254. 2:25:04about what market making is uh we can
  2255. 2:25:08create like a separate discussion
  2256. 2:25:09channel for that later.
  2257. 2:25:16Okay. Um
  2258. 2:25:21so let's go back to cloth and uh please
  2259. 2:25:25implement
  2260. 2:25:27trading uh endpoints
  2261. 2:25:31in hyperlquid client
  2262. 2:25:38using websockets.
  2263. 2:25:48Uh
  2264. 2:25:56please uh return the order result
  2265. 2:26:06for each function.
  2266. 2:26:12So here are training endpoints. I'm just
  2267. 2:26:14going to specify exactly what these end
  2268. 2:26:17points are.
  2269. 2:26:19So it's this,
  2270. 2:26:23this,
  2271. 2:26:25this, and that.
  2272. 2:26:47Why don't you use whisper flow to speak
  2273. 2:26:48in the input? Is it um
  2274. 2:26:52like voice to AI interpreter or
  2275. 2:26:55something like
  2276. 2:26:58or Yeah, I've never tried that. So far,
  2277. 2:27:00I'm just prompting with my keyboard. So
  2278. 2:27:02I assume you're mentioning that.
  2279. 2:27:22Okay. So now uh what I told Claude is to
  2280. 2:27:26implement the training functions for all
  2281. 2:27:28of these uh order types. uh they're all
  2282. 2:27:31going to use websockets, you know, for
  2283. 2:27:34uh best latency possible. And then I ask
  2284. 2:27:36clot to return the order result and
  2285. 2:27:38update open orders. Or maybe I didn't
  2286. 2:27:42tell it to update open orders.
  2287. 2:27:45I'll try to
  2288. 2:27:54Okay. So
  2289. 2:28:07we need to use hyper liquidizer for
  2290. 2:28:09signing. Okay, let's use this library
  2291. 2:28:12to so how it works is that uh
  2292. 2:28:17all the data that you see on hyperlquid
  2293. 2:28:20like this one you don't need an API key
  2294. 2:28:24actually right all you need to provide
  2295. 2:28:26is just the uh wallet address so in
  2296. 2:28:29theory because like everything is
  2297. 2:28:31running on the blockchain it's all
  2298. 2:28:33publicly verifiable
  2299. 2:28:35and so if you guys gave me not the
  2300. 2:28:38wallet secret but just the wallet
  2301. 2:28:40address, right? For examp, if I send you
  2302. 2:28:42money with crypto, I would you would
  2303. 2:28:43give me your wallet address. I can look
  2304. 2:28:45up all your trades, transactions, and
  2305. 2:28:48like your entire account uh on the
  2306. 2:28:52blockchain. And so therefore,
  2307. 2:28:55uh what we have here is that when we
  2308. 2:28:57start sending orders, we are now using
  2309. 2:29:00our API key to sign these messages. And
  2310. 2:29:03the signing actually is a security uh
  2311. 2:29:06feature to actually
  2312. 2:29:09prove that we are the owner on holder of
  2313. 2:29:11the account or basically the API key.
  2314. 2:29:26And
  2315. 2:29:31so now uh yeah,
  2316. 2:29:39I'm a bit confused if it's still
  2317. 2:29:42running.
  2318. 2:29:47Right here we have
  2319. 2:29:55Yeah. So Cloud is actually still
  2320. 2:29:57thinking. So right now Cloud's been
  2321. 2:29:59running for over three 3 minutes now and
  2322. 2:30:04it should be fine.
  2323. 2:30:25So while Claude is thinking,
  2324. 2:30:30let's have a look at, you know, maybe
  2325. 2:30:33today we still might have time to find
  2326. 2:30:36some trading opportunities.
  2327. 2:30:38So I will try to like open the hedge
  2328. 2:30:41ideally before the stream ends. So right
  2329. 2:30:44now here the funding rate on surdh is 20
  2330. 2:30:47minus 285% 77.43
  2331. 2:30:55x 77.42.
  2332. 2:31:02So here the spread is like quite high.
  2333. 2:31:04So in theory, we could, you know, maybe
  2334. 2:31:06try to find an opportunity on this asset
  2335. 2:31:10or maybe if you look at XYZ,
  2336. 2:31:18Brent oil
  2337. 2:31:21in theory, you could also like we could
  2338. 2:31:23like try Brent oil.
  2339. 2:31:25So yeah, let's see if cloth is done.
  2340. 2:31:28Nice.
  2341. 2:31:44Hi too. From your experience, how many
  2342. 2:31:46project strategies do you have max at
  2343. 2:31:48the same time? So me personally, I don't
  2344. 2:31:50like to complicate things. I just like
  2345. 2:31:52to focus on like one main strategy. But
  2346. 2:31:55the one main strategy doesn't mean that
  2347. 2:31:57I'm just trading this asset and this
  2348. 2:31:59symbol. So what I mean by that is that I
  2349. 2:32:02would for example put 90% or 80% of my
  2350. 2:32:05entire capital allocation into this one
  2351. 2:32:08strategy and then use the remaining
  2352. 2:32:10funds to play around and research like
  2353. 2:32:12other strategies and markets. So it's
  2354. 2:32:14always like always trying to look at the
  2355. 2:32:16best opportunities
  2356. 2:32:18at the current moment. And
  2357. 2:32:22so another approach you could have is
  2358. 2:32:24like you could split like your
  2359. 2:32:26strategies into three, four, five and
  2360. 2:32:28like distribute all the cap equally. But
  2361. 2:32:31for me that's like more administrative
  2362. 2:32:33stress and like uh like more workload.
  2363. 2:32:36So I was thinking like okay why not just
  2364. 2:32:39focus on one single strategy and try to
  2365. 2:32:42like optimize the results for this
  2366. 2:32:44single strategy.
  2367. 2:32:48So to summarize, I put most of my money
  2368. 2:32:50into one single strategy and like with
  2369. 2:32:53the remaining money I have, I like
  2370. 2:32:55research, experiment and try to find
  2371. 2:32:57like new different strategies more like
  2372. 2:32:59a backup, right? Always try to have a
  2373. 2:33:00backup when your main strategy stops
  2374. 2:33:03performing well.
  2375. 2:33:05Is it possible download historical bit
  2376. 2:33:07ask prices in MT5 terminal? Yes, it is.
  2377. 2:33:10You can extract the tick data that you
  2378. 2:33:12see on MT5
  2379. 2:33:14and you can use them for like more in
  2380. 2:33:17detail analysis. In fact, I can show you
  2381. 2:33:20like right now how to do it because
  2382. 2:33:21right now I have my notebook open. And
  2383. 2:33:24here if you call MT5 copy tick range,
  2384. 2:33:29right? And for example, if you want the
  2385. 2:33:30historic price on silver, you can
  2386. 2:33:33provide um
  2387. 2:33:37for example
  2388. 2:33:38datetime now minus time delta.
  2389. 2:33:45Uh so this is the start um
  2390. 2:33:49this is a start date time and then we
  2391. 2:33:52can take the current date time right and
  2392. 2:33:55then
  2393. 2:33:58you provide a flag copy takes all which
  2394. 2:34:00means I just I want to get all the text
  2395. 2:34:04from MT5. So
  2396. 2:34:07this is just to answer your quick
  2397. 2:34:10question. Uh
  2398. 2:34:14hopefully I wrote it correctly.
  2399. 2:34:19Copy text range. Um
  2400. 2:34:24date from date to.
  2401. 2:34:32Let me also call MT5.initialize
  2402. 2:34:35to make sure that we're initialized.
  2403. 2:34:39So initialize basically means that we're
  2404. 2:34:42connected to MT5
  2405. 2:34:45and like to quickly answer a question.
  2406. 2:34:46Yes, this is how you extract text from
  2407. 2:34:49T5. This is time, this is the bid, this
  2408. 2:34:51is the ask and then you know some other
  2409. 2:34:53data.
  2410. 2:34:58Do the CFD brokers hit you with toxic
  2411. 2:35:00flow penalties with this strategy? Uh it
  2412. 2:35:03depends. Um, I ran some strategies where
  2413. 2:35:07CFD brokers had no issues at all. And
  2414. 2:35:09then I had some strategies, for example,
  2415. 2:35:11when I tried to trade the gold arbitrage
  2416. 2:35:14on Interactive Brokers against MT5, I
  2417. 2:35:16was placing like five lots uh per round
  2418. 2:35:20turn, right? Five lots on gold is 500
  2419. 2:35:23units of gold. And at that time, gold
  2420. 2:35:25was around like 3,000 US. So 500 times
  2421. 2:35:293,000.
  2422. 2:35:31So, my like position size or volume per
  2423. 2:35:35side was $ 1.5 million US dollars,
  2424. 2:35:37right? We're talking about leveraged
  2425. 2:35:39positions and the CFD brokers didn't
  2426. 2:35:42like it. So, what they did is like they
  2427. 2:35:44didn't uh take any profits or anything.
  2428. 2:35:47They actually restricted me with um a
  2429. 2:35:51low leverage account. So, I was not able
  2430. 2:35:54to play such big positions. And maybe on
  2431. 2:35:57their back end, maybe they gave me
  2432. 2:35:58slippages, delays, but I don't know
  2433. 2:36:00because I can't verify what they do with
  2434. 2:36:03their execution engine, right?
  2435. 2:36:06Uh do you have some discord server? Uh
  2436. 2:36:09isolated ask. Uh yes, I do. And I offer
  2437. 2:36:11this discord server uh to my members who
  2438. 2:36:14sub are subscribed to the ATJ research
  2439. 2:36:16membership. So there you can like
  2440. 2:36:18connect with me or ask me questions like
  2441. 2:36:19you do on live chat here and like I'd be
  2442. 2:36:22very happy to help you, you know, set up
  2443. 2:36:24the training strategies that we're doing
  2444. 2:36:25here on live stream or like help you
  2445. 2:36:27with like any general algorithmic
  2446. 2:36:29trading question.
  2447. 2:36:32Okay, let's continue with this.
  2448. 2:36:56Okay. So, I asked Claude to
  2449. 2:36:59[clears throat]
  2450. 2:37:00implement my uh trading
  2451. 2:37:09my training endpoint.
  2452. 2:37:13And so right now I don't see any
  2453. 2:37:15changes. Let's see.
  2454. 2:37:20Okay, let me just close it. Maybe it's
  2455. 2:37:22just an issue with the IDE
  2456. 2:37:31or maybe I have to approve the changes.
  2457. 2:37:57Hyperlid client and it.py
  2458. 2:38:03or actually yeah these uh endpoints have
  2459. 2:38:06been implemented.
  2460. 2:38:08Um
  2461. 2:38:10so here we're get OLC history.
  2462. 2:38:14Uh and here we have send limit order
  2463. 2:38:17right we have send market order cancel
  2464. 2:38:20cancel orders and you return snapshot.
  2465. 2:38:22So these
  2466. 2:38:25so instead of prefilling uh claw decided
  2467. 2:38:28just to write the functions uh in this
  2468. 2:38:31section here.
  2469. 2:38:35So now what we should do is we should
  2470. 2:38:37test them. So now we should be careful,
  2471. 2:38:38right? because now we're going to send
  2472. 2:38:40real orders uh using the API and um
  2473. 2:39:04and so by default I'm going to like send
  2474. 2:39:08limit orders as um uh liquidity adding
  2475. 2:39:12orders. So they will always be added to
  2476. 2:39:14the order book. So instead of GTC I am
  2477. 2:39:16going to provide an AO order which
  2478. 2:39:19stands for add liquidity only.
  2479. 2:39:24And
  2480. 2:39:26so this this is a request this is the
  2481. 2:39:29market order that I'm not going to use
  2482. 2:39:34for today's script. I just want to
  2483. 2:39:35implement it so it's there. And then we
  2484. 2:39:37have cancel cancel all and uh
  2485. 2:39:48and so
  2486. 2:39:52I need to tell clot we are also missing
  2487. 2:39:55one endpoint in hyperlquid
  2488. 2:39:59client uh please also add a meant
  2489. 2:40:06order function
  2490. 2:40:08that will update the
  2491. 2:40:13amount and price of limit orders.
  2492. 2:40:20So we are also missing this last
  2493. 2:40:22function here. So we have cancel cancel
  2494. 2:40:24all send market order and send limit
  2495. 2:40:26order.
  2496. 2:40:30And so now, so once this is done, we're
  2497. 2:40:33going to test it and send uh real market
  2498. 2:40:36data, sorry, real orders to the
  2499. 2:40:38hyperlquid exchange.
  2500. 2:40:45So right now we're 50 cents in profit.
  2501. 2:40:48We can just leave it there.
  2502. 2:41:07I'm working on a project. I was hoping
  2503. 2:41:09if I can get some feedback from you on
  2504. 2:41:11that. Is it possible somehow it's
  2505. 2:41:12related to algo trading? Yes. So again,
  2506. 2:41:15if uh you're like part of the Discord
  2507. 2:41:18community, you can just come to me or
  2508. 2:41:20write uh in the Discord group what your
  2509. 2:41:22project is about and I'll happily like,
  2510. 2:41:25you know, give you some general advice
  2511. 2:41:27how to build that project assuming like
  2512. 2:41:30it's something I specialize in, right?
  2513. 2:41:31So if you tell me to code in C++,
  2514. 2:41:34probably I will not help you. But what
  2515. 2:41:36I'm showing on live stream here uh I
  2516. 2:41:38believe that definitely I can provide
  2517. 2:41:39some input uh when it comes to like
  2518. 2:41:43cross exchange arbitragees.
  2519. 2:41:55Okay. So it seems that our websocket
  2520. 2:41:59client on hyperlquid has for the most
  2521. 2:42:01part been implemented. uh in the
  2522. 2:42:04beginning we had some issues like with
  2523. 2:42:06uh getting the account data but as I've
  2524. 2:42:08mentioned this is actually the least
  2525. 2:42:10important one because again what we need
  2526. 2:42:13uh to run our training bot is just
  2527. 2:42:15having data for open orders positions
  2528. 2:42:19market data and the ability to submit
  2529. 2:42:22orders to the exchange
  2530. 2:42:39Okay. So now um let's play around with
  2531. 2:42:44the orders.
  2532. 2:42:56So, uh
  2533. 2:43:05let me create um
  2534. 2:43:10a quick folder called tests. uh in tests
  2535. 2:43:16folder. Please
  2536. 2:43:18create a simple test script that opens
  2537. 2:43:26that sends a limit order,
  2538. 2:43:33amends that order, and cancels that
  2539. 2:43:38order.
  2540. 2:43:40So, we're going to, you know, try to now
  2541. 2:43:43call these functions that we've created
  2542. 2:43:45uh in our test folder. Uh I want cloth
  2543. 2:43:48to create a simple script that like does
  2544. 2:43:50all all the three things. And
  2545. 2:43:54then we're going to run this. And so
  2546. 2:43:57hopefully it will be the
  2547. 2:44:00like the first time that now our uh
  2548. 2:44:04websocket client websocket client is
  2549. 2:44:06sending orders to the exchange. And then
  2550. 2:44:11the only thing that's left after this is
  2551. 2:44:13to then implement MT5, right? To get MT5
  2552. 2:44:16pricing and look for these arbitrage
  2553. 2:44:20opportunities.
  2554. 2:44:29So now I need to authenticate uh
  2555. 2:44:35this again.
  2556. 2:44:41And so let's see.
  2557. 2:44:48So now we're going to create a file in
  2558. 2:44:50test
  2559. 2:44:52and see what
  2560. 2:44:56if our trading scripts are now working.
  2561. 2:45:16So now let's uh go through a code
  2562. 2:45:18quickly. So here we want to open an
  2563. 2:45:21order on XYZ silver. Uh the size the
  2564. 2:45:26silver size is one. So basically it's
  2565. 2:45:28just one silver which is not that
  2566. 2:45:29expensive. One silver right now is
  2567. 2:45:33worth $77
  2568. 2:45:35uh US. Right. So here we have size one.
  2569. 2:45:41Then we're amending the size to two.
  2570. 2:45:44Uh
  2571. 2:45:48and here uh yeah it wants to set some
  2572. 2:45:53offset below or above a mid price and uh
  2573. 2:45:58then the amended offset. So I want to
  2574. 2:46:00use static levels. Let me climmit
  2575. 2:46:16at 100 and amend that limit to 125.
  2576. 2:46:31So like instead uh so what cloth is
  2577. 2:46:34trying to you know implement is more
  2578. 2:46:36like create a market making script that
  2579. 2:46:39places uh the prices around the mid
  2580. 2:46:42price of this asset. But here I just
  2581. 2:46:44want to test the price levels to just
  2582. 2:46:47send it like at as I said 100 and 125.
  2583. 2:46:50Right? So when we run this script, we
  2584. 2:46:53should have a sell limit at this level
  2585. 2:46:55at 100 and then amend it at 225 and then
  2586. 2:46:59cancel that order.
  2587. 2:47:40Okay. So,
  2588. 2:47:45I'm just reviewing the code, making sure
  2589. 2:47:47that there is no issue.
  2590. 2:47:50And so, now we should I'm just going to
  2591. 2:47:53try to, you know, run this script. And
  2592. 2:47:56so what it's going to do is we're going
  2593. 2:47:57to send a limit order, then going to
  2594. 2:48:00amend it, and then we're going to cancel
  2595. 2:48:03it. And and so what I'm also going to do
  2596. 2:48:05is I'm going to add a sleep function,
  2597. 2:48:08right? So I'm going to wait 5 seconds be
  2598. 2:48:10uh uh after every action so that we can
  2599. 2:48:14like observe uh like slowly if it works
  2600. 2:48:18or not. So here I'm going to also do
  2601. 2:48:20from time import sleep
  2602. 2:48:26Hey, what are you using to code cloud
  2603. 2:48:28code? Yes, I am using PyCharm. I'm
  2604. 2:48:31coding in Python. I'm using cloud code
  2605. 2:48:33to uh you know help me create the the
  2606. 2:48:37scripts here.
  2607. 2:48:41So, I'm like double checking double
  2608. 2:48:44checking side size limit price. I think
  2609. 2:48:47it should be fine.
  2610. 2:48:50So, now we're running our test. uh
  2611. 2:48:54string script and
  2612. 2:49:03when I run test trading.py
  2613. 2:49:11I get this error.
  2614. 2:49:15What's the issue?
  2615. 2:49:46Okay.
  2616. 2:49:49So maybe I can try to run this again.
  2617. 2:49:55So your sent limit order cell.
  2618. 2:49:58Uh so we're in step number one
  2619. 2:50:02training requests SDK. Okay. So it seems
  2620. 2:50:05that cloth imported or like is using
  2621. 2:50:08this uh package but I forgot to install
  2622. 2:50:11it using pip install. So what a simple
  2623. 2:50:15fix is just
  2624. 2:50:17writing pip install
  2625. 2:50:21um hyperlquid python SDK
  2626. 2:50:32and then we call pip install ETH Count.
  2627. 2:51:00So, we're just making sure that all the
  2628. 2:51:02packages are now installed. And so let
  2629. 2:51:05me restart the script.
  2630. 2:51:25And let's just debug using Cloud again.
  2631. 2:51:45what is the bot already doing? So, right
  2632. 2:51:48now, uh I'm testing the trading
  2633. 2:51:51endpoints on my of my script and I'm
  2634. 2:51:53trying to submit orders to Hyperlquid.
  2635. 2:51:57So here I'm trying to send a limit
  2636. 2:52:00order, amend that order and then cancel
  2637. 2:52:02that order which will be used for a
  2638. 2:52:04trade bot to then uh yeah arbitrage the
  2639. 2:52:08prices.
  2640. 2:52:20So in theory we could use like market
  2641. 2:52:21orders when the uh
  2642. 2:52:27one second. So we could in theory use
  2643. 2:52:30market orders like when we see that the
  2644. 2:52:31price is like very far away from the
  2645. 2:52:35current price. We could just use take
  2646. 2:52:36orders but they are more expensive. This
  2647. 2:52:38is one approach or we could add like
  2648. 2:52:40limit orders and try to capture the
  2649. 2:52:42spread for a good price and then hedge
  2650. 2:52:44it with MT5. So there are like two
  2651. 2:52:46approaches. I'm going to use the
  2652. 2:52:48approach that's uh a bit safer and like
  2653. 2:52:51more uh how you call it more consistent.
  2654. 2:52:55But if you want like an actual arbitrage
  2655. 2:52:57strategy that just looks at price
  2656. 2:52:59discrepancies, buys and sells at the
  2657. 2:53:01same time, uh this is also something you
  2658. 2:53:03could do. But then you don't have as
  2659. 2:53:05many opportunities because the fees for
  2660. 2:53:08taker orders are much higher.
  2661. 2:53:15Okay, let's see if Claude
  2662. 2:53:19was able to
  2663. 2:53:22identify the the issue now.
  2664. 2:53:32Yes. Uh I'm trying to enter as a maker
  2665. 2:53:34to avoid a taker fee. That's correct.
  2666. 2:54:06So now um let's just try to run it
  2667. 2:54:10again.
  2668. 2:54:12I think there are some naming issues
  2669. 2:54:14with the asset and the symbol. So,
  2670. 2:54:21coin silver is not found in that
  2671. 2:54:23universe.
  2672. 2:54:25So, if this keeps on with claw, most
  2673. 2:54:27likely I will try to, you know, fix the
  2674. 2:54:30issue myself.
  2675. 2:54:32But I think we're very close. Uh
  2676. 2:54:56so
  2677. 2:55:13Okay,
  2678. 2:55:18most likely the coins list is different
  2679. 2:55:20inside the meta.
  2680. 2:55:22Let me make the air surface what's
  2681. 2:55:24actually there so you can see.
  2682. 2:55:50So I think the problem here is that when
  2683. 2:55:52we call
  2684. 2:55:55uh
  2685. 2:56:10Okay, now we're getting somewhere. So,
  2686. 2:56:11here we have the list of coins that are
  2687. 2:56:14tradable in our DEX universe.
  2688. 2:56:22So, I'm going to do some little
  2689. 2:56:24debugging and fixing.
  2690. 2:56:27Will the bot check indicators to decide
  2691. 2:56:29buy and sell? Uh, yes. We're going to
  2692. 2:56:31well initially we're going to uh
  2693. 2:56:36like compute the indicators ourselves.
  2694. 2:56:38We're going to like set for example a
  2695. 2:56:40manual level. Say we want to sell at two
  2696. 2:56:42and exit at zero. And then eventually we
  2697. 2:56:45can apply uh Ballinger band or Z score
  2698. 2:56:49to have like more autonomous uh logic to
  2699. 2:56:52enter uh into trades.
  2700. 2:56:56Do you think it would be possible to use
  2701. 2:56:58this arbitrage between for example HP
  2702. 2:56:59and Mexir Binance? Well, it depends on
  2703. 2:57:02the exchange uh and their commission
  2704. 2:57:04tiers. If you are like a big market
  2705. 2:57:07maker or or like a big fund, right? Uh
  2706. 2:57:10you will usually get like very good
  2707. 2:57:12training conditions and rebates. Uh on
  2708. 2:57:14Binance, you need to be a very big
  2709. 2:57:16client to do that. So, it's quite
  2710. 2:57:18difficult for retail. But on Max Ci, I
  2711. 2:57:20think they offer zero commissions on
  2712. 2:57:23maker orders on some assets or like if
  2713. 2:57:25you look at the exchange promotions,
  2714. 2:57:27many times they also offer like trading
  2715. 2:57:29for zero fees.
  2716. 2:57:34So many times it just comes down to how
  2717. 2:57:37low are the fees for uh for retail and
  2718. 2:57:41it's always like good to just look at
  2719. 2:57:43exchanges that actually offer the the
  2720. 2:57:46lowest lowest fees.
  2721. 2:58:06When instantiating
  2722. 2:58:08the
  2723. 2:58:10hyper liquid client class,
  2724. 2:58:14can you add
  2725. 2:58:17a text? What is it?
  2726. 2:58:27uh
  2727. 2:58:31argument. So the class knows which text
  2728. 2:58:36to work with
  2729. 2:58:39like HL client is equal to hyperlquid
  2730. 2:58:45uh client
  2731. 2:58:49dex is equal to xyz.
  2732. 2:59:03In that case would your MT5 be the
  2733. 2:59:05spread of broker are using broker that
  2734. 2:59:07only charge commission? Uh in case of
  2735. 2:59:09MT5 it would be the commission plus a
  2736. 2:59:12spread. But in many cases on MT5 uh you
  2737. 2:59:15don't pay any commission. So for example
  2738. 2:59:17if you trade the SP500 index on MT5
  2739. 2:59:20there are no commissions. But if you
  2740. 2:59:22trade for example silver there is a
  2741. 2:59:24commission and a spread. But again they
  2742. 2:59:27are quite cheap uh
  2743. 2:59:30uh like in in comparison for example to
  2744. 2:59:34other exchanges. So
  2745. 2:59:45so now what I did is that because there
  2746. 2:59:47are like many assets and many like
  2747. 2:59:49universes on the hyperl exch exchange.
  2748. 2:59:52So when I create the hyperlquid client
  2749. 2:59:54class, I also want to like specify which
  2750. 2:59:57exchange I want to connect to.
  2751. 3:00:14And so now uh we've performed like this
  2752. 3:00:17change where I can like specify the
  2753. 3:00:18decks for a hyperlink client class. And
  2754. 3:00:23so now if I go to test trading and I
  2755. 3:00:26look at this part here. So I can say
  2756. 3:00:29like Dex is equal to XYZ. Uh I I believe
  2757. 3:00:32that it's still not going to be fixed
  2758. 3:00:34yet, but I applied like this change to
  2759. 3:00:36like isolate the issues for this
  2760. 3:00:38individual exchange.
  2761. 3:00:40And so now
  2762. 3:00:43I'm going to uh
  2763. 3:00:46tell Claw that I'm having this issue
  2764. 3:00:49still.
  2765. 3:01:18and so
  2766. 3:01:24okay let's apply the change.
  2767. 3:01:46And hopefully
  2768. 3:01:55Okay, it seems that status okay
  2769. 3:02:00amendment order status okay
  2770. 3:02:04and cancel order process finished.
  2771. 3:02:08So this is amazing. So uh let me try to
  2772. 3:02:13uh
  2773. 3:02:18run this script uh while showing you the
  2774. 3:02:21hyperlquid uh UI.
  2775. 3:02:28So it seems that here the order did not
  2776. 3:02:30get cancelled. But let me restart the
  2777. 3:02:32script and let's see if the trades are
  2778. 3:02:36being submitted to Hyperlquid.
  2779. 3:02:38So now we've created a short one at 100.
  2780. 3:02:43Then 5 seconds later
  2781. 3:02:46it got amended to two uh with price 125
  2782. 3:02:51and
  2783. 3:02:56then it should get cancelled.
  2784. 3:03:13So here we have response uh order was
  2785. 3:03:16never placed or cancelled or filled. Uh
  2786. 3:03:26so here I am telling clot I'm getting
  2787. 3:03:35in test trading.py
  2788. 3:03:40the order
  2789. 3:03:45has not been cancelled.
  2790. 3:03:48uh correctly.
  2791. 3:03:57So, so
  2792. 3:04:00actually it's great, right? So, our
  2793. 3:04:01script finally opened uh sell at 100.
  2794. 3:04:05Then it amended it at order 225,
  2795. 3:04:08but we just uh had an issue with
  2796. 3:04:12cancelling that order.
  2797. 3:04:24Okay. So now
  2798. 3:04:27clot again suggested
  2799. 3:04:37new change.
  2800. 3:04:40And so now let's again try to run the
  2801. 3:04:43script again. So here I'm going to
  2802. 3:04:45cancel this old order. And guys, so
  2803. 3:04:48so again what we're going to do is
  2804. 3:04:51uh our script will place a sell order at
  2805. 3:04:54100.
  2806. 3:04:56So and now 5 seconds later it will amend
  2807. 3:04:59that order to 125 and then it should
  2808. 3:05:03cancel the order.
  2809. 3:05:08All right. So
  2810. 3:05:10after 3 hours we've been we got quite
  2811. 3:05:12far. So finally we got we also
  2812. 3:05:14implemented the orders which means that
  2813. 3:05:18finally we can start writing our trading
  2814. 3:05:20bot and try to find you know some
  2815. 3:05:23trading opportunity. So the last thing
  2816. 3:05:25that we need to do is we need to create
  2817. 3:05:27like a strategy logic
  2818. 3:05:29compare the pricing with MT5 and then
  2819. 3:05:34maybe today we'll find some trading
  2820. 3:05:37opportunity and try to find you know
  2821. 3:05:39some hedge that for example I can then
  2822. 3:05:41show tomorrow and ideally you know we'll
  2823. 3:05:44make some profit today or tomorrow and
  2824. 3:05:47then yeah once that is done we can then
  2825. 3:05:50try to you know write a fully autonomous
  2826. 3:05:52string bot that for example uses z
  2827. 3:05:54scores
  2828. 3:05:55And uh then it can like run 245 from
  2829. 3:05:58Monday to Friday. So anyways, I'll have
  2830. 3:06:01another toilet break. So I'll be right
  2831. 3:06:02back. So uh
  2832. 3:06:06so please give me a few minutes
  2833. 3:06:13and I'll be back soon again.
  2834. 3:10:17Okay, so I'm [clears throat] back and
  2835. 3:10:20let's
  2836. 3:10:22try to finish our training bot. So now I
  2837. 3:10:25see that a order works
  2838. 3:10:30and so now
  2839. 3:10:33let's write
  2840. 3:10:36our trading strategy.
  2841. 3:10:42So here I'm going to create a file
  2842. 3:10:44called tradingbot.py
  2843. 3:10:47and here I'm going to define like the
  2844. 3:10:50main strategy logic of of the trading
  2845. 3:10:54bot
  2846. 3:10:57and yeah let's see where
  2847. 3:11:00where we'll get. So,
  2848. 3:11:06uh,
  2849. 3:11:16capture spread
  2850. 3:11:24for arbitrage
  2851. 3:11:27price.
  2852. 3:11:35Okay, I'm just going to check what
  2853. 3:11:37symbol I'm going to use. Maybe I will
  2854. 3:11:39find some good asset where I can try to
  2855. 3:11:42open a hedge. And right now I see that
  2856. 3:11:44S&P 500 has a negative funding rate. So
  2857. 3:11:47here we have 7544
  2858. 3:11:50and here we have 7553.
  2859. 3:11:52So maybe we can try to you know open a
  2860. 3:11:54long position on S&P 500 try to capture
  2861. 3:11:58you know this price difference and maybe
  2862. 3:12:02like in the meantime or we can like also
  2863. 3:12:04try to like to find other assets too.
  2864. 3:12:07But I think we can try to test on SP500
  2865. 3:12:11or another thing we can like try to uh
  2866. 3:12:15experiment on is Euro USD. I think that
  2867. 3:12:18could also uh work quite well even
  2868. 3:12:21though the liquidity is not as high
  2869. 3:12:24here. But first let's just finish the
  2870. 3:12:27train script and then um you know
  2871. 3:12:29depending once it's done depending on
  2872. 3:12:31the current market conditions we can
  2873. 3:12:33then try to choose any asset that you
  2874. 3:12:35want.
  2875. 3:12:38So here I'm just going to document the
  2876. 3:12:41strategy logic.
  2877. 3:12:43So all I'm going to do here is uh
  2878. 3:12:56from exchange connect exchange
  2879. 3:12:58connectors hyperlquid client import
  2880. 3:13:01hybrid client. Right now I don't have my
  2881. 3:13:03MT5 client implemented yet. So we're
  2882. 3:13:05going to work directly with the
  2883. 3:13:08Metatrader 5 library. So import
  2884. 3:13:10metatrader 5 as MT5 and then maybe in
  2885. 3:13:15the next live stream we can also like do
  2886. 3:13:17a similar thing that we did like here
  2887. 3:13:21right we've defined all these endpoints
  2888. 3:13:23but MT5 library is quite easy to work
  2889. 3:13:26with so it doesn't need like that much
  2890. 3:13:28work like as you seen we spent like two
  2891. 3:13:30hours or three hours implementing this
  2892. 3:13:32uh client class and I think it's only
  2893. 3:13:34like 50 60% done still requires like a
  2894. 3:13:37lot of like revisions but it in my
  2895. 3:13:39opinion already usable. So we can start
  2896. 3:13:43uh
  2897. 3:13:45yeah so we can start uh writing our
  2898. 3:13:48first trading script.
  2899. 3:13:51So
  2900. 3:13:53here these are the imports. Uh
  2901. 3:14:00so what we can define here in this
  2902. 3:14:03script is we can define some
  2903. 3:14:08like initial parameters of the strategy.
  2904. 3:14:13So I can for example say target spread
  2905. 3:14:17uh cell
  2906. 3:14:18is equal to uh four. Let me explain to
  2907. 3:14:21you again like how these parameters
  2908. 3:14:24would work. So if we go to analysis and
  2909. 3:14:28go to calculate historical spread, uh
  2910. 3:14:30what you see here like right here
  2911. 3:14:36is the historical spread on the S&P 500
  2912. 3:14:40500 index. Right. So here you can see
  2913. 3:14:42here the title is a bit wrong though.
  2914. 3:14:46Oh, it's actually correct. It's fine. We
  2915. 3:14:48could short S&P 500 at let's say two or
  2916. 3:14:52even like three like for testing
  2917. 3:14:54purposes I can like just say one or two
  2918. 3:14:56right and then when we have actual
  2919. 3:14:58profitable signals then I would like
  2920. 3:15:00adjust the levels accordingly but let's
  2921. 3:15:02say we just want to short at two and
  2922. 3:15:05exit at zero right
  2923. 3:15:10for example so uh here in my training
  2924. 3:15:13bot I can say for my target spread cell
  2925. 3:15:16is four. My target spread by is let's
  2926. 3:15:20say minus 4.
  2927. 3:15:23And so these are the levels that I'm
  2928. 3:15:25going to set to define my entry logic.
  2929. 3:15:29Um,
  2930. 3:15:36of course, the symbol
  2931. 3:15:38uh on hyperlquid is going to be uh
  2932. 3:15:44XYZ
  2933. 3:15:46SP500
  2934. 3:15:47and the symbol on MT5 is going to be
  2935. 3:15:51SP500. Right.
  2936. 3:15:54Yes, it's here. It's no it's actually
  2937. 3:15:56called US 500.
  2938. 3:16:03So
  2939. 3:16:06the volume on hyperlquid is uh going to
  2940. 3:16:11be one
  2941. 3:16:16and
  2942. 3:16:18so the thing is like uh you could write
  2943. 3:16:20like the volume MT5 should be one but
  2944. 3:16:23this is something like that I want to
  2945. 3:16:24explain now just because you quote a
  2946. 3:16:26volume of of one on hyperlquid does not
  2947. 3:16:29mean that you're going to get filled
  2948. 3:16:31what right you can get filled 0.1 0.01
  2949. 3:16:34right it depends on the counterparty who
  2950. 3:16:37decides you know to get filled at that
  2951. 3:16:40price so in this case we don't control
  2952. 3:16:43what the volume on MT5 is but we just
  2953. 3:16:46have to check the exposure on hyperlquid
  2954. 3:16:49and then send a market order to MT5 once
  2955. 3:16:52that position is hedged.
  2956. 3:16:57So we actually don't need to use volume
  2957. 3:16:59MT5.
  2958. 3:17:01But what we can do is we can for example
  2959. 3:17:04specify what the contract size on MT5
  2960. 3:17:06is. So the contract uh size on MT5 is
  2961. 3:17:13100. So if we for example go short one
  2962. 3:17:17unit on hyperlquid, we want to buy 0.01
  2963. 3:17:22on D5 because of these contract size
  2964. 3:17:25differences. So this is a difference.
  2965. 3:17:28So that's why I specified contract size
  2966. 3:17:30to be 100.
  2967. 3:17:34And so what other initial parameters uh
  2968. 3:17:37do we need?
  2969. 3:17:44I guess this is actually all we need. So
  2970. 3:17:47for now I think uh
  2971. 3:17:50the target spread is actually not a
  2972. 3:17:52fixed value. So we don't actually need
  2973. 3:17:54to uh create it fixed but we can like
  2974. 3:17:56add it inside a function. So
  2975. 3:18:02let's first initialize
  2976. 3:18:04our hyperut client right. So our hl
  2977. 3:18:07client is equal to hyperquate client
  2978. 3:18:11with our dex being uh xyz
  2979. 3:18:15and then our mt5 client
  2980. 3:18:20or we can collect this. So this is our
  2981. 3:18:22MT5 client.
  2982. 3:18:24Uh
  2983. 3:18:26it's just our MT5 client and we
  2984. 3:18:28initialize it. Right?
  2985. 3:18:31So here in this section we're
  2986. 3:18:33initializing
  2987. 3:18:34Exchange connectors
  2988. 3:18:42and then
  2989. 3:18:49initialize
  2990. 3:18:53And then we can create a very simple
  2991. 3:18:55loop here. So while true we can sleep 1
  2992. 3:18:59second
  2993. 3:19:00uh from time port sleep
  2994. 3:19:07and then we can print
  2995. 3:19:10an empty line here.
  2996. 3:19:14And then
  2997. 3:19:20for now let's just try to run this.
  2998. 3:19:38Okay. So uh
  2999. 3:19:46so now both our uh connectors have been
  3000. 3:19:50initialized. So basically we can like
  3001. 3:19:53access different endpoints just get
  3002. 3:19:55market data and so on and compare the
  3003. 3:19:58prices between those exchanges. So right
  3004. 3:20:01now what we need to do is we need to you
  3005. 3:20:03know compare the price between
  3006. 3:20:06hyperlquid MT5. So to explain what we
  3007. 3:20:10can do is we can first
  3008. 3:20:13subscribe to the best bit offer which
  3009. 3:20:15will then return the uh current price
  3010. 3:20:19for uh XYZ silver. So here I can
  3011. 3:20:24or I mean S&P 500. So here we're
  3012. 3:20:27subscribing to the market data of
  3013. 3:20:29hyperlquid. And so here
  3014. 3:20:34I can write a very simple function
  3015. 3:20:35define uh calculate spread right.
  3016. 3:20:43So uh what we can do here is we can
  3017. 3:20:47extract the pricing from hyperlquid. So
  3018. 3:20:50here uh
  3019. 3:20:55let's call it uh price hyperlquid is
  3020. 3:20:59equal to hyperlquid data client dot
  3021. 3:21:03market data and we want the market data
  3022. 3:21:06for this symbol here I'm going to add
  3023. 3:21:09maybe a sleep function maybe like two
  3024. 3:21:11seconds to initialize the data and then
  3025. 3:21:15in let's print
  3026. 3:21:18price hyperlquid
  3027. 3:21:25And let's call this function with every
  3028. 3:21:28iteration.
  3029. 3:21:40Oh, of course I need to
  3030. 3:21:44also print the data.
  3031. 3:21:53And here you can see that we have the
  3032. 3:21:55the bit price uh and the ask price,
  3033. 3:21:58right? That's all we need to compute the
  3034. 3:22:00prices.
  3035. 3:22:08So now [clears throat]
  3036. 3:22:12I can save the data. For example, in
  3037. 3:22:14bitid hyperlquid is equal to the price
  3038. 3:22:17of hyperlquid
  3039. 3:22:19um
  3040. 3:22:21with the keyword bid and uh price
  3041. 3:22:27and here the ask hyperlquid is equal to
  3042. 3:22:30this value. And guys, you might be
  3043. 3:22:32asking like why I'm not closing cloud
  3044. 3:22:33now. I just the reason I'm doing this is
  3045. 3:22:36like I'm writing like a very simple
  3046. 3:22:38template for cloud like a skeleton to
  3047. 3:22:40provide already like the basic functions
  3048. 3:22:43it needs and then I want it to work from
  3049. 3:22:45there because this type of coding is
  3050. 3:22:47actually like very easy for me. So I
  3051. 3:22:50just like to implement like a very
  3052. 3:22:52simple script that just computes uh the
  3053. 3:22:55spread and then uh cloud can take over
  3054. 3:22:58once we you know go to a more advanced
  3055. 3:23:01task.
  3056. 3:23:03And so this is the price for hyperlquid
  3057. 3:23:05and then price MT5.
  3058. 3:23:09For MT5 we can just do MT5 client dot
  3059. 3:23:13symbol info where we add the MT5 data.
  3060. 3:23:17And so here the bit MT5 is equal to the
  3061. 3:23:22price of MT5
  3062. 3:23:25dot bit. It's much easier on MT5 and the
  3063. 3:23:29ask MT5
  3064. 3:23:31is the ask price. Right? So here we can
  3065. 3:23:33also print
  3066. 3:23:35uh price MT5 and get the price data for
  3067. 3:23:40US 500.
  3068. 3:23:48So we can see guys right. So here we
  3069. 3:23:49have the data for MT5 and so instead of
  3070. 3:23:52printing uh these things here I will
  3071. 3:23:58print it like this. So here I'm going to
  3072. 3:24:01write a bit hyperlquid
  3073. 3:24:11and then I'm going to print it like
  3074. 3:24:14this. So here I'm going to add ask
  3075. 3:24:16hyperlquid and then so for MT5 I'm going
  3076. 3:24:20to do the same format. So bit MT5
  3077. 3:24:26uh
  3078. 3:24:29and then the ask MT5. And then to
  3079. 3:24:31compute the spread, it's actually really
  3080. 3:24:33easy. Just, you know, take uh bit minus
  3081. 3:24:36bit and ask minus ask. And let me
  3082. 3:24:38explain which prices are we going to
  3083. 3:24:40use, you know, for calculation of
  3084. 3:24:42spread. Like what does bit mean? What
  3085. 3:24:44does ask mean for us?
  3086. 3:24:54So here you see that we have the prices
  3087. 3:24:58And so think about this scenario
  3088. 3:25:01when we want to buy on hyperlquid right
  3089. 3:25:04it means we're quoting the bit price
  3090. 3:25:07right so we as market makers are adding
  3091. 3:25:11liquidity uh to the order book we are
  3092. 3:25:14quoting the bit and that's why we can
  3093. 3:25:16actually use the bit price as reference
  3094. 3:25:19on hyperlquid to compute the bit spread
  3095. 3:25:23or the buy spread right so when I'm
  3096. 3:25:26going to compute the bit spread. The bit
  3097. 3:25:30spread is the bit price of hyperlquid
  3098. 3:25:33because we want to buy at this price
  3099. 3:25:36minus
  3100. 3:25:37the
  3101. 3:25:39bit on MT5 because if you want to, you
  3102. 3:25:42know, again long the spread, we need to
  3103. 3:25:45buy at the bit on hyperlquid and we need
  3104. 3:25:48to sell on MT5. And when we sell on MT5,
  3105. 3:25:50because we are market takers, we will
  3106. 3:25:52always sell at the bid price because the
  3107. 3:25:54broker will always quote us a worse
  3108. 3:25:56price for a sales, a lower price. So
  3109. 3:25:59this is the bit bit spread. This is the
  3110. 3:26:03ask uh spread.
  3111. 3:26:11And so these are the values that we're
  3112. 3:26:14going to use to compute the pricing
  3113. 3:26:17discrepancies.
  3114. 3:26:23And here I'm going to return dictionary.
  3115. 3:26:25So here the bit spread is equal.
  3116. 3:26:41And here we see that the hyperlquid
  3117. 3:26:43values uh return a string and not a
  3118. 3:26:48float.
  3119. 3:26:51And there are ways to fix this. I can
  3120. 3:26:52either fix it in the script here, but
  3121. 3:26:54because I know that I'm going to
  3122. 3:26:58uh work with it uh on other projects and
  3123. 3:27:01other scripts also, I'm going to convert
  3124. 3:27:04the data
  3125. 3:27:07inside
  3126. 3:27:08the
  3127. 3:27:13uh hyperlquid client class.
  3128. 3:27:16So I'm going to plot um
  3129. 3:27:20hyperlquid
  3130. 3:27:22client returns strings
  3131. 3:27:26prices
  3132. 3:27:29market prices
  3133. 3:27:31as strings.
  3134. 3:27:34Can you convert them to floats?
  3135. 3:27:54So here we're just going to uh yeah
  3136. 3:27:57change the
  3137. 3:28:00data types and we're going to edit the
  3138. 3:28:03edit.py file. So here as you can see uh
  3139. 3:28:07we're changing these values to floats.
  3140. 3:28:39Okay, so let's try to run our training
  3141. 3:28:41bot and hopefully we now have the spread
  3142. 3:28:44between those two prices computed. So
  3143. 3:28:47now you see that here this is the bit
  3144. 3:28:49spread. So right now the difference
  3145. 3:28:51between hyper 25 is roughly minus1 for a
  3146. 3:28:55bit and minus 1.2 for the ask.
  3147. 3:29:04So this is great. So now we can for
  3148. 3:29:05example write a simple script to buy at
  3149. 3:29:08this bit price and then hedge it with
  3150. 3:29:11MT5 which would then
  3151. 3:29:15uh yeah complete the main task for today
  3152. 3:29:18and it is like to open like this hedge
  3153. 3:29:20position
  3154. 3:29:22and then we want to like to create train
  3155. 3:29:24bot that would like run uh enter time.
  3156. 3:29:28So now I can create a function. So
  3157. 3:29:31actually what I like to do usually is
  3158. 3:29:34like I don't like to
  3159. 3:29:36uh
  3160. 3:29:39how do you say it uh use prices
  3161. 3:29:43there are for example old or like when
  3162. 3:29:45it spikes you know sometimes the market
  3163. 3:29:47can spike one tick I like to for example
  3164. 3:29:49use uh averages so what I can do is I
  3165. 3:29:52can compute like a 5-second average for
  3166. 3:29:54a bit in ask spread to smoon out you
  3167. 3:29:56know the signal to you know filter out
  3168. 3:29:59any like big price spikes and also What
  3169. 3:30:01I can do is I can add like a tick
  3170. 3:30:04timeout check. So if the last tick or
  3171. 3:30:07the price update is too old then I can
  3172. 3:30:11disregard this price. But let's start
  3173. 3:30:14with the first one
  3174. 3:30:22in trading bot.py pi
  3175. 3:30:27I'm computing the bit
  3176. 3:30:31spread and ask spread.
  3177. 3:30:35Can you save these values in a list and
  3178. 3:30:40compute a 5-second
  3179. 3:30:43average of those values
  3180. 3:30:47in the
  3181. 3:30:51main
  3182. 3:30:56in the main strategy loop section.
  3183. 3:31:27So now Claude is working on it.
  3184. 3:31:59And yes, let's
  3185. 3:32:03accept the changes.
  3186. 3:32:43Okay.
  3187. 3:32:47So, yeah, question here. Do you only
  3188. 3:32:49create arbitrage strategies or do you
  3189. 3:32:50have any indicators based uh strats?
  3190. 3:32:52Right now, I'm just focusing on
  3191. 3:32:54arbitrage trading or if you remember my
  3192. 3:32:56USDC USD marketmaking bot, but it is
  3193. 3:32:59basically almost like a risk-free
  3194. 3:33:02strategy because uh the price doesn't
  3195. 3:33:04move anywhere. So I'm more focused just
  3196. 3:33:06on these strategies that can generate
  3197. 3:33:10like almost risk-free uh return.
  3198. 3:33:34Okay. Okay. So this is done.
  3199. 3:33:47Please print the 5second average bit
  3200. 3:33:49spread and the 5-second average spread
  3201. 3:33:53in the main loop.
  3202. 3:34:28Okay, it seems that the price didn't
  3203. 3:34:30initialize correctly.
  3204. 3:34:39So, I'm actually going to add a to-do.
  3205. 3:34:46Check if market data on Hyperlquit is
  3206. 3:34:50available.
  3207. 3:34:59If yes, proceed.
  3208. 3:35:02Beautiful.
  3209. 3:35:08So here uh we have the 5-second
  3210. 3:35:11averages. So here instead of using the
  3211. 3:35:13current bid and ask I'm going to use the
  3212. 3:35:16average values of this as my signal. So
  3213. 3:35:20here I can
  3214. 3:35:22actually return this
  3215. 3:35:24and here I can uh
  3216. 3:35:28yeah display this these average values
  3217. 3:35:35also I'm telling clot to
  3218. 3:35:39Okay.
  3219. 3:36:07Okay. So here we've implemented some
  3220. 3:36:11changes
  3221. 3:36:15and again like uh you see that uh we
  3222. 3:36:18need to check if the market data is
  3223. 3:36:21available
  3224. 3:36:25please uh
  3225. 3:36:29implement this to-do task in
  3226. 3:36:34tradingbot.py
  3227. 3:36:36Hi.
  3228. 3:37:01Do you want to make this edit to
  3229. 3:37:03trainbot.py? pi.
  3230. 3:37:11Okay, let's run this.
  3231. 3:37:37Okay, great. So now we have the average
  3232. 3:37:39bit spread and average ask spread. I can
  3233. 3:37:42actually print these uh side by side so
  3234. 3:37:47we save a bit of space.
  3235. 3:38:02I'm going to
  3236. 3:38:05rename like this so it's not too
  3237. 3:38:07confusing. There's a bit and ask spread,
  3238. 3:38:09right? And there's the bit spread and
  3239. 3:38:11the ask spread. Okay, a bit confusing,
  3240. 3:38:13but
  3241. 3:38:15I think should be fine.
  3242. 3:38:20Okay. So now I think we have all the
  3243. 3:38:23things we need to
  3244. 3:38:26uh
  3245. 3:38:28like try to open like a trade, right? So
  3246. 3:38:30uh now we have like the signals, right?
  3247. 3:38:33So let's see if I can find something
  3248. 3:38:36that we can theoretically trade
  3249. 3:38:41something that's not too expensive and
  3250. 3:38:43like cost efficient on MT5.
  3251. 3:38:53Interesting. The JP uh 225 index has an
  3252. 3:38:57annual funding rate of 94%.
  3253. 3:39:02Yeah, this in theory
  3254. 3:39:04could be very good even though the
  3255. 3:39:05liquidity is quite low. It's just 7
  3256. 3:39:07$760,000
  3257. 3:39:10in the past uh 24 hours.
  3258. 3:39:14But this could theoretically work. The
  3259. 3:39:18only problem is that this asset is coded
  3260. 3:39:21in USD and the JP225
  3261. 3:39:25index on MT5
  3262. 3:39:27might be coded in JPY.
  3263. 3:39:31What are you building, brother? I'm
  3264. 3:39:32building an arbitrage bot within
  3265. 3:39:34Hyperlquid and MT5. I've added the exact
  3266. 3:39:37strategy description and the project
  3267. 3:39:39description in the descriptions uh below
  3268. 3:39:42the live stream. So you can check it
  3269. 3:39:44out. So there's an article on my website
  3270. 3:39:46and you can read more about it there.
  3271. 3:39:52Here we have 65,000
  3272. 3:39:56and here we also have 65,000.
  3273. 3:39:59So instead, if I buy one
  3274. 3:40:03JP225,
  3275. 3:40:06the order value of this position would
  3276. 3:40:09be $65,000
  3277. 3:40:12US
  3278. 3:40:17and that is crazy. Yeah, I didn't
  3279. 3:40:22I didn't price adjust that. So let's not
  3280. 3:40:24focus on GP225 for now. But it would be
  3281. 3:40:26a great trading opportunity,
  3282. 3:40:29but I would like to focus on something
  3283. 3:40:31more simple today.
  3284. 3:40:33Maybe GBP is the that I've mentioned
  3285. 3:40:37here. The funding rates are still quite
  3286. 3:40:39good. So maybe we could try something.
  3287. 3:40:45Have you had any success so far in
  3288. 3:40:47actually making money?
  3289. 3:40:50How about
  3290. 3:40:52I mean I could say yes but you can just
  3291. 3:40:54stay on the live stream and find out for
  3292. 3:40:56yourself.
  3293. 3:40:59Hey, can you make a video about algo
  3294. 3:41:00trading propers like funded algo
  3295. 3:41:02trading? Yeah, that's an interesting
  3296. 3:41:04topic. Maybe I can like create a simple
  3297. 3:41:06script and show you guys how to you know
  3298. 3:41:08implement some risk management
  3299. 3:41:09algorithms but it's not something like I
  3300. 3:41:13want to pursue because
  3301. 3:41:15uh yeah I used to work for a prop firm
  3302. 3:41:17and like I'm over prop firms so this
  3303. 3:41:21strategy that you're looking at is
  3304. 3:41:23something that I like really want to
  3305. 3:41:25focus right now which is just arbitrage
  3306. 3:41:28trading basically but you can also apply
  3307. 3:41:30arbitrage trading propers that's
  3308. 3:41:32definitely possible
  3309. 3:41:35But there's always the risk factor of
  3310. 3:41:37getting denied and those consistency
  3311. 3:41:38rules that I actually don't like at all.
  3312. 3:41:57Do you only do most arbitrage in most of
  3313. 3:42:00strategies and why? Well, the reason why
  3314. 3:42:02is that the risk profile is quite low,
  3315. 3:42:05right? In arbitrage, you aim to capture
  3316. 3:42:08capture almost a risk-free profit. And
  3317. 3:42:11so, for that reason, I like the
  3318. 3:42:13consistency. And so, when arbitrage
  3319. 3:42:16strategies stop working performing, what
  3320. 3:42:18you see is that eventually maybe you
  3321. 3:42:20just get a break even outcome or a
  3322. 3:42:22slight loss, which means you can just
  3323. 3:42:24try to look for different strategies.
  3324. 3:42:27So, I always hated losing in trading.
  3325. 3:42:32So the best way to actually not lose
  3326. 3:42:35is to look for arbitrageing
  3327. 3:42:38opportunities, right? Risk-free setups.
  3328. 3:42:42And that's the main reason.
  3329. 3:42:54Okay, guys. So, I decided let's just
  3330. 3:42:56stick with S&P 500. We're just going to
  3331. 3:42:58place one test trait because SP5 500 is
  3332. 3:43:01quite cheap and actually the most liquid
  3333. 3:43:03asset on hyperlquid. And once the script
  3334. 3:43:06works works, we can then try to apply it
  3335. 3:43:08on a different asset.
  3336. 3:43:14So here I can create a function to quote
  3337. 3:43:17a limit price on hyperlquid and when
  3338. 3:43:19that price gets filled I want it to
  3339. 3:43:22hedge that trade or hedge the exposure
  3340. 3:43:25uh with Metatrader 5.
  3341. 3:43:30I'm also a software engineer with eight
  3342. 3:43:32plus years of experience and work
  3343. 3:43:33nowadays in creating AI agents but have
  3344. 3:43:35any training background except memecoin
  3345. 3:43:36trading. Do you think think I can learn
  3346. 3:43:39this? So if you're a software engineer,
  3347. 3:43:41I think that's a great advantage because
  3348. 3:43:43at least when you code using AI, you can
  3349. 3:43:46like get very good results by having
  3350. 3:43:49like good understanding what the code is
  3351. 3:43:51doing. And in trading if you learn the
  3352. 3:43:54basic concepts which I think you can
  3353. 3:43:56learn them quite easily. Uh I think that
  3354. 3:43:59is quite possible like there's a saying
  3355. 3:44:03I don't know who said it but uh someone
  3356. 3:44:05said it's easier to like teach a
  3357. 3:44:08mathematician or physician trading than
  3358. 3:44:10a trader how to do physics right uh
  3359. 3:44:12maybe some of you guys know the name of
  3360. 3:44:14the guy who said it but I I think that
  3361. 3:44:18is in my opinion true you you can always
  3362. 3:44:23it's easier to learn trading than it is
  3363. 3:44:24to learn physics so uh that's what it
  3364. 3:44:28or coding in this instance.
  3365. 3:44:36So I'm going to create a function called
  3366. 3:44:38quote bid on hyperlquid. So this
  3367. 3:44:41function will quote a bit price on
  3368. 3:44:44hyperlquid and then once that uh
  3369. 3:44:47position gets filled it will then try to
  3370. 3:44:49send a market order to MT5 and hedge
  3371. 3:44:52that exposure
  3372. 3:44:55and the arguments of this will be uh
  3373. 3:45:01the target spread so the price we want
  3374. 3:45:04to capture it for and that's basically
  3375. 3:45:07it and then so I'm going to like
  3376. 3:45:09document this function is going to do
  3377. 3:45:11and I'm going to create a same function
  3378. 3:45:13called quote ask on hyperlquid with the
  3379. 3:45:16same things right and so here in this uh
  3380. 3:45:24in this like main strategy loop what I
  3381. 3:45:27can do is 10k enough to start yes
  3382. 3:45:30absolutely even 1k is enough to start
  3383. 3:45:32with the strategy so you can like start
  3384. 3:45:34very small and build up from build it up
  3385. 3:45:38from from here.
  3386. 3:45:42As I said, I I I've been trying to teach
  3387. 3:45:44my brother and he started with $1,000
  3388. 3:45:46and like he's
  3389. 3:45:49he's got very good results over over the
  3390. 3:45:51past few weeks. Actually, I can ask him
  3391. 3:45:53to generate a report and then you know
  3392. 3:45:56share the results with you guys so you
  3393. 3:45:58guys can have a rough understanding how
  3394. 3:46:01you know you know my family and my
  3395. 3:46:03colleagues are also performing the
  3396. 3:46:04office.
  3397. 3:46:20So I think
  3398. 3:46:24here what we can do is uh
  3399. 3:46:31actually here we have this target spread
  3400. 3:46:34by and target spread
  3401. 3:46:37So maybe we can like create
  3402. 3:46:40like these levels. So what I can do is
  3403. 3:46:44this
  3404. 3:46:51if average bit spread is lower equal to
  3405. 3:46:55our target spread by so it's like a now
  3406. 3:46:58we're creating signal right
  3407. 3:47:06we're creating entry signal here if
  3408. 3:47:09average bit spread is less than target
  3409. 3:47:11spread by we want to start quoting
  3410. 3:47:17the the bit on hyperlquid.
  3411. 3:47:24And then here we have like this target
  3412. 3:47:26spread and our target spread we want to
  3413. 3:47:28buy for
  3414. 3:47:30minus one,
  3415. 3:47:32right? And so the same thing for uh
  3416. 3:47:38if average ask spread
  3417. 3:47:43is greater or equal to target spread
  3418. 3:47:46cell you can quote the ask on hyperlquid
  3419. 3:47:50for this price here.
  3420. 3:47:56What do you think is missing for us to
  3421. 3:47:57have a financial super AI technology? Do
  3422. 3:48:00we have enough data, algorithms, process
  3423. 3:48:01data, LLMs, news and so on? I don't know
  3424. 3:48:06unfortunately. Uh so I've always been
  3425. 3:48:09trading like doing manual research, you
  3426. 3:48:12know, I've been working with notebooks,
  3427. 3:48:13writing more algorithms and right now
  3428. 3:48:16I'm at this stage where AI is just
  3429. 3:48:18helping me to write code, right? But it
  3430. 3:48:20doesn't help me with any type of
  3431. 3:48:23analysis or signal generation. All it
  3432. 3:48:26does is just help me write code. And uh
  3433. 3:48:29so far it's been helping me quite a lot.
  3434. 3:48:32But I think AI can like really be used
  3435. 3:48:35to you know create signals, process
  3436. 3:48:38data, news and so on. So I believe
  3437. 3:48:40there's a lot of like use case for this.
  3438. 3:48:42But right now I am not very
  3439. 3:48:44knowledgeable or experienced in this in
  3440. 3:48:47this field.
  3441. 3:48:50So guys right now the ask the bit spread
  3442. 3:48:52is minus 1.9 right. So I can try to buy
  3443. 3:48:55at minus two right and try to capture
  3444. 3:48:57this. So first let me uh
  3445. 3:49:03let me try to do this. So
  3446. 3:49:12so first I'm going to create an input.
  3447. 3:49:16So here I'm going to create a direction
  3448. 3:49:19variable called direction is equal to
  3449. 3:49:21input.
  3450. 3:49:23And here we're going to create a
  3451. 3:49:26direction
  3452. 3:49:32um
  3453. 3:49:44and
  3454. 3:49:46so if direction in
  3455. 3:49:50by
  3456. 3:49:52cell Right. So I I just want to create
  3457. 3:49:55like u tell the bot to either buy or
  3458. 3:49:57sell for a specific price.
  3459. 3:50:01So if not direction
  3460. 3:50:04buy or sell
  3461. 3:50:07uh then I want it to
  3462. 3:50:13like exit the code.
  3463. 3:50:18So and direction is by and direction is
  3464. 3:50:23sell.
  3465. 3:50:25So here we have an input for a
  3466. 3:50:27direction. And now instead of specifying
  3467. 3:50:30the exact string level statically I will
  3468. 3:50:34actually uh define these inputs myself.
  3469. 3:50:37So I decided so uh here are my target
  3470. 3:50:42spread is equal to input
  3471. 3:50:46the target spread and I want to convert
  3472. 3:50:49this to a float.
  3473. 3:51:04And so here
  3474. 3:51:08I can try to do this. And then once this
  3475. 3:51:13uh function has been triggered then I
  3476. 3:51:16can like uh exit the loop like I can
  3477. 3:51:19just write break or I can create a
  3478. 3:51:23running variable.
  3479. 3:51:33I can create like is running is equal to
  3480. 3:51:36true here and then I can just set is
  3481. 3:51:39running to false.
  3482. 3:51:41So I can like also create like this
  3483. 3:51:44control logic where I disable this loop
  3484. 3:51:47here. Um so instead of doing anything I
  3485. 3:51:52I'm just going to like print uh quoting
  3486. 3:51:55bit on hyperlquid
  3487. 3:51:59and then here quoting ask on hyperlquid
  3488. 3:52:04and so let's try to run the script now.
  3489. 3:52:06So for example
  3490. 3:52:09let's say I want to enter a long spread
  3491. 3:52:11position. Uh I miss my script. So I want
  3492. 3:52:14to buy I want to buy at let's say minus
  3493. 3:52:17one. And now it computes the averages
  3494. 3:52:22and then quoting rhythm hyperlquid. And
  3495. 3:52:24that's our signal. So now the last step
  3496. 3:52:27is just to open the position and I think
  3497. 3:52:31uh
  3498. 3:52:33here we have to wait until the length of
  3499. 3:52:37the bit spread history is one. So
  3500. 3:52:44and I think we can do that here also.
  3501. 3:52:54So there are some more questions.
  3502. 3:52:59I build an uh MEV but in crypto but I
  3503. 3:53:01don't seem to win anything at all. Not
  3504. 3:53:03sure if I have that run. Can this same
  3505. 3:53:05approach work with crypto? Yes. So it's
  3506. 3:53:08just trading, right? So if you have any
  3507. 3:53:10asset you know that is priced somehow in
  3508. 3:53:12the exchange you can apply the same
  3509. 3:53:14logic for your strategy too. And so if
  3510. 3:53:19you have a bot and it's not winning at
  3511. 3:53:20all you have to do is just you know
  3512. 3:53:24uh well if it's an arbitrage bot then
  3513. 3:53:26you just have to check the execution if
  3514. 3:53:28you're getting good fills and that's it.
  3515. 3:53:31If you have a bot, you know, that just
  3516. 3:53:33has like some directional risk,
  3517. 3:53:35speculates on the direction, then you
  3518. 3:53:38have, you know, some exposure and you
  3519. 3:53:41kind of like control the outcome every
  3520. 3:53:42time. But maybe what you can check is,
  3521. 3:53:44you know, how much are you paying
  3522. 3:53:45commissions? Are you getting a lot of
  3523. 3:53:47slips or maybe, you know, some leaks
  3524. 3:53:49that uh can be optimized in your
  3525. 3:53:51strategy?
  3526. 3:53:53I don't think AI can predict price
  3527. 3:53:54movements for liquid non-manipulative
  3528. 3:53:56stuff like commodities at least as it is
  3529. 3:53:58purely driven by demand supply. I may be
  3530. 3:54:01wrong but this is what I feel right now.
  3531. 3:54:04uh I mean it's a legitimate like uh
  3532. 3:54:07opinion right that AI cannot predict
  3533. 3:54:09what will happen but AI definitely has
  3534. 3:54:12like some advantages
  3535. 3:54:14uh in comparison to a human right AI can
  3536. 3:54:17like ingest data very fast and analyze
  3537. 3:54:21the data a human right if you look you
  3538. 3:54:24know at news traders and they have like
  3539. 3:54:2620 screens they all watch like Bloomberg
  3540. 3:54:28and BBC news Twitter and so on AI can
  3541. 3:54:31like really uh take all the data and
  3542. 3:54:33like try to you know evaluate or
  3543. 3:54:36generate some signal. So I think there
  3544. 3:54:38is some advantage to AI. Maybe AI can
  3545. 3:54:41like take this data and like inform a
  3546. 3:54:43trader about you know world events and
  3547. 3:54:47provide you know some assisted analysis.
  3548. 3:54:50So maybe that's where we can probably
  3549. 3:54:51use AI.
  3550. 3:54:53We're posting our strategy. Check the
  3551. 3:54:54description uh of the YouTube live
  3552. 3:54:57stream and there you'll find an article
  3553. 3:55:00where I describe what we're doing.
  3554. 3:55:04And then Prabish uh said AI can help
  3555. 3:55:07analyze. Yes, super fast. So yeah, so
  3556. 3:55:09you have probably the same opinion as me
  3557. 3:55:12and but again I don't use AI uh in
  3558. 3:55:15signal generation so I don't really
  3559. 3:55:17know.
  3560. 3:55:18Have you been doing discretion training
  3561. 3:55:20before or when I train directly? Uh I've
  3562. 3:55:22been doing discretion training before.
  3563. 3:55:24So eight years ago I didn't know how to
  3564. 3:55:26code. I learned how to code during my
  3565. 3:55:28employment at a prop trading firm and
  3566. 3:55:31then over time you know I applied my
  3567. 3:55:34coding skills also in trading. So right
  3568. 3:55:37now I'm moved from discretionary trading
  3569. 3:55:40to algor algorithmic trading
  3570. 3:55:56So here what we're going to do is uh
  3571. 3:56:11place limit price on hyper.
  3572. 3:56:20So here I'm going to docu like tell
  3573. 3:56:23cloth exactly what to do. So I'm going
  3574. 3:56:25to tell cloud place
  3575. 3:56:28limit price
  3576. 3:56:30on the on symbol HL
  3577. 3:56:43with the volume
  3578. 3:56:46with volume
  3579. 3:56:50volume HL.
  3580. 3:56:58Um
  3581. 3:57:07so our accurate step place limit price
  3582. 3:57:20uh
  3583. 3:57:22limit Limit
  3584. 3:57:26limit price is defined
  3585. 3:57:30as
  3586. 3:57:31price
  3587. 3:57:36as bit MT5.
  3588. 3:57:40Oh, my ID is running a bit low, but it
  3589. 3:57:42should be fine. As bit MT5 plus
  3590. 3:57:48Whoops. Target spread. So here I want
  3591. 3:57:52you know to use MT5 as a reference price
  3592. 3:57:55to quote my bid prices. So for example
  3593. 3:57:58if M5 price is 10 and my target spread
  3594. 3:58:01is minus one then I want the hyperl
  3595. 3:58:03price to be minus one right
  3596. 3:58:09um
  3597. 3:58:14two
  3598. 3:58:17check that limit price has been
  3599. 3:58:22submitted
  3600. 3:58:25and is active. on Hyperlquid.
  3601. 3:58:35Actually, I think I can do it a bit
  3602. 3:58:37differently actually.
  3603. 3:58:52Okay. So here then uh
  3604. 3:59:04I'm going to create something like u uh
  3605. 3:59:09order timeout
  3606. 3:59:13time until is date time dotn now plus a
  3607. 3:59:18time delta. I'm going to create like uh
  3608. 3:59:21I want to place a limit order but for
  3609. 3:59:23example if after
  3610. 3:59:26let's say 1 minute the order doesn't get
  3611. 3:59:28filled I want to uh cancel the order
  3612. 3:59:32right so here
  3613. 3:59:35I will add time delta
  3614. 3:59:41and so here time out until so while date
  3615. 3:59:44time dot now is less then
  3616. 3:59:49time out until we can then quote you
  3617. 3:59:53know the main the main logic. So here
  3618. 3:59:58what we're going to do is we're going to
  3619. 4:00:01create something like uh uh sleep
  3620. 4:00:05interval. So or maybe like some amend
  3621. 4:00:11interval. So what you could in
  3622. 4:00:13theoretically what you could the
  3623. 4:00:14theoretically do is you could amend the
  3624. 4:00:17order like as fast as you can, right?
  3625. 4:00:18And that way you would uh
  3626. 4:00:22uh ensure that your bid and ask prices
  3627. 4:00:25that you code hyperlquid are always up
  3628. 4:00:27to date and so you will not for example
  3629. 4:00:29get arbitrage by chance. Yes, when you
  3630. 4:00:32build an arbitrage strategy, someone
  3631. 4:00:34could also try to arbitrage you right
  3632. 4:00:36when you're too slow. And so here I'm
  3633. 4:00:39adding this ament interval
  3634. 4:00:42uh
  3635. 4:00:45and uh maybe I can like add this into
  3636. 4:00:49the strategy here. So here a interval
  3637. 4:00:55is equal to let's say let's in the
  3638. 4:00:58beginning I'm going to uh create an
  3639. 4:01:02amend interval of 1 second so we can
  3640. 4:01:04like uh see the limit prices being
  3641. 4:01:07updated on hyperlquid.
  3642. 4:01:12Uh so here I'm going to apply a sleep
  3643. 4:01:14function with a meant interval.
  3644. 4:01:18And
  3645. 4:01:20so here what I want to do next is so
  3646. 4:01:28in this to-do
  3647. 4:01:34I want to
  3648. 4:01:36update
  3649. 4:01:38the
  3650. 4:01:40uh limit price
  3651. 4:01:43with
  3652. 4:01:45um
  3653. 4:01:48with a new updated MT5 price.
  3654. 4:01:55And then we're going to keep doing it
  3655. 4:01:57over and over and over again until our
  3656. 4:02:00order gets filled. Right? So actually
  3657. 4:02:07I actually don't have to do this do it
  3658. 4:02:09like this. I can.
  3659. 4:02:12So here I can do like to-do
  3660. 4:02:22check exposure.
  3661. 4:02:26uh
  3662. 4:02:28check that
  3663. 4:02:31exposure
  3664. 4:02:35on target on hyperlquid does not exceed
  3665. 4:02:40uh the target exposure.
  3666. 4:02:44So what I mean by that is that when we
  3667. 4:02:47place uh a limit order right so I can
  3668. 4:02:50say for for example current uh exposure
  3669. 4:02:54hyperlquid is equal to uh
  3670. 4:03:02define get exposure hyperlquid. So it
  3671. 4:03:05tells us how much silver we are owning
  3672. 4:03:07right now. So get exposure hyperlquid
  3673. 4:03:10uh
  3674. 4:03:15and here I can write uh this uh
  3675. 4:03:19functions function
  3676. 4:03:22returns the
  3677. 4:03:25current exposure on hyperl
  3678. 4:03:33and here I can also add the symbol right
  3679. 4:03:35if I want to the
  3680. 4:03:39expo
  3681. 4:03:41or I can also add for the for symbol HL.
  3682. 4:03:50So here I can tell clot um
  3683. 4:03:57in trading bot.py Pi
  3684. 4:04:02there is a function get exposure
  3685. 4:04:07HL. Can you write code for this
  3686. 4:04:11function? Right. So I want Claude to you
  3687. 4:04:14know write code for this function here.
  3688. 4:04:42So yeah, so this function goes through
  3689. 4:04:45HL client positions. Uh
  3690. 4:04:48and then oh what I should have done is
  3691. 4:04:51uh
  3692. 4:04:56oh yeah also like uh specify the
  3693. 4:05:00specific output but it's already like
  3694. 4:05:02returned the float. So this is exactly
  3695. 4:05:04what I need. So right now what is my
  3696. 4:05:07exposure on hyperlquid right? Right now
  3697. 4:05:10my exposure hyperlquid is one silver
  3698. 4:05:13short. So I can actually test this
  3699. 4:05:15function.
  3700. 4:05:16And I can test this function
  3701. 4:05:19by
  3702. 4:05:21just printing the current exposure here.
  3703. 4:05:24So
  3704. 4:05:30actually let me move this up here. Let's
  3705. 4:05:32leave the train statements down here.
  3706. 4:05:34And current exposure hyperlquid is get
  3707. 4:05:39current exposure. So here I can also
  3708. 4:05:42print uh exposure hyperlquid
  3709. 4:05:47is
  3710. 4:05:50current exposure hyperlquid. Right? So
  3711. 4:05:53this function is important to keep track
  3712. 4:05:56of our exposure to make sure that the
  3713. 4:05:59trading bot does not open uh more trades
  3714. 4:06:02than necessary.
  3715. 4:06:04Uh so right now yeah I'm just going to
  3716. 4:06:07fill the direction I'm going to fill
  3717. 4:06:09anything and so right now the exposure
  3718. 4:06:13on hyperlink is 0.0 which is wrong. So
  3719. 4:06:15we need to check why this is um why this
  3720. 4:06:20is wrong.
  3721. 4:06:23Can you tell me one simple thing if
  3722. 4:06:25people are actually making money using
  3723. 4:06:26this bot why they create a subscription
  3724. 4:06:28right and focus on making money using
  3725. 4:06:30this bot yourself? Well, that's a great
  3726. 4:06:33question. Um, well, to be honest,
  3727. 4:06:3890% of the things are going to scams,
  3728. 4:06:40right? People are just going to sell you
  3729. 4:06:42some type of bots, you know, that
  3730. 4:06:46don't work, right? And that's how they
  3731. 4:06:48make money. And so, how does that make
  3732. 4:06:52me different? And what makes me
  3733. 4:06:55different or I hope makes me different
  3734. 4:06:57is that I'm coding on live stream. I'm
  3735. 4:06:59showing you all, you know, the knowhow
  3736. 4:07:01and you guys can see firsthand what
  3737. 4:07:03we're doing. And mainly what I'm doing
  3738. 4:07:05is I'm sharing the
  3739. 4:07:07results live, right? So once this string
  3740. 4:07:10bot is done, we're going to deploy it
  3741. 4:07:12live. You're going to see the live
  3742. 4:07:13results and you guys can like decide for
  3743. 4:07:16yourself whether these strategies work
  3744. 4:07:17or not, right? So uh I'm not going to
  3745. 4:07:20force anyone to get a subscription. I'm
  3746. 4:07:22just going to let my work speak for
  3747. 4:07:24myself. So uh it is up to you. And the
  3748. 4:07:28question is why I'm not focusing just on
  3749. 4:07:31trading. And the thing is algorithmic
  3750. 4:07:34trading is like if you think about it,
  3751. 4:07:37hi
  3752. 4:07:38like quite boring, right? You just write
  3753. 4:07:40the code, you let it run and then maybe
  3754. 4:07:44a few days later you review the strategy
  3755. 4:07:46and then you'll find something else. But
  3756. 4:07:48basically all I'm doing is press start
  3757. 4:07:51on my training strategy and it's running
  3758. 4:07:53all day. And the second reason, and
  3759. 4:07:56that's the main reason, well, it's even
  3760. 4:08:00though you know you guys know how much
  3761. 4:08:03or those of you who've been with me on
  3762. 4:08:04the live stream know how much money I
  3763. 4:08:06have on my train accounts, right? I am
  3764. 4:08:08like quite highly capitalized over a few
  3765. 4:08:12hundreds of thousand
  3766. 4:08:14over $100,000 US in funding. But the
  3767. 4:08:17reality of trading is that even if I
  3768. 4:08:19have like 200k on my trading account and
  3769. 4:08:22I make like 20% per year, right? That is
  3770. 4:08:25$40,000 US per year, which to some
  3771. 4:08:28people might sound like a lot of money,
  3772. 4:08:31but I still have like a company to feed.
  3773. 4:08:32I have employees. I have my expenses.
  3774. 4:08:34And I also want my money to grow. So the
  3775. 4:08:37reason why I'm doing these memberships
  3776. 4:08:39and teaching you while also trade is
  3777. 4:08:42basically it's an extra opportunity for
  3778. 4:08:44me to actually do something meaningful
  3779. 4:08:47in my free time. So this is my answer to
  3780. 4:08:51your question.
  3781. 4:08:54Hey new year I do crypto arbitrage but
  3782. 4:08:55liquidity for grow has been low lately.
  3783. 4:08:57What other segment would you recommend?
  3784. 4:09:00Well you can well it depends where
  3785. 4:09:03you're trying to do crypto arbitrage
  3786. 4:09:04right. So, uh, did you trade with
  3787. 4:09:07Binance or did you do with BitGet or
  3788. 4:09:10have you tried Dexes, right? Because
  3789. 4:09:11there are a lot of DEXs. I think it's
  3790. 4:09:14good, you know, to explore different
  3791. 4:09:16exchanges because I believe that you
  3792. 4:09:19will find a lot of opportunities if you
  3793. 4:09:21like look deep enough, right? And so
  3794. 4:09:24there are right now a lot of taxes where
  3795. 4:09:26we can try to apply these arbitrage
  3796. 4:09:27strategies and yeah good luck finding
  3797. 4:09:31those is safe IC markets. Yeah sort of
  3798. 4:09:34um if you choose like a broker that has
  3799. 4:09:37like FCA or Cisc regulation uh your
  3800. 4:09:40funds should be safe.
  3801. 4:09:44Hey I know basic programming. I'm pretty
  3802. 4:09:46good with trading. Do you think I will
  3803. 4:09:47able to understand and use your training
  3804. 4:09:48system after gym membership? Uh well
  3805. 4:09:51that uh depends I think uh part of the
  3806. 4:09:55membership so what I do in the
  3807. 4:09:57membership is like I will share the code
  3808. 4:09:58with you right so what you see here is I
  3809. 4:10:00will then share the results with you. So
  3810. 4:10:03in theory once I test the code and then
  3811. 4:10:06upload it on my website or on GitHub you
  3812. 4:10:09can just download it and run it
  3813. 4:10:11yourself.
  3814. 4:10:12But if you like can truly like replicate
  3815. 4:10:15what I do like code prompt AI understand
  3816. 4:10:18what's going on like like line by line
  3817. 4:10:22uh that might be a bit difficult. So I
  3818. 4:10:26would say if you just want to mimic the
  3819. 4:10:28strategy I think yes that's doable. If
  3820. 4:10:31you want to learn like actual like
  3821. 4:10:33coding coding understand everything that
  3822. 4:10:35I'm doing on the live stream here. Uh
  3823. 4:10:37that might like take a few months or
  3824. 4:10:39years, but it's also like probably
  3825. 4:10:42doable.
  3826. 4:10:46Okay, so we're nearly done. So I just
  3827. 4:10:49need to, you know, finish uh
  3828. 4:10:55checking the expert. Oh, actually guys,
  3829. 4:10:58I know this is not an error because
  3830. 4:11:00right now I have a position on silver,
  3831. 4:11:02right? But I'm actually checking the
  3832. 4:11:04exposure on S&P 500. So what I can do
  3833. 4:11:09here is I can
  3834. 4:11:12create a new position on S&P 500. And
  3835. 4:11:16for example, I can try to open
  3836. 4:11:20uh a position with a size of 0.1 S&P.
  3837. 4:11:24And I'm well right now I'm just going to
  3838. 4:11:26speculate.
  3839. 4:11:28There's like no reason behind it.
  3840. 4:11:31price looks a bit low. So, I'm going to
  3841. 4:11:33go buy
  3842. 4:11:37and
  3843. 4:11:38so yes, I'm going to place the order at
  3844. 4:11:40the mid price and hopefully I will get
  3845. 4:11:43filled and I can test my exposure check.
  3846. 4:11:55So, now my limit order has been placed.
  3847. 4:11:57We're waiting to get filled and then
  3848. 4:11:58we're going to check our exposure.
  3849. 4:12:06I'm about to sign up. What other things
  3850. 4:12:07do you get beside codebase in your
  3851. 4:12:09membership? Uh well, I have some courses
  3852. 4:12:11for beginners. So, if you're like an
  3853. 4:12:13actual beginner, uh you can like try
  3854. 4:12:15some simple algorithmic training courses
  3855. 4:12:18and one main benefit is my discord
  3856. 4:12:21server, right? So uh once you you know
  3857. 4:12:25subscribe you can join my discord server
  3858. 4:12:27and if you want to you know ask any
  3859. 4:12:29questions or any you know highle
  3860. 4:12:32consulting with your training project
  3861. 4:12:33you can just let me know in the discord
  3862. 4:12:35group and I will try to help you set it
  3863. 4:12:37up. So for example uh you know last week
  3864. 4:12:41I've done uh my USDC and USD
  3865. 4:12:43marketmaking bot on revolute and this
  3866. 4:12:46week I'm planning to release the code uh
  3867. 4:12:48on GitHub. So just let me know. I'll add
  3868. 4:12:51you to the GitHub project and if you
  3869. 4:12:53want to set it up, I'll gladly help you
  3870. 4:12:55with that. So, you can have your own
  3871. 4:12:57algo running on your end.
  3872. 4:13:01Uh, have you ever had a training bot
  3873. 4:13:03with a high return? Like 100%. Uh, no.
  3874. 4:13:07Like a 100% trading bot. Like I've never
  3875. 4:13:10done 100%. Like if by the end of the
  3876. 4:13:12year I make 20 to 30% I am actually more
  3877. 4:13:17than happy.
  3878. 4:13:21I think was my question. Sorry AV. Uh I
  3879. 4:13:23will repeat here. What instruments of
  3880. 4:13:25CFD crypto exchange broke would you
  3881. 4:13:26suggest to algo trade with small budget
  3882. 4:13:27like 5K euro?
  3883. 4:13:29So uh
  3884. 4:13:33assuming you want to apply the exact
  3885. 4:13:35strategy that I'm showing you here right
  3886. 4:13:37now, right? So I would focus on low
  3887. 4:13:40liquidity assets where the arbitrage
  3888. 4:13:42opportunities, you know, are much
  3889. 4:13:44better. Right? So I wouldn't focus on
  3890. 4:13:46these high volume assets. But maybe if
  3891. 4:13:48you go to Felix and uh I look at these
  3892. 4:13:53other assets like silver and gold USDH
  3893. 4:13:55here the volume is like 306,000 per day
  3894. 4:13:58or 87,000 per day. So here the pricing
  3895. 4:14:02is much more inefficient because the
  3896. 4:14:04liquidity is low and you'll have much
  3897. 4:14:06better time uh you know applying the
  3898. 4:14:08strategy on these markets. But if you
  3899. 4:14:10just want to you know write simple
  3900. 4:14:12algorith scripts and not arbitrage
  3901. 4:14:14trading then I can't give you an exact
  3902. 4:14:18symbol because that depends on the
  3903. 4:14:20strategy that you want to trade right
  3904. 4:14:22ideally you want to trade something
  3905. 4:14:23that's cheap right that has like good
  3906. 4:14:26train conditions executions but that
  3907. 4:14:29depends on the broker so I can't like
  3908. 4:14:31really answer that question uh in detail
  3909. 4:14:38okay so Uh let's see if our uh position
  3910. 4:14:42on S&P 500 has been filled. And the
  3911. 4:14:46thing is it has
  3912. 4:14:49not. So let me try to submit a new limit
  3913. 4:14:51price on SP500 hyperlquid.
  3914. 4:15:01Have you tried arbitrage and poly
  3915. 4:15:02market? No, not yet. Uh I've done a bit
  3916. 4:15:04of research and it's something I will
  3917. 4:15:06explore uh in the future. hopefully by
  3918. 4:15:08the end of this year and I also have a
  3919. 4:15:11look at you know some poly markets uh
  3920. 4:15:14opportunities or culture or any
  3921. 4:15:16prediction market also if you look at
  3922. 4:15:18hyperlquid there is also like some
  3923. 4:15:19outcome market so you can also like uh
  3924. 4:15:21speculate predictions so this is also
  3925. 4:15:24something that's new so I'm interested
  3926. 4:15:26in that as well
  3927. 4:15:30okay so our uh SP500 is still not
  3928. 4:15:34getting filled
  3929. 4:15:37Uh let me still try to submit a new
  3930. 4:15:41limit order at limit price.
  3931. 4:15:49And let's try to get filled.
  3932. 4:16:02Amazing guys. So uh our position has
  3933. 4:16:06been filled. So, we are long 0.1 S&P 500
  3934. 4:16:09contracts. And so, if you run our
  3935. 4:16:11trading bot now, hopefully our uh
  3936. 4:16:14exposure.
  3937. 4:16:17Uh
  3938. 4:16:24oh, no.
  3939. 4:16:26So, yeah, our exposure on the hyperlquid
  3940. 4:16:28is 0.1. So, our script to, you know,
  3941. 4:16:31check the exposure is done.
  3942. 4:16:35And
  3943. 4:16:36so now we can actually continue
  3944. 4:16:40uh writing our function.
  3945. 4:16:44So here we have current exposure
  3946. 4:16:46hyperlquid is get current exposure and
  3947. 4:17:03so what we can do here is we want to get
  3948. 4:17:06filled until a certain amount of
  3949. 4:17:08exposure. So the thing with hyperlquid
  3950. 4:17:11is that uh when you amend the order
  3951. 4:17:15right it will not uh amend the original
  3952. 4:17:20volume. So if you get filled and
  3953. 4:17:21amendment the order the volume will stay
  3954. 4:17:24the same. So I need to create like a
  3955. 4:17:26risk check. So our exposure always stays
  3956. 4:17:28below the one that I want to have. So
  3957. 4:17:32current exposure
  3958. 4:17:34hyperlquid
  3959. 4:17:46uh so what I can do here is I can
  3960. 4:17:50specify the maximum exposure uh long
  3961. 4:17:55hyperlquid. So I want to define the
  3962. 4:17:58maximum amount of uh
  3963. 4:18:02uh hyperlquid units I want. So I don't
  3964. 4:18:04want to have more exposure than one,
  3965. 4:18:08right? And maximum exposure short
  3966. 4:18:11hyperlquid
  3967. 4:18:13will be minus one. So I don't want to,
  3968. 4:18:16you know, have more than minus one S&P
  3969. 4:18:20500.
  3970. 4:18:22So this is what I'm going to do.
  3971. 4:18:31And so here this is the current exposure
  3972. 4:18:34or actually I don't need this.
  3973. 4:18:39So what I can do here is I can check the
  3974. 4:18:42exposure. So current exposure is get
  3975. 4:18:46exposure and so if
  3976. 4:18:49my current exposure hyperlquid is
  3977. 4:18:51greater or equal to my maximum exposure
  3978. 4:18:56long
  3979. 4:18:58on hyperlquid then uh I want to cancel
  3980. 4:19:02order
  3981. 4:19:09cancel order and then return
  3982. 4:19:33and so here up the limit price. So,
  3983. 4:19:38and here uh
  3984. 4:19:46this should be fine.
  3985. 4:19:59Okay. Uh
  3986. 4:20:06And also I can add to-do uh
  3987. 4:20:10check order state
  3988. 4:20:13if it is filled then
  3989. 4:20:18exit.
  3990. 4:20:21So yeah so let's try to now implement
  3991. 4:20:25this function and hopefully with this
  3992. 4:20:28function we can now try to open a hedge.
  3993. 4:20:30So we will buy on hyperlquid
  3994. 4:20:32and sell on FT5.
  3995. 4:20:39And so another thing I should do
  3996. 4:20:46check exposure on hyperlquid
  3997. 4:20:49and hedge that exposure with FT5. So
  3998. 4:20:54then I think we need to
  3999. 4:20:57uh
  4000. 4:20:59like check the exposure with the hyper
  4001. 4:21:0225 and then it will send a market order.
  4002. 4:21:04Uh but let's try to implement this
  4003. 4:21:07function now. So
  4004. 4:21:09in trading bot.py Pi.
  4005. 4:21:16Uh, please code
  4006. 4:21:19the function
  4007. 4:21:27for the function
  4008. 4:21:29quote
  4009. 4:21:31bit
  4010. 4:21:34on HL.
  4011. 4:21:36And then I also add maybe some extra uh
  4012. 4:21:40information.
  4013. 4:21:42In this function uh
  4014. 4:21:46or this function
  4015. 4:21:50quotes
  4016. 4:21:52the bit price
  4017. 4:21:54on hyperlquid
  4018. 4:21:57which basically means a buy limit.
  4019. 4:22:00Uh the limit price is defined as MT5
  4020. 4:22:07uh bit price plus the target spread.
  4021. 4:22:13Right? Here I'm just explaining
  4022. 4:22:17step by step what we're doing. Uh
  4023. 4:22:22after the order is placed,
  4024. 4:22:26I want to uh regularly
  4025. 4:22:34update the order uh limit price to
  4026. 4:22:38reflect new MT5 price.
  4027. 4:22:42If MT5 price
  4028. 4:22:45is the same, there is no need to amend
  4029. 4:22:50the order.
  4030. 4:22:52If the order is already filled or
  4031. 4:22:57cancelled,
  4032. 4:23:00exit maybe I should have written like
  4033. 4:23:01this actually. It feels a bit easier to
  4034. 4:23:03do it like this. If MT5 price is saying,
  4035. 4:23:05there's no need
  4036. 4:23:07filled or cancelled. Exit.
  4037. 4:23:13Check that current exposure does not
  4038. 4:23:17exceed
  4039. 4:23:19uh max exposure. Otherwise, cancel
  4040. 4:23:23orders and exit.
  4041. 4:23:32And then if timeout
  4042. 4:23:36if timeout
  4043. 4:23:39is reached then also exit.
  4044. 4:23:45Okay. So let's just try to implement
  4045. 4:23:46this function with cloth and we'll see
  4046. 4:23:48what we get.
  4047. 4:23:53If you type at sign and then type the
  4048. 4:23:55file name, you'll give cloth code the
  4049. 4:23:57direct reference of a file if you want
  4050. 4:23:59to modify. Without that it's better to
  4051. 4:24:01close with okay
  4052. 4:24:04thank you.
  4053. 4:24:14So I'll try it from now on. So in at
  4054. 4:24:16stringb.py
  4055. 4:24:19actually I can cancel it
  4056. 4:24:22and I'll implement your suggestion.
  4057. 4:24:25Thank you for
  4058. 4:24:28Ah, here it is.
  4059. 4:24:39Oh, that's
  4060. 4:24:50line 57.
  4061. 4:24:54Thanks a lot.
  4062. 4:25:25Okay, so now clicking this function is
  4063. 4:25:27like a bit complex. So it might take
  4064. 4:25:29some time, but this is actually the most
  4065. 4:25:32important function, right? It's a
  4066. 4:25:33function that adds the limit orders on
  4067. 4:25:36hyperlquid and then places a h5.
  4068. 4:25:41I think I forgot to add the h there.
  4069. 4:25:59So let's see what Claude is now
  4070. 4:26:00suggesting.
  4071. 4:26:37Okay, let's try to add this change
  4072. 4:26:55and sorry guys. So once this function is
  4073. 4:26:57done, this is basically like 80 or 90%
  4074. 4:27:01of the work done because that is
  4075. 4:27:03actually what allows us to make money
  4076. 4:27:04and the rest is just some risk control
  4077. 4:27:06metrics and then we're going to add like
  4078. 4:27:09you know signals as we said like we can
  4079. 4:27:12compute the Z score and define our entry
  4080. 4:27:15and exit levels uh more dynamically but
  4081. 4:27:19this will be like the foundation or like
  4082. 4:27:22the basis bas you know the basic
  4083. 4:27:24functionality of a train bot. that will
  4084. 4:27:26be used in any type you know of uh
  4085. 4:27:29strategy.
  4086. 4:27:36Okay. Uh
  4087. 4:27:46okay. Here I'm going to create new file.
  4088. 4:27:48Uh I'm going to call it uh
  4089. 4:27:59so here I want to test the script. So I
  4090. 4:28:01I don't want to actually
  4091. 4:28:04um
  4092. 4:28:06use any of these. So actually all I'm
  4093. 4:28:08going to do here is actually I'm just
  4094. 4:28:12going to
  4095. 4:28:14do the quote bit function here. And here
  4096. 4:28:16the target spread I'm going to define
  4097. 4:28:19statically target spread is let's say
  4098. 4:28:22minus one or let's do minus 10 so we can
  4099. 4:28:25actually see uh if the limit prices
  4100. 4:28:30are being updated properly. So we're in
  4101. 4:28:33100.
  4102. 4:28:34So we're going to run this function
  4103. 4:28:41and now we're should be quoting the
  4104. 4:28:46limit on hyperlquid. So place by limit
  4105. 4:28:50and
  4106. 4:28:52now we see that the limit price has been
  4107. 4:28:55set $100 below our MT5 price.
  4108. 4:28:59Um,
  4109. 4:29:02okay. Just a cloth. Uh,
  4110. 4:29:13so I'm going to apply the suggestion
  4111. 4:29:17from Mr. Best Merch. So, thank you for
  4112. 4:29:19suggestion. So, in quote limit prices
  4113. 4:29:24test.py pi.
  4114. 4:29:27Uh, I got this error.
  4115. 4:29:46So now let clo try to find a fix for
  4116. 4:29:49this issue and then we can then try to
  4117. 4:29:52resume. So as you guys can see so now at
  4118. 4:29:55least uh the script is able to you know
  4119. 4:29:58quote the limit prices and so then it
  4120. 4:30:01will quote the prices here and then
  4121. 4:30:03we'll try to get filled on MT5. I think
  4122. 4:30:07for the hedging it's probably better to
  4123. 4:30:10create like a separate like hedging
  4124. 4:30:12script uh that will be independent from
  4125. 4:30:15this script and all cloud will do is
  4126. 4:30:18just check the exposures because I want
  4127. 4:30:20uh you know to have like a non um what
  4128. 4:30:24is it called non-blocking execution when
  4129. 4:30:26we update the limit prices because what
  4130. 4:30:29can happen is that
  4131. 4:30:31uh
  4132. 4:30:33yeah when we're when we're hedging there
  4133. 4:30:35might be some delay on the MT5 site
  4134. 4:30:37which takes extra processing time and
  4135. 4:30:39during this time maybe the quotes might
  4136. 4:30:42be outdated. So we want to make sure
  4137. 4:30:44that we always uh quote the up-to-date
  4138. 4:30:48prices
  4139. 4:31:09Okay. So,
  4140. 4:31:18so now we're quoting bit on hyperlquid
  4141. 4:31:23and here we've embended.
  4142. 4:31:26So, this is great guys. So right now our
  4143. 4:31:29limit price is being amended. There's
  4144. 4:31:32also one order that we've placed. So we
  4145. 4:31:34can cancel that one because that was
  4146. 4:31:37from uh the initial script that failed
  4147. 4:31:45and and now this order is being amended
  4148. 4:31:48right. Um, so I can tell Claude, uh,
  4149. 4:32:06please cancel open orders
  4150. 4:32:10for symbol hyperlquid
  4151. 4:32:14on in it.
  4152. 4:32:17So whenever we have some open um orders
  4153. 4:32:21when we start a script I want cloth to
  4154. 4:32:24um yeah cancel orders
  4155. 4:32:29and so now
  4156. 4:32:31that it actually works we can try to
  4157. 4:32:34actually get filled right so now I'm
  4158. 4:32:36going to place
  4159. 4:32:38uh the target spread let's say to minus
  4160. 4:32:40one right so minus one is not like a
  4161. 4:32:43good price level to to like enter But I
  4162. 4:32:46just want to test you know if it gets
  4163. 4:32:48filled and then if everything is okay.
  4164. 4:33:14Okay. So now we can
  4165. 4:33:25So now we're coding the bit price
  4166. 4:33:29on hyperlquid.
  4167. 4:33:31Now we see that the bit price hovering
  4168. 4:33:33here 39.3
  4169. 4:33:36and
  4170. 4:33:42it's 39.5. So now we see that the limit
  4171. 4:33:45prices are actually being updated
  4172. 4:33:49based on our MT5 price right. So right
  4173. 4:33:52now the logic is that we take MT5 price
  4174. 4:33:56the bit price minus one right. So that
  4175. 4:33:59is the limit price for our algorithm.
  4176. 4:34:06So it's 40.8 here it's 41.8 now it's
  4177. 4:34:0941.5
  4178. 4:34:11it's 40.5. So we see that we are
  4179. 4:34:15actually like trailing the MT5 price
  4180. 4:34:19sort of correctly. And now I just need
  4181. 4:34:20to test if we get filled how the
  4182. 4:34:24training bot acts when we get filled.
  4183. 4:34:27Right.
  4184. 4:34:36And so yeah, we're running a bit out of
  4185. 4:34:38time because I've been streaming for
  4186. 4:34:40over four hours now, which is fine, but
  4187. 4:34:43I have a meeting at 8, so I'll have to
  4188. 4:34:45go in 90 minutes latest. So worst case,
  4189. 4:34:48we can just resume the project tomorrow.
  4190. 4:34:54So now what happened is that timeout
  4191. 4:34:56reach, canceling order, and the script
  4192. 4:34:58exited. So, what if I'm really desperate
  4193. 4:35:01to get filled, right? Really desperate.
  4194. 4:35:03Or let me try to find another symbol.
  4195. 4:35:07Uh maybe we'll [clears throat] find some
  4196. 4:35:10symbol where we can have
  4197. 4:35:15an almost guaranteed fill.
  4198. 4:35:25Or actually, let's just set the target
  4199. 4:35:27spread to zero. We're going to do that.
  4200. 4:35:40So here our order got filled and then we
  4201. 4:35:44exited.
  4202. 4:35:56So right now our exposure of SP500 is
  4203. 4:35:591.1. So this is great. So the last thing
  4204. 4:36:02we need to do is we need to create a
  4205. 4:36:04hedging tool that can hedge this
  4206. 4:36:06exposure with MT5.
  4207. 4:36:11And
  4208. 4:36:13so what I can do now is we can decide to
  4209. 4:36:17put like the hedging script inside like
  4210. 4:36:19this one or we can create like a
  4211. 4:36:22separate script and like how how I would
  4212. 4:36:25start is I would do a separate script so
  4213. 4:36:28the code is much cleaner and we can see
  4214. 4:36:30exactly what we're doing and then
  4215. 4:36:33in the future we can then like merge
  4216. 4:36:35those two scripts together and create
  4217. 4:36:38like a hedging tool. So here I will call
  4218. 4:36:43uh create a script called hedge exposure
  4219. 4:36:47uh with MT5.
  4220. 4:36:53So this script uh listens to
  4221. 4:36:57exposure on MT5 and hedges uh that
  4222. 4:37:02exposure
  4223. 4:37:04uh on hyperlquid
  4224. 4:37:08and hedges.exposure
  4225. 4:37:11on MT5.
  4226. 4:37:15Uh
  4227. 4:37:18whenever we receive a new event in
  4228. 4:37:24positions
  4229. 4:37:26or clearing house
  4230. 4:37:32uh
  4231. 4:37:34hyperlquid for the specific
  4232. 4:37:38position.
  4233. 4:37:40Uh compare the exposure between
  4234. 4:37:46hyper liquid
  4235. 4:37:49and MP5
  4236. 4:37:51and
  4237. 4:37:54HD exposure.
  4238. 4:38:00So we're going to use like again symbol
  4239. 4:38:02hyperlquid then so for example here we
  4240. 4:38:06would do SP 500 and then we would here
  4241. 4:38:09add symbol MT5 which is US 500
  4242. 4:38:16right uh
  4243. 4:38:21so here in
  4244. 4:38:23hedge exposure with MT5 implement a
  4245. 4:38:28hedging logic
  4246. 4:38:30where
  4247. 4:38:39create uh
  4248. 4:38:42an exposure
  4249. 4:38:44hedger that hedges
  4250. 4:38:48exposure between hyperlid and 25.
  4251. 4:38:53Be careful about contract sizes.
  4252. 4:38:58uh one unit on hyperlquid
  4253. 4:39:07could potentially be a different lot
  4254. 4:39:12size on MT5.
  4255. 4:39:17So now we're creating this hedging tool
  4256. 4:39:19and when this is tested then yeah we can
  4257. 4:39:23try to use the last hour to find some
  4258. 4:39:26arbitrage opportunities and then like
  4259. 4:39:29it's about like adding a lot of control
  4260. 4:39:31metrics um and then we can like again
  4261. 4:39:35create like a web UI when we're done but
  4262. 4:39:38we still need to like finish this
  4263. 4:39:41specific thing
  4264. 4:39:44and also we need to implement the same
  4265. 4:39:46function for quote ask on hyperlquid
  4266. 4:39:58and we forgot to add that the time in
  4267. 4:40:00force should be alo because right now we
  4268. 4:40:03have GTC
  4269. 4:40:04and uh
  4270. 4:40:08so we need to add that too. So here I'm
  4271. 4:40:10also going to add another to-do
  4272. 4:40:16order limit should be a
  4273. 4:40:22liquidity only.
  4274. 4:40:56So here actually the MT5 contract size
  4275. 4:40:59is wrong because the contract size for
  4276. 4:41:01US 500
  4277. 4:41:05is one right. So this is actually the
  4278. 4:41:08dangerous part when you do algorith
  4279. 4:41:10here the AI assumes that contract size
  4280. 4:41:13is one on US 500 100 on US 500 but it's
  4281. 4:41:17just one
  4282. 4:41:21and then uh yeah
  4283. 4:41:29so here we're getting the exposure on
  4284. 4:41:32hyperlquid here we're getting the
  4285. 4:41:33exposure on MT5. five and here it uh it
  4286. 4:41:39wrote us a simple market sent market
  4287. 4:41:41order to hedge that exposure on our
  4288. 4:41:43platform. So now we have hedge here
  4289. 4:41:49and that's basically it.
  4290. 4:42:01So I'm just running the script see if it
  4291. 4:42:03works. Right now my algorithmic training
  4292. 4:42:04is disabled. So he can't place any
  4293. 4:42:07trades.
  4294. 4:42:10So here it's trying to sell 1.1 lots on
  4295. 4:42:14US 500. And that makes sense because we
  4296. 4:42:17try to we're long 1.1 right now. And
  4297. 4:42:21right now the script is trying to sell
  4298. 4:42:221.1.
  4299. 4:42:29Uh
  4300. 4:42:39all right so because
  4301. 4:42:41I also want to add you know some check
  4302. 4:42:44so in
  4303. 4:42:47uh
  4304. 4:42:50again Mr. best merch. Thank you for a
  4305. 4:42:51suggestion and hedge
  4306. 4:42:55exposure with MT5.
  4307. 4:42:58Um,
  4308. 4:43:05uh, please add maximum of
  4309. 4:43:10let's say 10 order retries
  4310. 4:43:13if the hedge failed. Otherwise, exit the
  4311. 4:43:19script.
  4312. 4:43:38But so yeah, so I think if I just run
  4313. 4:43:40this code, it will uh place
  4314. 4:43:44an order to met Metatrader 5 and we'll
  4315. 4:43:47have a fully hatched hedged position on
  4316. 4:43:51US 500.
  4317. 4:44:48Okay. So now
  4318. 4:44:55if you look at our function H.
  4319. 4:45:13So let's run this.
  4320. 4:45:22And now it's trying to, you know,
  4321. 4:45:24attempt to hedge the position and then
  4322. 4:45:28it exits.
  4323. 4:45:32So now let's try to
  4324. 4:45:38run the script. I enable algorithm
  4325. 4:45:40trading on my MT5 account. And now you
  4326. 4:45:44see that
  4327. 4:45:48the position has been hedged, right? So
  4328. 4:45:50right now we have actually all we need
  4329. 4:45:53to
  4330. 4:45:55have a fully function arbitrage
  4331. 4:45:56strategy. Of course we have to implement
  4332. 4:45:58like a lot of security features,
  4333. 4:46:00monitoring and like strategy logic. But
  4334. 4:46:04the the code to you know open hedge
  4335. 4:46:07position is now fully running. So in
  4336. 4:46:10theory if I exit the position right if I
  4337. 4:46:14want to exit SM5 position here um
  4338. 4:46:18it should then exit on the MT5 side. So
  4339. 4:46:22here uh I will let hedge exposure MT5
  4340. 4:46:25running because this script edges uh I
  4341. 4:46:28also need to implement quote ask on
  4342. 4:46:31hyperlquid.
  4343. 4:46:38So quote ask means I want to sell. So,
  4344. 4:46:40I'm going to actually put
  4345. 4:46:43the quote ask uh below the quote bit.
  4346. 4:46:55And I'm going to tell Claude
  4347. 4:47:06and quote limit prices uh py
  4348. 4:47:18uh implement the quote
  4349. 4:47:24task
  4350. 4:47:25on HL function
  4351. 4:47:28in line 139.
  4352. 4:47:33The same way
  4353. 4:47:36like quotes
  4354. 4:47:40bit on HL
  4355. 4:47:43but for sell limit orders.
  4356. 4:47:47Also please uh change the limit type to
  4357. 4:47:53alo
  4358. 4:47:55post or post only orders.
  4359. 4:48:10Okay. So now we're
  4360. 4:48:12okay. We're changing that to ALO. That's
  4361. 4:48:15the first thing.
  4362. 4:48:25Code limit prices tested pie. Yes.
  4363. 4:49:17All good.
  4364. 4:49:19Also, I'm a paranoid. So in H exposure
  4365. 4:49:22uh
  4366. 4:49:29in H
  4367. 4:49:32exposure
  4368. 4:49:34with MT5,
  4369. 4:49:36can you add uh a risk check
  4370. 4:49:42for maximum
  4371. 4:49:44volume
  4372. 4:49:46hedged per day
  4373. 4:49:49and also So
  4374. 4:49:55max trades uh place or just maximum
  4375. 4:49:59point per day. So it avoids to create
  4376. 4:50:02like trade too much. So it can happen
  4377. 4:50:04that for example my trading bot goes
  4378. 4:50:07into some kind of loop. It just opens
  4379. 4:50:09and closes opens closes and in such a
  4380. 4:50:11case it can burn my account. Right? And
  4381. 4:50:14if you have like thousands or tens of
  4382. 4:50:16thousands of dollars on your account,
  4383. 4:50:18this can be a disaster. So even though
  4384. 4:50:21the code looks okay to me and I don't
  4385. 4:50:23see any issues, it's always good to add
  4386. 4:50:25like this risk control check.
  4387. 4:50:48So now in hedge exposure, so let's say
  4388. 4:50:50the maximum amount of lots I want to
  4389. 4:50:52open on this strategy would let's say be
  4390. 4:50:5610 right right now. So I wouldn't trade
  4391. 4:50:59more than 10. If something happens, I
  4392. 4:51:01would just notify
  4393. 4:51:03myself. Oh, sorry. This is actually
  4394. 4:51:05already correct. So Claude already
  4395. 4:51:07filled this for me. So it's going to be
  4396. 4:51:0910.
  4397. 4:51:33Nice.
  4398. 4:51:37And then the last thing in code limit
  4399. 4:51:40prices test uh create a function that
  4400. 4:51:46checks exposure
  4401. 4:51:49between
  4402. 4:51:51hyper liquid
  4403. 4:51:53and MT5. And if there is an
  4404. 4:52:00exposure discrepancy,
  4405. 4:52:03uh cancel
  4406. 4:52:07open orders and halt uh
  4407. 4:52:13trading.
  4408. 4:52:26or actually I should do that for the
  4409. 4:52:27main training bot. So I can do it later
  4410. 4:52:30actually. So so now
  4411. 4:52:33uh code ask has been implemented. Uh my
  4412. 4:52:36hedge exposure bot is still running. So
  4413. 4:52:40let's uh restart my H exposure. And here
  4414. 4:52:44we have the risk control check to
  4415. 4:52:52no check the hedges. Uh and so now oh we
  4416. 4:52:57don't need this. Uh let me now quote
  4417. 4:53:04ask and I want to exit at minus one. So
  4418. 4:53:06I'm intentionally creating a loss now,
  4419. 4:53:08right? I just want to see uh if the
  4420. 4:53:11strategy works. So now uh we're coding
  4421. 4:53:16ask on hyperlquid.
  4422. 4:53:21And so here my order got rejected
  4423. 4:53:24because it would have been matched with
  4424. 4:53:26a bet best bid offer on hyperlquid.
  4425. 4:53:31And that makes sense because now I have
  4426. 4:53:33liquidity adding orders only. So I
  4427. 4:53:35should also create a script that uh has
  4428. 4:53:38like a minimum spread offset so I can
  4429. 4:53:41all so you know so the order gets added
  4430. 4:53:43to the order book.
  4431. 4:53:54So in quoting prices test uh
  4432. 4:54:00when quoting bit and ask prices on
  4433. 4:54:05hyperlquid
  4434. 4:54:09please check the current top of book
  4435. 4:54:12price.
  4436. 4:54:15Uh
  4437. 4:54:17if uh
  4438. 4:54:21the price would
  4439. 4:54:24if uh
  4440. 4:54:27the limit if or let's just write if the
  4441. 4:54:31current
  4442. 4:54:32bit price is uh
  4443. 4:54:37greater
  4444. 4:54:49Or let me try to phrase it a different
  4445. 4:54:51way. Um, when coding bid and ask price
  4446. 4:54:54hyper liquid, please check the current
  4447. 4:54:55top of price
  4448. 4:54:59if the order would have
  4449. 4:55:06or add a minimum offset from the best
  4450. 4:55:11top of book price. If the limit price
  4451. 4:55:16would have immediately
  4452. 4:55:20match.
  4453. 4:55:25I think that should enough.
  4454. 4:55:39So right now what we're just doing is uh
  4455. 4:55:44so for example right now this this is
  4456. 4:55:45the bit and ask price and I can't quote
  4457. 4:55:48a bid price that's like above the
  4458. 4:55:50current ask price. You can't add this to
  4459. 4:55:52the order book. You would have to either
  4460. 4:55:54like uh get filled here but because our
  4461. 4:55:58order type is add liquidity only we
  4462. 4:56:01cannot add liquidity at that level.
  4463. 4:56:08And here we have like a minimum top of
  4464. 4:56:09book offset which is set to uh to one.
  4465. 4:56:17Uh so this is actually great.
  4466. 4:56:48So now we're computing new limit prices
  4467. 4:56:50in case we would have been immediately
  4468. 4:56:52matched
  4469. 4:56:53and that would help us you know
  4470. 4:56:57it actually gives us a better price.
  4471. 4:56:59That's what it what's happening.
  4472. 4:57:35Okay. So
  4473. 4:57:39now we've added this change.
  4474. 4:58:14And so now I think
  4475. 4:58:19we can try to sell.
  4476. 4:58:22So let's run this again.
  4477. 4:58:26Our script to H exposure is still
  4478. 4:58:27running.
  4479. 4:58:33So right now we are trying to sell by
  4480. 4:58:36adding liquidity to the order book and
  4481. 4:58:39as you can see now we are exiting our
  4482. 4:58:42position. So as you can see order no
  4483. 4:58:44longer open. Uh it's exiting now and the
  4484. 4:58:48script is finished. So our order got
  4485. 4:58:50filled and it got immediately hedged
  4486. 4:58:52with MT5.
  4487. 4:58:54So now what we need to do is like we
  4488. 4:58:56need to let this script run like over
  4489. 4:58:59and over again, right? So we just got
  4490. 4:59:01one trade executed. So here order no
  4491. 4:59:04longer opened filled or cancelled. So
  4492. 4:59:06it's exiting because it couldn't find
  4493. 4:59:08that order. And
  4494. 4:59:15let's see. So here our volume hyper
  4495. 4:59:17liquid is now one.
  4496. 4:59:36So let's try to run this again. I'm
  4497. 4:59:38going to make sure that everything's
  4498. 4:59:40running correctly. So again what's
  4499. 4:59:43happening here is so on hyperlquid now
  4500. 4:59:45we are quoting uh cell limit right
  4501. 4:59:50because we want to exit our position uh
  4502. 4:59:53this cell limit is set to minus one uh
  4503. 4:59:57like the current MT5 safety price minus
  4504. 4:59:59one
  4505. 5:00:08let's See
  4506. 5:00:11if the pricing can update it.
  4507. 5:00:15It's still 41.8 and here's 41.4
  4508. 5:00:19because we like still
  4509. 5:00:23I guess we're still uh updated because
  4510. 5:00:26of top of book
  4511. 5:00:29and yeah again we're just waiting to get
  4512. 5:00:32filled.
  4513. 5:00:34Here we are at top of book. So someone
  4514. 5:00:37who decides to buy on the exchange will
  4515. 5:00:40buy it from us essentially
  4516. 5:00:54and
  4517. 5:00:56as I can see uh a trade got executed. So
  4518. 5:01:00here I can see that
  4519. 5:01:03oh the timeout has been reached.
  4520. 5:01:06and
  4521. 5:01:09we hatched one. So here also what I can
  4522. 5:01:12do is I can change the volume
  4523. 5:01:18let's say to 0.1
  4524. 5:01:21I want to finish closing this remaining
  4525. 5:01:24order and then let's try to after this
  4526. 5:01:29let's try to find a symbol where we can
  4527. 5:01:32actually try to make money right so this
  4528. 5:01:35is the minimum usable
  4529. 5:01:37like script that we can
  4530. 5:01:40So now we're actually going to try, you
  4531. 5:01:42know, find some profitable opportunities
  4532. 5:01:44and then in the like next live streams
  4533. 5:01:48uh throughout this week, I'm going to
  4534. 5:01:50try, you know, make everything look
  4535. 5:01:52nicer, debug everything and make a
  4536. 5:01:55training bot that can run 24/7.
  4537. 5:02:06So now we're coding 0.1
  4538. 5:02:09at top of book
  4539. 5:02:18and we have exit our position.
  4540. 5:02:24As you can see now we're a bit we're a
  4541. 5:02:25bit short. So this is what I meant like
  4542. 5:02:27when you amend an order uh on hyperlquid
  4543. 5:02:31the original order size uh disappears.
  4544. 5:02:35So I want to actually when I amend the
  4545. 5:02:38order I want to uh include the initial
  4546. 5:02:42order size so we don't open too much
  4547. 5:02:44than intended. So let me actually add
  4548. 5:02:47this to cloth.
  4549. 5:02:56When I amend an order, it does
  4550. 5:03:01not take
  4551. 5:03:12the volume. Uh,
  4552. 5:03:28not causing me to trade more than I
  4553. 5:03:33want. Can you take already filled amount
  4554. 5:03:39into consideration?
  4555. 5:03:43when amending uh limit orders.
  4556. 5:04:07So yeah, but the hedging basically
  4557. 5:04:09works. Uh right now our position on S&P
  4558. 5:04:13500 is 0.02
  4559. 5:04:16but here on MT5 it is 0.01 which means
  4560. 5:04:20we also have an error in hedging
  4561. 5:04:24somewhere here and
  4562. 5:04:28actually here.
  4563. 5:04:35So in hyperl we are minus 0.026 026 and
  4564. 5:04:38on MT5 we have 0.1.
  4565. 5:04:40So our difference is 0.1.
  4566. 5:04:45Let me restart it. Maybe
  4567. 5:04:48it'll fix it. Or maybe there's some bug
  4568. 5:04:51inside the code.
  4569. 5:04:56So it's not a bug. I think there is
  4570. 5:04:58maybe like a minimum uh size discrepancy
  4571. 5:05:03and for that reason does not hedge but
  4572. 5:05:05it's a very very small amount so it's
  4573. 5:05:07it's actually not that bad it's just 0.1
  4574. 5:05:10so I think
  4575. 5:05:13maybe in Hex exposure MT5
  4576. 5:05:17let me check so here uh
  4577. 5:05:22oh yeah we have it
  4578. 5:05:33So I think there's oh there's a h
  4579. 5:05:35threshold unit. So if the exposure
  4580. 5:05:38discrepancy stays below 0.5
  4581. 5:05:42which it is then there is actually no
  4582. 5:05:45issue. But because the price precision
  4583. 5:05:48on MT5
  4584. 5:05:51is 0.01 01. I think we can decrease the
  4585. 5:05:54threshold unit to
  4586. 5:05:570.05. So now if I restart the script
  4587. 5:06:05now the threshold will update and now
  4588. 5:06:08we're zero and hyperlquid our exposure
  4589. 5:06:12is like also basically zero.
  4590. 5:06:16So yeah,
  4591. 5:06:19[sighs]
  4592. 5:06:31so here I still need to you know modify
  4593. 5:06:34using the original size.
  4594. 5:06:38And so now let's have a look. Do we have
  4595. 5:06:42any training opportunities today? If
  4596. 5:06:44not, we can try to look for some
  4597. 5:06:45tomorrow.
  4598. 5:06:47But
  4599. 5:07:05I think maybe we can try to find
  4600. 5:07:08something.
  4601. 5:07:24I mean platinum looks quite interesting
  4602. 5:07:25here. We have like 23% funding rate.
  4603. 5:07:28That could theoretically work
  4604. 5:08:03Um so yeah.
  4605. 5:08:14So now
  4606. 5:08:17let me also
  4607. 5:08:18do something and
  4608. 5:08:28I made a lot of changes in quote limit
  4609. 5:08:33prices test.py.
  4610. 5:08:38Can you synchronize the changes
  4611. 5:08:42in
  4612. 5:08:45tradingbot.py.
  4613. 5:08:54Oh yeah, I forgot to add the tag again
  4614. 5:08:57to specify the files, but I think it
  4615. 5:08:58should be fine.
  4616. 5:09:32Okay, we're going to add that. And then
  4617. 5:09:35what I'm going to do is also I'm going
  4618. 5:09:36to create like a strategy configuration
  4619. 5:09:38file. So as you know like trading bot.py
  4620. 5:09:41PI uh
  4621. 5:09:44code limit price and H exposure they all
  4622. 5:09:47use like shared like same initial like
  4623. 5:09:51variables.
  4624. 5:09:59Oh yeah, I forgot to also add an
  4625. 5:10:02exposure check, but we'll get to that.
  4626. 5:10:28And I think now we can actually like try
  4627. 5:10:30to prompt claude to like create like a
  4628. 5:10:33training board that is now running with
  4629. 5:10:35these like uh
  4630. 5:10:41like specified entry and exit levels. So
  4631. 5:10:58let cloud just, you know, update any
  4632. 5:11:01changes because I've been doing a lot in
  4633. 5:11:02like code limit prices and test.py. So
  4634. 5:11:06I'm just synchronizing the changes
  4635. 5:11:10and yeah. Oh, I have another question.
  4636. 5:11:12Sorry. Uh how many training systems you
  4637. 5:11:14have running advance in your company? As
  4638. 5:11:16I said, I have one main one. Uh and then
  4639. 5:11:21I have like small accounts to like
  4640. 5:11:23research and test and look for like
  4641. 5:11:25backup plans in case the main strategy
  4642. 5:11:27uh stops performing.
  4643. 5:11:30And it's one strategy that I'm running
  4644. 5:11:33on hyperlquid, right? So we're talking
  4645. 5:11:35about hyperl against MT5. Sometimes it
  4646. 5:11:38can also like be lighter, right? Against
  4647. 5:11:40MT5.
  4648. 5:11:41So we have that too.
  4649. 5:11:51It's that a little bit stupid to have a
  4650. 5:11:52single file training strip VIP coding.
  4651. 5:11:54Uh maybe I can clarify some things. Uh
  4652. 5:11:57my strategies that I'm training so far
  4653. 5:11:59are not vioded. I coded all of them
  4654. 5:12:02myself. And the reason why I'm like
  4655. 5:12:05coding with you right now is that uh
  4656. 5:12:10uh like I got into AI like a week or two
  4657. 5:12:12ago and I'm trying like to explore the
  4658. 5:12:14capabilities of AI by implementing my
  4659. 5:12:17own strategies using the help of AI. So,
  4660. 5:12:23and also I wouldn't call this VIPE
  4661. 5:12:25coding necessarily because at the end of
  4662. 5:12:26the day we are still like reviewing the
  4663. 5:12:28code and like we try to you know keep
  4664. 5:12:31track of what's going on in there. So
  4665. 5:12:33it's not like uh I don't understand
  4666. 5:12:36what's going on here but it's a
  4667. 5:12:37legitimate opinion. So uh feel free to
  4668. 5:12:41think that
  4669. 5:12:55Okay.
  4670. 5:13:07So now uh let's create a strategy. So uh
  4671. 5:13:10I want to um let's say my maximum
  4672. 5:13:14exposure
  4673. 5:13:16is two.
  4674. 5:13:18My uh max H for short is minus two.
  4675. 5:13:24This is in my training bot file.
  4676. 5:13:27Actually, instead of adding the
  4677. 5:13:30direction here,
  4678. 5:13:32uh, instead I will now specify the
  4679. 5:13:34static levels and I'll tell CL to do
  4680. 5:13:36like a fully 24/7 strategy. So,
  4681. 5:13:48so we want to enter let's say at minus4
  4682. 5:13:52or let's let's say minus4 is fine.
  4683. 5:13:57Let's just do three. Limit price cell
  4684. 5:14:02entry
  4685. 5:14:03is equal to three. So basically what I'm
  4686. 5:14:06doing right now guys is I'm looking at
  4687. 5:14:08uh
  4688. 5:14:11the historical spread that we computed.
  4689. 5:14:13Actually I can rerun this code again
  4690. 5:14:22and we can look at today's spread.
  4691. 5:14:47and
  4692. 5:14:57all right so
  4693. 5:15:01we are still loading
  4694. 5:15:08So basically I'm taking the levels from
  4695. 5:15:10these right. So we can see like uh
  4696. 5:15:13throughout the day also I can like
  4697. 5:15:15increase the the period. So here in a 1
  4698. 5:15:20minute I can try to extend the period
  4699. 5:15:21maybe use 5 minute uh data and maybe
  4700. 5:15:24compute the spread for past 24 * 7 hours
  4701. 5:15:29right and so let me run this script
  4702. 5:15:32again for the uh 15-minute data frame
  4703. 5:15:36uh time frame sorry
  4704. 5:15:39and we can then have a look at the
  4705. 5:15:41historical spread. So while this is
  4706. 5:15:44loading uh let me continue
  4707. 5:15:48editing the training bot.
  4708. 5:15:52So let's say I want to export
  4709. 5:15:57and here I can do limit uh price by
  4710. 5:16:02exit.
  4711. 5:16:06So for examp I want to exit minus one
  4712. 5:16:11and
  4713. 5:16:13so I want to exit my buy position
  4714. 5:16:22at one.
  4715. 5:16:28So here I have the logic you know to I
  4716. 5:16:32want to enter minus4 and exit at minus
  4717. 5:16:34one which would give me
  4718. 5:16:38uh a profit of $3 if I get perfect
  4719. 5:16:41execution. And same thing for here.
  4720. 5:16:49And so now
  4721. 5:16:53uh
  4722. 5:16:59so if average bit spread is lower than
  4723. 5:17:10limit price
  4724. 5:17:15entry Okay,
  4725. 5:17:19we can try to buy at this price
  4726. 5:17:23here. We can do sell
  4727. 5:17:26and then we can try to sell at this
  4728. 5:17:28price.
  4729. 5:17:32Uh and here and current exposure
  4730. 5:17:35hyperlquid. We want like if we want to
  4731. 5:17:38enter into a trade then we want to make
  4732. 5:17:40sure that our current exposure
  4733. 5:17:42is uh
  4734. 5:17:50less than our max exposure long
  4735. 5:17:53hyperlquid.
  4736. 5:17:55And here we also want to make sure that
  4737. 5:17:57our current exposure hyperlquid is
  4738. 5:18:01greater than the max exposure short on
  4739. 5:18:04hyperlquid.
  4740. 5:18:07And then here we can also add another L
  4741. 5:18:10if block. Uh
  4742. 5:18:14so here
  4743. 5:18:18one second let me check my message
  4744. 5:18:19first.
  4745. 5:18:29And so here we will have our exit
  4746. 5:18:33signals.
  4747. 5:18:38And so if our
  4748. 5:18:46average ask spread is greater equal than
  4749. 5:18:49limit price by exit
  4750. 5:18:53and current exposure
  4751. 5:18:57is
  4752. 5:19:01greater than zero.
  4753. 5:19:07Then we can quote ask on hyperlquid at
  4754. 5:19:10the exit price
  4755. 5:19:16and then to exit our
  4756. 5:19:20other position. Whoops.
  4757. 5:19:23Average
  4758. 5:19:25bit spread is less than equal to limit
  4759. 5:19:30price cell exit and current
  4760. 5:19:37exposure
  4761. 5:19:39is um
  4762. 5:19:47less than zero. So here we have a cell
  4763. 5:19:49posture open which means our exposure is
  4764. 5:19:51negative. So as long as our exposure is
  4765. 5:19:55negative, we can quote the bit price for
  4766. 5:19:59this value here. And now I'm going to
  4767. 5:20:01prompt Claude to, you know,
  4768. 5:20:04like improve the logic. So I'm going to
  4769. 5:20:06exactly explain what Clot should do to
  4770. 5:20:09run this string strategy.
  4771. 5:20:12So in
  4772. 5:20:15trading
  4773. 5:20:17bot.py
  4774. 5:20:22I want the trading bot
  4775. 5:20:26to
  4776. 5:20:30run without any
  4777. 5:20:34interruptions
  4778. 5:20:36unless there is oh I forgot one thing.
  4779. 5:20:42I want you to add an exposure check with
  4780. 5:20:47MT5
  4781. 5:20:49that if uh
  4782. 5:20:54there is an even exposure between
  4783. 5:21:00hyperlquid and MP5. Uh cancel all open
  4784. 5:21:06orders and hold trading.
  4785. 5:21:10And I think here we have the check
  4786. 5:21:14exposure.
  4787. 5:21:20Okay, let's just try to run this.
  4788. 5:21:27Uh
  4789. 5:21:29this exposure check
  4790. 5:21:35should uh
  4791. 5:21:39be compatible with the hedging script
  4792. 5:21:45uh hedge exposure
  4793. 5:21:47identifi.
  4794. 5:21:50So, so I'm adding another like risk
  4795. 5:21:53check to make sure that uh
  4796. 5:21:59that the exposure is correct at any
  4797. 5:22:01point in time. So if for example on MT5
  4798. 5:22:04the exposure is not evenly hedged then
  4799. 5:22:07it will stop trading. So we are actually
  4800. 5:22:10avoiding uh like trades being opened if
  4801. 5:22:14there is something wrong.
  4802. 5:22:23So now let cloth work And
  4803. 5:22:55So now
  4804. 5:23:08Okay, that's fine.
  4805. 5:23:35So maybe what makes sense actually is
  4806. 5:23:37that uh the checking of exposures on
  4807. 5:23:39like uh hedging explor and training bot
  4808. 5:23:43maybe we can create like a file where
  4809. 5:23:45these two scripts are using the same
  4810. 5:23:47function and so that way we can avoid Um
  4811. 5:23:51any discrepancies in the mathematics and
  4812. 5:23:54the calculation.
  4813. 5:24:09Okay. And so now my last prop is going
  4814. 5:24:11to be like finalizing this trading
  4815. 5:24:14script. And uh
  4816. 5:24:19yeah, let's try to implement that.
  4817. 5:24:32I have best strategy. You can code DM
  4818. 5:24:33me. Careful about scammers, guys. People
  4819. 5:24:36who try to sell you something like me
  4820. 5:24:38and telling you to DM you are usually
  4821. 5:24:40very shady. So, I'm actually
  4822. 5:24:44going to hide this user
  4823. 5:24:48because in 99% of all cases, it's a
  4824. 5:24:51scam.
  4825. 5:25:08Okay. So yeah, I wanted to create this
  4826. 5:25:11like fine logic.
  4827. 5:25:15Can you please review
  4828. 5:25:18trading botpy?
  4829. 5:25:23The strategy should
  4830. 5:25:27uh
  4831. 5:25:30go long
  4832. 5:25:37when limit price by entry.
  4833. 5:25:46uh
  4834. 5:25:51should enter
  4835. 5:25:56until max uh exposure long is reached.
  4836. 5:26:11If price
  4837. 5:26:14reaches
  4838. 5:26:18uh limit
  4839. 5:26:24or if long positions to be more exact,
  4840. 5:26:26if long positions
  4841. 5:26:28uh reach limit price by exit,
  4842. 5:26:32please offload all positions until
  4843. 5:26:36exposure is roughly zero.
  4844. 5:26:40or just zero.
  4845. 5:26:43Apply same logic for cells.
  4846. 5:27:31How long it take you for you to develop
  4847. 5:27:32your main strategy? So I think for the
  4848. 5:27:36hyperlquid training strategy it took me
  4849. 5:27:38like like two weeks to have like a first
  4850. 5:27:41uh usable version and it took me like
  4851. 5:27:44one or let's say one or two months to
  4852. 5:27:47have it in a form where I'm actually
  4853. 5:27:49happy for it to run like 245 24/7 and
  4854. 5:27:53but still I have some bugs that I'm
  4855. 5:27:56still like fixing uh on a regular basis.
  4856. 5:27:59So I was hoping that by like coding with
  4857. 5:28:01AI and then comparing the results with
  4858. 5:28:03my own code whether I can like implement
  4859. 5:28:06certain functions or certain like uh
  4860. 5:28:09features. So and like I can see already
  4861. 5:28:12like some features being better than my
  4862. 5:28:14old code. So I'm using my old code more
  4863. 5:28:18like as a reference to code this
  4864. 5:28:19strategy and I'm trying to make like a
  4865. 5:28:21better version of it by you know
  4866. 5:28:24streaming this live with you guys.
  4867. 5:28:39Thank you for the work you're putting
  4868. 5:28:40in. Is your main strategy in arbitrage?
  4869. 5:28:42If yes, what type? Lat statistical. Uh
  4870. 5:28:44main strategy.
  4871. 5:28:46Yes. So my main strategy is an
  4872. 5:28:47arbitrage. It's not latency. uh it's
  4873. 5:28:50more like statistical peer trading and
  4874. 5:28:52like arbitrage of crypto derivatives
  4875. 5:28:55with real world assets in some sense.
  4876. 5:28:58It's also like a funding rate arbitrage
  4877. 5:29:00if you think about it. So it's like a
  4878. 5:29:04you could consider it based on how you
  4879. 5:29:06look at it.
  4880. 5:29:34Two things to consider each quote.
  4881. 5:30:07Okay. So
  4882. 5:30:29a trading bot
  4883. 5:30:32pie. Okay.
  4884. 5:30:56So I just think cloud like if there is
  4885. 5:30:57something else that can be like added
  4886. 5:30:59like just print it here and let's try to
  4887. 5:31:02run it. So this is great. So
  4888. 5:31:07now I create a very simple strategy in
  4889. 5:31:08S&P 500. So we're just you know again
  4890. 5:31:11buying at minus4 selling at four and
  4891. 5:31:13then we have like these exit levels. So
  4892. 5:31:16these levels reflect the analysis that
  4893. 5:31:19we've create in calculate historical
  4894. 5:31:21spread that you can see here and
  4895. 5:31:26now we're just going to let it run and
  4896. 5:31:28hopefully
  4897. 5:31:30this is done. So yeah guys, so I can't
  4898. 5:31:33promise actually that um we'll have
  4899. 5:31:38what do you call it? Um like a profits
  4900. 5:31:41of the day. So I kind of like actually
  4901. 5:31:43chase profits. I was hoping that I would
  4902. 5:31:45find something today because I found
  4903. 5:31:47like temporary opportunities today. But
  4904. 5:31:50what I'm going to do is tomorrow I'm
  4905. 5:31:52going to let this bot run the entire
  4906. 5:31:54day. I'm going to monitor it and then
  4907. 5:31:56maybe on Wednesday I can like then
  4908. 5:31:58provide an a live stream where we update
  4909. 5:32:00on the train results and where we can
  4910. 5:32:02like add extra feature to a training bot
  4911. 5:32:05and so as I've mentioned we can then try
  4912. 5:32:07to apply strategy on multiple markets so
  4913. 5:32:09I will show you a lot of examples and
  4914. 5:32:12once this code is tested you know and
  4915. 5:32:15I'm sure they can like some work I will
  4916. 5:32:18then upload it to git and your um and
  4917. 5:32:21the members can then download it and try
  4918. 5:32:23it for themselves. Oops.
  4919. 5:32:46Okay. So, I let Claude now manage the
  4920. 5:32:50print statements and
  4921. 5:32:52uh
  4922. 5:32:56Can you also dump uh a JSON
  4923. 5:33:02file from
  4924. 5:33:07tradingbot.py
  4925. 5:33:10for debugging purposes if the script
  4926. 5:33:14crashes.
  4927. 5:33:19So I'm also asking cloud like to dump
  4928. 5:33:21out some file. Uh like dumping a simple
  4929. 5:33:24JSON file should not take too many
  4930. 5:33:26resources and so whenever B crashes or
  4931. 5:33:29there's some issue it's good like to
  4932. 5:33:31have some uh something to investigate
  4933. 5:33:33it. Also you can use like a logging
  4934. 5:33:35library right you can log things but me
  4935. 5:33:38personally I just like to access a quick
  4936. 5:33:39JSON file because it's already like
  4937. 5:33:42formatted and you can see all the like
  4938. 5:33:44uh data that are stored.
  4939. 5:33:53will be free for us to download and use
  4940. 5:33:55please. Unfortunately, no. I'm going to
  4941. 5:33:56provide this code and you know the
  4942. 5:34:00things to my members only.
  4943. 5:34:06So, if you're really interested, you
  4944. 5:34:08know, to access the code, you can check
  4945. 5:34:09out my website and um I offer
  4946. 5:34:12memberships to my members there.
  4947. 5:34:38Okay.
  4948. 5:34:40So let us try to run the script now. It
  4949. 5:34:43looks okay to me but you know a lot of
  4950. 5:34:45can screw up.
  4951. 5:34:48Why don't use open code? What is open
  4952. 5:34:51code?
  4953. 5:34:55Is it like some ID
  4954. 5:35:19cloth code alternative? Um, I don't
  4955. 5:35:22know. I've just tried cloth. So far I
  4956. 5:35:24like it. I don't see any issues with it.
  4957. 5:35:27Uh
  4958. 5:35:30so far I've been like very productive
  4959. 5:35:31with cloth. So I don't have any
  4960. 5:35:33experience with open code. So if any of
  4961. 5:35:36you guys have tried it, uh you can let
  4962. 5:35:38like let me know your reviews in the
  4963. 5:35:40chat if it's worth like trying.
  4964. 5:35:43I mean, $5 is of course like great
  4965. 5:36:01cloud limit is very low. Well, yes. Uh I
  4966. 5:36:04would say this
  4967. 5:36:06to many people, but so far if you look
  4968. 5:36:09at my usage limits, right? So, it reset
  4969. 5:36:11like a few hours ago. So right now me
  4970. 5:36:13using cloth only used up like 8% for a
  4971. 5:36:16session which will reset like in 3 hours
  4972. 5:36:18and 46 minutes. So so far I don't feel
  4973. 5:36:21like I'm getting that limited.
  4974. 5:36:34An idea is to have claude create
  4975. 5:36:36comprehensive error code index and to
  4976. 5:36:38have a self test check button built in
  4977. 5:36:40that when pushed will run self test to
  4978. 5:36:42make sure no new features broke other
  4979. 5:36:44code. Yes. Uh so testing definitely will
  4980. 5:36:47help us also.
  4981. 5:36:53All right then. So now uh we are in the
  4982. 5:36:57final stages to run the run the bot.
  4983. 5:37:12And it looks like we have something
  4984. 5:37:17to work with.
  4985. 5:37:37Oh, I also forgot to add one check in
  4986. 5:37:40pi.
  4987. 5:37:42Wait until 5 seconds have elapsed to
  4988. 5:37:48fully compute the spread average.
  4989. 5:37:56Then resume with the
  4990. 5:38:10how do I become member please? Uh in the
  4991. 5:38:12descriptions you'll find a link to my
  4992. 5:38:14website atjresearch.com
  4993. 5:38:16and you can uh find out more on my
  4994. 5:38:18website.
  4995. 5:38:23Why Python? It is so slow for tick trade
  4996. 5:38:25data. Well, it's the first language I've
  4997. 5:38:28learned and so far I've only coded
  4998. 5:38:31Python. So it's actually the only thing
  4999. 5:38:33I know how to use because you know I've
  5000. 5:38:36been also doing a lot with data
  5001. 5:38:37analysis. So yeah, that's uh what I'm
  5002. 5:38:41working with.
  5003. 5:39:07Okay guys, so now it seems that I can
  5004. 5:39:10try to start the training bot. Uh, so
  5005. 5:39:14far my hing script is still running.
  5006. 5:39:22So now
  5007. 5:39:28my training bot is sort of running.
  5008. 5:39:32But I think there is probably a mistake
  5009. 5:39:35because we shouldn't be placing bile
  5010. 5:39:37limit orders because
  5011. 5:39:40uh the thresholds
  5012. 5:39:43have not been met. So bry less than -4
  5013. 5:39:46exit - one sell entry above four and
  5014. 5:39:49less than one.
  5015. 5:39:53And let's see
  5016. 5:39:56what's going on here. So now we're
  5017. 5:39:57actually trying to place a buy limit at
  5018. 5:40:02the top of book. Now where did you get
  5019. 5:40:04this crypto data? It's from Hyperlquid.
  5020. 5:40:06So I'm connected to this exchange and
  5021. 5:40:08I'm getting data directly from this
  5022. 5:40:11exchange.
  5023. 5:40:19So right now my
  5024. 5:40:22uh
  5025. 5:40:24US 559.8 eight.
  5026. 5:40:28And if I want to buy
  5027. 5:40:30then
  5028. 5:40:35it should be like 35.
  5029. 5:40:38So I think it's definitely an error.
  5030. 5:40:52And so I'm going to cancel this order
  5031. 5:40:54and I'm going to try to debug a bit
  5032. 5:40:56more.
  5033. 5:41:09So we're going to cancel this.
  5034. 5:41:12That's fine.
  5035. 5:41:16Is this data free or paid? Yes. Uh this
  5036. 5:41:18data is uh free to use from the
  5037. 5:41:20exchange. So feel free to use it.
  5038. 5:41:23Would work on cloud uh pro subscription
  5039. 5:41:25also how is token consumption like uh so
  5040. 5:41:28right now I'm using uh the cloud max uh
  5041. 5:41:335x and right now the consumption is 9%
  5042. 5:41:36which is pretty good. I think on pro it
  5043. 5:41:38would be pretty usable. Also if you're
  5044. 5:41:40interested just in the trading strategy
  5045. 5:41:42itself I will share a code to my
  5046. 5:41:44members. So you won't need to use AI for
  5047. 5:41:47that. But if you want to use AI to
  5048. 5:41:50develop the strategies uh you know and
  5049. 5:41:52do similar things like I do, I think pro
  5050. 5:41:54should actually be enough for this
  5051. 5:42:18Okay. So I need to now check
  5052. 5:42:30how the limit prices are being computed
  5053. 5:42:33because we had you know quote bit right
  5054. 5:42:36so we're quoting the bit price
  5055. 5:42:45and so it's defined as bitid 5 plus the
  5056. 5:42:49target spread.
  5057. 5:42:51That's how our limit price is defined.
  5058. 5:42:55And so here we go down our target spread
  5059. 5:43:01for buy orders.
  5060. 5:43:07Uh this is prior to exit. So here we are
  5061. 5:43:09entering by we want to enter at limit
  5062. 5:43:13price by entry
  5063. 5:43:15which is
  5064. 5:43:18minus 4.
  5065. 5:43:20And so maybe when we amend the order.
  5066. 5:43:31So in the event section uh
  5067. 5:43:38new bit new limit price uh
  5068. 5:43:43is the new bit MT5 plus the target
  5069. 5:43:47spread.
  5070. 5:44:06Okay, let's try to run it again. I need
  5071. 5:44:08to see exactly what's going on here.
  5072. 5:44:19So, we're placing a limit uh
  5073. 5:44:25on hyperlquid. So the current price is
  5074. 5:44:2739.8
  5075. 5:44:29but on hyperlquid the
  5076. 5:44:33open order price
  5077. 5:44:35is at 39.3.
  5078. 5:44:47So again we can try to cancel it. Uh,
  5079. 5:44:49and I'll let CL know
  5080. 5:45:02prices. I tried to place limit uh by
  5081. 5:45:08on hyperlquid.
  5082. 5:45:22prices. The current
  5083. 5:45:27MT5 price is
  5084. 5:45:33how much?
  5085. 5:45:357540.
  5086. 5:45:39And the limit price
  5087. 5:45:46coded on hyperlquid
  5088. 5:45:49was
  5089. 5:45:547539
  5090. 5:46:00because the limit price by entry is
  5091. 5:46:05minus4.
  5092. 5:46:08The limit price
  5093. 5:46:11should be at least 4 USD lower compared
  5094. 5:46:17to MT5. Can you investigate?
  5095. 5:46:57Okay, so we're very close. Um, so now
  5096. 5:47:00we're actually providing the quot limit
  5097. 5:47:02prices. We just need to make sure that
  5098. 5:47:04the training bot is quoting the limit
  5099. 5:47:06prices at a correct level. And then
  5100. 5:47:11once uh that is checked, then we can
  5101. 5:47:14start the training script again.
  5102. 5:47:22Have you tried DeepSc V4 Pro? No, I
  5103. 5:47:24haven't. Uh right now the only thing I'm
  5104. 5:47:26using is cloth sometimes Gemini because
  5105. 5:47:28it's on my phone and that's all I've
  5106. 5:47:31been using uh so far
  5107. 5:47:59Okay, I'll try out. Uh not sure how good
  5108. 5:48:02it is with coding, but um maybe worth a
  5109. 5:48:06try.
  5110. 5:48:18Sir, it's really hard to code bots like
  5111. 5:48:20this because when you try to fetch data
  5112. 5:48:22frequently, you will get rate limit on
  5113. 5:48:23hyperre if you don't run node. Actually,
  5114. 5:48:26no. I think like
  5115. 5:48:29so far I've like never been rate limited
  5116. 5:48:31using the websocket library using
  5117. 5:48:33strategies I use. So that's not
  5118. 5:48:37something that I've experienced. Also,
  5119. 5:48:40for example, lighter, if you like submit
  5120. 5:48:42a lot of trades and get lots of fills,
  5121. 5:48:44they actually want you, you know, to
  5122. 5:48:46provide the quotes and the liquidity.
  5123. 5:48:48So, you you actually the the rate they
  5124. 5:48:51offer good they offer good rate limits
  5125. 5:48:54as long as you trade on the exchange.
  5126. 5:48:57Could you do live streams implementing
  5127. 5:48:59strats on poly markets in Kalashi? Well,
  5128. 5:49:01personally, I haven't like looked into
  5129. 5:49:04these markets yet. So, I don't even know
  5130. 5:49:06if I'm capable of arbitrageing these
  5131. 5:49:09markets, but I definitely want to
  5132. 5:49:11explore that and see, you know, what I
  5133. 5:49:12can do because I I believe that there is
  5134. 5:49:14lots of money to be made. So eventually,
  5135. 5:49:17you know, I'll have a look at the
  5136. 5:49:18prediction markets too.
  5137. 5:49:37Well, again, uh the question regarding
  5138. 5:49:40Koshi and Poly Market bots, uh I don't
  5139. 5:49:43have any experience yet, but it's going
  5140. 5:49:46to be exciting once I test it out.
  5141. 5:49:55And yeah, Bo, thank you for uh
  5142. 5:49:56explaining the things. So, yes, you are
  5143. 5:49:58correct. And so, with websockets, if you
  5144. 5:50:01keep a persistent connection just uh
  5145. 5:50:03like receive the data, there's of course
  5146. 5:50:05no issue with the right limits.
  5147. 5:50:58Okay, let's try
  5148. 5:51:00to run this.
  5149. 5:51:06So, right now it's 43.3.
  5150. 5:51:13No, this is still not good enough
  5151. 5:51:16for 5.1.
  5152. 5:51:21Um
  5153. 5:51:28actually,
  5154. 5:51:36okay, so we cancel the order. Um,
  5155. 5:51:39let's also add a security feature that
  5156. 5:51:42only one order should be open at any
  5157. 5:51:44point in time. I think that would also
  5158. 5:51:47help
  5159. 5:51:52in trading bot.py
  5160. 5:51:56please.
  5161. 5:51:58uh or just make sure that only
  5162. 5:52:03one order is open at any point in time
  5163. 5:52:08for the specified
  5164. 5:52:11symbol.
  5165. 5:53:21Okay, so we've added a check so only one
  5166. 5:53:23order is open at any point in time. Uh
  5167. 5:53:26to make sure that you know if the bot
  5168. 5:53:28suddenly decides to open many orders uh
  5169. 5:53:31in a sequence that uh that doesn't
  5170. 5:53:35happen.
  5171. 5:53:44And I'm interested how the clamping
  5172. 5:53:46actually works because still the limit
  5173. 5:53:48prices are not exactly being
  5174. 5:53:52updated correctly. Where do you live?
  5175. 5:53:54US? No, I live in Europe. Uh, Czech
  5176. 5:53:57Republic, Prague. It's in central
  5177. 5:54:00Europe.
  5178. 5:54:17So here we compute the limit price
  5179. 5:54:27and here we are computing a safe limit
  5180. 5:54:48It's pretty close to Turkey. Emble
  5181. 5:54:49Turkey. Yeah, that's that's true.
  5182. 5:54:52So, it's not that far.
  5183. 5:55:02Okay, so the new changes have been
  5184. 5:55:04updated. So now if I check open orders,
  5185. 5:55:08there should only be one open order at
  5186. 5:55:11any point in time.
  5187. 5:55:24So, seven, five, four, five.
  5188. 5:55:38So, it seems that 7545
  5189. 5:55:4475
  5190. 5:55:56So we are still having the issue we're
  5191. 5:55:58opening double orders. So I think right
  5192. 5:56:00now what makes sense is actually going
  5193. 5:56:03through manual review because I think AI
  5194. 5:56:06is actually getting a bit
  5195. 5:56:08counterproductive. So it is doing all
  5196. 5:56:10the risk test correctly. I'm really
  5197. 5:56:12happy with the hedge exposure with MT5,
  5198. 5:56:16but I have to like review the logic and
  5199. 5:56:19the pricing of limit prices uh step by
  5200. 5:56:21step now. So I think uh I will review it
  5201. 5:56:26like uh in the evening or tomorrow
  5202. 5:56:28throughout the day. So I guess guys uh
  5203. 5:56:31you know because I've been streaming for
  5204. 5:56:32almost six hours, I think I'll call it
  5205. 5:56:35you know the day for today. So thank you
  5206. 5:56:38guys for joining today's live stream and
  5207. 5:56:41I'll give you an update once I have you
  5208. 5:56:43know some updates on this string
  5209. 5:56:45strategy. So I just need you know to do
  5210. 5:56:47some last fine tetuning bug fixes uh
  5211. 5:56:50basically debugging
  5212. 5:56:53and
  5213. 5:56:55uh then I'll let you know you know once
  5214. 5:56:58I have fixed this. So I think we are
  5215. 5:57:00like very close. So hopefully maybe
  5216. 5:57:03tomorrow on Wednesday I'll have a first
  5217. 5:57:05function version that I can then share
  5218. 5:57:08with you guys. And so while I have still
  5219. 5:57:10some time right I can still spend a few
  5220. 5:57:12minutes for some Q&A session. So guys,
  5221. 5:57:15if you have any questions, you know,
  5222. 5:57:16about this project or, you know, about
  5223. 5:57:18what I'm doing, uh, feel free to ask.
  5224. 5:57:22And, uh,
  5225. 5:57:25yeah, I'm ready to answer any questions.
  5226. 5:57:28And
  5227. 5:57:31so
  5228. 5:57:56I'm new here. Can you give a short
  5229. 5:57:57summary what exactly you're trying to
  5230. 5:57:58build, how it works, what's the goal? Uh
  5231. 5:58:01yeah, so uh if you know check
  5232. 5:58:03descriptions, uh I've added a link to a
  5233. 5:58:06post my website where I describe the
  5234. 5:58:09strategy like more in detail. So what
  5235. 5:58:11we're building here is an arbitrage
  5236. 5:58:14strategy between Hyperlquid and MT5. So
  5237. 5:58:17here on hyperlquid what you see is uh is
  5238. 5:58:20a crypto exchange where you can trade
  5239. 5:58:22perpetual futures and
  5240. 5:58:25uh we're trying to you know arbitrage
  5241. 5:58:27price discrepancies with real world
  5242. 5:58:30price such as on metatrader 5. So
  5243. 5:58:33whenever for example S&P 500 is
  5244. 5:58:35overpriced we want to sell it and we
  5245. 5:58:37want to buy it on MT5 and then when the
  5246. 5:58:40price is even out uh you're then trying
  5247. 5:58:43to buy hyperlquid and then sell MT5 hope
  5248. 5:58:46hoping to make money on the spread. So
  5249. 5:58:51uh here uh you'll find the article where
  5250. 5:58:54I'm describing detail uh what we're
  5251. 5:58:56building and what you need to do it and
  5252. 5:58:58so feel free to read that and maybe in
  5253. 5:59:01the next live stream you can you know
  5254. 5:59:02ask questions uh you know more in detail
  5255. 5:59:06if you don't understand anything.
  5256. 5:59:09What's the process for using this and
  5257. 5:59:11please can someone use ICD concepts? Um
  5258. 5:59:18well
  5259. 5:59:20again the strategy is described in the
  5260. 5:59:22article so uh there's actually not much
  5261. 5:59:26to add and I don't see any relation to
  5262. 5:59:29ICT with this strategy right uh me
  5263. 5:59:32myself I don't believe in ICT I think
  5264. 5:59:35ICT is actually uh scam to teach retail
  5265. 5:59:39traders how to trade without actually
  5266. 5:59:41you know
  5267. 5:59:43providing adding any value to retail
  5268. 5:59:44traders. So, I'm going to say bluntly
  5269. 5:59:46that like ICT is a scam and uh anyone
  5270. 5:59:50who trades ICT should proud move away
  5271. 5:59:52from him. And if I've offended someone,
  5272. 5:59:54I'm very sorry, but this is how I feel.
  5273. 6:00:01Like if you check you know 90 99% of all
  5274. 6:00:05content you know on the internet even
  5275. 6:00:07myself when I try manual trading there
  5276. 6:00:09is so much like trash that you read
  5277. 6:00:12online and people should actually not
  5278. 6:00:16learn from those people right so it's
  5279. 6:00:18very difficult to filter out good and
  5280. 6:00:21bad content and hopefully you know while
  5281. 6:00:24I live stream and code and show you guys
  5282. 6:00:26the things I also want to make like
  5283. 6:00:27money in front of you guys so you see
  5284. 6:00:29that the strategies that I'm teaching
  5285. 6:00:31actually work
  5286. 6:00:33and so hopefully you know I can gain
  5287. 6:00:35your trust actually by live trading and
  5288. 6:00:38showing consistent results over time.
  5289. 6:00:42So yeah.
  5290. 6:00:45All right. So guys, if you don't have
  5291. 6:00:48any other questions, I think I'll give
  5292. 6:00:49it like two more minutes. I'll just
  5293. 6:00:51reply to some of my friends. I have a
  5294. 6:00:53dinner schedule today uh outside, so at
  5295. 6:00:57least I can enjoy the sun. It's quite
  5296. 6:00:59hot today.
  5297. 6:01:03And yeah.
  5298. 6:01:16All right, guys. So, I guess uh
  5299. 6:01:21thank you everyone for joining today's
  5300. 6:01:24live stream. It's been like six hours.
  5301. 6:01:26I've actually never streamed this long
  5302. 6:01:27like before, but it was quite fun and
  5303. 6:01:30we've done lots of work. Unfortunately,
  5304. 6:01:32like the string bot is not working, but
  5305. 6:01:33hopefully like tomorrow or the day after
  5306. 6:01:36I'll, you know, stream again and show
  5307. 6:01:39you, you know, some results with a
  5308. 6:01:40training bot and hopefully like we can
  5309. 6:01:42then or I can then share the results
  5310. 6:01:45with you soon.
  5311. 6:01:48And so again, question, where are you
  5312. 6:01:50based? I'm based in Czech Republic,
  5313. 6:01:52Prague, which is in central Europe.
  5314. 6:01:56Uh, I was asking if I could use this
  5315. 6:01:58algobot using ICT concepts.
  5316. 6:02:02Most likely not because ICD concepts
  5317. 6:02:06and arbitrage trading are two completely
  5318. 6:02:09separate things. Uh,
  5319. 6:02:12where
  5320. 6:02:15yeah, you can't like compare pairs and
  5321. 6:02:18apples. Uh but if you want to code a
  5322. 6:02:21strategy using ICD concepts which I do
  5323. 6:02:24not advise because ICT
  5324. 6:02:28I'm sorry to say it does not work uh you
  5325. 6:02:32can still try you know to try apply ICD
  5326. 6:02:34concepts uh with AI. So feel free to do
  5327. 6:02:38that.
  5328. 6:02:42Okay guys so thank you for the live
  5329. 6:02:44stream and it was a pleasure. I'll I'll
  5330. 6:02:47announce by the way I'll announce the
  5331. 6:02:48next live stream very soon. So tomorrow
  5332. 6:02:50uh if I'm planning to stream on
  5333. 6:02:52Wednesday I will you know then uh
  5334. 6:02:55probably announce a stream on Tuesday.
  5335. 6:02:57So if you want do not want to miss it
  5336. 6:02:59you can always turn on the not
  5337. 6:03:00notification bell icon to not miss any
  5338. 6:03:03live streams. So until then, I'll see
  5339. 6:03:05you guys and enjoy the

About this transcript

This page contains the full transcript of Coding a HyperLiquid DEX Arbitrage Bot with Claude AI by ATJ Research, generated from the public captions YouTube serves with the video. The transcript has 33,131 words across 5,339 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.