Problem with the ExecutionFilter from reqExecutions of the TWS API

  interactive-brokers, python, tws

Good afternoon to all, I want to get details of previous execution details in my app and I have the following error:

”’

Exception in thread Thread-8:
Traceback (most recent call last):
  File "C:ProgramDataAnaconda3libthreading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:ProgramDataAnaconda3libthreading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:ProgramDataAnaconda3libsite-packagesibapi-9.76.1-py3.8.eggibapiclient.py", line 239, in run
  File "C:ProgramDataAnaconda3libsite-packagesibapi-9.76.1-py3.8.eggibapidecoder.py", line 1278, in interpret
  File "C:ProgramDataAnaconda3libsite-packagesibapi-9.76.1-py3.8.eggibapidecoder.py", line 1259, in interpretWithSignature
TypeError: 'bool' object is not callable

”’

I use the following code:

”’

@iswrapper
def execDetails(self, reqId: int, contract, execution):
    super().execDetails(reqId, contract, execution)
    print("ExecDetails. ", reqId, contract.symbol, contract.secType, 
          contract.currency, execution.execId, execution.orderId, 
          execution.shares, execution.lastLiquidity) 

@iswrapper
def commissionReport(self, commissionReport):
    super().commissionReport(commissionReport)
    print("CommissionReport. ", commissionReport.execId, 
          commissionReport.commission, commissionReport.currency, 
          commissionReport.realizedPNL)

self.reqExecutions(0,taf.executionFilter(0,self.account,time_,
                                             contract))

”’

where "taf.executionFilter(0,self.account,time_,contract)" is:

”’

def executionFilter(clientId,account,time_,contract):

    execFilter = ExecutionFilter()
    execFilter.clientId = clientId
    execFilter.acctCode = account
    execFilter.time = time_
    execFilter.symbol = contract.symbol
    execFilter.secType = contract.secType
    execFilter.exchange = contract.exchange
    return execFilter

”’

I don’t know what I am doing wrong. Could someone explain to me how to assign properly the execution filter?

Thanks

Source: Python Questions

LEAVE A COMMENT