Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Modify examples to avoid known bugs #129

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 3 additions & 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 Expand Up @@ -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",
]) \
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
Loading