Nolus Docs

Quoting a position

Preview a Spot Margin position with the Leaser quote query, including position size, loan amount, loan rate and margin rate, before opening it.

A quote previews the position that a down payment would open right now, giving its size in the position asset, the loan in the pool currency and the two annual interest rates. Because the quote is a read-only query on the protocol's Leaser, it costs nothing and needs no account, which is why apps use it to show the terms before the user signs.

Request a quote

The quote query names the down payment, the asset that the position will hold and, if you want less than the maximum leverage, a cap on the loan:

{
  "quote": {
    "downpayment": { "amount": "100000000", "ticker": "USDC" },
    "lease_asset": "SOL",
    "max_ltd": 2000
  }
}

The query has three fields:

FieldMeaning
downpaymentThe down payment, as an amount in the smallest unit and a ticker. It can be in the pool currency, in a position asset of the protocol, or in NLS.
lease_assetThe ticker of the asset the position will hold. For short markets this is USDC.
max_ltdOptional. Caps the loan as a multiple of the down payment, in permille, so 2000 borrows at most 2x the down payment. Omit it to quote the maximum leverage.

To run the query from the command line, send it to the Leaser of the protocol with nolusd:

nolusd q wasm contract-state smart $LEASER \
  '{"quote":{"downpayment":{"amount":"100000000","ticker":"USDC"},"lease_asset":"SOL"}}'

Here $LEASER holds the address of the protocol's Leaser, which you can look up as described in Find the contract addresses. The command leaves out max_ltd, so it quotes the maximum leverage.

Read the response

For a down payment of 100 USDC on a SOL long with no max_ltd, the Leaser returns a response like the following one:

{
  "data": {
    "total": { "amount": "4747215219", "ticker": "SOL" },
    "borrow": { "amount": "400000000", "ticker": "USDC" },
    "annual_interest_rate": 96,
    "annual_interest_rate_margin": 45
  }
}

The following table explains each field of the response and gives its value in the example:

FieldMeaningIn the example
totalPosition size in the position asset, which is the down payment plus the loan, swapped at the current price.4.747 SOL at the time of the example
borrowThe loan, in the pool currency.400 USDC, 4x the down payment at an 80% opening LTV
annual_interest_rateThe loan rate paid to the pool, in permille a year.9.6%
annual_interest_rate_marginThe margin interest added on top, in permille a year.4.5%

The total interest a position pays is the sum of the two rates, because margin interest is charged on top of the loan rate.

A quote is not binding, because the loan rate depends on the pool's utilization and the position size depends on the price, both at the moment the position opens. Once the position is open, its rate is fixed and does not change afterwards.

Limits checked at opening

A quote shows the terms, and the Leaser enforces the protocol's limits when open_lease runs. It rejects the open unless all of these conditions hold:

  • The down payment is at least the minimum transaction.
  • The loan is at least the minimum transaction.
  • The down payment plus the loan is at least the minimum position.

The position parameters give example values for both minimums and the query that returns the live ones. Before opening, the lending pool can also report whether it can lend a given amount, and at what rate, through the LPP query {"quote":{"amount":{"amount":"400000000","ticker":"USDC"}}}, which returns {"quote_interest_rate":<permille>} or "no_liquidity".

Once a quote looks right, Opening a position shows how to send open_lease with the down payment.

On this page