Send all precision errors to the user

This commit is contained in:
Mark Veidemanis 2023-02-14 07:20:47 +00:00
parent 68a33cea7d
commit 1fc969177d
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 5 additions and 4 deletions

View File

@ -225,11 +225,12 @@ def get_precision(account, symbol):
instruments = account.instruments instruments = account.instruments
if not instruments: if not instruments:
log.error(f"No instruments found for {account}") log.error(f"No instruments found for {account}")
return sendmsg(account.user, f"No instruments found for {account}", title="Error")
return (None, None)
# Extract the information for the symbol # Extract the information for the symbol
instrument = account.client.extract_instrument(instruments, symbol) instrument = account.client.extract_instrument(instruments, symbol)
if not instrument: if not instrument:
# sendmsg(user, f"Symbol not found: {symbol}", title="Error") sendmsg(account.user, f"Symbol not found: {symbol}", title="Error")
log.error(f"Symbol not found: {symbol}") log.error(f"Symbol not found: {symbol}")
return (None, None) return (None, None)
# Get the required precision # Get the required precision
@ -311,8 +312,8 @@ def execute_strategy(callback, strategy, func):
# Get the precision for the symbol # Get the precision for the symbol
trade_precision, display_precision = get_precision(account, symbol) trade_precision, display_precision = get_precision(account, symbol)
if not trade_precision or not display_precision: if not trade_precision or not display_precision:
sendmsg(user, f"Precision not found for {symbol}", title="Error") # sendmsg(user, f"Precision not found for {symbol}", title="Error")
log.error(f"Precision not found for {symbol}") # log.error(f"Precision not found for {symbol}")
return return
# Round the received price to the display precision # Round the received price to the display precision