Add Tastytrade client to Iron Condor example

This commit is contained in:
moshferatu 2023-09-15 08:45:19 -07:00
parent d3ddfc50e5
commit 190a6f9a73

View File

@ -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