You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting the commission fn is not smooth error when trying to implement quantity and price-based commission as follows:
class TradingCommissions:
MIN_COMM = 0.35
QTY_RATE = 0.0035
MAX_RATE = 0.01
@staticmethod
def calc(q, p):
qty_comm = abs(q) * TradingCommissions.QTY_RATE
max_comm = abs(q) * p * TradingCommissions.MAX_RATE
# Final commission is the maximum of the minimum commission
# and the smaller of the quantity and maximum commissions
return max(TradingCommissions.MIN_COMM, min(qty_comm, max_comm))
I am passing TradingCommissions.calc to the backtester. The tests will run but invariably and somewhat unpredictably end in the message:
The difference between what we have raised with q and the amount we are trying to raise has gotten bigger since last iteration! full_outlay should always be approaching amount! There may be a case where the commission fn is not smooth
I have gone over my code for hours looking for a reason. I have concluded it has something to do with a bug in the core. There is some discussion here about past issues in implementing commissions.
I am getting the
commission fn is not smooth
error when trying to implement quantity and price-based commission as follows:I am passing
TradingCommissions.calc
to the backtester. The tests will run but invariably and somewhat unpredictably end in the message:The difference between what we have raised with q and the amount we are trying to raise has gotten bigger since last iteration! full_outlay should always be approaching amount! There may be a case where the commission fn is not smooth
I have gone over my code for hours looking for a reason. I have concluded it has something to do with a bug in the core. There is some discussion here about past issues in implementing commissions.
Some references: #97 #247 #342 #384
I am using integer positions. Any suggestions for how or where to look for a way to resolve this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: