Examples
These examples assume no fees and will differ slightly from the reality of trading on the VALR exchange. It also assumes 5x leverage applies to the spot margin pairs. For fully accurate figures, please incorporate fees into your calculations.
Max that can be spent by borrowing ZAR to buy BTC where there is no existing debt
For an account holding BTC with no pre-existing debt, how can a customer calculate the maximum total, including leverage, that could be placed as a buy order on BTCZAR?
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 1 BTC | 1 BTC | 19,000 USDC | 20,000 USDC | 0.95 |
ZAR | 0 | 0 | 0 | 20 ZAR | 1 |
Max borrow amount is given by the formula:
Borrowable amount in Reference
= (Max Initial Leverage Multiple * Available in Reference Weighted) / (1 + Leverage Multiple * (1 - Weight of received currency)
= (5 * 19000) / (1 + 5 * ( 1 - 0.95)) = 76,000 USDC
In ZAR this is 76,000 * 20 = 1,520,000 ZAR.
Max that can be spent by borrowing BTC to sell for ZAR where there is no existing debt
For an account holding ZAR with no pre-existing debt, how can a customer calculate the maximum total, including leverage, that could be placed as a sell order on BTCZAR?
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 0 | 0 | 0 | 20,000 USDC | 0.95 |
ZAR | 200,000 ZAR | 200,000 ZAR | 10,000 USDC | 20 ZAR | 1 |
Max borrow amount is given by the formula:
Borrowable amount in Reference
= (Max Initial Leverage Multiple * Available in Reference Weighted) / (1 + Leverage Multiple * (1 - Weight of received currency)
= (5 * 10000) / (1 + 5 * ( 1 - 1)) = 50,000 USDC
In BTC this is 50000 / 20000 = 2.5 BTC
Max that can be spent by borrowing ZAR to buy BTC where there is no existing debt
For an account holding ZAR with no pre-existing debt, how can a customer calculate the maximum total, including leverage, that could be placed as a buy order on BTCZAR?
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 0 | 0 | 0 | 20,000 USDC | 0.95 |
ZAR | 300,000 ZAR | 300,000 ZAR | 15,000 USDC | 20 ZAR | 1 |
First consider conversion of the ZAR balance to BTC:
300,000 ZAR would be converted into 300000 / 20 / 20000 = 0.75 BTC
Max borrow amount is given by the formula:
Borrowable amount in Reference
= (Max Initial Leverage Multiple * Available in Reference Weighted) / (1 + Leverage Multiple * (1 - Weight of received currency)
= (5 * [0.75 * 20000 * 0.95] ) / (1 + 5 * ( 1 - 0.95)) = 57,000 USDC
In ZAR this is 57000 * 20 = 1,140,000 ZAR
In this example, a spot balance in ZAR would first be used to purchase spot BTC. Then that spot BTC balance would be collateralised to cover a 1,140,000 ZAR debt that is obtained to buy more BTC.
Max that can be spent by borrowing BTC to sell for ZAR where there is no existing debt
For an account holding BTC with no pre-existing debt, how can a customer calculate the maximum total, including leverage, that could be placed as a sell order on BTCZAR?
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 0.5 BTC | 0.5 BTC | 9,500 USDC | 20,000 USDC | 0.95 |
ZAR | 0 | 0 | 0 | 20 ZAR | 1 |
First consider conversion of the BTC balance to ZAR:
0.5 BTC would be converted into 0.5 * 20000 * 20 = 200,000 ZAR
Max borrow amount is given by the formula:
Borrowable amount in Reference
= (Max Initial Leverage Multiple * Available in Reference Weighted) / (1 + Leverage Multiple * (1 - Weight of received currency)
= (5 * [200000/20] ) / (1 + 5 * ( 1 - 1)) = 50,000 USDC
In BTC this is 50000 / 20000 = 2.5 BTC
In this example, a spot balance in BTC would first be used to sell spot BTC. Then that spot ZAR balance would be collateralised to cover a 2.5 BTC debt obtained to sell more BTC for ZAR. Weighting is applied based on spot account balances; if weightings change after a debt is obtained, then margin information is recalculated based on new balances.
Max that can be spent by borrowing ZAR to buy BTC where there is existing ZAR debt
For an account holding BTC with an existing ZAR debt below max leverage, how can a customer calculate the maximum total, including leverage, that could be placed as a buy order on BTCZAR?
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 1.95 BTC | 0.45 BTC | 9,000 USDC | 20,000 USDC | 0.95 |
ZAR | -475,000 ZAR | 0 | 0 | 20 ZAR | 1 |
Max borrow amount is given by the formula:
Borrowable amount in Reference
= (Max Initial Leverage Multiple * Available in Reference Weighted) / (1 + Leverage Multiple * (1 - Weight of received currency)
= (5 * [9000 * 0.95] ) / (1 + 5 * ( 1 - 0.95)) = 34,200 USDC
In ZAR this is 34200 * 20 = 684,000 ZAR
Max that can be spent by borrowing BTC to sell for ZAR where there is existing ZAR debt
For an account holding BTC with an existing debt in ZAR, how can a customer calculate the maximum total, including leverage, that could be placed as a sell order on BTCZAR?
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 1.95 BTC | 0.45 BTC | 9,000 USDC | 20,000 USDC | 0.95 |
ZAR | -475,000 ZAR | 0 | 0 | 20 ZAR | 1 |
First consider conversion of the BTC balance to ZAR:
1.95 BTC would be converted into 1.95 * 20000 * 20 = 760,000 ZAR
Max borrow amount is given by the formula:
Borrowable amount in Reference
= (Max Initial Leverage Multiple * Available in Reference Weighted) / (1 + Leverage Multiple * (1 - Weight of received currency)
= (5 * [0.45*20000*0.95] ) / (1 + 5 * ( 1 - 1)) = 42,750 USDC
In BTC this is 42750 / 20000 = 2.1375 BTC
This example illustrates that it is not possible to apply leverage on collateralised balances, even where a trade would repay debt. The maximum sell order that is possible on BTCZAR, in this case, is selling the available spot balance of 0.45 BTC, plus the collateralised balance of 1.5 BTC, plus applying leverage to the available in reference of 0.45 BTC at mark price of 20,000 after applying collateral weighting of 0.95
Max that can be spent by borrowing ZAR to buy BTC where the account holds BTC
For an account holding BTC with no pre-existing debt, the account places a market order to buy bitcoin beyond its ZAR balance and therefore borrows ZAR.
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 1 BTC | 1 BTC | 19,000 USDC | 20,000 | 0.95 |
ZAR | 0 | 0 | 0 | 20 ZAR | 1 |
Place market buy order with leverage where the order is matched at a price of 400,000 ZAR per BTC:
"type": "PLACE_ORDER",
"data": {
"type": "MARKET",
"side": "BUY",
"quantity": "1",
"price": "0",
"pair": "BTCZAR",
"allowMargin": true
Resulting Balance:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 2 BTC | 0.7368421 | 14,736.84 USDC | 20,000 | 0.95 |
ZAR | -400,000 ZAR | 0 | 0 | 20 ZAR | 1 |
Balances in reference:
Assets in reference weighted: |
38,000.00 USDC |
Debt in reference: |
20,000.00 USDC |
Equity in reference weighted: |
18,000.00 USDC |
Margin calculations:
collateralisedMarginFraction: |
0.20 |
initialMarginFraction: |
0.20 |
totalBorrowedInReference: |
20000.00 |
collateralisedBalancesInReference: |
24000 |
referenceCurrency: |
USDC |
initialRequiredInReference: |
24000 |
availableInReference: |
14736.84 |
maintenanceMarginFraction: |
0.1 |
autoCloseMarginFraction: |
0.03333333 |
marginFraction: |
0.90000000 |
LeverageMultiple: |
1.12 |
Placing a market sell order, including leverage where an account holds ZAR
For an account holding ZAR with no pre-existing debt, the account places a market order to sell bitcoin beyond its BTC balance and therefore borrows BTC.
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 0 | 0 | 0 | 20,000 USDC | 0.95 |
ZAR | 600,000 ZAR | 600,000 ZAR | 30,000 USDC | 20 ZAR | 1 |
Place market sell order with leverage where the order is matched at a price of 400,000 ZAR per BTC:
"type": "PLACE_ORDER",
"data": {
"type": "MARKET",
"side": "SELL",
"quantity": "1",
"price": "0",
"pair": "BTCZAR",
"allowMargin": true
Resulting Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | -1 BTC | 0 | 0 | 20,000 USDC | 0.95 |
ZAR | 1,000,000 ZAR | 520,000 ZAR | 26,000 USDC | 20 ZAR | 1 |
Balances in reference:
Assets in reference weighted: |
50,000.00 USDC |
Debt in reference: |
20,000.00 USDC |
Equity in reference weighted: |
30,000.00 USDC |
Margin calculations:
collateralisedMarginFraction: |
0.20 |
initialMarginFraction: |
0.20 |
totalBorrowedInReference: |
20000.00 |
collateralisedBalancesInReference: |
24000 |
referenceCurrency: |
USDC |
initialRequiredInReference: |
24000 |
availableInReference: |
26000.00 |
maintenanceMarginFraction: |
0.1 |
autoCloseMarginFraction: |
0.03333333 |
marginFraction: |
1.50000000 |
LeverageMultiple: |
0.67 |
Placing a limit buy order, including leverage into the order book where an account holds BTC
For an account holding BTC with no pre-existing debt, the account places a limit order to buy bitcoin beyond its ZAR balance and therefore borrows ZAR. The order is added to the order book as it does not match any existing sell orders.
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 1 BTC | 1 BTC | 19,000 USDC | 20,000 USDC | 0.95 |
ZAR | 0 | 0 | 0 | 20 ZAR | 1 |
Place limit buy order with leverage where the order is placed into the book at a price of 400,000 ZAR per BTC:
"type": "PLACE_ORDER",
"data": {
"type": "LIMIT",
"side": "BUY",
"quantity": "1",
"price": "400000",
"pair": "BTCZAR",
"allowMargin": true
Resulting Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 1 BTC | 0.78947368 BTC | 15789.47 USDC | 20,000 USDC | 0.95 |
ZAR | 400000 - 400000 = 0 ZAR | 0 | 0 | 20 ZAR | 1 |
Balances in reference:
Assets in reference weighted: |
39,000.00 USDC |
Debt in reference: |
20,000.00 USDC |
Equity in reference weighted: |
19,000.00 USDC |
Margin calculations:
collateralisedMarginFraction: |
0.20 |
initialMarginFraction: |
0.20 |
totalBorrowedInReference: |
20000.00 |
collateralisedBalancesInReference: |
24000 |
referenceCurrency: |
USDC |
initialRequiredInReference: |
30000.00 |
availableInReference: |
15000 |
maintenanceMarginFraction: |
0.1 |
autoCloseMarginFraction: |
0.03333333 |
marginFraction: |
0.95000000 |
LeverageMultiple: |
1.06 |
In this example, 400,000 has been borrowed in ZAR and is locked in an open order while the order remains in the order book. The collateralised balance includes the ZAR amount of 400,000 that has been borrowed along with an additional 0.21052632 BTC (= 4,000 USDC after weighting).
Placing a limit sell order, including leverage into the order book where an account holds ZAR
For an account holding ZAR with no pre-existing debt, the account places a limit order to sell bitcoin beyond its BTC balance and therefore borrows BTC. The order is added to the order book as it does not match any existing buy orders.
Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | 0 | 0 | 0 | 20,000 USDC | 0.95 |
ZAR | 600,000 ZAR | 600,000 ZAR | 30,000 USDC | 20 ZAR | 1 |
Place limit sell order with leverage:
"type": "PLACE_ORDER",
"data": {
"type": "LIMIT",
"side": "SELL",
"quantity": "1",
"price": "600000",
"pair": "BTCZAR",
"allowMargin": true
Resulting Balances:
Coin |
Balance | Available | Available in Reference |
Mark Price | Weighting |
BTC | -1+1 = 0 | 0 | 0 | 20000 USDC | 0.95 |
ZAR | 600,000 | 380,000 | 19,000 USDC | 20 ZAR | 1 |
Balances in reference:
Assets in reference weighted: |
49,000.00 USDC |
Debt in reference: |
20,000.00 USDC |
Equity in reference weighted: |
29,000.00 USDC |
Margin calculations:
collateralisedMarginFraction: |
0.20 |
initialMarginFraction: |
0.20 |
totalBorrowedInReference: |
20000.00 |
collateralisedBalancesInReference: |
24000.00 |
referenceCurrency: |
USDC |
initialRequiredInReference: |
24000.00 |
availableInReference: |
25000.00 |
maintenanceMarginFraction: |
0.1 |
autoCloseMarginFraction: |
0.03333333 |
marginFraction: |
1.45000000 |
LeverageMultiple: |
0.69 |
This list of examples is intended to serve as an illustrative FAQ. Note further adjustments are made to max order sizes on limit orders where price differs from mark price. These examples will be updated and modified as needed based on customer feedback.
Thank you to all who contribute!
Please refer to VALR's Margin Terms of Service for more details.