@@ -103,7 +103,7 @@ def log(self):
103
103
return self ._log
104
104
105
105
def error_handler (
106
- self , reqid : int , error_code : int , error_string : str , contract : ibContract
106
+ self , reqid : int , error_code : int , error_string : str , ib_contract : ibContract
107
107
):
108
108
"""
109
109
Error handler called from server
@@ -116,34 +116,22 @@ def error_handler(
116
116
:return: success
117
117
"""
118
118
119
- msg = "Reqid %d: %d %s" % (reqid , error_code , error_string )
120
-
121
- log_to_use = self ._get_log_for_contract (contract )
119
+ msg = "Reqid %d: %d %s for %s" % (
120
+ reqid ,
121
+ error_code ,
122
+ error_string ,
123
+ str (ib_contract ),
124
+ )
122
125
123
126
iserror = error_code in IB_IS_ERROR
124
127
if iserror :
125
128
# Serious requires some action
126
129
myerror_type = IB_ERROR_TYPES .get (error_code , "generic" )
127
- self .broker_error (msg = msg , myerror_type = myerror_type , log = log_to_use )
130
+ self .broker_error (msg = msg , myerror_type = myerror_type , log = self . log )
128
131
129
132
else :
130
133
# just a general message
131
- self .broker_message (msg = msg , log = log_to_use )
132
-
133
- def _get_log_for_contract (self , contract : ibContract ) -> pst_logger :
134
- if contract is None :
135
- log_to_use = self .log .setup ()
136
- else :
137
- ib_expiry_str = contract .lastTradeDateOrContractMonth
138
- instrument_code = self .get_instrument_code_from_broker_contract_object (
139
- contract
140
- )
141
- if instrument_code is missing_contract :
142
- instrument_code = "UNKNOWN (%s)" % contract .symbol
143
- futures_contract = futuresContract (instrument_code , ib_expiry_str )
144
- log_to_use = futures_contract .specific_log (self .log )
145
-
146
- return log_to_use
134
+ self .broker_message (msg = msg , log = self .log )
147
135
148
136
def broker_error (self , msg , log , myerror_type ):
149
137
log .warn (msg )
0 commit comments