Error code 162 - no market data subscription

Hi I'm trying to collect history for ASX stocks.

I've followed all steps in Error code 162: Historical Market Data Service error message:No market data permissions as best I can.

I've subscribed to market data, including specific to ASX (ASX Total) and shared it with my paper account.

This error occurs for ALL asx listings.
I've followed the Market Data Assistant Tool.
I can view many stocks in TWS with no problem.
I've upgraded to version 1.6

The only thing I can't do is the account limit validation Usage Guide because this triggers a MFA/ security code sent to my mobile, which there is no way to enter in jupyter.

Is there a way to input this, along with password when calling
set_credentials()

and any other tips to receive data?

Thanks

For 2 factor auth, you need to open the IB Gateway GUI to complete the login:

https://www.quantrocket.com/docs/#deploy-enter-ib-login-security-card-required-

For permissions, if you recently enabled them in IB Client Portal, you might need to stop and restart IB Gateway for them to take effect. Also there sometimes seems to be a bit of a delay before IB Gateway is aware you have enabled the permission.

Hi Brian,

Thanks very much for your help!

I've followed the account limit validation steps, but despite waiting more than 10 minutes, my account_balance and account_balance_under_limit keys are not displayed.

I followed steps re permissions several days ago. I've tried stopping and restarting the gateway.

Issues:

  1. Still not seeing account balance.

IB provides two usernames for live and paper
(removed)
How does this relate to credentials in QR?:
(removed)

I'm definitely subscribed in IB:
(removed)

  1. I'm now consistently getting error code 200 for ALL ASX listings. This seems unlikely to be anything from Error code 200: No security definition has been found for the request . Except maybe a bug?

  2. I noticed there was a similar, recent issue for non-North American users, that was resolved with later versions???

Can you confirm that ASX history is collectable (for anyone?).

Thanks again.

There are definitely users who are working with ASX. To simplify, try testing with a single security, BHP. See if you can:

collect the listing:

quantrocket master collect -i 4036812

create a db for BHP and collect the history:

quantrocket history create-db 'bhp-1d' -i 4036812 -z '1 day' 
quantrocket history collect 'bhp-1d'

If not, what do the logs say?

Thanks again.

Error code 162

In IB Gateway GUI I've got 9 clients, and Market Data Farm is disconnected / red. Is that related?
Any other tips?

IB and quantrocket don't seem to be matching up for some reason...

FYI, I did use a different email initially for a trial that expired, then signed up with another email. From memory, I may have had the same username for both.

Appreciate your help.

Ultimately it's just a permission issue. The IB API mirrors Trader Workstation so I recommend logging into Trader Workstation, making sure you can pull up the data there (and that it's not delayed data), then logging in with the exact same credentials and trading mode in QuantRocket.

Hi,

after all that, turns out my initial funds had bounced. Now that I've sorted that out with IB, working fine.

IB subscriptions also listed as active despite not actually being the case until funds were received (which seems obvious in retrospect!).

Thanks again, @Brian, for your patience.

Cheers,

James.

Hi @drjamescondon ,

What do you mean by bounced?
I have a funded account and this same occurrence is happening to me. I was able to pull data about 2 days ago fine, and came back today to being told I have no market data subscription for even baseline securities like SPY.
I checked in the IB Account Management and everything says active as well.

@Brian you can see only market data farm is disconnected, is something else wrong?

Thanks,

Kevin

I would log in to Trader Workstation and if you can't get data there and expect to, I would open a support ticket with IB. If you can get data in TWS, then restarting IB Gateway might help, as well as going through this checklist:

Hi Brian I have tried each of these on just SPY. Here is my current subscriptions and confirmed that TWS is accessing live data. I crossed reference an additional live feed app I have.
I have started and stopped the gateways multiple times.

Now, after restarting the gateway I am getting the continual connect/disconnect issue. My 2nd factor authentication prompts me every 5-10 seconds.

I'm wondering if this is the suspected case. How can I delete additional ibg's? I searched the API/Docs. I had attempted to set credentials for ibg1 & ibg2, live and paper respectively. I am ok deleting the ibg2 and just toggling live/paper for ibg1.

For anyone else I believe that setting quantrocket.launchpad.permissions.yml was the key. The database started to collect again after I saved and loaded it. At least it has given me a timeline of the collection.

Running paper and live for the same account at the same time will trigger back-and-forth disconnects due to IB restrictions, so yes, you should run 1 gateway per account and switch back and forth to paper or live.

To remove the extra gateway, delete ibg2 from your docker-compose.override.yml then run:

docker-compose up -d --remove-orphans

(quantrocket.launchpad.permissions.yml only determines whether QuantRocket should make requests for specific symbols/exchanges to specific gateways and doesn't seem related to your issue.)

1 Like

Hey Brian I appreciate the due diligence. I got it to work. Here is what I had to do for anyone else wondering.

  1. I deleted quantrocket.launchpad.permissions.yml within /codeload inside QR.
  2. Then I deleted docker-compose.override.yml within my local location cd ~/quantrocket.
  3. Then I ran docker-compose up -d --remove-orphans
  4. I reset my credentials with just my paper trading account to ibg1.
1 Like