使用币安 API 下单时,可能会报如下错误:
-2027 MAX_LEVERAGE_RATIO Exceeded the maximum allowable position at current leverage.
这个错误的意思是当前杠杆倍数下超过了允许的最大仓位价值。
我们先通过下面几张图看一下:
![币安 API 报 Exceeded the maximum allowable position at current leverage-程序旅途](https://www.chengxulvtu.net/wp-content/uploads/2021/08/2021080917514847.png)
ETH 1倍杠杆下最高仓位价值没有限制。
![币安 API 报 Exceeded the maximum allowable position at current leverage-程序旅途](https://www.chengxulvtu.net/wp-content/uploads/2021/08/2021080917530019.png)
ETH 20倍杠杆下允许最高持仓 1000000 USDT
![币安 API 报 Exceeded the maximum allowable position at current leverage-程序旅途](https://www.chengxulvtu.net/wp-content/uploads/2021/08/2021080917542678.png)
ETH 60倍杠杆下最高持仓 100000 USDT
从上面3张图可以看到,不同杠杆下允许持有的最大头寸是不同的,具体的解释可以看这篇文章《U本位合约的杠杆和保证金》
那么使用 API 如何获取这个最大允许的头寸值呢?
获取账户信息接口返回这个值,在 positions 下
![币安 API 报 Exceeded the maximum allowable position at current leverage-程序旅途](https://www.chengxulvtu.net/wp-content/uploads/2021/08/2021080918032597.png)
获取到这个值,就可以在下单前先判断一下,如果下单的仓位超过了这个值,应该怎么处理。