Jump to content
McKay Development

Recommended Posts

Posted

Hello,

 

I apologize for the longwinded questions, I'm new to Steam trading and would like to learn more about building trade bots. Using multiple trade bots at once is a pretty common usage scenario of node-steam-user and node-steam-trade-offer-manager but I haven't found many guides or examples that go into finer detail on this. I have a fuzzy idea of how to do it but I would like some validation/clarification to see if I'm heading in the right direction. 

If I have many available bot accounts, say 20 bots, and I start them all up at once, I'm sure I would run into steam's rate limiting per IP address, as well as getting a LogonSessionReplaced error if my bots were to re-login on the same IP. I see that there is a loginID option for the steam-user logOn method, I'm assuming I can use a proxy pool in tandem with this option to mitigate these issues? 

Is logging in with different IP addresses enough or do I need to use a loginKey? I see that when logging in and using the rememberPassword option, it triggers a loginKey event, which I can store and use for subsequent logins. Does using a loginKey bypass the LogonSessionReplaced error as well? I don't quite understand the benefit of using a loginKey instead of username/password.

 

Second question - Can I send trades from the same bots that are running in separate processes?  For example, maybe on app startup, I can log into all my bots at once and have them ready to initiate trades. I would also have a worker process running in the background that would start up all of the same bots to send a trade at a later time, let's say when an item on trade hold becomes available. Would these bots log off the other bots from app startup? This is probably related to my first question about using a loginKey or loginID. 

Last question - How can I check if a bot is already logged on? Instead of starting up all bots on app startup, I could just login to each bot separately when a trade is requested for an item in their inventory. I would want to check if the bot is logged in already before calling the logOn method again. 

Thank you for your time and for your great work on these libraries! 

 

 

Posted

You would most likely run into rate limiting if you tried to run 20 bots from the same IP address. You will probably need at least two IPs. Running 10 bots per IP isn't unheard of, depending on how many HTTP requests you make from each bot. You don't necessarily need proxies if you can have multiple IPs on whatever server you're running on. In this case, you'd want to use localAddress to pick which IP each bot uses.

 

I don't personally use loginKeys. The biggest benefit to using them is that you don't need to have your bot's password and two-factor secret in config files on your server. Problem is, using a loginKey doesn't actually always work (thanks Valve!) so you'll need to enter passwords and 2FA codes at some point anyway. Personally, I prefer to just put the password and 2FA secret in a config file and use those.

 

You really shouldn't run the same bot in two different processes. You'll probably run into issues doing so. You're better off just running one process for each bot and building in some way to communicate with those processes if you need to control the bot externally. I tend to prefer to start up an HTTP server using the built-in http module and just make POST requests to control the bot.

Posted

How do you create a new process per bot within the same web app instance? Something like the Node Cluster API? I'm using ExpressJS with a postgres DB, and ideally I would create 20 bots on app startup, and maybe with each bot in its own forked process. How do I then reference those instantiated bots from my API endpoints/controllers? And last question from before that didn't get answered, how can I check if a bot is logged in already? Thanks so much! 

 

Posted

Yeah, you can use the cluster module to spin up child processes. Usually what I do when I have multiple bots I need to run to do the same task is I have a database table with a row for each bot. The table has a column named like last_heartbeat and the bots update this column with the current time every 10 seconds or so. If the timestamp is recent, then the bot is running. You could also have another column storing the IP address (and port) of the server/process where the bot is running and use that to make HTTP calls to the bot.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...