qtpylib icon indicating copy to clipboard operation
qtpylib copied to clipboard

Support for FA IB accounts

Open nwillemse opened this issue 7 years ago • 14 comments

Currently qtpylib doesn't support FA accounts. When using an FA account to log into TWS, no market data is retrieving from IB.

nwillemse avatar Dec 06 '16 02:12 nwillemse

I can confirm this. Related to issue #36

rterbush avatar Dec 06 '16 03:12 rterbush

There shouldn't be any difference between an individual or an FA account, as far as QTPyLib is concerned...

The bugs reported in issues #36 and #37 have been fixed with version 1.5.41. Can you upgrade to the latest version and confirm everything's working as it should now?

To upgrade, run:

$ pip install qtpylib --upgrade --no-cache-dir

Thanks

ranaroussi avatar Dec 06 '16 05:12 ranaroussi

When connecting to an FA account, the following error is printed.

2016-12-06 13:23:36,430 [INFO] qtpylib.blotter: Connecting to Interactive Brokers...
Server Version: 76
TWS Time at connection:20161206 06:23:35 MST
2016-12-06 13:23:37,489 [INFO] qtpylib.blotter: Connection established...
2016-12-06 13:23:37,546 [WARNING] qtpylib.blotter: [IB #321] Error validating request:-'aV' : cause - Invalid account code '0'.

In my experience, you need to specify the account you are acting on behalf of when using an FA account. This does appear to be working for data access (with exception of futures contracts which I will report in new issue), after recent changes, but will be a problem for trade allocation.

rterbush avatar Dec 06 '16 14:12 rterbush

Got it! This makes sense. I'll mark this issue as an #enhancement and try to find a solution in the near future.

Thanks for making me aware of this issue

ranaroussi avatar Dec 06 '16 14:12 ranaroussi

Here is a relevant part of the API as shared with me by @nwillemse

https://www.interactivebrokers.com/en/software/api/apiguide/java/updateaccountvalue.htm

rterbush avatar Dec 06 '16 14:12 rterbush

Looking in to it, tho I can't imagine this will be a quick fix :)

ranaroussi avatar Dec 06 '16 14:12 ranaroussi

Not a quick one, but not terrible either. There are some other good examples out there that I will see if I can dig up.

rterbush avatar Dec 06 '16 15:12 rterbush

👍

ranaroussi avatar Dec 06 '16 15:12 ranaroussi

Is there any update on this issue? Was the bug fixed?

adeora avatar Jul 26 '17 04:07 adeora

I still get the same error with the latest version(1.5.82).

2019-02-02 21:10:11,103 [INFO] qtpylib.blotter: Connecting to Interactive Brokers... Server Version: 76 TWS Time at connection:20190202 21:10:11 IST 2019-02-02 21:10:12,169 [INFO] qtpylib.blotter: Connection established... 2019-02-02 21:10:12,214 [ERROR] qtpylib.blotter: [IB #321] Error validating request:-'bl' : cause - Invalid account code '0'.

how to specify an account for trading?

githubbla avatar Feb 02 '19 19:02 githubbla

this is fixed? I got the same error: 2020-06-04 00:00:46,852 [ERROR] qtpylib.blotter: [IB #321] Error validating request:-'bq' : cause - Invalid account code '0'.

ch01ca avatar Jun 04 '20 00:06 ch01ca

I got the same error. any fix?

2020-06-19 20:06:15,302 [ERROR] qtpylib.blotter: [IB #321] Error validating request:-'bq' : cause - Invalid account code '0'.

FrankyHo avatar Jun 19 '20 12:06 FrankyHo

Same error. Doesn't run. Has anybody ever got this working in the last 5 years?

yubobao27 avatar May 07 '21 12:05 yubobao27

i think it has something to do with:

https://github.com/ranaroussi/ezibpy/blob/main/ezibpy/ezibpy.py#L2209

RusEu avatar Jan 07 '22 13:01 RusEu