Entry.order.ref problem. Any suggestions?
Hi everyone. I decided to start working again on something that was almost finished. I´m not the coder, just altering loging and fine tuning it. Turns out I got this error today that wasn´t triggering a few days ago and I dont get it.
This is the code, hapening for each ticker the algo trades:
, line 1219, in initialise_trade_list_from_broker_data
original_order_id = int(entry_order_ref.split('_')[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'ENTRY'
I have no idea how this has happened,
This is the relevant part of the code containing the entry.order.ref stuff:
# overwrite __init__ generated values of Trade object
t.datetime_stamp = entry_order_ref.split('_')[2]
# TODO: trade_datetime must be timezone aware, to enable comparison with live trades
t.trade_datetime = datetime.strptime(t.datetime_stamp,
'%Y%m%d-%H%M%S').replace(tzinfo=ZoneInfo(key='US/Central'))
# reconstruct trades from orphaned callbacks
reconstructed_trades = []
for entry_order_ref, order_details in orphaned_orders.items():
if 'ENTRY' in entry_order_ref:
# collect trade parameters
contract = order_details[1]
entry_order_object = order_details[2]
trade_id = int(entry_order_ref.split('_')[0])
original_order_id = int(entry_order_ref.split('_')[1])
cancel_price = float(entry_order_ref.split('_')[4])
Any help is appreciated!
Thanks!
Posted Sep 25, 2024, 12:13 PM UTC