diff --git a/examples/example_all_functionality.py b/examples/example_all_functionality.py index 2ff8783d..2a2bf1d1 100644 --- a/examples/example_all_functionality.py +++ b/examples/example_all_functionality.py @@ -8,6 +8,10 @@ import deephaven_ib as dhib +## Setup + +account = "DU9999999" # Set your account here + ########################################################################### # WARNING: THIS SCRIPT EXECUTES TRADES!! ONLY USE ON PAPER TRADING ACCOUNTS ########################################################################### @@ -483,7 +487,7 @@ def get_contracts() -> Dict[str, Contract]: print(contract) order = Order() -order.account = "DF4943843" +order.account = account order.action = "BUY" order.orderType = "LIMIT" order.totalQuantity = 1 @@ -494,7 +498,7 @@ def get_contracts() -> Dict[str, Contract]: print("Placing order: END") order = Order() -order.account = "DF4943843" +order.account = account order.action = "BUY" order.orderType = "LIMIT" order.totalQuantity = 1 @@ -505,7 +509,7 @@ def get_contracts() -> Dict[str, Contract]: print("Placing order: START") order = Order() -order.account = "DF4943843" +order.account = account order.action = "BUY" order.orderType = "LIMIT" order.totalQuantity = 1 diff --git a/examples/example_market_maker.py b/examples/example_market_maker.py index f4424676..2c69403c 100644 --- a/examples/example_market_maker.py +++ b/examples/example_market_maker.py @@ -29,7 +29,7 @@ ## Setup -account = "DU4943848" +account = "DU9999999" # Set your account here max_position_dollars = 10000.0 em_time = "PT00:02:00" @@ -179,6 +179,8 @@ def update_orders(contract_id: int, pred_low: float, pred_high: float, buy_order "Position = replaceIfNull(Position, 0.0)", "PositionDollars = Position * MidPrice", "MaxPositionDollars = max_position_dollars", + ]) \ + .update_view([ "BuyOrder = PositionDollars < MaxPositionDollars", "SellOrder = PositionDollars > -MaxPositionDollars", ]) \ diff --git a/examples/example_read_only_functionality.py b/examples/example_read_only_functionality.py index a8ef9144..c0658733 100644 --- a/examples/example_read_only_functionality.py +++ b/examples/example_read_only_functionality.py @@ -8,6 +8,10 @@ import deephaven_ib as dhib +## Setup + +account = "DU9999999" # Set your account here + print("==============================================================================================================") print("==== Create a client and connect.") print("==== ** Accept the connection in TWS **") @@ -479,7 +483,7 @@ def get_contracts() -> Dict[str, Contract]: print(contract) order = Order() -order.account = "DF4943843" +order.account = account order.action = "BUY" order.orderType = "LIMIT" order.totalQuantity = 1 @@ -496,7 +500,7 @@ def get_contracts() -> Dict[str, Contract]: print("Placing order -- confirm fail: END") order = Order() -order.account = "DF4943843" +order.account = account order.action = "BUY" order.orderType = "LIMIT" order.totalQuantity = 1 @@ -513,7 +517,7 @@ def get_contracts() -> Dict[str, Contract]: print("Placing order -- confirm fail: START") order = Order() -order.account = "DF4943843" +order.account = account order.action = "BUY" order.orderType = "LIMIT" order.totalQuantity = 1