Please tell me how to use try in python if this error occurs, except

Author: wangtaolue, Created: 2021-12-01 12:00:09, Updated:

Mistakes Sell ((581.63, 0.01): 400: {code:-4024,msg:Limit price cant be lower than 600.087} My code. def sell ((currency, price, amount): Log (("sell currency: ", currency) set_precision ((currency)) exchange.SetDirection (sell button) id1 = 0 k is equal to 0. while (id1 == 0 and k == 0): try: id1 = exchange.Sell (price, amount) Log (("price: ", price) is the name of the file. Log (("amount: ", amount) is the name of the k is equal to 1. Log (("k: ", k) except: Cancel_all_sell_order (currency) Continue return id1

I don't have access except to ask why.


More

The Little DreamAn exception mechanism can only capture program errors, interface reports are not program errors (interface reports are interface business errors, not anomalies).

The Little DreamIn the same way, calls that fail return empty values.

The Little Dreamnil is the meaning of the empty value. It is possible to judge whether the interface is called failed, and to judge whether the return is empty.

wangtaolueI looked at it and it looked like it was returning nil, but I didn't know if it was a string or what type.

wangtaolueI asked for this error: 502: ERROR: The request could not be satisfied

502"> ERROR

The request could not be satisfied





























>




The Little DreamWhat's up? Sell ((581.63, 0.01): 400: {"code":-4024, "msg:"Limit price can't be lower than 600.087"} What's up? This is a business error, the interface returns an empty value, python is ``None ``. JS is ``null ``. Get the original response information from the exchange interface using GetRawJSON, which is available in the FMZ API documentation.

wangtaolueIs it a string or what type?

wangtaolueSo this is going to return a value that is this string, S_ID:

wangtaolueSo what's the return value of this is this string?

wangtaolueHow to get this situation?

wangtaolueSell ((4649.03, 0.022): 502: ERROR: The request could not be satisfied

502"> ERROR

The request could not be satisfied.


noshade size="1px"> The connection originated from closed. We can't connect to the server for this website at this time. This is a mistake that will never happen again.