Hi, from the docs, a response from GET /sapi/v1/margin/account
would look like this:
"borrowEnabled": true,
"marginLevel": "11.64405625",
"CollateralMarginLevel" : "3.2",
"totalAssetOfBtc": "6.82728457",
"totalLiabilityOfBtc": "0.58633215",
"totalNetAssetOfBtc": "6.24095242",
"TotalCollateralValueInUSDT": "5.82728457",
"tradeEnabled": true,
"transferEnabled": true,
"accountType": "Margin_1",
"userAssets": [
{
"asset": "BTC",
"borrowed": "0.00000000",
"free": "0.00499500",
"interest": "0.00000000",
"locked": "0.00000000",
"netAsset": "0.00499500"
}, ...
I have a couple of questions:
- How is the
marginLevel
variable calculated for"accountType": "Margin_1"
?
-
marginLevel
=totalAssetOfBtc
/totalLiabilityOfBtc
or
-
marginLevel
=totalAssetOfBtc
/totalLiabilityOfBtc
+ outstanding interest
In other words, does the totalLiabilityOfBtc
account for the interest also?
From the docs, it seems like Total Liabilities and Outstanding Interest are two separated topics, even though interest is also a liability from a borrower’s persective.
Margin Level of Cross Margin Account = Total Asset Value of Cross Margin Account / (Total Liabilities + Outstanding Interest), where:
- Total Asset Value of Cross Margin Account = Current Total Market Value of All Digital Assets in Cross Margin Account
- Total Liabilities = Current Total Market Value of All Outstanding Margin Loans in Cross Margin Account
- Outstanding Interest = Amount of Each Margin Loan * Loan Time (in hours, at the time of the calculation) * Hourly Interest Rate - Deduction/Paid Interest
- Is the
interest
field in eachuserAsset
calculated this way?
interest
= borrowed
* interest_rate/hour
* hours
?
Thank you