I can't figure out how to capture in a dataframe the executed trades with the execDetails function from https://interactivebrokers.github.io/tws-api/executions_commissions.html
class TradingApp(EWrapper, EClient):
def __init__(self):
EClient.__init__(self, self)
self.orderExec_df = pd.DataFrame(columns = [
'ReqId', 'Symbol', 'SecType', 'Currency', 'ExecId', 'Time', 'Account', 'Exchange', 'Side', 'Shares', 'Price', 'PermId', 'ClientId', 'OrderId', 'Liquidation', 'CumQty', 'AvgPrice', 'OrderRef', 'EvRule', 'EvMultiplier', 'ModelCode', 'LastLiquidity'
])
def execDetails(self, reqId, contract, execution):
super().execDetails(reqId, contract, execution)
print("ExecDetails. ReqId:", reqId, "Symbol:", contract.symbol, "SecType:", contract.secType, "Currency:", contract.currency, execution)
dictionary = {"ExecDetails. ReqId:", reqId, "Symbol:", contract.symbol, "SecType:", contract.secType, "Currency:", contract.currency, execution}
self.orderExec_df = self.orderExec_df.append(dictionary, ignore_index = 0)
orderExec_df = app.reqExecutions(10001, ExecutionFilter()) time.sleep(1) orderExec_df = app.execDetails print(orderExec_df)
printing the data works fine
I get this error message
TypeError: cannot concatenate object of type '<class 'set'>'; only Series and DataFrame objs are valid