Building an Agent to play the Meme price prediction game

Share
Building an Agent to play the Meme price prediction game

If you tried playing our game and there were no other human players to join within the 10s game start delay, chances are you competed against the bots we created to join every game. When we first started out, those bots picked completely random tokens and random price predictions.

Even with those random choices, a lot of times, they would randomly select the winning predictions. This is not surprising, we only have 10 meme coins in the game and with 10-15 bots joining, chances are one of them will select the combination that moves up or down the most.

This is all fun and games, but how would a more elaborate bot perform against human and random picks ? We set out to find just that, and in this post describe exactly how you can do it as well.

The tl;dr is that the bot performs quite well, definitely better than myself. With a record hovering at around 21 wins and 20 losses as of the time of this writing.

Strategy

The time frame for the price prediction is super super tight. Anything can happen in 60 seconds. My initial gut feeling told me that it's completely random and no algorithm will be able to predict that. This is mostly correct. It seems like the best strategy so far is to keep selecting the same tokens and bet combination that previously won because chances are, the trend will continue for more than one game. If we combine that with some sort of timeseries forecasting, we should have a winning combination. Spoiler alert, this is not a money printing algorithm (otherwise we would have kept it to ourselves 🤣). All jokes aside, this is a good base line to start with. With enough signals going in, it's definitely possible to have a more than 50% winning ratio. I'd expect most successful hedge funds to have cracked that.

For the time series forecast we will use an LLM model that was specifically trained on time series data called Chronos (https://huggingface.co/amazon/chronos-bolt-base). It has been trained on 100 Billion data points and the largest model has only 205M parameters - this means we will have no problem running it locally.

After we listen on price feed events for about 120s, we feed those into the model and get back a 60s price forecast. We then take that forecast, along with the previous game outcomes (ie. what selections were made and what scores and outcomes came out of that) and feed it to a traditional LLM and ask it to make the decision on the next game predictions. This is an example of a prompt we feed to Google Gemini 2.0

You are an agent playing a meme coin price prediction game. 
You have to select 3 tokens and predict weather the price will go up or 
down for the next 60 seconds. Below are the results of a time series 
forecast for each token. Use that information to make a decision. 
If your previous game ranking is 1 and you won, you might consider 
the same picks:

symbol: PENGU, direction: -1 (1 means up, -1 means down), confidence: 0.26
symbol: FLOKI, direction: -1 (1 means up, -1 means down), confidence: 0.21
symbol: SHIB, direction: -1 (1 means up, -1 means down), confidence: 0.17
symbol: POPCAT, direction: 1 (1 means up, -1 means down), confidence: 0.14
symbol: WIF, direction: 1 (1 means up, -1 means down), confidence: 0.13
symbol: PEPE, direction: 1 (1 means up, -1 means down), confidence: 0.11
symbol: BONK, direction: -1 (1 means up, -1 means down), confidence: 0.1
symbol: TURBO, direction: 1 (1 means up, -1 means down), confidence: 0.08
symbol: PNUT, direction: -1 (1 means up, -1 means down), confidence: 0.06
symbol: DOGE, direction: 1 (1 means up, -1 means down), confidence: 0.01

Previous game outcome:
Ranking: 10
FLOKI (1) Success false Points -1.31903
PNUT (-1) Success false Points -1.31903
SHIB (-1) Success false Points -1.31903

Game Loop and events

If you've followed up our blog posts, you'll know by now that we purposely built our first game to allow anyone to build agents to play them. This is time to eat our own dog food and build the first more advanced bot that runs outside of the main game application.

Game Loop and Agent

Our API has all the information and endpoints you will need to achieve this. The Game Agent service always listens for games created that are in waiting_for_players mode. You can of course, change this logic and have your bot create their own games.

Price Prediction Service

We picked Python for this service only because the time series model is easiest to run using Python. The service is only a rough prototype - it stores the predicted prices in memory and has no other type of persistence.

Agent

For our agent, we're sticking to Typescript and using the Deno runtime. This service is also super bare bones and not something you would deploy in production - but it serves as a good starting point for developing further. You will need a Gemini API key to run this.

Knobs and dials

There are definitely a lot of settings to fine tune with both the agent and the time series forecasting. For example, one can play with the past time series data points we feed to the model or how far into the future we predict. There are also other signals we can introduce, such as sentiment analysis, that could give you more insight into trends. We are super excited to open this up and see how well agents and bots build by the community perform when pinned against each other and humans.