1
Seguir
0
Seguidores

Cómo usar try, excepto si ocurre este error en Python

Creado el: 2021-12-01 12:00:09, Actualizado el:
comments   11
hits   891

El error Sell(581.63, 0.01): 400: {“code”:-4024,“msg”:“Limit price can’t be lower than 600.087”} Mi código def sell(currency,price,amount): Log(“sell currency: “, currency) set_precision(currency) exchange.SetDirection(“sell”) id1 = 0 k = 0 while (id1 == 0 and k == 0): try: id1 = exchange.Sell(price, amount) Log(“price: “, price) Log(“amount: “, amount) k = 1 Log(“k: “, k) except: cancel_all_sell_order(currency) continue return id1

No entró, excepto por preguntar por qué.