¶1Hello, hope you are doing well. So, while I was on my holiday last week, uh OpenAI released their GPT6 Astra model and from my early testing, this looks super strong for our use cases uh in this new niche I'm using. And today, I wanted to try to use this to build a AI trading bot on Kalshi. Uh but more specifically I wanted this to be targeting the New York City for now uh weather markets using the new weather next three model from Google deepmind. This is like a forecast model you can use to predict weather.
¶2So I think this is a really interesting combination I really wanted to try out and this opportunity with the new Astro model. Uh yeah it's a perfect occasion to try it out. I think we're just going to spin up like a VPS from AVS today. But here you can of course pick another uh provider. And like I said, we're going to use the Google Deep Mind weather next three model to yeah do some forecasting.
¶3And on Cali, we are just going to target the daily temperature market, I think. So yeah, we're just going to do this from scratch. And I can kind of take you through every step I do to build this trading bot. And like I said, we're going to be using the new GPT6 Astra model uh in combination with codeex. So before we get into it, let's just talk a bit about uh actually how this market work on Cali here.
¶4So here you can see we have the highest temperature in New York City today. This is of course today's date 8th of September. But I think we are going to target when a new event launches. I think that's in like 5 hours or something. they kick off the new event and we wanted to kind of look into kind of what the buckets they are going to put up here and we want to be ready when this event launches and try to get the bucket we predict at a good price.
¶5That is kind of our goal for this AI trading bot. And basically how we're going to do this is we're going to target like I said the upcoming market but as a test you can see I placed uh a small um prediction from this model yesterday uh on yes here. So we're just going to see how this turns out during the day as a just simple control I guess. But the main goal of the video is just to walk you through how you can kind of set up this 24/7 bot uh using the new weather next uh model here uh from Google Dip Mind. So, uh, where I like to start here is pretty straightforward.
¶6So, now let's just go over to our terminal. Let's just do our directory. Let's call it calc uh NYC uh uh let's just call it uh weather next tree or something like that. Uh let's just go into this directory codeex. I like to do yolo just to save some time.
¶7Okay. And here you can see uh we want to select uh a model. if you don't have codeex. Uh it's super easy to install and you can also use this with cloud code if you wanted to. So we're going to select GPT6 Astra, right?
¶8And I'm going to put this on high [snorts] reasoning. Uh you can of course play around with this. You don't have to have it on high, but this is the model we are going to use because this is kind of what I wanted to test on this video. And now that we kind of have our openi codec set up, I think the next thing is actually just to start looking at the events at the events on cal before we kind of update our uh data sources. So I'm just going to go to calc copy this New York City event here.
¶9[snorts] And let's just head back here and paste it in. And let's just say something like so I'm just going to say there's a new event launching for 9th of September market that is of course tomorrow uh at 1600 Oslo time. I don't know what is this in like UTC but uh just going to ask GPT6 here to confirm this so we can kind of target tomorrow's market but now come kind of uh the most important part and that is of course the data. So the Google weather next model is something you can just click on try here. So if you go to kind of um the weather next announcement here, just click on try weather next and you can just click on build with weather next and this will take you to a page where you can just click on get forecast data and here there is a request form.
¶10So you click just click on open data request form and here you just fill out this so you can request access to this model. They said it's take could take up to seven days to get access but for me it was very quick. I think I got access in like a day or two. It didn't take long. Uh then I got access to use this uh forecasting data from the weather next model and uh it looks pretty good so far.
¶11But uh weather next just came out. I think it came out like a couple of days ago or something. And you can kind of see here on Weather Next 3 uh this is in the big query and Earth Engine. This is what we are using to try to predict. When you get the email that you have access to weather next, you just like I said head over to your Google cloud account and you're just going to click on API and services.
¶12So what you're going to do is just click on here enable APIs and services and we just search for big query something like that. And we should find it down here the big query API. This is the one we want. And you can see I have this enabled right API enabled. But you're just going to click enable and then you should have access to that.
¶13And we also want to check out Earth. I think it's called Earth Engine API. Okay. Uh this is a bit different maybe, but uh if you don't have it, just click on enable. And I think that should be what you need.
¶14And when you have enabled those two APIs, we can just go back here and click on I think I'm just going to go back here. APIs and services and you can check out credentials here and here you can just select uh I think I'm just going to pick web application and yeah just give it a name just Kelshi weather next tree or something and yeah just hit create and when you have done that you can see you should have some oat 2.0 all client ids because when we do that we can actually use the Google CLI to actually log into our weather next data and we can start using that from kind of the CLI and that of course lines up perfect with um with using the codeex and of course the GP6 Astra high. So now you can see uh 160 Oslo time today is expected opening for the September 9 market. Uh but it isn't officially but I kind of know that and that is the buckets we're going to try to predict today. So now I'm just going to say something.
¶15So I'm just going to say I want to use the weather next three data for this plus the Earth Engine. I'm just going to paste in the weather next models here. And for authentication, I just want to use uh Google CLI. So I'm just going to send this to Codex now. And this hopefully should be enough to access the data we can get from weather next.
¶16So while we wait for that, uh we kind of want to automate this on Kali. So if you have an Cali account, you can kind of just go to your uh account here and if you scroll down here, you can find API keys and you can just generate an API key here uh on Cali. So you just uh create key. So you just give this name a key and you will get this download downloadable private key that we're going to use for automated trading here. And then we can just in head into our browser here let's say on cursor or VS code and just create av file cali uh API key calop uh let's just do cali something like this.
¶17And just paste in your API key down here. And we should be able to you might need actually your private key in like a file here but uh we'll see about that later. So let's just head back here now and see. Yeah, we can see we are still working on this installing Google CLI and after that we can just kind of log into our account here and we hopefully should have access to Google weather next. Okay, so you can see now we have connected successfully using our Google CLI credentials and our project.
¶18Perfect. You can see we also fetched and validated so weather next three data forecast for tomorrow near Central Park. And this is important because we also need to check that uh if we go to the event here in New York City, we really want to check what kind of station Kali is using to kind of resolve this. So I'm just going to paste in uh the event again uh to uh to codeex and make it confirm we know what station Kali is actually using for this event. And you can see I also said so we will use a combination of weather next tree and earth engine.
¶19So yes weather next produces the weather forecast. Earth engine let us query and extract them for uh the location and date. Right. So, I'm just going to put in the event here and I'm going to say so I'm just going to say confirm uh the exact stationation spot Cali uses for resolution for this event just to confirm this because this can be important. Let's say uh it's on JFK versus like Central Park.
¶20That could be like differences, right? Could be a couple of degrees difference. So, we kind of want the exact spot uh Cali in this case is using for uh the resolution here in the contract. And it can be also kind of smart to just copy the market rules here uh into codeex and just to confirm this too. So you can see uh the event uses central parks weather station in Manhattan.
¶21Okay, that's pretty good. So now we kind of know the physical spot of this. Uh it sits on the Rocky Hill immediately south of Belvadier Castle. So that's pretty good. Uh great um rules.
¶22So we can also paste in kind of the market rules so we kind of know uh or kind of give the codeex here GPT6 the information about the rules. So I think we kind of have our data pipe kind of lined up now. Uh it could also be good to use other sources of data of course but for this simple um tutorial I think we're just going to focus on weather next tree and earth engine from Google. So yeah, we kind of have uh this set up now and I think we can kind of move on from here. So what we're going to do next now is actually do a back test on the data from Weather Next and Earth Engine.
¶23Kind of compare it with the historical data from uh the Cali News uh NYC events. Uh it's not going to be something perfect, but uh I'm just going to use the prompt I kind of have my standard prompt for this. So the prompt is something like act as a rigorous quantitative researcher in this repo. build and run a reproducible back test of weather next tree forecast retrieved through Google Earth Engine against the historical NYC calc temperature events. You can see we have some research questions here.
¶24Uh does weather next three add a predictive information beyond Cali prices for these events. Uh settling on Central Park uh uh and does that information survive realistic fees and execution assumptions. And you can see we have uh verify the target. Enforce point in time data. Evaluate separate forecast horizons.
¶25Uh fit probabilities without leakage. This is important of course. Validate honestly. Uh evaluate execution only where data supports it. And challenge the results.
¶26This is kind of the prompt I basically use for all back tests on these types of markets. So basically that is what we're going to paste in here. And hopefully now we can just use codeex GPT4 GPT6 Astra to execute this grab all the data we need from weather next and calc and run the back test and we can kind of compare the results to see if we want to continue in this exact market. So one interesting thing is at uh I did this test on Miami but on Miami it wasn't really that strong compared to new to New York. That's why I kind of picked New York for this uh tutorial.
¶27So, while we wait for that, I think it's a good time. You can kind of see now, remember we tested the model earlier today, or I guess it was last night. I wanted to see how this worked. So, if you just do a quick check in here on the highest temperature in New York City today, this is not what we're going to try to break for tomorrow. Uh so, this was the 81 to 80 to 81 bucket.
¶28Uh we bought at around 56. Now you can see this is trading at 63 cents and we are about 12% up on this trade. So yeah, this was was my from my testing yesterday. So the back test now is still running and we're just going to wait it out and then we're going to see what kind of results we get here from running this on the yeah NYC market. So, I did talk about this because if you want to set up like a 24/7 running VPS here on uh this yeah this AI trading bot, we will need our Cali API key like I showed you earlier.
¶29And when you generate this, you will also get this. You can see I have a Kali private key txt here. This is kind of the private key to actually yeah do trading uh programmatically using the Cali API. So, I will need a key here and I will need a private key. So, I just put this in a text file in my my folder here.
¶30But, uh there are of course other ways to do this if you want to be a bit more secure. But basically, that is how I set this up. And when we have the private key and we have the API key, we can kind of launch that uh uh onto the VPS and we can start trading programmatically by using our setup here. So, after the back test, now I'm going to actually test the private key and the API key to see if we can kind of fetch our balance on Kali using the API. If we can do that, we should be also be able to trade using the the API.
¶31Okay, so after about 40 minutes, we actually got our back test results back and you can see we look pretty strong at opening plus 1 minute. And I think this is what we're going to target today. Uh you can see our retrospective signals here is like 64 versus 74 or like 74 I guess. And I think that is what we're going to target. So, I'm just going to say uh you can see I asked how was the results.
¶32It says really pro or promising I guess at market opening. But of course, we don't have enough data to establish an edge here. But we're going to look more into it. So, I just said, can you create a graph with a opening plus one results? So, we can target placing a position on a bucket at one minute pass opening.
¶33So let's just wait for the graph and then we can kind of check out uh how this looks. Okay. So now you can see we have uh both our images. Let me just find this here. So this was the first image we had.
¶34So this is kind of the opening plus 1 minute. So you can see we do actually look like 13% uh better here. You can see lower is better of course 64 versus 74. So that's pretty interesting. And I think we're actually going to aim for decision time uh6001.
¶35Uh, of course, this is going to be on the New York City Central Park station. And I also did actually do like a test on uh let me just find that on kind of the other opening minutes. So you can see we have 1 minute, 2 minute, 5, 10, 15, and 30. And here lower is better. So, I think we're just going to pick the one minute here, right?
¶36So, if we want to, what we want to do next is actually start to predict the buckets. So, I'm just going to set up um come up with a prompt here so we can start looking at the buckets when the market opens in about 3 hours, I think. So the next thing I'm going to do now is I'm going to say use your existing uh NYC weather next 3 uh earth engine model to predict today's uh event uh verify uh yeah pop up. So we're actually going to target the buckets because we want to see or predict what kind of buckets will pop up when the market launches today. So yeah uh yeah it's pretty straightforward here.
¶37We're just going to try to predict the bucket size. Uh and of course we're going to try to place some probability in percentage on uh where we want to start this. But this will of course we will of course adjust this when we are close to our uh601 opening uh to be as close as uh the models are to that point and we're going to place a position on that. But uh basically now let's just try to predict the buckets see where we are at and just that means that we can kind of prepare uh for opening. Uh of course we need to set up the we need to set up the the VPSS and stuff.
¶38So I'm going to head over to AWS now and prepare my instances. So, if we head over to uh AWS now, uh for Cali, I like to just pick the US Ohio uh market or like yeah, I guess um zone. Uh you can see I already have like a Cali VPS running here. So, what I'm going to do now is I'm just going to head over to my cursor here and I'm going to fill out my AWS access key, my secret and region. Yeah, I can just state that.
¶39So, we're going to have that in uh ourv here. Okay. And when uh this is done, I'm going to start uh up an instance autonomously using the CLI here. And here you can see I'm using like a T3 small instance, but in this case, I think I'm going to use T3 micro just because that's a bit cheaper because we're only going to be using this uh this simple setup here. So yeah, I'm just going to wait for this.
¶40When kind of we have the buckets prepared, I'm going to launch uh the AWS and yeah, I guess you start uploading our 24/7 bot onto a AWS. So here we can see for September 9th, these are the provisional probabilities uh as of today at 1316. So we have the buckets here. These are from 83 and below uh up to 92 or above. So this might change on market open but let's just wait and see.
¶41And now you can see we are kind of priced at 71.5 cents for 83 and below we are at 27.2 cents at uh 84 to 85. But uh of course we need to update this because of course we want to check out the plus one minute um after600. So for now we're just going to leave it like this. and we're going to look a bit closer to opening time. But in the meantime, I'm going to prepare our um I'm going to prepare our um VPS.
¶42So I am going to ask to set up like an instance here on AWS to actually run this setup uh autonomously. So, I'm just going to say we now have our ENV file and our private key and the AWS to spin up like an Ohio WPS to trade. Uh, so we're just going to start by confirming our Cali is working uh by just fetching our balance right on our account. So, and now we're just going to use GPD 6 here in Codeex to write some simple scripts to just fetch our balance so we know everything is ready to go. And then we probably going to do some simple local testing uh before we actually put this up on the cloud and the VPS to run this 24/7.
¶43So let's just wait for that. See if we get the balance and then we can move on. And here you can see confirm this is working and we can fetch our balance. Yeah, we have 100 bucks on this account. Perfect.
¶44So now let's just try to use our AWS to prepare an instance before we actually move a bit more into the logic of this. Uh or maybe we should just do the logic first. So let me just um yeah set up this prompt here. So the way we're going to do this is uh before we push the trade bot to AWS, let's set up the trading logic as a proquant researchers researcher and dev build a trading bot uh to be ready to place the best position at decision time6001 on the new IC event for set 9. Uh based on the latest data, we can calculate this like 15 minutes before decision time.
¶45find the best logic algorithm to execute this flawless to get the best possible price on the bucket we think is the most uh expected value based on our predictions using the better next tree and the earth engine. So let's just build the trading bot here locally. Now we can test and everything do locally. I can also add test this locally and make sure everything is okay. And after we know everything is working and we have tested this, we can yeah basically just push this up to the cloud and have this run on our uh virtual private server.
¶46So now you can see we have built and tested everything locally. And now just let's just go through kind of the logic of the trading bot we built here now in like simpler terms. And now you can kind of see the bot looks now for a bucket price cheaply enough compared with our weather estimate basically our model right so at 15 minutes before 606001 I guess 15 minutes we're going to freeze the prediction we're going to allow for the forecast being wrong601 right Oslo time check the actual prices because now the market has spawned and we're going to compare buying yes or no on every September 9th bucket and we're going to check that uh Yeah, check that is enough contracts so we actually don't do like some midpoint. We basically want to have liquidity before we enter so we don't get any slippage. Choose the strongest remaining value and we just basically going to check if any contracts has uh 5 cents of advantage uh on the contract per uh our model.
¶47So, let's say our model says 60%, if the price is uh 65 or let's say 55, then we want to enter, right? That's pretty good. If nothing qualifies, we we're not going to trade. But today, we might do an exception just to test the model out. We'll see.
¶48Uh check the price again, then attempt one order. That is basically the logic. And here we have an example for a cautious 65% win probability a 50 cent price 2cent fee 1 cent buffer leaves 12 cents of edge enough to qualify right or it says advantage but you can think of this like edge right and yeah it's default to paper mode but uh we're going to upgrade this to live soon. So that is basically our model. And next up, we're going to need to yeah push this to the VPS, I guess.
¶49So now I'm just going to do the prompt. Uh we have our AVS credentials, right? Let's spin up the Ohio AS instance to prepare to run this uh on a live a AWS server. We will of course run some tests before the live mode. Let's pick a T3 micro uh EC2.
¶50That is the server we want. Here you can do whatever you want. You can use hosting air. You can use cloud gct GCP. There's a bunch of other VPS services you can use here.
¶51Uh I'm just going to use AWS now because I have everything set up. Uh so yeah, let's just push this uh or like spawn up this in Ohio. US East 2 deploy the bot in paper mode and then we will switch to live uh after we done some testing. Okay. So you can see now we are running the deploy launch here and we are launching this on US East2 uh mode paper.
¶52We're going to switch that. But if we go here now and refresh hopefully you can see soon that we are spinning up an instance here on um yeah on our account here on the Ohio location. And here you can see we are spinning up this T3 micro like we said we are just going to initialize this put up our logic trading bot and we should be able to test this and after the testing is good we should be able to put this in live mode and prepare for the model freezing 15 minutes before the yeah launch. So let's just wait for that and yeah I guess I'll be right back. Okay.
¶53So now you can see we have uh light mode disarmed. Perfect. And we are ready. We did all the test. Forecast freezes.
¶54So that did pass. So you can see it froze successfully at uh 1546. And I'm just going to ask what is the latest bucket predictions and you can see now we have kind of shifted a bit. We are now like 67% old 83 or below. But I think maybe these buckets can change.
¶55Uh we will have to see when this goes live. Uh 30% at 8485 and almost 3% at 8687. So these are now the estimates or like the model we are going to based uh based our entries on. So basically we're just going to have to wait and see uh if we find anything that uh looks pretty good. So let's say the pricing now is uh let's say 55 uh on poly market on this bucket.
¶56We will of course hopefully enter uh that should be a pretty good deal but that doesn't happen every day and that is why this is like an autonomous butt that runs 24/7 because sometimes we find a good good price sometimes we don't. So now we just have to wait 5 minutes and hopefully we find something. If not, we're just going to check in and see how close we were. So, yeah, I'll see you in five. Okay, so you can now see uh yeah, it's like 1,600 and we are now just waiting.
¶57Should be launched now. Uh annoyingly, we have a lot of uh here are some other markets. I'm also in like a a bot that enters the Miami market, but this should be like 1 minute later. There's a lot of orders here, but I guess we can just stay down here. Uh let's just wait for the 1601 here.
¶58Uh that should be a minute delayed as we set up what to do. But uh this is like Miami, but this is like a a different one I'm running on a server. So this did Yeah, this entry was pretty good. You can see 25 33 U. But let's just wait and see.
¶59So yeah, should be going pretty soon. I think maybe we enter, maybe we don't. Just let's just wait and see. So should be any time now. and I'll be back if we enter.
¶60If not, let's just check how close we were. So, it should be 1601 now. Don't see any orders yet. So, maybe we didn't enter. Let's just ask.
¶61So, I'm just going to say um just check and give me the prices because I didn't see we enter anything. Now, uh we might just enter maybe anyway just to see how it goes and just to test out the bot. We I'm just going to do like a manual decision on this. So, let's just give me the prices on the buckets and then we can do like a uh a test just to see if we can place the order. So, while we wait for that, you can see we did actually sell some positions on the Miami bot here.
¶62I think we actually run into context compacting here. That was a bit unlucky, but uh yeah, let's just wait it out. Check the prices. Maybe we find something. Maybe just see if it works.
¶63Yeah, you can see we ran into the context compaction here. So, let's just grab the prices and uh yeah, maybe do like an override or something. Okay, so let's see here now. So, you can see this was our bucket. We did actually give this like 67%, right?
¶64Uh we did get a pretty good price here and at the opening we did have 30 we did actually have 30 shares available, right? So I think we actually should have entered here. You can see model probabilities remain those frozen and the bot said that we had like a 15 cent expected edge here after fees. But there were some issues here. Uh the advantage disappeared under the configured uncertainty checks.
¶65So that's probably something we have to fix. I can just quickly look into that. But uh just for fun I went ahead and I did actually enter here manually. I just selected yes. I entered like 50 and we entered for like Yeah, I can check it out here.
¶66Yeah, 83 or below. You can see we we bought at like 51 for $17, right? So, we can also do like a quick update the prediction now. But, uh we also need to kind of check out why this didn't autonomously enter. Uh but we can do that afterwards.
¶67So, another thing you can do is let's say we go to our 8 to3 position here. It could be interesting to just check the books here, right? You can see someone wants to buy at 5049. Some people are looking to buy at yeah a bit lower, but there's a very thin market now because it just been live for 11 minutes. And you can also start to Yeah, these are more lottery tickets, but uh 51 now is kind of the what people wants to what to sell this for.
¶68And we are still a few shares we have lined up at 50 here. Maybe we sell them later. We'll see. Or we buy those later. But uh yeah, that is basically the position.
¶69And if you kind of look at the probabilities still the same here from our model. Does this mean that our model is correct? No, it doesn't. Right? So this is basically just a tutorial on how to do something with the model we picked now.
¶70But you can transfer this into any type of data you have, right? The setup is basically going to be the same. You can have like a different data source. I have other systems like my like my quant VFX system uh is not using I guess I can zoom in a bit. This uh uh weatherbot is not using Google deep mind weather.
¶71Next, this is using more like open metro ensemble data and other data. Right? So, I'm also running a different system uh not based on the deep mind weather next. So, I wanted to try this out. So, why didn't I just make a video on it and how to set it up?
¶72So, I'm going to keep monitoring um how this weather next model is going to do and then we're just going to keep watching this because I was going to ask about this uncertainty here. But basically now this can run 24/7 in this instance, right? I guess we can update this now. And you can see this [snorts] is now running on uh the Ohio server. Uh this is now ready for tomorrow, right?
¶73If we prepare it for tomorrow. So this can every day at this time it can check the market, check the prices, is there any good prices and if it is we can just enter autonomously like we are doing uh with the other models we have. So this could be like a part of your portfolio and if you find a model that runs pretty well, you can just leave it running on the VPS. But you got to remember something. Let's say this, I think this T micro here is around $16 per month.
¶74So you also got to calculate in the cost of actually running this VPS here. So don't forget about that and the fees of course uh when you do your uh calculations here. So it looks like something happened here. So the models estimate adventure did not disappear. My earlier warning was uh misleading.
¶75The bot replaced the 67 estimate with 37 from a scenario that assumed one farmer faright warmer forecast. Uh that produced a minus stress test edge. I don't know what happened here, but we need to fix that. Uh because of tomorrow, we want this to be online, but it should be like a quick fix for Astro High. I don't think this is going to be a problem to fix.
¶76So yeah that is basically how I am building up like a portfolio on these automated bots uh that is kind of running uh on VPSs right and some of them lose money some of them win money and you just got to monitor this uh like I check them once a day and just to see how they're doing and if they're not performing anymore I'm just going to cut them out maybe try to find something new. So I really hope you enjoy this and this gave you some inspiration to try to get more into more like uh using data using these strong uh models we have now with GPT6 Astra Fable 5.1 really good at mathematics really good at writing code really good at data and that's basically all you need to build like a strong trading bot right uh of course you need to think a bit about the IDs you want to do this is like a standard one and now that we have access to the weather next tree I really wanted to try that out and see how it's going to work on these markets. Uh yeah, you can probably do the same too if you want to. So if you want to hear more um content like this, learn more about prediction markets. I'm also going to dive a bit more into on interactive brokers.
¶77I'm going to dive a bit more into the new e nano. So this is like a new uh e- nano equity index futures. So these are like uh in nano is like the smallest one like derivative of the let's say the yeah NASDAQ Brussol and stuff like that. So you or SP500 so we can do the nano version of this so we can kind of do some yeah micro trading. So I'm going to actually explore a bit more on GP6 on that.
¶78So, if you want to stay around for more content like this, feel free to subscribe and give this video a like if you learned something. And yeah, enjoy your day and hopefully I'll see you again very