Owning Tarkov’s Marketplace
So one key thing to note is how the Tarkov market works. With every sale, the game charges you a set fee. This is based on numerous factors and I have found it quite difficult to calculate. With that in mind, I am only going to run my bot on one market, where I know the fee and can make enough margins to profit. The in-game item Bitcoin is a relatively stable market. It fluctuates between 100k and 150k RUB. As well, it has a market fee around 7k. This provides ample room for profit.
So first things first, we need some wrappers for how we will interact with the web API. For this, I created a wrapper around the HttpClient found in System.Net.Http. For this, we define the remote Uri we will be connecting to, https://prod.escapefromtarkov.com, and create functions for sending and receiving data.
Okay, You can see from this, we also have a TarkovResponseMessages class. This collects all of the response data and applies decompression for us. Here is the compression class, nothing special here.
Now, I have my web backend, but before I start my login process, I needed a way to quickly iterate on different methods of attacking the market for the greatest profit. For this, I broke down some of my first tests and created a base class for all methods to derive from. Here is the base class.
So here we can see some virtual and abstract methods. As well, we have a lot of classes I haven’t shown. Things like MarketOffer and InventoryItem are simple wrappers around the data received from requests. They store the information required for any of my bot methods. You can also see some actions used for callbacks to the main class for the bot. The await methods are for waiting to quickly purchase an item. Oh ya, every market listing has a 60 second delay before it is available for sale. So with this, my bot will wait for the listing if it thinks it is a good enough deal, or at least that is an option.
One key to the bot method was the ability to move cash from your mailbox back into the inventory. When an item is sold on the market, the money goes to your mailbox, and you can not spend that until you move it to your inventory. So the MailMessage stuff is covering that.
So yeah, this class provides us all the core code to run our bot.
Here is an example of how web requests are processed. This is from the BuyOffer(MarketOffer offer, InventoryItem Money_Items) method.
Looking at an actual botting method, this is how simple it boils down to in the end.
So yeah, I basically program in “Do this, then this then that” and it just works.
Onto the public and visible portion of the bots core, this allows my frontend to communicate with these backend classes. Here we can see the login process:
So here we can see I fire off a login request and, if the request fails in a specific way, we know a hardware activation is required, otherwise, we start up our login request. As well, I have a bit of legacy cookie extraction. Really anything collapsed is not required.
I won’t show Keep-Alive because its quite simple, but here is the hardware activation:
So that is the real meat of a tarkov market bot. Nothing really complex, but a lot of very interesting code and methods for reaching it.
Thanks for reading this far lmao.