How to get actual marginType and levarage of a pair


Whenever we need to place a futures order, we need to set margin type and leverages in a separate requests.

Actually this is logically bad idea becase we need to make 3 call in a row to achieve this.

Also if the margin type or leverage was the same value as we need to set Futures API throwing an error like this:

margin type could not change:  Error: No need to change margin type.

So I have 2 questions:

1- Why we don’t have an option to set Margin Type and Levarage while we’re opening a position?
2- Is it possible to get current Levarage and Margin Type info of every futures pair from the Futures API?

1 - It’s not usual to change the current margin type or leverage every time a new order is posted, so not necessary to include those as additional params in the new order endpoint.
2 - You can use /fapi/v2/positionRisk and check “marginType” and “leverage” fields. If you don’t have open position and don’t have registered your current “marginType” and “leverage”, then you can send 2 requests to change them.

1- It can stay if the leverage or margin type is the same within the new order. But if we can do this in a single request, it will help us to reduce 2 more requests to open a new position

2- /fapi/v2/positionRisk will give only the leverage and marginType of the open positions. I’m asking that how can I get the default (or the last) marginType and leverage of a coin

For example default marginType is CROSSED and default leverage is 20x on my account (I’m not sure that I can change it from anywhere). If I didn’t open any position on a coin (for example KSMUSDT) I have to set the leverage and marginType before opening a position because I don’t know that it’s leverage and marginType is different than my new position. Actually this is what I’m asking for. How can I get the default or last marginType and leverage of any pair in futures?

I just noticed that positionRisk is giving all leverage and margin of all pairs. So my question has now a solution :slight_smile: