I want to play a sound every time an IF condition satisfies, I tried playsound module but it plays once & ask for unique alias device id but as per my IF condition, I should be get different answer every time whereas sound only plays once.
def orderManagement():
sheet = xw.Book("angel_excel(working).xlsx").sheets[0]
sheet.range(f"A1:K200").autofit()
for i in range(2, (len(tickerlist)+2)):
Status = sheet.range('I' + str(i)).value
quantity = sheet.range('J' + str(i)).value
if (Status != None) & (type(Status) != float) & (type(Status) != int) & (quantity != None) & (type(quantity) != str):
if (quantity > 0):
Status = Status.upper()
quantity = int(quantity)
Script = sheet.range('A' + str(i)).value
Script = (f"{Script}-EQ").upper()
price = sheet.range('C' + str(i)).value
token = sheet.range('B' + str(i)).value
if (Script not in buy_traded_stocks) and (Status == "BUY"):
orderparams = {
"variety": "NORMAL",
"tradingsymbol": Script,
"symboltoken": int(token),
"transactiontype": Status,
"exchange": exchange,
"ordertype": "LIMIT",
"producttype": "INTRADAY",
"duration": "DAY",
"price": price,
"squareoff": "0",
"stoploss": "0",
"quantity": quantity
}
orderId = obj.placeOrder(orderparams)
print(f"{Status} order placed for {Script}, at Price: {price} for Quantity: {quantity}, with order_id: {orderId} at time: {datetime.datetime.now()}")
buy_traded_stocks.append(Script)
sheet.range(f"K{i}").value = "Order Placed"
I want to play sound as soon as ORDER PLACED sent to excel sheet.