brndnmtthws / thetagang

ThetaGang is an IBKR bot for collecting money
GNU Affero General Public License v3.0
1.94k stars 255 forks source link

Fix empty portfolio when user has multiple accounts #272

Closed junyuanz1 closed 1 year ago

junyuanz1 commented 1 year ago

Problem:

Solution:

bpeterson92 commented 1 year ago

Running into this issue with multiple accounts under one login, where "Portfolio positions: " doesn't populate, but "Account Summary: " values are getting pulled correctly in the output.

tailing ib_insync logs shows all positions and accounts are getting called (strangely no account summary details here), yet none of the accounts I try in thetagang.toml will work. thetagang continues to try and allocate as if I have zero positions, which isn't true. No other errors get reported, so leads me to think syntax/config/etc are all correct.

Paper account worked flawlessly since there wasn't multiple account numbers in position summary.

brndnmtthws commented 1 year ago

Odd, you could try modifying the code and experimenting with the account APIs. Maybe try printing the output from this call with print(self.ib.managedAccounts()) and make sure the account details match what you expect.

bpeterson92 commented 1 year ago

output of ib.managedAccounts() is what I expect. Are there more in-depth ways I can log this? Seems weird it pulls NLV/buying power/etc. correctly but not positions.

bpeterson92 commented 1 year ago

Not sure what changed, but thetagang 1.6.0 is now working with multiple accounts.