@@ -16,13 +16,13 @@ def reqPositions(self):
1616 def positions (self ):
1717 return [
1818 SimpleNamespace (
19- account = "U18308207 " ,
19+ account = "U00000001 " ,
2020 contract = SimpleNamespace (symbol = "TQQQ" ),
2121 position = 3 ,
2222 avgCost = 100.0 ,
2323 ),
2424 SimpleNamespace (
25- account = "U18308207 " ,
25+ account = "U00000001 " ,
2626 contract = SimpleNamespace (
2727 symbol = "TQQQ" ,
2828 secType = "OPT" ,
@@ -35,7 +35,7 @@ def positions(self):
3535 avgCost = 3200.0 ,
3636 ),
3737 SimpleNamespace (
38- account = "U15998061 " ,
38+ account = "U00000000 " ,
3939 contract = SimpleNamespace (symbol = "AAPL" ),
4040 position = 5 ,
4141 avgCost = 200.0 ,
@@ -44,33 +44,33 @@ def positions(self):
4444
4545 def accountValues (self ):
4646 return [
47- SimpleNamespace (account = "U18308207 " , tag = "NetLiquidation" , currency = "USD" , value = "1000" ),
48- SimpleNamespace (account = "U18308207 " , tag = "AvailableFunds" , currency = "USD" , value = "250" ),
49- SimpleNamespace (account = "U15998061 " , tag = "NetLiquidation" , currency = "USD" , value = "2000" ),
50- SimpleNamespace (account = "U15998061 " , tag = "AvailableFunds" , currency = "USD" , value = "500" ),
47+ SimpleNamespace (account = "U00000001 " , tag = "NetLiquidation" , currency = "USD" , value = "1000" ),
48+ SimpleNamespace (account = "U00000001 " , tag = "AvailableFunds" , currency = "USD" , value = "250" ),
49+ SimpleNamespace (account = "U00000000 " , tag = "NetLiquidation" , currency = "USD" , value = "2000" ),
50+ SimpleNamespace (account = "U00000000 " , tag = "AvailableFunds" , currency = "USD" , value = "500" ),
5151 ]
5252
5353
5454class IbkrPortfolioTests (unittest .TestCase ):
5555 def test_fetch_portfolio_snapshot_filters_by_account_id (self ) -> None :
5656 ib = FakeIB ()
5757
58- snapshot = fetch_portfolio_snapshot (ib , account_ids = ("U18308207 " ,), wait_seconds = 0 )
58+ snapshot = fetch_portfolio_snapshot (ib , account_ids = ("U00000001 " ,), wait_seconds = 0 )
5959
6060 self .assertTrue (ib .req_positions_called )
6161 self .assertEqual (snapshot .total_equity , 1000.0 )
6262 self .assertEqual (snapshot .buying_power , 250.0 )
6363 self .assertEqual (tuple (position .symbol for position in snapshot .positions ), ("TQQQ" ,))
64- self .assertEqual (snapshot .positions [0 ].account_id , "U18308207 " )
65- self .assertEqual (snapshot .metadata ["account_ids" ], ("U18308207 " ,))
64+ self .assertEqual (snapshot .positions [0 ].account_id , "U00000001 " )
65+ self .assertEqual (snapshot .metadata ["account_ids" ], ("U00000001 " ,))
6666 self .assertEqual (snapshot .metadata ["option_positions" ][0 ]["underlier" ], "TQQQ" )
6767 self .assertEqual (snapshot .metadata ["option_positions" ][0 ]["right" ], "C" )
6868 self .assertEqual (snapshot .metadata ["option_positions" ][0 ]["strike" ], 70.0 )
6969
7070 def test_fetch_portfolio_snapshot_sums_selected_accounts (self ) -> None :
7171 snapshot = fetch_portfolio_snapshot (
7272 FakeIB (),
73- account_ids = ("U18308207 " , "U15998061 " ),
73+ account_ids = ("U00000001 " , "U00000000 " ),
7474 wait_seconds = 0 ,
7575 )
7676
0 commit comments