Skip to content

Commit b42069c

Browse files
authored
fix: Modify examples to avoid known bugs (#129)
* Modify examples to avoid a known bug (deephaven/deephaven-core#5998) * Make the examples easier to change the account number
1 parent e5f0164 commit b42069c

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

examples/example_all_functionality.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import deephaven_ib as dhib
1010

11+
## Setup
12+
13+
account = "DU9999999" # Set your account here
14+
1115
###########################################################################
1216
# WARNING: THIS SCRIPT EXECUTES TRADES!! ONLY USE ON PAPER TRADING ACCOUNTS
1317
###########################################################################
@@ -483,7 +487,7 @@ def get_contracts() -> Dict[str, Contract]:
483487
print(contract)
484488

485489
order = Order()
486-
order.account = "DF4943843"
490+
order.account = account
487491
order.action = "BUY"
488492
order.orderType = "LIMIT"
489493
order.totalQuantity = 1
@@ -494,7 +498,7 @@ def get_contracts() -> Dict[str, Contract]:
494498
print("Placing order: END")
495499

496500
order = Order()
497-
order.account = "DF4943843"
501+
order.account = account
498502
order.action = "BUY"
499503
order.orderType = "LIMIT"
500504
order.totalQuantity = 1
@@ -505,7 +509,7 @@ def get_contracts() -> Dict[str, Contract]:
505509
print("Placing order: START")
506510

507511
order = Order()
508-
order.account = "DF4943843"
512+
order.account = account
509513
order.action = "BUY"
510514
order.orderType = "LIMIT"
511515
order.totalQuantity = 1

examples/example_market_maker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
## Setup
3131

32-
account = "DU4943848"
32+
account = "DU9999999" # Set your account here
3333
max_position_dollars = 10000.0
3434
em_time = "PT00:02:00"
3535

examples/example_read_only_functionality.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import deephaven_ib as dhib
1010

11+
## Setup
12+
13+
account = "DU9999999" # Set your account here
14+
1115
print("==============================================================================================================")
1216
print("==== Create a client and connect.")
1317
print("==== ** Accept the connection in TWS **")
@@ -479,7 +483,7 @@ def get_contracts() -> Dict[str, Contract]:
479483
print(contract)
480484

481485
order = Order()
482-
order.account = "DF4943843"
486+
order.account = account
483487
order.action = "BUY"
484488
order.orderType = "LIMIT"
485489
order.totalQuantity = 1
@@ -496,7 +500,7 @@ def get_contracts() -> Dict[str, Contract]:
496500
print("Placing order -- confirm fail: END")
497501

498502
order = Order()
499-
order.account = "DF4943843"
503+
order.account = account
500504
order.action = "BUY"
501505
order.orderType = "LIMIT"
502506
order.totalQuantity = 1
@@ -513,7 +517,7 @@ def get_contracts() -> Dict[str, Contract]:
513517
print("Placing order -- confirm fail: START")
514518

515519
order = Order()
516-
order.account = "DF4943843"
520+
order.account = account
517521
order.action = "BUY"
518522
order.orderType = "LIMIT"
519523
order.totalQuantity = 1

0 commit comments

Comments
 (0)