Skip to content

offish/tf2-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tf2-express

License Stars Issues Size Discord Code style

Automated TF2 trading bot with GUI support, built with Python. Prices are by default provided by Prices.TF.

Donate

Donations are not required, but greatly appericated.

Features

  • GUI for adding and changing items, prices, max_stock + browsing trades
  • Automated item pricing by Prices.TF
  • Bank as many items as you want
  • Add items by either name or SKU
  • Uses MongoDB for saving items, prices and trades
  • Supports Random Craft Hats [?]
  • Run multiple bots at once, each with their own database
  • Keeps track of item stock and checks if trades surpass their related item's max_stock
  • Fetches the bot's inventory once, and keeps track of items using receipts
  • Supports SKU item formats for ease of use
  • Supports 3rd party inventory providers [?]
  • Supports 3rd party emitted "deals" [?]
  • Utilizes tf2-sku
  • Utilizes tf2-data
  • Utilizes tf2-utils

Available options can be found here.

Backpack.tf listing is not supported yet.

Showcase

GUI Showcase tf2-express

Installation

Full installation guide can be found on the wiki.

If MongoDB is already installed, installation should be fairly straight forward.

git clone git@github.com:offish/tf2-express.git
cd tf2-express
pip install -r requirements.txt

Updating

# tf2-express/
git pull
pip install --upgrade -r requirements.txt
# update packages like tf2-utils, tf2-data and tf2-sku,
# which the bot is dependant on

Setup

Rename config.example.json to config.json. Update credentials and set your preferred options.

Example config:

{
    "name": "nickname",
    "check_versions_on_startup": true,
    "listen_to_pricer": true,
    "bots": [
        {
            "name": "bot1",
            "username": "username",
            "password": "password",
            "api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
            "secrets": {
                "steamid": "76511111111111111",
                "shared_secret": "Aa11aA1+1aa1aAa1a=",
                "identity_secret": "aA11aaaa/aa11a/aAAa1a1="
            },
            "options": {
                "enable_deals": false,
                "inventory_provider": "steamcommunity or steamsupply or steamapis",
                "inventory_api_key": "inventory api key or empty",
                "fetch_prices_on_startup": true,
                "accept_donations": true,
                "decline_bad_offers": false,
                "decline_trade_hold": true,
                "decline_scam_offers": true,
                "allow_craft_hats": false,
                "save_trades": true,
                "save_receipt": true,
                "poll_interval": 30,
                "database": "mydatabasename",
                "owners": [
                    "76511111111111111",
                    "76522222222222222"
                ]
            }
        },
        {
            "name": "bot2",
            "username": "username2",
            "password": "password2",
            "api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
            "secrets": {
                "steamid": "76511111111111111",
                "shared_secret": "Aa11aA1+1aa1aAa1a=",
                "identity_secret": "aA11aaaa/aa11a/aAAa1a1="
            },
            "options": {
                "accept_donations": true,
                "allow_craft_hats": true,
                "save_trades": true,
                "poll_interval": 60,
                "database": "bot2database"
            }
        }
    ]
}

For more information follow the wiki.

Running

# tf2-express/
python main.py # start the bot
python panel.py # start the gui

After starting the GUI, you can open http://127.0.0.1:5000/ in your browser.

Logs will be available under logs/express.log. Level is set to DEBUG, so here you will be able to see every request etc. and more information than is shown in the terminal.

Do NOT share this log file with anyone else before removing sensitive information. This will leak your API_KEY and more.

Explanation

Random Craft Hats

If a craftable hat does not have a specific price in the database, it will be viewed as a Random Craft Hat (SKU: -100;6), if enable_craft_hats is enabled.

WARNING: This applies to any hat. Such as Ellis' Cap, Team Captain, Earbuds, Max Heads etc. This is a feature, not a bug.

Simply open the GUI and add "Random Craft Hat" to the pricelist. Set the buy and sell price to whatever you want. This item cannot get automatic price updates.

3rd Party Inventory Providers

Avoid Steam's inventory rate-limits by using a third party provider like SteamApis, Steam.Supply or your own.

3rd Party Deals

"Deals" in this context are data which is emitted by third party using a TCP socket. This data will be acted on, such as sending an offer using the included trade URL and price. They are named "deals" as I've been using it for arbitrage purposes.

Testing

# tf2-express/
python -m unittest

All of the tests should output OK, except for the version check. They should be equal.

License

MIT License

Copyright (c) 2020-2024 offish (confern)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.