How to set commission with condition by order?
-
In some futures exchange, If you close a position that you open it today, the commission is higher than normal.
So in this situation how to set commission ?
and I have read https://www.backtrader.com/docu/user-defined-commissions/commission-schemes-subclassing.html
but the
def _getcommission(self, size, price, pseudoexec):
method do not haveorder
ortrade
argument pass in, can not determine the commission's order is open or is close, and close for which order. -
I wouldn't even bother and set max commission for all trades.
If the system fails, then it is not stable enough for real trading. -
but the trade fee of close a today position is quite high. it is the open position fee's 2000%.
If I set the max commission for all trades. It's too far from the real trading.
-
Create a commission derived scheme which takes the corresponding data feed as an extra parameter. Use the data feed when called to get a timestamp.
tstamp = self.data.datetime.datetime()