I have create a stock market program which consists of multiple threads. Each thread can perform function of placing order when a condition is met. There are times when same condition is in 2 or more threads. My problem is broker my doesn't allow more than 3 orders per second. So if threads simultaneously place orders they get rejected Need help
#get broker object
kite=get_kite()
def place_order():
pass
def entry():
while True:
#scans for condition
if condition:
place_order()
for i in range (0,10):
thread = threading.Thread(target = self.entry)
thread.start()
I tried using semaphore but didnt succeed