From f80ae0727e2cf562fc541217356483497765f8e9 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Mon, 18 Dec 2023 05:29:53 -0800 Subject: [PATCH] Add order submission example script --- order_submission_example.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 order_submission_example.py diff --git a/order_submission_example.py b/order_submission_example.py new file mode 100644 index 0000000..c29aff9 --- /dev/null +++ b/order_submission_example.py @@ -0,0 +1,14 @@ +from datetime import datetime +from ibkr import Client, OptionLeg +from ibkr.option_type import PUT +from ibkr.order_action import BUY, SELL + +client = Client(host = '127.0.0.1', port = 7497) + +symbol, sub_symbol = 'SPX', 'SPXW' +expiration = datetime.now() + +short_leg = OptionLeg(symbol, expiration, 4695.0, PUT, SELL, sub_symbol) +long_leg = OptionLeg(symbol, expiration, 4645.0, PUT, BUY, sub_symbol) + +client.submit_combo_option_order([short_leg, long_leg], 1) \ No newline at end of file