Backtrader doesn't receives data from TWS after a few hours of running
-
Hi everyone!
I have some problems in passing the right params to Cerebro, store, and feed.
I need to trade US futures (for example 30 of them) with my custom strategy, live at IB.
TRADES and sometimes BID_ASK data are used.
Also, I neednext()
to be called every minute regardless of data is received completely or not, As I have some big problems making TWS work properly.
Adding to this, backfilling at the start is desirable.My
resampledata()
input params are like this now:-
rtbar=True
-
historical=False
-
backfill_start=True
-
backfill=True
Now it works for a few hours continuously and then suddenly it stops, while TWS is running and
datas
areCONNECTED
and also the script is running butnext()
is not called.So what should I change? Is there any major change needed?
-
-
@amir-mansoubi said in Backtrader doesn't receives data from TWS after a few hours of running:
I need next() to be called every minute regardless of data is received completely or not,
Not sure it works this way, AFAIK in live scenario the
next()
is called on each new bar produced by any feed added tocerebro
engine ( and not by schedule)@amir-mansoubi said in Backtrader doesn't receives data from TWS after a few hours of running:
Now it works for a few hours continuously and then suddenly it stops
Could you please take a look at the TWS API log and see if some unexpected warnings or bust events (since you are using real time bars ) are present.
-
@vladisld thanks for answering.
Actually, I use IB GATEWAY which doesn't have any API log. But there is a Gateway log for the day.
Is it useful? -
@amir-mansoubi said in Backtrader doesn't receives data from TWS after a few hours of running:
I use IB GATEWAY which doesn't have any API log
The Gateway do have the API logs - there is an option to view it right from the UI or download each daily log separately.
-
@vladisld
Unfortunately, it was unchecked in settings.
I enabled it and will send the log next time thr problem happens.