Using Margin

Hi,

I am using Python to access the BINANCE servers.

Question : Can the code I used to “create orders” for Futures and Spot Exchanges (on Binance) also be used for trading Margin (on Binance)?

I also found this information here speaking of Applying For and Repaying Loans (for use with Margin)

see: https://github.com/binance-exchange/binance-official-api-docs/blob/master/margin-api.md#margin-account-new-order-trade

Can one apply for a loan AND create an order at the same time? If so, how long would such an operation take?

Below is the way I am seeing it now …

=> For Order Creation:

  1. Determine a safe amount to borrow (max is 3 to 1 - i.e. if you have 1 BTC, you can borrow 2 more)
  2. Check the interest rate (how can this be calculated)
  3. Calculate the liquidation level ( see here: https://youtu.be/6FctbZBo2qw?t=282 )
  4. Apply for the loan
  5. If approved, open the Order

My questions are:
=> How to find the interest rate for the coin ( #2 above)
=> How could one calculate the liquidation level (#3 above)
=> How long would it take to be ‘apporoved’ or ‘denied’ for the loan. Does one have to use asyncio to track the “approval” or denial"

In the case of a CANCEL or SELL, one would have to “Repay” the loan - but - for a SELL, it would be better to SELL First. Once complete, then “Repay” the loan.

@cadmufasa

  1. current interest rate is available from here only https://www.binance.com/en/margin-fee#indexprice
  2. margin level is available from endpoint GET /sapi/v1/margin/account
  3. borrow is automatically
    • from API, POST sapi/v1/margin/loan
    • borrow when placing the order from endpoint POST sapi/v1/margin/order, set the sideEffectType to MARGIN_BUY

https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-order-trade