Problem with the Execution Filter

Discussion in 'Interactive Brokers' started by jcgtanaka, Jul 23, 2021.

  1. jcgtanaka

    jcgtanaka

    Good evening 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:\ProgramData\Anaconda3\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
    File "C:\ProgramData\Anaconda3\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
    File "C:\ProgramData\Anaconda3\lib\site-packages\ibapi-9.76.1-py3.8.egg\ibapi\client.py", line 239, in run
    File "C:\ProgramData\Anaconda3\lib\site-packages\ibapi-9.76.1-py3.8.egg\ibapi\decoder.py", line 1278, in interpret
    File "C:\ProgramData\Anaconda3\lib\site-packages\ibapi-9.76.1-py3.8.egg\ibapi\decoder.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 = 0
    execFilter.acctCode = "D..."
    execFilter.time = time_ #String as per requested by IB
    execFilter.symbol = "EUR"
    execFilter.secType = "CASH"
    execFilter.exchange = "IDEALPRO"
    return execFilter
    """

    I don't know what I am doing wrong. Could someone explain to me how to assign properly the execution filter? I think I use correctly the ExecutionFilter but I don't know why I get that error, please help!

    Thanks
     
  2. which platform are you using?
     
  3. jcgtanaka

    jcgtanaka

    TWS, not Gateway...
     
  4. DaveV

    DaveV

    I know that the date doesn't work in execFilter (it is documented on the IB website). Not sure if time works. Try sending the request with just the initialized execFilter (i.e. don't change any fields). That should get you all the executions for the current day, and you can filter what you want in your code.
     
  5. d08

    d08

    Where's execFilter.side ?
     
  6. jcgtanaka

    jcgtanaka

    I resolved the problem, the problem was that I was assigning a boolean value to the funtion execDetailsEnd, so stupid!

    thanks to everybody!
     
  7. Dugrel

    Dugrel

    It's good that the problem has been resolved, now you will know if the situation happens again.