Module: NOWPayments::API::Estimation

Included in:
Client
Defined in:
lib/nowpayments/api/estimation.rb

Overview

Estimation and calculation endpoints

Instance Method Summary collapse

Instance Method Details

#estimate(amount:, currency_from:, currency_to:) ⇒ Hash

Estimate price for currency pair GET /v1/estimate

Parameters:

  • amount (Numeric)

    Amount to estimate

  • currency_from (String)

    Source currency

  • currency_to (String)

    Target currency

Returns:

  • (Hash)

    Price estimate



25
26
27
28
29
30
31
# File 'lib/nowpayments/api/estimation.rb', line 25

def estimate(amount:, currency_from:, currency_to:)
  get("estimate", params: {
        amount: amount,
        currency_from: currency_from,
        currency_to: currency_to
      }).body
end

#min_amount(currency_from:, currency_to:) ⇒ Hash

Get minimum payment amount for currency pair GET /v1/min-amount

Parameters:

  • currency_from (String)

    Source currency code

  • currency_to (String)

    Target currency code

Returns:

  • (Hash)

    Minimum amount info



12
13
14
15
16
17
# File 'lib/nowpayments/api/estimation.rb', line 12

def min_amount(currency_from:, currency_to:)
  get("min-amount", params: {
        currency_from: currency_from,
        currency_to: currency_to
      }).body
end