Skip to content

dev-kostiuk/cs2_skins_trading_tradeup

Repository files navigation

CS2 Skins — Trade-Up Contract Finder

Daemon that automatically finds profitable CS2 trade-up contracts across multiple markets. Analyzes collections, calculates output float/wear, and sends Telegram alerts when a guaranteed-profit trade-up is found.

How It Works

  1. Fetches the full CS2 collections graph from CSGO-API
  2. For each collection and rarity tier:
    • Finds the 10 cheapest input skins of that rarity
    • Calculates the output float using the CS2 formula: output_float = avg_input_float × (max - min) + min
    • Determines the output wear (FN/MW/FT/WW/BS) based on calculated float
    • Looks up the market price for each possible output at its actual wear
  3. Only alerts if worst-case output is profitable (cheapest possible result still makes money)
  4. Validates against Steam median prices (inputs must be below Steam, outputs must be at/above Steam)
  5. Requires an offer buffer — each input skin must have extra offers beyond the 10 needed

Trade-Up Formula

CS2 trade-up takes 10 skins of the same rarity → 1 random skin of the next rarity from the same collection(s).

Output float = average_input_float × (skin_max_float - skin_min_float) + skin_min_float

The daemon uses average float per wear tier (e.g., FT = 0.265) for calculations.

Dependencies

  • Node.js >= 18
  • better-sqlite3 — reading offer databases
  • dotenv — configuration

Related Repositories

Repository Purpose
cs2_skins_trading_database Database schemas and init scripts
cs2_skins_trading_offers_parse Fills offer databases
cs2_skins_trading_arbitrage Arbitrage bot + Steam prices

Installation

cd cs2_skins_trading_tradeup
npm install
cp .env.example .env
nano .env

Configuration (.env)

Variable Description Default Where to get
TG_BOT_TOKEN Telegram bot token @BotFather/newbot
TG_CHAT_ID Telegram chat ID @userinfobot
DMARKET_OFFERS_DB_PATH Path to DMarket offers DB ../database/offers_dmarket.db Filled by offers_parse/dmarket.js
WHITEMARKET_OFFERS_DB_PATH Path to WhiteMarket offers DB ../database/offers_whitemarket.db Filled by offers_parse/whitemarket.js
MIN_PROFIT_USD Minimum worst-case profit in USD 1.0
MIN_INPUT_PRICE_USD Minimum input skin price (filters junk) 0.10
MIN_OFFERS_BUFFER Extra offers required beyond the 10 needed 3
MAX_ALERTS Max alerts per cycle (anti-spam) 20
DEDUP_TTL_MS Don't repeat same trade-up alert (ms) 14400000 (4h)
LOOP_SLEEP_MS Pause between full cycles (ms) 600000 (10min)
COLLECTIONS_REFRESH_MS Refresh collections catalog (ms) 86400000 (24h)
OFFER_MAX_AGE_SEC Max offer age to consider fresh (sec) 7200 (2h)
STEAM_PRICES_DB_PATH Path to Steam prices DB ../database/steam_prices.db Filled by arbitrage/steam_prices.js
STEAM_MAX_RATIO Input price must be below steam × ratio 0.9
STEAM_MIN_OUTPUT_RATIO Output price must be above steam × ratio 1.0
REQUIRE_STEAM_PRICE Skip items without Steam price (1/0) 1

Running

# Direct
node tradeup.js

# PM2 (recommended)
pm2 start tradeup.config.cjs
pm2 save

Debugging

pm2 status tradeup-daemon
pm2 logs tradeup-daemon --lines 50
tail -20 logs/tradeup.out.log
tail -20 logs/tradeup.err.log
pm2 restart tradeup-daemon

File Structure

tradeup/
├── tradeup.js          # Main daemon — trade-up contract finder
├── env.js              # Environment config loader with hot-reload
├── tradeup.config.cjs  # PM2 process config
├── .env                # Local config (not in git)
├── .env.example        # Config template
├── package.json
└── logs/               # PM2 log files
    ├── tradeup.out.log
    └── tradeup.err.log

Telegram Alert Example

📉 TRADE-UP [DMARKET]
📦 The Havoc Collection

🔁 Mil-Spec Grade → Restricted  |  інпут: Field-Tested

📥 10 інпутів  →  4.50 разом:
  1. MAG-7 | Rust Coat  0.42
  2. MAG-7 | Rust Coat  0.43
  ...

📤 Аутпути (1/3 кожен):
  ✅ 6.20  MP7 | Fade [Factory New]  (+1.70)
  ✅ 5.80  Tec-9 | Fuel Injector [Minimal Wear]  (+1.30)
  ✅ 5.10  FAMAS | Afterimage [Field-Tested]  (+0.60)

💰 Worst-case профіт: +0.60

About

Automated CS2 trade-up contract finder. Analyzes collections, calculates output float/wear, finds guaranteed-profit trade-ups across multiple markets with Telegram alerts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors