DEV Community

Cover image for How I gained $2,000 in 3 weeks using custom-built CS:GO trading bot
Aymen Hmani
Aymen Hmani

Posted on

How I gained $2,000 in 3 weeks using custom-built CS:GO trading bot

After the announcement of Counter-Strike 2, all CS:GO items skyrocketed in value. So, I thought, "Why don't I start trading skins to cash out weapon cases?"

price chart of the Dreams & Nightmares Case
price chart of the Dreams & Nightmares Case

1. Find the potential traders

to make the trade process easy and smooth it is essential to find Steam accounts with a minimum of four cases (valued at around $3-5). Ideally, these accounts should have a Steam level of 0. Why is this important? By having a level 0 account, the owner is unable to access the community marketplace and sell their own cases. As a result, the account owner is more likely to agree to trade their cases for skins.

Team Tunisia Group It seemed perfect for me because it has many Free2play players.
So we need to fetch thier steamID64

class SteamGroup:
    """
    This Python class fetches the SteamID64's of all the Steam group members. Use run() to fetch and print the ID's.
    """
    XML_URL = 'https://steamcommunity.com/groups/TeamTunisia' + \
        '/memberslistxml?xml=1'  # Add your custom group URL here
    XML_NEXT_PAGE = False
    XML_PAGE = 1

    REQUEST_TIMEOUT = 3.00  # in seconds

    STEAM_IDS = []

    def __init__(self):
        pass

    def get_steam_ids(self, page=XML_PAGE):
        """
        Proccessed the response from the get function (xml in text) and save the SteamID64's to an array.
        Uses get_steam_ids as a recurive function to fetch all the pages.
        :param page: the XML page, max is 1000 members per page.
        :return: the response XML in text format.
        """
        response = self.get(page)
        if response is None:
            return None

        root = ET.fromstring(response)
        members = root.find('members')
        if members is None:
            return None

        for steamid in members.findall('steamID64'):
            self.STEAM_IDS.append(int(steamid.text))

        if root.findall('nextPageLink'):
            page += 1
            return self.get_steam_ids(page)

        print('[OK!] Fetched ' + str(len(self.STEAM_IDS)) + ' SteamIDs')

        steamids = self.STEAM_IDS
        self.STEAM_IDS = []

        return steamids

    def get(self, page):
        """
        Get's the XML GroupMembers from Steam, no API key required.
        :param page: the page, max 1000 members per page.
        :return: the reponse, return None is not a valid response.
        """
        url = self.XML_URL + '&p=%s' % page

        response = None
        try:
            response = requests.get(url, timeout=self.REQUEST_TIMEOUT)

            print('[%s] %s' % (response.status_code, response.url))

            if response.status_code != 200:
                return None
        except Timeout as e:
            print(e)
        except RequestException as e:
            print(e)

        if response is None:
            return None

        return response.text
Enter fullscreen mode Exit fullscreen mode

2. Filter the Data

a. more than 4 cases

After acquiring more than 3000 steamIDs, we need to filter the ones that have more than 3 cases.

def getInventory(steamid):
    data = requests.get(
        "https://steamcommunity.com/inventory/{}/730/2?l=english&count=100".format(steamid))
    with open("data.txt", "w", encoding="utf-8") as f:
        f.write(data.text)
    json_data = json.loads(data.text)
    if "rgDescriptions" not in json_data:
        return False  # User's inventory is private or not accessible
    descriptions = json_data["rgDescriptions"]
    csgo_cases = 0
    for item in descriptions:
        if "case" in descriptions[item]["name"].lower():
            csgo_cases += 1
    return csgo_cases > 4
Enter fullscreen mode Exit fullscreen mode

carful here for each cycle the code waste 100 request (&count=100") and steam only allow 10,000 per day , but you can dodge that using proxies

b. LVL 0 in steam:

def is_steam_account_level_0(steam64id):
    url = f"https://steamcommunity.com/profiles/{steam64id}?xml=1"
    response = requests.get(url)
    if response.status_code == 200:
        data = response.text
        if "<level>0</level>" in data:
            return True
    return False

Enter fullscreen mode Exit fullscreen mode

I make the Lvl0 account a priority in the "target list."

Tips:

  • you can automate the skin buying process , example
  • dont forget to calculate the steam tax (%15)
  • i you want to cash out using D-market for example add (-30%) to your cases steam price

Top comments (0)