@vladisld WAS CONFUSED BY FOREX DATA FEED. YOU'RE RIGHT.
Latest posts made by SPECULARI FUND
-
RE: How to use IB delayed data
-
RE: Starting with Interactive Brokers (IB) - no data feed
@rluc99 said in Starting with Interactive Brokers (IB) - no data feed:
I have discovered the problem. It is not related to Backtrader.
I did some digging around on the IB website. It seems that the IB demo account does not allow historical bars through the API for anything other than FOREX. The same applies to paper trading or live accounts unless there is a subscription to the relevant market data feed. If there is a subscription in place then the historical bars are available at any time, including week-ends.
(As an aside, historical bars are constructed by TWS regardless of whether there is a subscription in place or not.)
Delayed data is available during market hours for accounts without market data subscription, but to obtain this data a flag has to be set in the API. I don't think Backtrader allows the user to set this flag but I have not investigated this in detail.Most of the above information comes from the following two links:
http://interactivebrokers.github.io/tws-api/market_data.html
http://interactivebrokers.github.io/tws-api/historical_data.htmlSo, it's not possible to get even delayed stock data from IB using Backtrader for not funded account right?
-
RE: How to use IB delayed data
Looks like not possible to get delayed stocks data with a paper not funded account from IB. I am right?
-
RE: Crossover + MACD error
@Xavier-Escudero said in Crossover + MACD error:
@SPECULARI-FUND I've the same problem. Have you any solution?
I used raw data from the API to this library.
-
How to use IB delayed data
Is it possible to use delayed data from IB (I mean paper, but not FOREX market) as a "live" strategy?
next()
will be called if data is delayed? Maybe my question is stupid, just try to understand the logic. Thanks! -
Crossover + MACD error
self.macd = btalib.macd(self.get_data_bars(self.symbol, '1Min')[self.symbol], pfast=self.params.macdfast, pslow=self.params.macdslow, psignal=self.params.macdsignal) self.macdX = btalib.crossover(self.macd.macd, self.macd.signal) print(self.macd.df)
time macd signal histogram 2020-10-19 11:37:00-04:00 NaN NaN NaN 2020-10-19 11:38:00-04:00 NaN NaN NaN 2020-10-19 11:39:00-04:00 NaN NaN NaN 2020-10-19 11:40:00-04:00 NaN NaN NaN 2020-10-19 11:41:00-04:00 NaN NaN NaN ... ... ... ... 2020-10-19 14:52:00-04:00 -0.248898 -0.304889 0.055992 2020-10-19 14:53:00-04:00 -0.252423 -0.298331 0.045908 2020-10-19 14:54:00-04:00 -0.225212 -0.289191 0.063979 2020-10-19 14:55:00-04:00 -0.164539 -0.273610 0.109071 2020-10-19 14:56:00-04:00 -0.086874 -0.250268 0.163394
Error:
UserWarning: evaluating in Python space because the '-' operator is not supported by numexpr for the bool dtype, use '^' instead f"evaluating in Python space because the {repr(op_str)} "
What I am doing wrong?
-
Backtesting question about "fromdate" and "todate" with polygon.io
DataFactory = store.getdata data = DataFactory( dataname=ticker, tz=timezone, timeframe=bt.TimeFrame.Minutes, compression=1, fromdate=pd.Timestamp(args.start), sessionstart=datetime.time(9, 30), sessionend=datetime.time(16, 00), historical=True)
I am using such parameters to backtest on history some simple strategy and I see that it runs from right date
fromdate
, but then after 1month of period, it skips all dates range and jump to the current last date. Any idea why this happens? -
RE: Running multiple symbols data feeds in live IB
@orenshkol @vladisld why when I am using with
resample
data insteadadddata
, strategy runs on the first symbol only? -
RE: My stop-loss order is getting executed when it shouldn't
May be you can help how check type of order that accepted? Because I am updating take profit Limit order by moving average price and every updating of price I receiving new Limit order - previous not replaced.
-
Live feed alpaca-backtrader-api - KeyError: ‘bidprice’
I understand that this is not bug by backtrader, but anyway maybe someone had the same.
When stock is hold by exchange or sometimes after overnight I see that type of error. How I can catch this?
File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/backtrader/cerebro.py", line 1130, in run runstrat = self.runstrategies(iterstrat) File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/backtrader/cerebro.py", line 1301, in runstrategies self._runnext(runstrats) File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/backtrader/cerebro.py", line 1545, in _runnext drets.append(d.next(ticks=False)) File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/backtrader/feed.py", line 407, in next ret = self.load() File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/backtrader/feed.py", line 479, in load _loadret = self._load() File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/alpaca_backtrader_api/alpacadata.py", line 301, in _load ret = self._load_tick(msg) File "/home/x777/anaconda3/envs/env_backtrader/lib/python3.6/site-packages/alpaca_backtrader_api/alpacadata.py", line 401, in _load_tick msg['bidprice']) KeyError: 'bidprice'