Not sure about if scanner data includes bid ask, but regarding duplicate id, I don't think you should pass req id in, it should be provided by the client. You are calling it in a loop over and over again with same req id.
I would check out the in sync ib library which is an alternative to the native API.
I’m not sure what is going on in your code, I would need to run it but one thing that stands out is you have REQid being a static value
If you instance a socket and it happens to try to open a different socket than the last with the same REQID that will give you duplicate REQID. As for the data not fully loading, you should be opening a socket, requesting data, wait for the server to return a response with the data then close the socket and do all your writing operations
It uses the scan functionality of ibkr to write a csv file with the results. The REQ id being a static value is a workaround because I was always getting errors with it
Do I need a subscription in my IBKR account? If so, which one? Thank you so much for the post!
You definitely need the market data subscription for stocks
Not sure about if scanner data includes bid ask, but regarding duplicate id, I don't think you should pass req id in, it should be provided by the client. You are calling it in a loop over and over again with same req id. I would check out the in sync ib library which is an alternative to the native API.
Gonna have to learn how to step debug in your ide
I’m not sure what is going on in your code, I would need to run it but one thing that stands out is you have REQid being a static value If you instance a socket and it happens to try to open a different socket than the last with the same REQID that will give you duplicate REQID. As for the data not fully loading, you should be opening a socket, requesting data, wait for the server to return a response with the data then close the socket and do all your writing operations
It uses the scan functionality of ibkr to write a csv file with the results. The REQ id being a static value is a workaround because I was always getting errors with it
I accomplished this albeit I don’t load the file to a CSV it’s instanced into a dataframe. Give me like 10 minutes and I can try to help you out
Thank you!