Search code examples
pythoninteractive-brokerstws

Interactive Brokers accountSummary() change currency of values


I've built a program that communicates with IB TWS in Python. All seems to work, but I'm stuck struggling with one last issue: My account has EUR as base currency but I'll be trading in USD. Obviously I'd like to receive the values of the accountSummary() callback in USD, but it's giving me all the values in EUR now.

Does the api provide a way to customize that?

Any guidance would be highly appreciated.


Solution

  • When the "$LEDGER:CURRENCY" tag is specified, the account summary data will be returned only in the CURRENCY specified. The CashBalance and TotalCashBalance returned are the balance in that specific currency only as you see within the TWS Account Window.

    Example: "$LEDGER:USD", "$LEDGER:EUR", "$LEDGER:HKD" etc.

    self.reqAccountSummary(9003, "All", "$LEDGER:EUR")
    

    http://interactivebrokers.github.io/tws-api/account_summary.html#acct_summary_req

    If you have multiple currencies the "$LEDGER:ALL" will give a breakdown by currency.