• User Guide
    • Security Notes
      Security Notes
    • Online/Desktop Apps
      • Account Management
        • Create Account
          Create Account
        • Log in to Account
          Log in to Account
        • Backup Seed Phrase
          Backup Seed Phrase
        • Recover Account
          Recover Account
        • Find Out Your Waves.Exchange Address
          Find Out Your Waves.Exchange Address
        • Create Personal Alias
          Create Personal Alias
        • Import From Keeper Wallet
          Import From Keeper Wallet
        • Use Ledger Nano Devices With Waves.Exchange
          Use Ledger Nano Devices With Waves.Exchange
        Account Management
      • Token Management
        • Deposit & Withdraw Tokens
          • Transactions Tab
            Transactions Tab
          Deposit & Withdraw Tokens
        • Buy Tokens with a Bank Card
          • How to Use Advanced Cash
            How to Use Advanced Cash
          Buy Tokens with a Bank Card
        • Create Token
          Create Token
        • Mass Transfer
          Mass Transfer
        • Reissue Token
          Reissue Token
        • Change Reissuable to Not Reissuable
          Change Reissuable to Not Reissuable
        • Burn Token
          Burn Token
        • Sponsored Transaction
          Sponsored Transaction
        • Sponsored Fee
          Sponsored Fee
        • OTC Service
          OTC Service
        • Swap DeFo
          Swap DeFo
        • Swap WAVES/USDN
          Swap WAVES/USDN
        Token Management
      • Investment Tools
        • Stake Tokens
          • How to Get USDN (Quick Guide)
            How to Get USDN (Quick Guide)
          • How to Get USDT/USDC/BTC/ETH (Quick Guide)
            How to Get USDT/USDC/BTC/ETH (Quick Guide)
          Stake Tokens
        • Lambo Investments
          Lambo Investments
        • Algorithmic Trading
          Algorithmic Trading
        • Neutrino Governance
          Neutrino Governance
        • Neutrino Pools
          Neutrino Pools
        Investment Tools
      • Liquidity Pools
        • How to Maximize Passive Income from Liquidity Pools?
          How to Maximize Passive Income from Liquidity Pools?
        • How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
          How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
        • How to Stake/Unstake LP Tokens?
          How to Stake/Unstake LP Tokens?
        • How to Claim LP Staking Reward in WX?
          How to Claim LP Staking Reward in WX?
        • How to Stake WX Token to Boost LP Staking Reward?
          How to Stake WX Token to Boost LP Staking Reward?
        • How to Claim WX Staking Reward?
          How to Claim WX Staking Reward?
        • WX Token Protocol
          WX Token Protocol
        Liquidity Pools
      • Voting
        Voting
      • Advanced Features
        • Script Transaction
          Script Transaction
        • JSON Confirmation
          JSON Confirmation
        Advanced Features
      • Start Trading on Waves.Exchange
        Start Trading on Waves.Exchange
      Online/Desktop Apps
    • Mobile Apps
      • Account Management
        • Create Account
          Create Account
        • Log in to Account
          Log in to Account
        • Recover Account
          Recover Account
        • Find Out Your Waves.Exchange Address
          Find Out Your Waves.Exchange Address
        • Create Personal Alias
          Create Personal Alias
        Account Management
      • Token Management
        • Deposit & Withdraw Tokens
          Deposit & Withdraw Tokens
        • Buy Tokens with a Bank Card
          Buy Tokens with a Bank Card
        • Stake WAVES
          Stake WAVES
        • Stake USDN
          Stake USDN
        • Burn Token
          Burn Token
        Token Management
      • Start Trading on Waves.Exchange
        Start Trading on Waves.Exchange
      • WX Invest App
        WX Invest App
      Mobile Apps
    User Guide
  • API and Library
    • CCXT
      CCXT
    • Fees
      Fees
    • Payment API
      Payment API
    • Web Auth API
      Web Auth API
    • Gateway API
      • Deposit
        • [Deprecated] GET /v1/deposit/addresses/{currency}
          [Deprecated] GET /v1/deposit/addresses/{currency}
        • GET /v1/deposit/addresses/{currency}/{platform}
          GET /v1/deposit/addresses/{currency}/{platform}
        • GET /v1/deposit/currencies
          GET /v1/deposit/currencies
        • [Deprecated] GET /v1/deposit/currencies/{currency}
          [Deprecated] GET /v1/deposit/currencies/{currency}
        • GET /v1/deposit/currencies/{currency}/{platform}
          GET /v1/deposit/currencies/{currency}/{platform}
        • Terms of Deposit
          Terms of Deposit
        Deposit
      • Withdraw
        • [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
          [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
        • GET /v1/withdraw/addresses/{currency}/{address}/{platform}
          GET /v1/withdraw/addresses/{currency}/{address}/{platform}
        • GET /v1/withdraw/currencies
          GET /v1/withdraw/currencies
        • [Deprecated] GET /v1/withdraw/currencies/{currency}
          [Deprecated] GET /v1/withdraw/currencies/{currency}
        • GET /v1/withdraw/currencies/{currency}/{platform}
          GET /v1/withdraw/currencies/{currency}/{platform}
        • Terms of Withdrawal
          Terms of Withdrawal
        Withdraw
      • Movements History
        Movements History
      • Platforms List
        Platforms List
      • Crosschain Supply Consistency
        Crosschain Supply Consistency
      • Error Codes
        Error Codes
      Gateway API
    • Access Token
      • Get Access Token in Waves.Exchange App
        Get Access Token in Waves.Exchange App
      • POST /v1/oauth2/token
        POST /v1/oauth2/token
      Access Token
    • Get Trades
      Get Trades
    • Staking Annual Percentage Yield API
      Staking Annual Percentage Yield API
    • Matcher
      • Waves.Exchange Protocol
        Waves.Exchange Protocol
      • Matcher Fee
        Matcher Fee
      • Install Matcher on Ubuntu From Deb-package
        Install Matcher on Ubuntu From Deb-package
      • Matcher Settings
        Matcher Settings
      • Matcher API
        • Order Validation
          Order Validation
        • Exchange Transation Validation
          Exchange Transation Validation
        Matcher API
      • Matcher WebSocket API
        • Errors and Debugging
          Errors and Debugging
        • Common Streams
          Common Streams
        Matcher WebSocket API
      Matcher
    API and Library
  • Glossary
    Glossary
      • English
      • Русский
      On this page
        • Types of Fee
        • Calculating minimal fees for different fee types
        • Example

          # Matcher Fee

          An exchange transaction contains two separate fields for Matcher's fee, which goes from buyer's order and seller's order. An order can be fully executed by some transaction, in this case, all matcher fee from it is included in that transaction. If the order is partially executed by some deal-transaction, the matcher fee is included in that transaction proportionally to the executed amount, i.e.

          executedAmount * orderMatcherFee / orderAmount.

          The remaining matcher fee for this order will be included in other transactions until the order's full execution.

          # Types of Fee

          Current version of Waves.Exchange matcher charges either dynamic or percent type of fee depending on the selected trading pair.

          • Dynamic fee mode is similar to the old setup. Matcher charges 0.01 WAVES fixed fee for trade orders.

          • Percent fee mode is the mechanic when matcher charges 0.1% of the exchange transaction amount but not less than the equivalent of 0.01 WAVES. Waves.Exchange matcher charges percent fee in the token that you spend. For example, if you exchange USDN to get BTC (you spend USDN), you pay the fee in USDN. Or if you exchange BTC to get USDN (you spend BTC), then you pay fee in BTC.

          Important: Both types of fee (dynamic and percent) can be optionally paid in WX token at 50% of the normal price.

          You can use POST /matcher/orderbook/calculateFee method to calculate fees for a pair.

          GET /matcher/settings method allows to find out the type of fee (dynamic or percent) that is used for a trading pair and other matcher setting.

          Note: We recommend to request settings at least once per minute, so that you don't miss the changes of percent pairs.

          Request example (testnet):

          curl -X 'GET' 'https://matcher-testnet.waves.exchange/matcher/settings' -H 'accept: application/json'
          

          Matcher settings response example (testnet):

            "orderFee": {
              "composite": {
                "default": {
                  "dynamic": {
                    "baseFee": 1000000
                  }
                },
                "custom": {
                  "5Sh9KghfkZyhjwuodovDhB6PghDUGBHiAPZ4MkrPgKtX-25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT": {
                    "percent": {
                      "type": "spending",
                      "minFee": 0.1,
                      "minFeeInWaves": 1000000
                    }
                  },
                  "WAVES-25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT": {
                    "percent": {
                      "type": "spending",
                      "minFee": 0.1,
                      "minFeeInWaves": 1000000
                    }
                  }
                },
                "discount": {
                  "assetId": "EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc",
                  "value": 50
                }
              }
            }
          

          orderFee is one of the fields returned by GET /matcher/settings method.

          As you can see, in the example there can be pairs that have dynamic fee mode and a pairs that have percent fee mode.

          See percent mode parameters:

          • type - type of token that should be used to pay fee. Can be amount - the amountAsset, price - the priceAsset, spending- the token being spent, receiving - the received token. Waves.Exchange matcher uses spending type.
          • minFee - minimal fraction of the order amount that should be payed as fee. Where 0.14 is 0.14%
          • minFeeInWaves - minimal value of fee in WAVES (regardless of the order amount, the fee should be greater than or equal minFeeInWaves)

          Also, note the discount section that describes parameters of discount on fees paid with discountAsset:

          • asset - is the ID of discountAsset.
          • value indicates 50 percent discount.

          # Calculating minimal fees for different fee types

          Depending on the fee mode matcher charges fees in various tokens.

          • For trading pairs with Dynamic fee mode the fees can be paid in WAVES or in WX (discountAsset) token.

          • For trading pairs with Percent fee mode the fees can be paid either in priceAsset (for buy orders) or in amountAsset (for sell orders) or otherwise in WX (discountAsset) token.

          The fee rates used in the following calculations can be obtained by means of GET /matcher/settings/rates method.

          Request example:

          curl -X 'GET' 'https://matcher.waves.exchange/matcher/rates' -H 'accept: application/json
          

          # Constants

          PriceConstantExp = 8
          PriceConstant = 10 ** PriceConstantExp
          

          # Functions

          correctedRate(rate, assetDecimals) = rate * 10 ** (assetDecimals - PriceConstantExp)
          

          scripts_count is the number of smart script runs that are required to validate the order.

          # Calculation of minimal fee for Dynamic fee mode

          Using WAVES:

          baseFee + 400000 * scripts_count
          

          Using discountAsset:

          rate = correctedRate(rates[discountAsset], discountAssetDecimals)
          
          (baseFee + 400000 * scripts_count) * correctedRate * (100 - discount) / 100
          

          # Calculation of minimal fee for Percent fee with the following settings:

          {
              "percent" : {
              "type" : "spending",
              "minFee" : 0.14,
              "minFeeInWaves" : 300000
              }
          }
          

          Selling fee:

          Using amountAsset:

          rate = correctedRate(rates[amountAsset], amountAssetDecimals)
          
          order.amount * minFee / 100
          

          Using discountAsset:

          discountAssetRate = correctedRate(rates[discountAsset], discountAssetDecimals)
          amountAssetRate = correctedRate(rates[amountAsset], amountAssetDecimals)
          
          order.amount * minFee / 100 * (discountAssetRate / amountAssetRate) * (100 - discount) / 100
          

          Buying fee:

          Using priceAsset:

          rate = correctedRate(rates[priceAsset], priceAssetDecimals)
          
          order.amount * order.price / PriceConstant * minFee / 100
          

          Using discountAsset:

          discountAssetRate = correctedRate(rates[discountAsset], discountAssetDecimals)
          priceAssetRate = correctedRate(rates[priceAsset], priceAssetDecimals)
          
          order.amount * order.price / PriceConstant * minFee / 100 * (discountAssetRate / priceAssetRate) * (100 - discount) / 100
          

          You should check that the fee is not less than minFeeInWaves, to do so multiply minFeeInWaves by the adjusted FeeAssetRate and compare with your fee. The discount also applies to minFeeInWaves when using discountAsset to pay fees.

          # Example

          Note: In this example no script runs are required to validate order.

          Lets trade 0.00032173 BTC by 42611.43

          pair = BTC/USDN

          price = 42611430000

          amount = 32173

          order amount in:

          • price assets = 13.709237 USDN

          • amount assets = 0.00032173 BTC

          rates[BTC] = 0.000329

          rates[USDN] = 13.9

          rates[discountAsset] = 10.534

          corrected rates:

          • priceAsset = rates[USDN] * 10 ** (-2) = 0.1390

          • amountAsset = rates[BTC] = 0.000329

          • discountAsset = rates[discountAsset] = 10.534

          minFee = 0.14%

          minFeeInWaves = 300000

          discount = 50%

          priceAssetDecimals = 6

          amountAssetDecimals = 8

          discountAssetDecimals = 8

          minFeeInWaves converted:

          • priceAsset = 41700

          • amountAsset = 98

          • discountAsset = 3160200

          # Calculating the fees

          Selling fee in Percent fee mode:

          Using amountAsset:

          32173 * 0.14 / 100 = 45 (0.00000045 BTC ~ 0.019 USDN)
          

          Using discountAsset:

          32173 * 0.14 / 100 * (10.534 / 0.000329) * (100 - 50) / 100 = 721085
          

          Buying fee:

          Using priceAsset:

          32173 * 42611430000 / 100000000 * 0.14 / 100 = 19193 (0.019 USDN)
          

          Using discountAsset:

          32173 * 42611430000 / 100000000 * 0.14 / 100 * (10.534 / 0.139) * (100 - 50) / 100 = 727267
          

          # Check minFeeInWaves

          When paying in priceAsset:

          300000 * 0.139 = 41700 (0,041700 USDN)
          

          When paying in amountAsset:

          300000 * 0.000329 = 99 (0,00000099 BTC)
          

          When paying in discountAsset:

          300000 * 10.534 * (100 - 50) / 100 = 1580100 (0,015801 discountAsset)
          

          Note: In all the example scenarios above the fee is less than minFeeInWaves.

          Waves.Exchange Protocol
          Install Matcher on Ubuntu From Deb-package
          Waves.Exchange Protocol
          Install Matcher on Ubuntu From Deb-package