Skip to content

Commit

Permalink
fix: Modify examples to avoid known bugs (#129)
Browse files Browse the repository at this point in the history
* Modify examples to avoid a known bug
(deephaven/deephaven-core#5998)
* Make the examples easier to change the account number
  • Loading branch information
chipkent authored Aug 28, 2024
1 parent e5f0164 commit b42069c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions examples/example_all_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
###########################################################################
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/example_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

## Setup

account = "DU4943848"
account = "DU9999999" # Set your account here
max_position_dollars = 10000.0
em_time = "PT00:02:00"

Expand Down
10 changes: 7 additions & 3 deletions examples/example_read_only_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 **")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b42069c

Please sign in to comment.