In prediction market trading bot systems, managing websocket connections efficiently is critical for performance and scalability. A single websocket connection per bot can lead to data gaps and high latency, while using multiple concurrent connections (5-10) significantly improves data coverage and reduces latency. The optimal architecture involves creating a shared event data layer that maintains a limited number of persistent websocket connections to the prediction market, then distributing events to all subscribed bots. This approach reduces connection overhead from hundreds to just 10-15 connections while maintaining data quality and reducing latency by approximately 3 milliseconds.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Vibe coding ravn.gg in publicAdded:
Okay, we are live. Just need to update some settings here.
See if we can put on the live tracking here.
Okay, we are live now. And if you are new here, I'm just going to give you a quick update on what this actually is.
So, I'm building raven.gg here in public. I've been doing this for about 3 to four months and once in a while I I'll be live streaming and normally I do that once once per week. And um basically what Raven is is a venue agnostic no code trading bot builder for prediction markets. So think of it as a trading bot, but instead of the stock market, it's it's for a prediction market like poly market. If you don't know what poly market is, you probably do, but if you don't, it's it's quite popular now. It's basically a prediction market that has binary outcomes.
For example, you have the Bitcoin up and down. You can bet if it's going to go up or down the next 5 minutes. You can also bet on something like esports. You can also bet on something like Iran war, you know, stuff like that. And a lot of the uh the actually people that make money on this is not people that just randomly, you know, try to predict the future, but rather it's people that actually build trading bots. And uh what I'm building here is is a framework and and and a basically a strategy builder for uh uh trading bots. So I'm just going to quickly give an introduction to this. So you can uh create a strategy like this. It's an interface a UI where you can uh build it like this. Right now we only have poly market venue. So you can select the venue. In the future, there'll be more venues and you can select the market selector here and connect them. So, it's this drag and drop kind of like in in you can select between specific market. You can also select active markets. Most people are going to select the active markets because it just runs basically forever.
Right now, we have two predefined markets like 5 minute or 15 minute, but you can also add whatever ID you want for specific markets. And um and yeah, then you can just build out a strategy given all these different conditions.
You know, we have the order book for example. You can get the the bid price, we have candlesticks, we have moving averages, and we have tick size, price to beat. So for example, the price to beat is the price you see on the crypto page. So this price here and you can we have external data. So we have the crypto price. So that's a live price for Binance chain link and all sorts of good stuff. Then you have different conditions and you have actions. So when do you want to buy?
When do you want to sell?
And right now, let me see if I can share some stats.
So, right now, we have 700 people on the wait list. We have about we have 261 that has signed up. So, that's registered accounts. And then we have about 236 monthly active users. We have 73 weekly active users and 11 daily active users. So we have um already users and it's still in very early stage. So now we are in the in the beta.
So it's still no live trading.
Everything is simulated and we are running a leaderboard right now.
The leaderboard uh is um we have all these people here on the leaderboard and it's I think there's there's 27 actually on the leaderboard. Now the leaderboard only shows the top 29. I probably have to fix that. And um basically the top three is going to win a total prize pool of $100.
Um but um but yeah, this going to run until say so 30 days going to end at May 15. So if you want to participate in this, you can sign up for the weight list. uh down in the description below there's a link to the uh weight list where you can sign up and I expect to send out invitations at the end of this week probably going to be tomorrow so if you want to participate in this uh you have the chance we still have actually more than two weeks left um so yeah it's absolutely dominated by uh by one person right now um but actually the number two only have a profit of 1,000 there still uh it's very much possible to uh to to get in on the on the top of the leaderboard here.
And yeah, when when you run your bots, uh let me see if I can find I don't even know if I have a running bot right now.
I don't think Oh, actually, I do have.
Yeah, it's going to look something like this. So, so it also include the uh the whole infrastructure. So, you can deploy a a bot and follow along the live monitor.
It's going to look something like this.
And it's actually going to show you a lot of different data.
So you can see here how it's going to show the the up and down price live. And it's going to show you the uh the stop-loss and take profit lines. Now I think this one already exited. That's why we can't see we can't see the uh the exit line here. But you can see it's otherwise going to show the the lines.
Um for take profit you have an event terminal and um this is very much verbose right now. you can see exactly what's going on. We have a live order book as well. You can see the external price here and then it's going to automatically switch to the next markets if um if uh if you have a recurring uh market here and then you can see the the past orders here. Now this one doesn't have that many um so you can follow along there. You can also see the if you go to the sessions you can also see the performance of uh of all the different Let me see.
Yeah, my I mean my performance is not that great, but a lot of this is also for for testing basically. And you can go into any any of these and uh take a look at the performance. You have an equity curve draw down, you have different metrics, you have the trade lock. Yeah. So that's the state of Raven right now. And uh yeah, it's been uh working on this for since January actually and it's been about three and a half months now. So yeah, we are still um very much in progress and uh we're getting closer, but there's still like a lot of important things I want to fix and I want to give an uh sort of an overview of that I think today. Um and what I've been dealing with um yeah so basically we have uh one major issue that I'm trying to address is kind of twofold. So, I'm going to explain a little bit how Raven currently is. Um, uh, actually, let me see here if I can find Figma. Okay, so I'm just going to explain a little bit about how I deploy the bots because basically when you click deploy, it's going to be hosted in its own container.
So, let's say you click on deploy for your training strategy.
There's actually two modes.
So, we have two different modes.
So, this is live and this is simulation.
See if I can put this. So, if uh if it's simulation, it's going to go into a sim host. I'm going to explain what that is.
And then when you click live, it's on its own uh container.
Okay. So the sim host is a docker container.
Let me see if I can explain this. So the docker container is like this. And this is actually shared. Why does it keep doing that?
This is shared between several users.
And the reason I did this because now we do a simulation and and it's actually quite resource intensive. So if we if everybody had their own container on this current server, uh yeah, it would it probably would work right now because we don't have that many users. But um it could potentially cause uh it's a 128 GB uh server and uh each container is probably like 500 mgabyte of RAM, right? So, so we could at this current state handle it because we don't have that many butts like we have as you say like we have probably at any one time a few let me see if I can find that doesn't matter but yeah that's why I've done it like this however if it's a single container it just runs uh on its own I think the sim host right now I did it so it only supports um five bots about five bots this one is just a single one. It also allows with this architecture, it allows uh us to kind of easily deploy it on on its own server. So right now it's deployed everything is deployed on the same server. It's in Finland.
um which is is probably not the one the server that we're going to use for for live trading because the the latency is it's not too bad compared to to um to other servers but but it could be better and uh I think in today I'm also going to go a little bit into detail about um the work I do on latency um because I've been doing some testing.
I also did a video on YouTube about latency and I've actually been working more on this. I'm going to show and I had a test running last night. I'm also going to show. So hopefully we'll have time for that today.
Okay. So that's that's and then uh one issue with this kind of setup here which we've been talking about in this discord we've been talking about this on YouTube is the is the web sockets.
Okay. So the web sockets.
So right now each each bot gets its own connection. So each bot actually gets um three connections.
Now if if we have now we have uh where is it?
We go back to the statistics we have actually I should have a a data about how many bots is active but let's say we have 73 butts active actually each user can have two butts now every user is not going to deploy but two bots. So let's say we have it's probably the the daily active views or maybe not. Let's say we have 73 bots just just as an example.
So that's 73 times uh three.
So what is that? That is 73 219 connections potentially now 219 connections there's a high high chance that the server is going to get raid limited maybe maybe even blocked it hasn't been an issue right now as I'm aware of at least but it's not a good setup something I need to fix I am working on I actually have a a change already in place and this uh change comes um as inspiration also from a a user in the discord.
Um so let's say that how I can explain this. So this is the current setup we have. Now, the new one, I'm actually going to go use um radius because we already have radius, but we we could also use something else.
Uh so, we have So, we have an event data layer. That's at least what I'm working on now.
The event data layer is going to um subscribe keep connection uh let's see keep a so that one is going to keep a recurring connection to polyark's websocket and and this one here now this is the important part and this kind of fits into the talk we've had about latencies and connections.
Uh the ideal setup is something like five to 10 connections actually. So you can watch the video I did a few days ago. The ideal setup for websocket connections if you want to improve latency and data quality and and not have too many data gaps is having five to 10 connections. So we actually need to increase we actually need to increase our connection. So if we had it like this.
So if I had to have the ideal setup today, it would be let's say 73 * 5. So that's 365.
365 or 700 uh connections.
Okay, that's a lot of connections and it's that's just not uh scalable.
So, we'll have this connection. We just have one connection now or actually five to 10 probably going to be 10 connections and we're going to keep that in a data layer.
This one is connected with with a with a radius.
And then all the butts here is going to subscribe to that layer.
Okay. So instead of subscribing directly to the websocket, they're going to subscribe to um they're not going to subscribe directly to radius actually. So this is actually wrong.
Let do like this. Something like this.
Okay.
This is much more scalable.
Now, so the way it's going to work is we're going to have um I'm just going to have a connection running and then let's say that this bot want to connect. It's going to connect through the data layer here and then this data layer is going to make sure that this new marketer token is going to be subscribed to to this recurring connection up here.
and and then this one here subscribes to the specific events and this one is going to make sure that it's going to be filled to the correct bots.
So we so in this case we can maintain a much more stable connection instead of managing you know 200 to 700 connections which is crazy and not scalable we can maintain maybe 10 or even 15 connections that all these different bots are subscribing to.
Yeah.
So, that's that's uh that's the plan. I already have a feature in place that I'm probably going to test today.
Um yeah. So I think what I'm going to do now is um yeah actually so I want to talk about latency but actually was an ex uh post I want to talk about as well. So let's see this guy here Josh. I think actually this is an interesting post here. So Josh here is uh basically writing so it's his third week as vice president of engineering defi at poly market and I'm going to be straight the traction polyarks has seen has massively outpaced our infrastructure and we haven't done nearly enough to scale to keep up I hear you and fixing this out in is our entire focus we are a major company now and we need to engineer like one here's exactly what we're doing so he has a lot stuff in pipeline that they going to be working on to improve the um the uh the infrastructure here.
So the onchain data latency we work on making this near instant so the experience is incredible.
Chain migration. This is the big one, right?
Chain migration. We need more block space, cheaper gas, and much smaller block times. So, settlement is instant.
So, now they released the uh central limit order book version two where we have to migrate the USDC to PUSD. But now they're talking about a completely new chain. So, that's a big change.
And then transaction are getting cancelled. We understand this is one of the most frustrating issues right now.
And we have a complete fix coming very soon. This might be related to the ghost fields. I I think it probably is.
But I did experience this when I did some trading where it would be um cancelled and that's yeah that's a that's frustrating. Massive focus on the website to make it fast, more responsive and build better UX. We added observ observability everywhere. Proper alerting so we can catch issues ourselves. Market maker should not be the one telling us something is down.
End to end test throughout starting with a clo so issue get caught in se for anything ship. So apparently they have had an issue with uh quality you uh you know uh and and and now they're stepping up their game to test it um to better do um um yeah. So that that's good to hear at least, but it sounds like they didn't have good uh monitoring before and maybe good enough test um flows, whatnot.
And then uh central limit order book v2 is not a rewrite. It won't improve performance or stability on its own.
It's an upgrade that unlocks us to move fast right after. We'll do it better with communication next time. This is also a big one because this kind of contradicts at least my understanding of what this was. I thought it was a rewrite and I thought it would improve performance, stability, but he's saying it's not. But it seems like it's laying the foundation so that it can be improved.
Yeah. So, and then it's kind of also weird here, right? because we are rebuilding the clo from the ground up. Most important thing we are doing without it we can't be the best DeFi exchange in the world. We know it. We on it. It's mission critical.
It's interesting what he writes here because I thought they did this already like they already released we have the uh V2 already. Is he talking about V2? Is he talking about something else?
Right. because it's um How's it going guys?
Welcome to the stream and and I I can't so I'm I'm I'm seeing this we can't be the best DeFi exchange in the world. I feel like poly market is moving away from prediction markets actually because they just announced the per so they're going in direct competition with something like uh Binance and now he's saying directly we can't be the best defy exchange in the world a defi exchange so it's not a prediction market anymore or what so I feel like polyark is is going towards more mainstream defi exchange a little bit away from prediction markets it's kind of getting seems like everybody's do and then the uh defi exchange is going more into prediction market. So they all kind of becoming the same thing.
So it's um yeah and then they have a unified TypeScript SDK for all APIs. So I did uh read about this uh I can't remember where. So they're going to unify the GMA API and all these different SDKs, but it's only going to be in Typescript, which I'm at least for now, which I'm a little bit sad about because I do mine in in Python. But we'll see if they're going to do this in in Python.
Yeah. And the unified API one uh web server connection for everything.
That's cool because the websocket is kind of strange a little bit today. But yeah, it's cool. New Polyark contract works that unlocks things that are in simply impossible on the current protocol. And then they're going to do some new hires, smaller teams working close with customer support, proper communication, and have been good with communication thus far.
security and then the pers incoming brand new contracts and back in build from scratch in rust.
Yeah, that's uh I mean that's good to hear.
Can I h Where's it where did it go now? I want to make it make a question here. Are we going to Yeah. So the ghost fills is um they they should they should fix it in clv2 here. So uh poly market now uh let's see so I think it's mentioned they they don't mention it specifically but what they the specific fix is the order fields here so before there's actually two things so before we have the the nons so so the ghost fields was something like where you could you could change the nons for an order and then it would be cancelled or something like that and they could, you know, uh manipulate that. But you can't do that with a time stamp anymore because uh to cancel an order there would be like some kind of a delay now or something like that. Um I'm not really uh I haven't really experienced myself I think uh exactly but this at least is my understanding that this should be the fix actually from nons to time stamp and then there was a some kind of a pause function on of the on the new contract that should um it's I don't think it's specified here actually that's also changed that should help with the ghost fills um so I think the the new changes here should fix a lot of that but again. Um, if we go back to to the X, uh, where is it?
This one here. It kind of worries me a little bit that they say it won't improve performance or stability on its own. I thought it kind of would, but but we'll we'll see. But it says it's an upgrade that unlocks us to move fast right after.
So, it's it seems like the new version here is going to have the potential for new like capabilities or upgrades later down the road. Maybe it's a little bit more futurep proof.
Uh I'm kind of confused with Polar's fee structure. Dubai orders on esports order books have fees if they fill uh Dubai orders on Yeah. So, where is Poly Markets?
Let me see if we can Google Poly Market fees. I think it is on esports as well.
uh crypto, sports, finance, politics, economics, culture, weather, other mentioned tech. Okay, I think actually there's no fees.
So, I think for for esports they actually don't have a fee.
Uh yeah. So, but then that if there was a fee, the way it would work is there's a maker and a take a fee rate. So if you pay fee it would depends if you take an order make the order.
So if you go to mega rebate rewards it does say there's mega rebate here actually. So you probably have to call the API to get that information. It's not it's not maybe it's not up to date this one. Am I just not seeing it on other general or maybe it's within other or general. So I think there is basically fees on everything and um yeah and and I mean if you place a bit let's say you place a bit around here 7 cents you won't pay any uh fees on that but if you placed here okay now this spread here is crazy so this is a bad example but if you actually went and placed and and uh placed that order here to take it right away you would pay a fee on that.
So that's the difference. You are basically a mega if you place limit orders on on this side of the book here.
But if you cross the spreads over to the ass side and buy directly as a taker, you would pay a fee on it.
Now if you place you can see here we have the mega rebates on this one here.
So if you placed bits here and uh and it would be taken you know in the future you would get a a a rebate actually you would actually get uh make money on that but the spread here is crazy so this is a very bad example but um yeah but I think there is fees on it because I think it's just since it has mega rebate it has fees so there is fees on on esports it's I thought I think it's just within in the um the other in general is not specified in the list here. Um so yeah or maybe it's within sports. Yeah.
Okay.
So how do you handle the residues? I mean sometimes when I sell Yeah. Yeah. I get exactly the same issue and honestly it's it's just the residue. I haven't done anything about it. It's just there. I think it's such a small amount of dust that it has no value. So I think it's just a it's just, you know, a crypto thing that it's it happens all the time. So I had the same experience and I don't do anything about it right now. I don't think that if I don't know if there's anything to do about it actually. Uh but it's such a small amount that it doesn't really matter. Um but Omega generally have zero fees.
Yeah, that's my understanding that Omega has zero fees and um but there's a re and there's a rebate uh where you can actually uh make money.
Um, so you get a part of the fees that's paid because you can see if you go to Yeah, you can see here the mega re uh fee rate the mega fee rate is zero and then you have the take a fee rate which is over here and then it's it's calculated with a formula. So you can see it's all the different on on on the different and then if you take the closer you are in the middle so this is the price right so 50 cents you're going to pay the most fees but if you go towards the edges it's going to be less and less and uh yeah so the Omegas have zero fees and then they actually get 20% 25% and so on the taker fees so it incentivizes people. It basically incentivizes liquidity on order book.
Um and and and liquidity is important for poly market um to make trading fair.
You can see the example here. If you go back to this one here, this one don't have a lot of liquidity and that's why you have such a big spread. Nobody want to trade on this one.
And that's why they have these incentives. They have both the uh you can sponsor rewards on this so it can attract more liquidity and that's going to make the spread uh smaller and uh yeah rebates the the difference between a mega and a tega is basically where on the order book you place your your orders.
So you have the uh the spread here. So that so the ask is people that want to sell and and the bits people want to buy. So let's say that you place your orders if you want to buy something uh you can place your orders on the on the bit side here but they won't be uh they won't be uh be uh executed right away because they are um uh not on the ask side. But let's say that you if you went and and bought uh on uh on 40 cents instead of the seven cents, it would be taken right away and then you become a taker. So basically it depends on if you are on this side of the order book, you are mega. If you are on this side of the order book, you are taker basically. So you can see here that um if I place my order here in 40 cents, it would uh basically be taken right away because the people are asking 40 cents for their shares right now.
Um yeah, this is why something but it's not right after.
Yeah. Yeah. Exactly. So if it takes some time most often it's because it's because you basically put it exactly on like if I put my buy order now on seven cents it's probably not going to get uh filled right away. It's going to take a while maybe not going to get filled at all but if I actually put my buy order on 40 cents it would be filled right away and I would be a a taker. And you can also in the APIs you can check if whether if you are make or take actually. So there's some I I think it's the the scoring there's um uh I think there's a order scoring maybe this one here.
Oh no sorry that's about rewards. Um, but yeah, there's you can check it in the API actually if the order is is a make or taker if you have a trading bot.
Uh, it also say in the UI X available right now.
Yeah. Oh yeah. Yeah. Exactly. Exactly.
if you do a limit for 40 cents at eight shares.
So yeah, that's a good question. But most often what you would see is when you when you place orders that it's going to take a little bit from here and it's going to take a little bit from here. So it's going to move the order book a little bit up. So so so sometimes you'll see that you'll probably get filled uh and it also depends on the order type. Um so you can experience where it's going to fill 7.12 shares here and then take the remaining shares from here.
You can also change I don't know if you can do it here. Oh, [ __ ] Market.
Okay. But in in the settings, you can go to your settings. Uh what you can do is you can change the order type uh to uh force it to basically fill the full amount. So if you cannot fill the full amount, it's not going to execute at all. You can also change it so it just takes whatever is available. So it's going to take just 7.12 and not the remaining you know 80 88 usually. How do you handle profit versus stop loss? I mean currently as soon as I see a good feedback from the model I buy something after this moment. How do I handle profit? Well there's many different ways you can do that. So the way that I have handled it in raven is with well I mean basically they take profit right um this is what I would normally do so if for example in raven in raven there is two ways so of course there's a stop-loss what I would what I would often do is put a trailing stop-loss so for example a 10% stop-loss uh trade failing. So that means that the stop loss would follow the price increase and then there's also a takerit for example 20%.
That is uh let me zoom in here.
That's how most people do it.
You can also just manually execute a sell order.
Um, for example, here I'm not going to go too much into detail because this really depends on the strategy, but for example, this and then you can you can manually put a sell order.
Yeah, Matthew, the 80 would would be cancelled depending on on the order type. Um, yeah. So, there's different order types.
I think you can. So, if you do manual trading on Poly Market, you can you can set this in your settings. If you do it if you do it with the API, you can set it on the order. So uh so good good till cancelled order type it's going to rest on the book uh until it filled or cancelled that's the typical one and then this one is for a date but then here we have fill or kill so this one must be filled immediately and entirely and entirely. So if you cannot find the full amount it's it's just going to get cancelled.
And then there's fill and kill where it's going to fill as many shares as available immediately then cancels any unfilled remainder.
Yeah.
And this one good till cancel it can also keep resting on the order book.
So if you if you place let's say you place eight shares at 40 um then you could see that it fills the 7.12 and then the remaining is just going to wait until um there's available liquidity. So it really depends on the order type that you select here the how it's going to behave and stuff like that.
trailing um trailing stop-loss. Let I think it's easiest if you just show it on the chart. Let's go to Bitcoin just for the sake of example here.
Um so for example if let's say that you put your stop-loss let's say if I buy here and I put my stop-loss here and then the if the if the price then increases let's say the price increase oh the price going to go up here then the trailing stop loss is actually going follow the price up. So if you go up here, the stop loss is maybe going to move up here.
Oh. Ah, like this.
So the stop loss base just follow the price and then if the price moves down again, it's going to get stopped up, right? So it's going to get stopped up, stopped out here instead of here. So then you actually took a profit.
That's basically how the the the stop loss works. So, it's just going to follow up the price like that. That's the best I can explain it.
And uh yeah, so that's something I added in um in uh in Raven.
I can't it's going to it's a little bit difficult to show it actually because I don't really have See this one here.
You can see this line here is the stop is actually the uh take profit now. The stop loss. I can't really show it here.
Um but yeah, but the stop loss just follow.
All right. No worries, man. Um all right, so um yeah, any other question? Just uh fire away. So I was explaining just before here in Figma my whole setup and um with these different connections and latency.
So I think actually I have maybe I can check that now.
Um so I have a testing server right now.
I think the test should be done now.
Hope it didn't break.
Yeah. Okay.
Make server.
I think this should be or 12.
12 this one here. So that's six or two. Not fear two. Yeah. Okay. Number six is the most recent.
So I think I will um I will share this benchmark maybe on YouTube later. So basically it can do um I'm basically testing the websockets. Let me see.
Yeah.
So I ran a test of uh different so I already did a video actually about this on YouTube but I've been continuing testing. Let me see if I can find a video here.
Yeah, I did this video here. Single uh single Polymark websocket isn't enough.
So, I'm testing one versus 10 connections. And I'm kind I'm still doing this. I'm still testing this out.
And last night, I started the new test with different configurations. And this is the results here. So, I'm just going to go through that. Um, so yeah, you can see here and it's ran for uh 43,200 seconds. So that is uh 12 I think it's 12 hours.
And I ran 18 connections in total. And this is on a on a server in the closest server you can get to Polymark server.
It's in Ireland. I think it's in Dublin on ABS.
So, I have one websocket, two two websockets, five and then 10 websockets. It's on the uh Bitcoin five minute market and yeah, let me see if there is Yeah.
So, the 10 web connection had actually 100% coverage. So there was no data loss at all. Of course, five, two, and one connection had a little bit data loss.
So 0.1, 0.1, 0.3.
Yeah. So the websockets you use that to trade. That's the fastest way of getting um the price updates. So every time you can subscribe to different data in the web sucket but every time there's h anything that that that changes something on the orderbook you can get an event and then you can execute your bot based on that event. So this is what all trading bots do and it's quite important to have a fast connection and have this set up properly and uh that's why I do these tests and um just to figure out what is the ideal setup and I mean this test here actually shows a lot of things. So you can see here the um we had 100% coverage so so no data loss and this can be an issue if you have just one websocket you can lose some data that can be you know that can be everything for a trading strategy and you can see first scene so of all topologies of all the different websockets who saw an event first and that's the 10 web sockets here so it's in 62.3% of the time it saw event first so I'm actually quite surprised about arrival P95 here, which is now I think here this doesn't make any sense. There's definitely something wrong here with the freshness.
That's seconds. That's very, very slow.
And this one here, arrival, the freshness. Let me see what else we have.
I want to see these here.
Uh, okay. This one. Okay, that's interesting. So, the the median freshness, this is basically latency.
Okay, so the median latency looks correct to me. So, 12.9 milliseconds.
So, the way we measure this is we compare the time we receive an event with the time stamp on the poly market events from the websocket. And of course you need to sync your server um before this is accurate.
So going from one web socket to 10 websockets you decrease the latency by about 3 milliseconds which it might not matter or it might matter depending on your strategy right but since then some Yeah. So it's and the Yeah. And then the freshness or the latency the 95 percentile is very high.
Now as I as in my test I did yesterday and the day before I these numbers was around I think around 300 milliseconds but now it's 1.5 milliseconds. So that means that some events is actually like like 5% is slower than this. So there's some events that's really really slow. And then I think I think actually what I want to do with Raven is to make an option to not trade on these events.
Like if an event is so old, maybe we don't even want to trade on it at all.
So actually I want to make an issue about that just to remind myself about this skip slow events.
In some cases the slowest events is really slow. make an option in Raven to not trade on events that is slower than XYZ.
I think we actually have some kind of a setting for this. I need to check if this works. So I think we have actually this setting uh rate limits max signal age now okay that's for signals uh okay yeah we have this one here max signal age but that is for signals okay so yeah that's fine so I still need this issue just to check up on Did I create it?
Yeah, I did. Yeah. Okay.
Uh, I'm trying to build an arbitrage, but between Poly Market and Calia, the main issue I found is that price between the two platform often differ. Do you have any alternative ideas? Str. Well, what do you mean about the prices between the two platforms differ? Isn't that the whole point about about doing the arbitrage? like you want the price to be different on those markets because you can use that in the strategy. What what what issue specifically do you have with the prices being different? Because this is typically what we're looking for when we are doing an arbitrage spot. So maybe you mean something different. Uh if you can elaborate on that and I'm going to give you my my take on it.
The target is different. Ah, so it's like is it like the outcome if you go to 15minute markets?
So like the the price to beat maybe is different and the time stamps are different. Is that what you mean between Kelsey and uh Poly Market?
is it? You mean the beat price to beat or the actual price over here?
The time. Okay. the time stamp that are okay because as long as the time stamps are the same and the price to beat. So you should be able to maybe the price to beat is not the same depending on this on the oracle that they use.
But if you see if you see the prices, let's say it's here it's 55, but on Kelsey it's 52 or something like that, you should be able to do an arbitrage where you buy on both platforms at the same time as long as the combined value of up and down is less than $1 including fees and stuff like that. But if you if because that's kind of the idea behind it, right? If you can buy below a dollar also including fees and all that on both platforms reliably and they resolve the same way then you should be able to make a profit. But that's the big question.
Do they resolve to the same price to beat um I haven't looked into that yet like my plan with Raven is to en enable trading on Kelsey but right now I'm only focused on poly market but in the future it should be should be possible. that's at least or maybe other prediction markets as well. Um but yeah, you want to look for the price differences and then buy on both platforms either up and down like both up and down. Um so you are sure to win on one of the platforms and then if you do that all the time and you can buy below $1 also including for the fees and stuff then you should in the long run uh be able to make a profit.
That's at least the idea behind it. Um yeah. So, so we can see here the arrival the arrival we compare um the topology. So the topology is down here 10 webs webockets, five websockets, two websockets and one websocket. And then we we are measuring um milliseconds behind the first seeing topology.
So we have the 10 websocket topology is zero milliseconds because it's the one that saw the event first. So the 10 websocket topology basically always beats all the other and then the five websocket comes half a millisecond after and then the two websockets comes like almost 2 millconds and then 3.3 milliseconds after. So it's it's not a lot, but it clearly demonstrates that there's there's a an impact. There's actually a difference. It does make sense to have more than one web socket.
And um and then at the at the edges here at at the the 95% actually is where the difference really matters. So you can see here actually I don't know why this one is 20, but you can see here how far behind especially one web socket is. So the slowest So basically what this means is the slowest events it's basically the slowest events is much slower than uh than the uh the 10 websocket topology.
Uh I'm still not sure why this one is so high here. It's it's uh I feel like there's something wrong with the benchmark since these are so high. But maybe it's actually maybe not like because if Yeah. Yeah. I don't know.
Uh let's see. So this is the gap counts in um in data. So gap gap runs uh spans this poly miss while the union was still seeing events. So basically just measured uh how many runs did it have um have gaps in the data. So we see in uh websockets sometimes it doesn't return any data. This is a major issue and obviously if you have more websockets it could improve it and it's clearly shows here. So having 10 websockets over about 12 hours uh we saw 249 gap runs versus 2,586 gap runs in just one websocket.
And um one web socket here lost the largest gap events was 9,000.
Increasing it to two websockets actually drastically decreases this five websockets for for some reason was higher than two. Don't know why but this I see this sometimes it kind of fluctuates and then we we have the winner of 10 websockets again.
Then relative loss events uh relative loss events total events missed by this topology.
So we have keep in mind there's a lot of events in this 5m minute mark. So 12 hours.
So the one websocket lost 65,000 events.
The 10 webs only lost 5,000. Still loss but compared to how many events? Let me see.
Doesn't it say how many events we have?
All right. That that was in the other report maybe.
Does it say here?
No.
Okay. Well, it's it's we are talking about millions of events.
Um there's usually about a 6% divergent uh divergence in events which ends up killing the expected value like when Kel resolves up while bull market down.
Okay, so I'm trying to search.
Yeah, I mean I don't really have any suggestion for specific markets. I think that's just you just have to kind of deploy. If you have a setup already for a trading bot, I would suggest just deploying it on many different markets to test it out, right? Um I like what I was looking into a little bit was um sports betting, but to be completely honest, I really haven't had enough time to to look into my own strategies because I'm so focused on Raven takes all my time. So, what I was looking into, an idea that I think could work is is sports betting either from prediction market to prediction markets or you could actually do it with a prediction market and then uh normal boo bookers like these normal legacy sports booking websites. Um they put in high fees though, like a high um house edge, so it's not sure if it's possible. Um, and maybe it's difficult to automate, but I think there could be potential there. But it probably requires a little bit more manual trading, especially if you if you use these legacy sports booking engines, uh, these book makers.
But I think there could be potential there to combine prediction markets with the legacy bookkeeping book makers. Um, yeah. Yeah. like uh what what's an what's a big uh bookmaker like big bits 365 or something like that I hope uh okay yeah like something like this right um they have a lot of like has a lot of of if you can find a way I don't know if they have an API but if you could find a way to pass all these different uh events that they have here on on bet 365 for example and then compare it with poly market and Kaly there might be arbitrage opportunities like like EV plus bets where you're sure to win I think there's potential there for example I think I think the odds on uh this website probably doesn't update as frequently as as poly market. So if you see an event on poly market that changes rapidly like from one minute to another maybe the bookmakers is not fast enough to update their odds and you can actually potentially make money on that but it really depends on if you can automate it.
Yeah, I saw there is also an API. Um, bookmaker.
This one here, the odds API. I haven't tried it though.
Uh, so this is sports betting API covering odds from book makers around the world.
Um, so maybe you could use this API combined it with a browsing automation tool that place the bets automatically.
Um, I think that's I don't think that's something I'm going to do in Raven because it's a little bit out of the scope maybe, but I think I would go in that direction honestly like uh if I wanted to do um some arbitrage that's not Bitcoin up and down markets.
Yeah.
Okay. Okay, I'm just going to continue a little bit with my uh latency stuff here. So, gap runs, we talked about that like gap gap duration. I mean, this is all good.
So, this report doesn't really give me more information um compared to what I saw before. So, I think it's all good. I think the conclusion for me at least for now and what I'm working on is to to do this uh new setup here that I explained.
Um so where am I with that? Let me see if I can Oh yeah, actually I want to check something first. So I actually had an issue.
I need to make sure I don't show anything I should not.
Uh no, it's all good. It's all good.
Okay, now this one is running. So that's fine. And we had an issue with background task not working for a while, but it's it's up and running now again.
So that's good. Just needs to check that.
Yeah.
Okay.
Fine.
Okay. So, I think I will continue with a feature that I was working on.
Let's see if I could find it now.
Um, actually, what I mean, I I didn't make a plan today for the stream. Actually, I just want to see if I Okay, actually I want to talk about the the last piece of my plan here before I start working on a feature was actually talk about my AI flow here. So, I'm just going to explain uh how I use VIP coding because a lot of people is talking about VIP coding and VIP coding and it's basically what I'm doing as well, but it's not just VIP coding. It's it's basically a genic development. So, I'm going to explain a little bit about my setup and how I do it. So, uh I use obviously I use GitHub and you can see here we have all these different labels and that's actually something new I just introduced and uh I actually have so I have a Mac Mini. Um I don't know if I can show it.
So I have I have this one here and it should be running. I just clicked the close button. That's was a mistake.
But anyway, I have the Mac Mini.
Let me see if it um Yeah, I have it here.
Yeah. So, this one is my Mac Mini and um I have Hermes agent running.
So Hermes is basically the new Clawbot and everybody's basically talking about this now. It's it's it's Claudebot but different. I'm basically testing it it out now. It's uh this one here. And I set this up in um on my Mac Mini.
Which crone jobs do I have running now?
So this one currently is connected with codeex and you can see here we have three chrome jobs. So we have a raven triage triage hourly. So it's an hourly. I'm going to explain what that is. I have a raven ducks update daily. I'm also going to explain what that is. And then a raven implement ready for death hourly.
So when I create issues in GitHub, what what Hermes is going to do XML Mac Mini is it's going to for example this one. It's going to do this soon. It's going to go in and look at the issue and it's going to uh read whatever is here and then it's going to go into the codebase and then it's going to propose what to do about the issue.
Now in this case it proposes to close it and then if I have some comment here what I can do is I can remove the label from here and then this chrome job that runs over on my Mac minus and it's all the it's on all the time it's actually going to look at my comment and then you know we just basically ping pong that way until I change uh some feature here.
So maybe if I'm agree that this should be closed, I can do that manually. But if we have this one here for example is ready for def.
So it's going to it's going to uh basically describe everything and say oh this one we can build this feature. What I can do is then I can just remove the the label here the triage label and then I have this chrome job which is this one here which is actually going to look at these. It's going to look at which one doesn't have this label and have this label and then it's actually going to build the feature and it's going to create it as a pull request over here.
So, it's going to create it as a pull request over here and then it's up to me manually to actually test it out and make sure that it's it's it's good. And then I have a third one. So, a daily doc update. So, we have documentation for all the users. And this one basically every day is going to look at all the different commits that happened on uh I think it's on the development branch this branch here and then it's going to create updated documentation. So you can see here this one was open 28 minutes ago and I think I was streaming at that time so I I didn't do this. It did it automatically and um it uh it says all the covered commits and the different commits that was shipped. You can see here what it actually did.
It didn't really do much for this one here. It updated a little bit uh for the from some explanation but basically just updating the documentation which is if I go to uh Raven again we have this one here the documentation and this is basically what it's maintaining because all the different features I'm building and changes I want to make sure that that's up to date in the documentation.
So that's how that works.
And then obviously I use claude codes and codeex. So I have a codeex over here and I'm still I actually use I have both subscription. So I have um codeex here. What you can do is you can just uh you can create a new work tree for example create permanent work tree and then have codeex run on many different features at one point. And then of course over in uh in uh Ram here I have Claude. Uh I also have Codex if I want to use uh Codeex and um but I want to try um automate as much as possible to where I just do these uh pull requests automatically and then basically what I do is I just check and test the pull request. So what we're working on now is this one here. I think actually we have two. So, let me just check which one it is cuz I was merging these two in 12. Not No, wait a minute.
I have how do you indicate a setup to iterate them keep working and create the PSI?
Well, I mean it's it's um it's just a chrome job that runs every hour and then the chrome job checks the labels in the issues. So I I basically communicate with this chrome job and the AI with these different labels here and there and the comments and stuff like that.
Uh, I did some changes this morning. I just need to make sure which branch it was.
Maybe it's this one here.
25. Yeah. 1 hour ago. This this one here.
Uh so the issues. Yeah. So actually the way I use so either I create the issues manually like I just did for example I just created this one here and then it's going to be maintained and then actually in the discord now people haven't used this feature yet but in discord um people can actually do uh issue like this and then let's actually just try to test issue.
Maybe it's hope it works because nobody used it yet. Let me see. So now we got the report and I have AI reviewing it in the background here.
Let's see. And then I can uh add details or I can submit it as is.
then create issue and then let's go back to GitHub and you can see we have test issue here now so this one is a user generated now users they they haven't done this yet but now people in discord can actually create their own issue in here and but they need to have their specific role the raven role I'm just going to delete this one here Okay, I just delete it.
So the good thing about building in public and doing these live streams and having this discord is actually people is actually using Raven And um there's so many edge cases that it would be impossible for me to actually um test all this out by myself. And that's kind of why I also did this leaderboard.
So I'm putting my own money on the line, right? I giving away $100 on for the leaderboard here. And it's the way I'm looking at this is I'm basically paying $100 to have a lot of people testing this out. Um and uh it's we had good Yeah. So it's it's uh a lot of people want to we still have bucks, but people also want to do live trading. I'm kind of worried a little bit about live trading because I want to make sure that there's no bucks. Uh before we live trade uh what what had 25,000. I think that is probably a mistake.
Now he's gone down here.
I have to look into Hey.
Heat. Heat.
Heat. Heat.
Let me see rec consiliation.
So there is a job running in the background that basically checks and fixes balances. Uh let me see.
Uh like this I just close my tabs down here. So much stuff.
Let's All right. Uh, but will be later as as I'm streaming now.
All right. Um, yeah. So, I have to check that a little bit later because I will have to go into the database and I don't want to show that on stream. Um, so these are some of the issues we've had where sometimes the balance is what wasn't calculated correctly and and not carried over correctly. I'm not sure what going on with this guy though why it would um why that would matter. I mean why it would change so much. So I have to check that. I think it comes after I enable the the background jobs because uh let me see. I don't think I have anything uh that's that shows stale. Uh all right.
Yeah, I have to check that a little bit later. I I don't want to I don't want to go into the database on a on a stream um because I want I need to check the actual database. So um so I'll check that later.
So I think for the remainder of this stream I'm just going to uh see if I can test out this new new feature here. Let me see if I have it up and running.
I do have Okay. And there's something I need to set though.
Should be this.
Now I need to remove this. I don't want to show my env.
Wait, this is fine, right? Yep.
All right. So, I need to be careful about what I'm showing here. I don't want to show everything.
Okay.
What to set? So, we have to set this. I just did that. Auto operation edit.
Start the publisher first without a possible spin. Waiting for snapshots.
That's ready.
Let me just Oh, okay.
Uh let me see we have radius up and running.
Let's go local host.
Okay. So far, so far not working. Let's see we have anything in the API.
Okay, I have set the env docker again. But when I deploy a bot, I don't see any data flowing through it.
How to verify is sh but looks sh ID but locks. Let me see if we have bot locks.
Quick check.
Shad feed publisher.
Okay.
probably isn't running without it. Damn.
So this pool drop sh feed in your but yeah this pool builds it own in via allow list.
Uh this needs one line fix.
Yes. Yes fix. It should support both sim host and regular containers.
Okay.
Okay, let me see.
I should be able to just do make Not seeing not seeing the service coming up.
confirm the new SIM host has the ENV Make docker.
No. Uh, extend make docker, please.
Yeah.
Doesn't need all of them to run.
Add share light feed. Add shadow. So this one I think we can close it.
No one. So it's um this one I can close it because it's I merged them into each other.
Um this is a duplicate as I Yeah. Yeah. We have it here.
Okay.
Heat.
Yeah. So now we have we have this service here, shared feed publisher. So that's the one that's going to handle the website connections and I can see that it does connect to to poly market here the websockets.
Okay.
So, I'm going to go ahead and try test it out now by deploying a bot again.
Okay, let me just delete these here.
So we are getting data actually. So that's looks great.
Um let's do the locks.
Money.
or the only way to get those cash in last round. This one The wrapping part is silent which is what made this hard to debug. One line info.
Yep. Please go. Please go ahead.
I don't believe it has been that easy to refactor it to such an extent. So it definitely requires more testing. Uh so I'm probably going to deploy it on development soon and then test some more make sure everything works as as expected and then uh I have so all existing bots when I deploy this feature how are they going to handle this? Are they able to keep uh the current connections that they have or do we have to roll the current bots over um forcefully Short ends existing bots keep the current connections. They will not migrate to shared feed on their own. No force rule needed. You can drain naturally. Quite safe.
Uh deploy the PR confirm properties comes up health and new deploy but show the new info log line. Don't charge live but it drain naturally as you stop deploy simhost either let tail reap them or recycle them to ones doing all files.
Okay. All right. Um I don't think we did any changes about the websocks. That's kind of next step I think. But I think I'll wait to do that first. Let's make sure that this actually works properly. And then when that works, I can start to optimize the websocket connection. So we have 10 recurrent connections.
Um so I think next step is I will deploy this to development and um and then there just do some testing.
Okay.
All right, that is now pushed and I will merge it in this one.
I just want to make sure that I have running bots. So, I want to make sure I have some bots running on development and see if they get disrupted. So, I have this one here running and this one here 2 hours.
Okay, let's just open one more. Maybe I just open this one here. All right. So let's just make sure that this one here is running and then if that's running I will uh merge into development and then first I will see if these bots is getting disrupted in any way and then I'm going to deploy new butts and verify that it runs on the shared uh data layer.
Okay.
Yeah. Okay. Okay, that's running.
And then this one.
Make sure we have Yes. All right. Good.
It's getting merged in now. And I think that's it.
Good.
All right.
I'm just going to see if it actually creates this service. Oh, actually I forgot to add the in. So, I'm just going to not show this here.
Let me put it over here.
And where is this one as well?
Yeah. So, there's some information I need to set. I cannot show this on stream like this.
Okay, now I'm going to redeploy again.
Uh, like this. And we'll see.
And the bot is still running.
now. So now it's Yeah. So it's deploying now. That's why we see a load failed. It should come.
Yeah. All right. So, the bot here is still running and I'm not seeing I'm not seeing the um the new service actually here on staging.
It's probably because it's the wrong uh radius Ul maybe. Uh let's see.
I have just deployed now to staging but I'm not seeing the new service running.
I already set the environment variables and then It's probably I think the radius is maybe difference.
Heat. Heat.
Uh found doc post behind profiles share feed and doc doesn't activate shared field pro profile default. So the service silently skipped it in staging local found because mega file passes.
Okay.
Profile. Okay.
All right. Let's see.
Ah, it uh deployed on the wrong branch.
God damn it.
Can you please make this change on development? I already merged it into development.
What's what did he say? Uh push to a shared branch and hard to reverse blast radius action.
Cher pick landed clearly gate is gone.
Only service name appears shared feed. Okay. Yep.
And I can see now it's deploying on development. So let's see if we got it.
Yeah. So I see we have a shared feed publisher now running.
Okay.
Let's see. We have all bots still running fine.
So, what I'm going to do now is deploy another bot and see if that runs on the shared feed publisher.
I don't think it's working. Let's see if No, something's definitely wrong.
Okay.
I just deployed the shared feed publisher onto staging and the first bot I deployed does not uh work. I think these are the locks.
The shared feed publisher container is up and running and has the following locks.
Okay, let me see if Oh, so Oh, yeah. So, this ah okay, it actually did error out, but now it uh it automatically redeployed. Uh that's that's a actually a feature. But why would it Okay.
Um Oh, wait a minute. Oh, okay. I see there's actually a trace back here.
Yeah. Okay. So, there's an error actually.
Did it catch that? I think it did.
Um, let's see.
Yeah.
All right. Right. Just stop.
Okay.
Yeah. So, that's definitely going to take a while to make sure that that works properly. It's going to take a while to test that out.
Um, and the next step is going to be skip.
Okay, I'm going to do a new issue.
Improve websockets uh setup.
need at least 10 recurring uh connections in the shared beat publisher.
I think actually I did have codeex map it out or did I remove that?
No. Nope. Nope. Okay.
I don't have that here.
Um, all right. I'll just I'll just uh keep that is uh is as is.
Oh, it doesn't see all the logs or what?
I think it's this one here.
Okay, so there's that's annoying.
There's something about the locks, too.
So, now that I stopped it, I don't see that error log anymore. I need to start again.
Should be this one here.
Yeah, this one.
Yeah, I can't find uh it's it's the radius URL that's that's broken, I think. I mean, it's not broken. It's just the wrong URL. Uh it has a different it has a different URL internally inside of of uh Docker.
Um, I'm actually not sure what it is. Uh, maybe I can see it here.
Ah, actually I do have it here. Yeah, I have it here. So, I can just I should be able to just update this.
Um, yeah. So, it's the URL for the radius instance that was wrong. I will try reload everything and see if it works again.
It's probably also what he's going to say, right?
So, I think when this is deployed, I'm just going to check if that works and then I'll stop the stream for now. I need probably some coffee and a breakfast.
Let's see. And then I need to help this other guy out from Discord. We had an issue with this guy losing his balance.
I need to check exactly what what happened. Um, so I'm going to do that also after the stream.
Um, let's see. It's deploying right now.
And okay, it's it's deployed now. So, let's see. I have uh this one here. Okay, I'll redeploy this. And let's see if it works now after updated the radius u.
What happened? Yep, here we go.
Okay.
Still no data though. So there's something still broken.
Okay. It did error out again. So where is it? This one here.
Uh, it should be I can't can tell him two things whether you already come Um, I updated the radius URL uh and gets the following errors now.
Are we sure about this? Let me just stop.
Just want to double check at least some of this.
This one don't want to delete a one.
What's going on?
See if I can see something in the logs here.
Okay.
Okay, definitely not working.
Uh, please please confirm the issue. All right, I think with that set, I will close uh now. And yeah, I think that's it. I'll just have that cook for a while. And I need to test this out a little bit more, too.
So, thank you everybody for checking in.
Um, and see you at the next stream. Bye-bye.
Related Videos
VALORANT's Latest 'Exclusive' Tier Bundle is Rough...
KangaValorant
17K views•2026-05-28
Flight Attendant Mocks Poor Looking Black Woman — Mid Air Announcement Exposes Her Real Power
SkyboundStories-b4r
184 views•2026-05-28
I FIXED My Friend’s Blown Turbo RX-8… Then Sold It
Cameron-RX8
134 views•2026-05-28
NewsWatch 12 at 5: Top Stories
NewsWatch12
1K views•2026-05-28
Simon Jordan & Danny Murphy deliver PREDICTIONS for Arsenal's Champions League FINAL with PSG
talkSPORTArsenal
6K views•2026-05-28
Botting is OUT OF CONTROL in Classic WoW (Again)...
SolheimGaming
108 views•2026-05-28
The "AI Job Apocalypse" is CANCELLED!
WesRoth
9K views•2026-05-28
STREET FIGHTER 6 - INGRID Story Walkthrough @ 4K 60ᶠᵖˢ ✔
RajmanGamingHD
12K views•2026-05-28











