0

I have the following code running to return the specified account value.

def returnAccountValue(tag="SettledCash", currency="USD"):

         accountValueString = ib.accountValues()

                 for a in accountValueString:

                        if a.tag == tag and a.currency == currency:

                                return float(a.value)

Unfortunately this returns none, but when I use a different tag such as 'AvailableFunds' it returns the correct value. Has anyone else experienced this? Are there any issues with my code? Please let me know.

1 Answers1

0

"SettledCash" is not a valid tag, while "AvailableFunds" is a valid tag.

Since IB_insync is an interface to the TWS Api, it will only be able to retrieve the data available from within the Api itself.

Have a look here, https://interactivebrokers.github.io/tws-api for a complete list of available data and short descriptions of the tags.

dno
  • 971
  • 6
  • 13
  • So how would I go upon getting the balance of settled cash in my account? Is "AvailableFunds" the correct tag? – OffensiveName Nov 04 '22 at 21:37
  • "AvailableFunds" is most likely the tag you're looking for. It does not include any unreal PnL, and tells you 'tells what you have available for trading'. – dno Nov 05 '22 at 21:02