exception in ibbroker.py



  • I am using following methods to set commission in both cases getting following exception, any pointers what's going wrong...
    Product is emini future.

    1. cerebro.broker.setcommission(commission=1.25, margin=2000.0, mult=50.0)

    2. comminfo = CommInfo_FIXED(commission=1.25,stocklike=False) # 1$
      cerebro.broker.addcommissioninfo(comminfo)
      where CommInfo_FIXED is following class.

    class CommInfo_FIXED(bt.CommInfoBase):
    params = (('stocklike', False), ('commtype', bt.CommInfoBase.COMM_FIXED),)
    def _getcommission(self, size, price, pseudoexec):
    return self.p.commission

    both varieties gives following error when trade is executed.

    ERROR Exception in message dispatch. Handler 'commissionReport' for 'commissionReport'
    Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\ib\opt\dispatcher.py", line 44, in call
    results.append(listener(message))
    File "build\bdist.win32\egg\backtrader\stores\ibstore.py", line 1377, in commissionReport
    self.broker.push_commissionreport(msg.commissionReport)
    File "build\bdist.win32\egg\backtrader\brokers\ibbroker.py", line 525, in push_commissionreport
    closedvalue = comminfo.getoperationcost(closed, pprice_orig)
    AttributeError: 'NoneType' object has no attribute 'getoperationcost'



  • More of a question than any useful feedback but I have assumed that the ibbroker is providing the commission info and it would make no sense to set commission for that broker. Am I wrong?



  • I tried that (not setting any commission info at all), still the same issue.


  • administrators

    It makes no sense to add any kind of commission to the Interactive Brokers broker, because commissions are reported by the broker and the platform tries to get them.

    File "build\bdist.win32\egg\backtrader\brokers\ibbroker.py", line 525, in push_commissionreport
    closedvalue = comminfo.getoperationcost(closed, pprice_orig)
    AttributeError: 'NoneType' object has no attribute 'getoperationcost'

    The error shows that getoperationcost is being called at line 525. The file history (for the last 10 months) seems to show that getoperationcost was never called at line 525.

    It would therefore seem a locally modified version is being run.


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.