Probably taking a look at TWS API logs may give you some clue.
Posts made by vladisld
RE: generic csv data dtformat not correct?
I've run your code and it seems the dtformat is defined correctly - just try to use the correct
todateinterval (like 2017/7/1 - 2020/8/15 ).
The error you are seeing is raised during the plotting and probably related to the fact that indeed no data was loaded for the requested time period.
RE: No excecution of orders during tutorial SMAcrossover
Seems to me like a classic case for the indicator. Take a look at: https://www.backtrader.com/docu/inddev/
RE: Compare next bar values
Probably I misinterpreted your original post. There are many indicators putting the predicted/calculated values to the future bars ( like Ichimoku indicator for example) and this is perfectly legal. BTW, there were multiple discussions about it in this forum:
My apologies for misunderstanding.
RE: IbBroker live Trading / IdealPro minimum value / error code : 399 / Odd Lot Orders reported as Rejected
hmm, at first sight it seems like a bug in IBBroker:
Looking at ibbroker.py:
def push_ordererror(self, msg): with self._lock_orders: try: order = self.orderbyid[msg.id] except (KeyError, AttributeError): return # no order or no id in error if msg.errorCode == 202: if not order.alive(): return order.cancel() elif msg.errorCode == 201: # rejected if order.status == order.Rejected: return order.reject() else: ----> order.reject() # default for all other cases
called from ibstore.py registered
@ibregister def error(self, msg): # 300-399 A mix of things: orders, connectivity, tickers, misc errors ... # < code removed for clarity > if msg.errorCode is None: ... # < code removed for clarity > elif msg.errorCode < 500: # Given the myriad of errorCodes, start by assuming is an order # error and if not, the checks there will let it go if msg.id < self.REQIDBASE: if self.broker is not None: ----> self.broker.push_ordererror(msg) else: # Cancel the queue if a "data" reqId error is given: sanity q = self.qs[msg.id] self.cancelQueue(q, True)
The order is marked rejected for every "unknown" ( to be more exact - unhandled) error/warning.
RE: Compare next bar values
As a side note: using the information from the future is not a good idea in general ( it will definitely not work in real time trading).
Having said that it is still possible to get the future bar information in case the data feed /indicators are preloaded ( see the
preloadparameter for Cerebro engine https://www.backtrader.com/docu/cerebro/). Still need to be careful not to access the data feed index past the last preloaded bar.
Also I believe a similar question was already discussed in the following posts:
any many others
RE: SQLite example
Please take a look at the PSQL data feed implementation suggested in the following PR:
it could be relatively easily converted to use SQLite API. However, you need an additional code to store new data since the above PR is only for data feed.
RE: Accessing downloaded IBData outside of Strategie-class:
Data feeds in general and IBData in particular, do not load any data (historical or live) during the instantiation. IBData will issue the historical data subscription request only when its
startmethod will be called, which in turn will be called within Cerebro engine
So, answering your question, getting the data from the data feeds before running the Cerebro
runmethod is not possible ( at least not with current design).