使用币安 API 下单时,可能会报如下错误:

-2027 MAX_LEVERAGE_RATIO Exceeded the maximum allowable position at current leverage.

这个错误的意思是当前杠杆倍数下超过了允许的最大仓位价值。

我们先通过下面几张图看一下:

币安 API 报 Exceeded the maximum allowable position at current leverage-传奇量化

ETH 1倍杠杆下最高仓位价值没有限制。

币安 API 报 Exceeded the maximum allowable position at current leverage-传奇量化

ETH 20倍杠杆下允许最高持仓 1000000 USDT

币安 API 报 Exceeded the maximum allowable position at current leverage-传奇量化

ETH 60倍杠杆下最高持仓 100000 USDT

从上面3张图可以看到,不同杠杆下允许持有的最大头寸是不同的,具体的解释可以看这篇文章《U本位合约的杠杆和保证金

那么使用 API 如何获取这个最大允许的头寸值呢?

获取账户信息接口返回这个值,在 positions 下

币安 API 报 Exceeded the maximum allowable position at current leverage-传奇量化

获取到这个值,就可以在下单前先判断一下,如果下单的仓位超过了这个值,应该怎么处理。