Bid/ask fee, how to set as a percentage?


#1

Skimming through the code I couldn’t find how are the bid and ask fees calculates, and how can I set them to a percentage of the amount being traded.


#2

Hello @rraallvv !
Bid and ask fees are configured in the markets.yml for each market.
Here is example of the code:

   - id: bchbtc
     position: 1
     ask_unit: bch
     bid_unit: btc
     ask_fee: 0.0015
     bid_fee: 0.0015
     ask_precision: 6
     bid_precision: 6
     enabled: true

You see, here is ask_fee and bid_fee.

Here is link to the related code inside config template


#3

Hi @Mafarain!

Thanks, I’ve seen those fees of 0.0015 all over the place in the source code and templates, I guess that’s a bit confusing at first. It’s not clear to me if the fee is an absolute value like fee = 0.0015 BTC, or relative to ‘traded_amoun’, like fee = 0.0015 * traded_amount.

I also found that the ask_fee and bid_fee are validated between 0 and 0.5, which makes me think those are relative values.

By the way, it would very useful if all fees could be defined by these three parameters slope, min, and max. With slope taking positive values that could be expressed as a percentage too, in which case it would be slop = percentage / 100. While min could take values between 0 and max, and max taking values between min and infinity. Also min and max could be defined by default to 0 and infinity respectively, or assumed to have those values if not defined anywhere else.


#4

So taking a look to the API module for getting the fees, it seems there are two type of fees fixed and relative. Fixed fees are used for deposits and withdrawals, while relative fees are used for trading operations.