错误 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,请问是为什么
发明者量化-小小梦 异常机制只能捕获程序异常,接口报错不属于程序异常(接口报错是接口业务错误,并非异常)。
发明者量化-小小梦 都一样,调用失败返回的都是空值。
发明者量化-小小梦 nil 就是空值的意思。判断接口是不是调用失败,判断返回的是不是空值就可以了。
wangtaolue 我看了一下好像返回的是<nil>,但是不懂是字符串还是什么类型
wangtaolue 我问的是这个错误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>
发明者量化-小小梦 ``` 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 文档上有,可以查阅看下。
wangtaolue 是字符串还是什么类型的
wangtaolue 这个的返回值是<nil>这个字符串吗,S_ID: <nil>我看了我的程序后面是返回这个
wangtaolue 这个的返回值是<nil>这个字符串吗
wangtaolue 出现这种情况要怎么获取
wangtaolue 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> 出现这个错误也不会返回