Type/to search
1
Follow
0
Followers
পাইথনে এই ত্রুটিটি দেখা দিলে, try কীভাবে ব্যবহার করবেন
Help
Created 2021-12-01 12:00:09  
 11
 1178

ভুল
Sell(581.63, 0.01): 400: {"code":-4024,"msg":"Limit price can't be lower than 600.087"}
আমার কোড
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

Except, কেন জিজ্ঞাসা না

Related Recommendations
Comment
All comments (11)

    异常机制只能捕获程序异常,接口报错不属于程序异常(接口报错是接口业务错误,并非异常)。

    5 years ago

    是字符串还是什么类型的

    5 years ago

    这个的返回值是<nil>这个字符串吗,S_ID: <nil>我看了我的程序后面是返回这个

    5 years ago

    这个的返回值是<nil>这个字符串吗

    5 years ago

    出现这种情况要怎么获取

    5 years ago
    Sell(581.63, 0.01): 400: {"code":-4024,"msg":"Limit price can't be lower than 600.087"}

    这种业务错误, 接口返回空值,python 是None 。 JS是null
    获取交易所接口原始应答信息,用GetRawJSON, 在FMZ API 文档上有,可以查阅看下。

    5 years ago

    我看了一下好像返回的是<nil>,但是不懂是字符串还是什么类型

    5 years ago

    nil 就是空值的意思。判断接口是不是调用失败,判断返回的是不是空值就可以了。

    5 years ago

    我问的是这个错误Sell(4649.03, 0.022): 502: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE> </HEAD><BODY> <H1>502 ERROR</H1> <H2>The request could not be satisfied.</H2> <HR noshade size="1px"> The origin closed the connection. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. <BR clear="all"> If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation. <BR clear="all"> <HR noshade size="1px"> <PRE> Generated by cloudfront (CloudFront) Request ID: I0xVlMaU_kVYhR0FicEUq-pulPa--VPkbJtWbjg_2yZlhX1x1wnL4g== </PRE> <ADDRESS> </ADDRESS> </BODY></HTML>

    5 years ago

    都一样,调用失败返回的都是空值。

    5 years ago

    Sell(4649.03, 0.022): 502: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE> </HEAD><BODY> <H1>502 ERROR</H1> <H2>The request could not be satisfied.</H2> <HR noshade size="1px"> The origin closed the connection. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. <BR clear="all"> If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation. <BR clear="all"> <HR noshade size="1px"> <PRE> Generated by cloudfront (CloudFront) Request ID: I0xVlMaU_kVYhR0FicEUq-pulPa--VPkbJtWbjg_2yZlhX1x1wnL4g== </PRE> <ADDRESS> </ADDRESS> </BODY></HTML>
    出现这个错误也不会返回

    5 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)