High-Frequency-Trading-Model-with-IB icon indicating copy to clipboard operation
High-Frequency-Trading-Model-with-IB copied to clipboard

Error when running

Open JayneFrack opened this issue 5 years ago • 1 comments

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 avatar Feb 27 '20 15:02 JayneFrack

Looks like you do not have market data permissions on your account

SC4RECOIN avatar Oct 30 '20 17:10 SC4RECOIN