For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Getting current equity from IB
Hello, I am able to retrieve current IB Account balance (only) during IB-live sessions with self.broker.getvalue() inside next function, when strategies are running (store + strategies + cerebro).
Unfortunately I am not able to fetch the same outside strategies.
For this purpose I found ib_insync library and with few lines (*) is possible to get what I am looking for.
Is it possible get the same result with backtrader (without ib_insync)?
from ib_insync import * ib = IB() ib.connect('127.0.0.1', 4002, clientId=10) p = ib.positions() t = ib.openTrades() v = [v for v in ib.accountValues() if v.tag == 'NetLiquidationByCurrency' and v.currency == 'BASE'] print(p, t, v)
Thanks in advance