Broker: Stop Getting Cash and Value During Backfill
-
Hello All
Is there way to prevent the broker from attempting to call
getcash()
andgetvalue()
during a backfill? I.e whenself._state = self._ST_HISTORBACK
?I guess this might be an illogical thing to ask since we can have multiple feeds and some might be delayed, reconnecting backfilling etc whilst others are live....
The reason I am asking is because I have been playing around with the CCXT implementation from Mr Bartosh and noticed that Backfilling takes a long time as a rest API call is made to access cash and value before the bar comes in and after.
So I am trying to think of a way to speed things up a little.
Cheers!
-
The thing is that the internals don't know if you are backfilling or not and go through the entire cycle. The key to support different modes transparently is to not make distinctions as to what the actual nature of the data is.
-
Sure, I appreciate that thanks.
So in the end I decided to do something a bit hacky and add a attribute to the CCXT broker that can be overwritten from inside the strategy. I.e When I set it to
false
, the broker will just return the lastcash
andvalue
figures that were downloaded. If it istrue
the broker will make the proper store method call.Probably not the best idea but needs must :) I can now warm up the indicators without waiting a lifetime.
-
This was discussed in another thread: the broker should not make synchronous calls ...