hackingthemarkets / interactive-brokers-web-api

A docker container and flask app for use with the Interactive Brokers Web API 1.0
Apache License 2.0
52 stars 30 forks source link

Will not work if trying to connect to DEMO/PAPER account #1

Open philferriere opened 1 month ago

philferriere commented 1 month ago

Hi Larry,

As always, thank you for sharing your work with us.

I just wanted to leave a note as a heads up for anyone else who tries this -- auth does not seem to stick if you are trying to access your paper account. I tried using both my live and paper account IDs as ACCOUNT_ID in app.py and logging in with my paper account login credentials. I get a 401 Client Error: Unauthorized for url in both cases when trying to access the /portfolio route.

And, yes, it does work if I use my my live account as ACCOUNT_ID and log in using my live account credentials followed by 2FA.

If anyone manages to make this work with their paper account, I would love to know what steps you followed!

Cheers, -- Phil

auphucdup commented 2 weeks ago

Hi Phil,

Got it working on my end.

For whatever reason the process is slightly different when logging into your paper account via the gateway - you need to use a paper username.

You can retrieve it from the Client web portal by logging in with your live username and then clicking through to "Paper Trading Account" in settings

You can "Reset Password" to set a password for the paper trading account.

You'll also want to note the Account Number so you can configure the docker-compose.yml for portfolio access.

Relevant documentation