Error when running
JayneFrack opened this issue · 3 comments
JayneFrack commented
Hi, when I try running the main.py after including all the libraries this happens:
RESTART: C:\Users\Devx86\Desktop\InteractiveBrokers-PairsTrading-Algo-master\main.py
Connecting on host: 127.0.0.1 port: 4002
[2020-02-26 19:19:43.100615]started
Error 162, reqId 4: Historical Market Data Service error message:No market data permissions for AMEX STK, contract: Stock(symbol='SPY', exchange='SMART', currency='USD')
Error 162, reqId 5: Historical Market Data Service error message:No market data permissions for ISLAND STK, contract: Stock(symbol='QQQ', exchange='SMART', currency='USD')
Error 354, reqId 6: Requested market data is not subscribed.Delayed market data is available.Error&BEST/STK/Top&BEST/STK/Top, contract: Stock(symbol='SPY', exchange='SMART', currency='USD')
Error 354, reqId 7: Requested market data is not subscribed.Delayed market data is available.Error&BEST/STK/Top&BEST/STK/Top, contract: Stock(symbol='QQQ', exchange='SMART', currency='USD')
Traceback (most recent call last):
File "C:\Users\Devx86\Desktop\InteractiveBrokers-PairsTrading-Algo-master\main.py", line 29, in <module>
model.run(to_trade=to_trade, trade_qty=100)
File "C:\Users\Devx86\Desktop\InteractiveBrokers-PairsTrading-Algo-master\models\hft_model_1.py", line 67, in run
self.recalculate_strategy_params()
File "C:\Users\Devx86\Desktop\InteractiveBrokers-PairsTrading-Algo-master\models\hft_model_1.py", line 182, in recalculate_strategy_params
resampled = self.df_hist.resample('30s').ffill().dropna()
File "C:\Users\Devx86\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\generic.py", line 8155, in resample
base=base, key=on, level=level)
File "C:\Users\Devx86\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\resample.py", line 1250, in resample
return tg._get_resampler(obj, kind=kind)
File "C:\Users\Devx86\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\resample.py", line 1380, in _get_resampler
"but got an instance of %r" % type(ax).__name__)
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index'
I would really appreciate help, thank you.
JayneFrack commented
I think that I've included all libraries and I connected to my IB successfully I think but it still doesn't work. I would greatly appreciate any help possible
zbanga commented
@JayneFrack You need to subscribe to the relevant data feeds within Interactive Brokers
chicago-joe commented
@JayneFrack Login to your account and subscribe to the US Indexes data feed