Hi,
When I use:
cerebro.broker.setcommission(commission=0.005)
and place a buy order:
self.buy(data=self.data0, size=1)
I see in 'notify_order' when the order status is order.completed:
order.executed.price = 1.8768
cerebro.broker.getvalue(self.datas) = 1.9732
self.data0[0] = 1.9732
which indicates that 1 unit of the stock was bought.
However, when I set
cerebro.broker.setcommission(commission=0.005, commtype=bt.comminfo.CommInfoBase.COMM_FIXED)
and use the same buy order I get when the order is completed
order.executed.price = 1.8768
cerebro.broker.getvalue(self.datas) = 1.0
self.data0[0] = 1.9732
which indicates that the order was places to buy as many units as possible for 1 monetary unit.
Is this a bug or a feature?
How can I set a fixed commision in monetary units and still place buy orders where the size parameter indicates units of the stock to buy?
Thanks!