Spaces:
Running
Running
Update pages/2_Portfolio_Builder.py
Browse files
pages/2_Portfolio_Builder.py
CHANGED
|
@@ -34,8 +34,6 @@ def open_nested_event_loop():
|
|
| 34 |
|
| 35 |
open_nested_event_loop()
|
| 36 |
|
| 37 |
-
from ib_insync import *
|
| 38 |
-
|
| 39 |
|
| 40 |
def get_positions(account):
|
| 41 |
positions = ib.portfolio(account)
|
|
@@ -77,6 +75,7 @@ obb.account.login(pat=os.environ['open_bb_pat'])
|
|
| 77 |
if re.search('AuthenticAMD', platform.processor()) and 'tickers' not in st.session_state: # use live ibkr portfolio if ran from local machine
|
| 78 |
try:
|
| 79 |
# Initialize IB connection here
|
|
|
|
| 80 |
with IB().connect('127.0.0.1', 7497, clientId=0, timeout=10) as ib:
|
| 81 |
# Assuming you're connecting to a local TWS instance with default settings
|
| 82 |
paper_acct = ib.managedAccounts()[0]
|
|
|
|
| 34 |
|
| 35 |
open_nested_event_loop()
|
| 36 |
|
|
|
|
|
|
|
| 37 |
|
| 38 |
def get_positions(account):
|
| 39 |
positions = ib.portfolio(account)
|
|
|
|
| 75 |
if re.search('AuthenticAMD', platform.processor()) and 'tickers' not in st.session_state: # use live ibkr portfolio if ran from local machine
|
| 76 |
try:
|
| 77 |
# Initialize IB connection here
|
| 78 |
+
from ib_insync import *
|
| 79 |
with IB().connect('127.0.0.1', 7497, clientId=0, timeout=10) as ib:
|
| 80 |
# Assuming you're connecting to a local TWS instance with default settings
|
| 81 |
paper_acct = ib.managedAccounts()[0]
|