jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.57k stars 767 forks source link

Using leverage in Futures Market #578

Open Naografix opened 3 years ago

Naografix commented 3 years ago

Hello

How leverage works in the futures Market when I want to open a trade order?

Currently, I'm configuring the ticker with this:

await binance.futuresLeverage( 'ETHUSDT', 50 );
await binance.futuresMarginType( 'ETHUSDT', 'ISOLATED' );

And then, with 100$, I calculate the amount I can buy :

let amount = 100/PriceOfETHUSDT 

And opening the trade like this:

let buyOrder = await binance.futuresMarketBuy(pair, amount.toFixed(precision), {newOrderRespType: 'RESULT'});

But, do I need to multiply this amount by my leverage? Or Binance works lonely and my leverage is applied on my trade ?

Thank you

Kuzmich100kM commented 3 years ago

qty = orderSize / price * leverage

Jaquedeveloper commented 3 years ago

@Naografix How did you manage to do it?