I wrote two customized commission scheme for cryptocurrencies, one for spot market and the other for contracts:

```
class CryptoSpotCommissionInfo(bt.CommissionInfo):
'''Commission scheme for cryptocurrency spot market.
Required Args:
commission: commission fee in percentage, between 0.0 and 1.0
'''
params = (
('stocklike', True),
('commtype', bt.CommInfoBase.COMM_PERC), # apply % commission
)
def __init__(self):
assert abs(self.p.commission) < 1.0 # commission is a percentage
assert self.p.mult == 1.0
assert self.p.margin is None
assert self.p.commtype == bt.CommInfoBase.COMM_PERC
assert self.p.stocklike
assert self.p.percabs
assert self.p.leverage == 1.0
assert self.p.automargin == False
super().__init__()
def getsize(self, price, cash):
'''Support fractional size.
More details at https://www.backtrader.com/blog/posts/2019-08-29-fractional-sizes/fractional-sizes/.
'''
return self.p.leverage * (cash / price)
```

```
class CryptoContractCommissionInfo(bt.CommissionInfo):
'''Commission scheme for cryptocurrency contracts.
Including futures contracts and perpetual swap contracts.
Required Args:
commission: commission fee in percentage, between 0.0 and 1.0
mult: leverage, for example 10 means 10x leverage
'''
params = (
('stocklike', False),
('commtype', bt.CommInfoBase.COMM_PERC), # apply % commission
)
def __init__(self):
assert abs(self.p.commission) < 1.0 # commission is a percentage
assert self.p.mult > 1.0
assert self.p.margin is None
assert self.p.commtype == bt.CommInfoBase.COMM_PERC
assert not self.p.stocklike
assert self.p.percabs
assert self.p.leverage == 1.0
self.p.automargin = 1 / self.p.mult
super().__init__()
def getsize(self, price, cash):
'''Support fractional size.
More details at https://www.backtrader.com/blog/posts/2019-08-29-fractional-sizes/fractional-sizes/.
'''
return self.p.leverage * (cash / price)
def _getcommission(self, size, price, pseudoexec):
'''Percentage based commission fee.
More details at https://www.backtrader.com/docu/user-defined-commissions/commission-schemes-subclassing/.
'''
return abs(size) * self.p.commission * price * self.p.mult
```

Hope it helps!