ranaroussi / ezibpy

ezIBpy, a Pythonic Client for Interactive Brokers API
Apache License 2.0
324 stars 116 forks source link

Market Data not subscribed #23

Closed numyio closed 5 years ago

numyio commented 6 years ago

This might be a newbie question, but I have been reading the docs for IB API and couldn't find my answer.

I am trying to run the following code from the example provided:

stk_contract = ibConn.createStockContract("AAPL")

fut_contract = ibConn.createFuturesContract("ES", expiry="201606") csh_contract = ibConn.createCashContract("EUR", currency="USD") opt_contract = ibConn.createOptionContract("AAPL", expiry="20160425", strike=105.0, otype="PUT")

And when running this command:

ibConn.requestMarketData() # This gives me an error

With the following message:

2018-05-17 07:48:29,469 [ERROR] ezibpy: [#354] Requested market data is not subscribed.Delayed market data is available.Error&NYSE/STK/Top

This is simulated trading currently, and I found in the docs that I have to run a command to subscribe to market data type.

# ibConn.reqMarketDataType(3) # This is what the docs say to request delayed market data?

Interactive Brokers Doc for this: https://interactivebrokers.github.io/tws-api/market_data_type.html

Is there a similar command for ezibpy? Or do I need to contact IB for delayed market data?

I appreciate any help!

asnatm commented 6 years ago

@numyio did u solve this issue? can u share the code? Highly appreciated!

numyio commented 5 years ago

I did find an approach around this. Please reach out again and I can get it back to you soon. @asnatm

SantoshSrinivas79 commented 5 years ago

@numyio I have the same issue too. Could you pls share the code?

SantoshSrinivas79 commented 5 years ago

@numyio any code you can share to get delayed market data?

numyio commented 5 years ago

@SantoshSrinivas79 @asnatm Apologize for the delay. I mispoke. I did get it to work with TWS Python's API.

tws.reqMarketDataType(3)

In order for it to get it to work with ezibpy I would have had to manipulate the package. My theory at that point was to create my own wrapper similar to ezibpy.

It opens up a socket and streams market data... Personally think there is a better way for this to work.

I would recommend looking at TWS documentation.

Regards.

SantoshSrinivas79 commented 5 years ago

Thank you. I'm using erdewit/ib_insync and its working pretty well!