how to fix: code: -2019, msg: 'Margin is insufficient.' #899

190 views Asked by At

I am trying to open a simple short position on coin-m futures

Here's the code:

const Binance = require('node-binance-api');

const binance = new Binance().options({
APIKEY: 'some api key',
APISECRET: 'some secrets',
'family': 4,
});

let temp = async () => {
//console.info( await binance.universalTransfer("MAIN_CMFUTURE","XRP",10) );
console.info(await binance.deliveryMarginType("XRPUSD_PERP", "CROSSED"));
console.info(await binance.deliveryLeverage("XRPUSD_PERP", 1));
console.info(await binance.deliveryMarketSell("XRPUSD_PERP", 70, { positionSide: "SHORT"}));
}

temp();

I have also checked the balance, here is the result:

[Object: null prototype] { 
     asset: 'XRP', 
     walletBalance: '104.91600000', 
     unrealizedProfit: '0.00000000', 
     marginBalance: '104.91600000', 
     maintMargin: '0.00000000', 
     initialMargin: '0.00000000', 
     positionInitialMargin: '0.00000000', 
     openOrderInitialMargin: '0.00000000', 
     maxWithdrawAmount: '104.91600000', 
     crossWalletBalance: '104.91600000', 
     crossUnPnl: '0.00000000', 
     availableBalance: '104.91600000', 
     updateTime: 1696236724456 
}

Why is the margin insufficient and how can i fix this error?

1

There are 1 answers

0
Solomon On

Figured it out, there is a multiplier factor.

You should think of your balance as a (your balance / multiplier factor)

multiplier factor is how much coins there are in 10 usd, for xrp it is 19 (at the time of writing)

so when my balance is 104 xrp coins, i have to think of them (104 / 19) ~ 5

Hope that explains it and helps someone!