I want to create a system where I can manage a privet trading bots ,I don't Know how to architects it with OOP or create a file for each bot I will store the strategies in one file so I can import it create a class for the bot that have stop and start methods
this is all easy , what I don't Know to do is how to create many bots Objects from this class and manage their statues STOPPES or ACTIVE I will manage it through GUI(start or stop it) , and show some info from database the only problem is how I will manage the objects , like I'm a user(object)that do a functions and has info how does I create an object -- store its info in DB --- start method activated --- ? then what I don't understand
how would you plan this system ?
CodePudding user response:
You can try to write bots in a separate projects and run them via a subprocess from main file. Just create main.py with GUI and set functions that calls or stops your bots.
p = subprocess.Popen(['python3', 'bot1.py']) # on start button
p.kill() # on stop button
Also you can track subprocess activity using Python. See subprocess docs for other details.