From 190a6f9a73585d290b4fcdf9ac3b4f1c3c09bf02 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Fri, 15 Sep 2023 08:45:19 -0700 Subject: [PATCH] Add Tastytrade client to Iron Condor example --- iron_condor.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/iron_condor.py b/iron_condor.py index a3af87b..0ee293d 100644 --- a/iron_condor.py +++ b/iron_condor.py @@ -1,7 +1,20 @@ from datetime import datetime +from dotenv import load_dotenv from ibkr import Client +from os import getenv +from tastytrade import Tastytrade -ibkr_client = Client(host = '127.0.0.1', port = 7497) +load_dotenv() + +ibkr_host = getenv("IBKR_HOST") +ibkr_port = getenv("IBKR_PORT") +ibkr_client = Client(host = ibkr_host, port = ibkr_port) + +tastytrade_account = getenv("TASTYTRADE_ACCOUNT") +tastytrade_username = getenv("TASTYTRADE_USERNAME") +tastytrade_password = getenv("TASTYTRADE_PASSWORD") +tastytrade_client = Tastytrade(tastytrade_username, tastytrade_password) +tastytrade_client.login() underlying_ticker = ibkr_client.get_ticker('SPX', 'CBOE') current_price = underlying_ticker.last