• 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 Address
          Find Out Your Address
        • Create Personal Alias
          Create Personal Alias
        • Import From Keeper Wallet
          Import From Keeper Wallet
        • Use Ledger Nano Devices With WX Network
          Use Ledger Nano Devices With WX Network
        Account Management
      • Token Management
        • Deposit & Withdraw Tokens
          • Transactions Tab
            Transactions Tab
          Deposit & Withdraw Tokens
        • 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
        • Swap Tokens
          Swap Tokens
        Token Management
      • Investment Tools
        • Stake Tokens
          • How to Get XTN (Quick Guide)
            How to Get XTN (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
        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 WX Network
        Start Trading on WX Network
      Online/Desktop Apps
    • Mobile Apps
      • WX Network App
        WX Network App
      • Waves.Exchange App
        • Account Management
          • Create Account
            Create Account
          • Log in to Account
            Log in to Account
          • Recover Account
            Recover Account
          • Find Out Your Address
            Find Out Your Address
          • Create Personal Alias
            Create Personal Alias
          Account Management
        • Token Management
          • Deposit & Withdraw Tokens
            Deposit & Withdraw Tokens
          • Burn Token
            Burn Token
          Token Management
        • Start Trading on WX Network
          Start Trading on WX Network
        Waves.Exchange App
      • WX Invest App
        WX Invest App
      Mobile Apps
    • Working With MetaMask in Waves Network
      Working With MetaMask in Waves Network
    • WX Referral Program
      WX Referral Program
    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
      • Error Codes
        Error Codes
      Gateway API
    • Access Token
      • Get Access Token in WX Network App
        Get Access Token in WX Network 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
      • WX Network Protocol
        WX Network 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 WX Network 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. WX Network matcher charges percent fee in the token that you spend. For example, if you exchange XTN to get BTC (you spend XTN), you pay the fee in XTN. Or if you exchange BTC to get XTN (you spend BTC), then you pay fee in BTC.

          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. WX Network 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. In this example:

          • 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:

          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:

          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/XTN

          price = 42611430000

          amount = 32173

          order amount in:

          • price assets = 13.709237 XTN

          • amount assets = 0.00032173 BTC

          rates[BTC] = 0.000329

          rates[XTN] = 13.9

          rates[discountAsset] = 10.534

          corrected rates:

          • priceAsset = rates[XTN] * 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 XTN)
          

          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 XTN)
          

          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 XTN)
          

          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.

          WX Network Protocol
          Install Matcher on Ubuntu From Deb-package
          WX Network Protocol
          Install Matcher on Ubuntu From Deb-package