diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b694934 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv \ No newline at end of file diff --git a/client/company/main.py b/client/company/main.py index ef938ed..07aa11a 100644 --- a/client/company/main.py +++ b/client/company/main.py @@ -43,10 +43,9 @@ if __name__ == "__main__": while True: companies = getCompanies() - for company in companies: - price = randint(20, 2000) - for i in range(randint(0, 10)): - emitShare(company["id"], price) + price = randint(20, 2000) + for i in range(randint(0, 4)): + emitShare(randint(0, len(companies) - 1), price) - sleep(30) + sleep(4) diff --git a/client/shareholder/main.py b/client/shareholder/main.py index b76765d..4153673 100644 --- a/client/shareholder/main.py +++ b/client/shareholder/main.py @@ -59,9 +59,8 @@ if __name__ == "__main__": shareholders = getAllBuyers() shares = getAllShares() - for shareholder in shareholders: - shareId = randint(0, len(shares) - 1) - buyShare(shareholder["id"], shareId, shares[shareId]["price"] + randint(-20, 20)) + shareId = randint(0, len(shares) - 1) + buyShare(randint(0, len(shareholders) - 1), shareId, shares[shareId]["price"] + randint(-20, 20)) - sleep(30) + sleep(4)