diff --git a/iron_condor.py b/iron_condor.py index 3fa490f..e8c69c3 100644 --- a/iron_condor.py +++ b/iron_condor.py @@ -89,10 +89,6 @@ def enter_iron_condor(entry_time: datetime): logging.error('Error: %s', traceback.format_exc()) def _enter_iron_condor(entry_time: datetime): - ibkr_host = getenv('IBKR_HOST') - ibkr_port = getenv('IBKR_PORT') - ibkr_client = Client(host = ibkr_host, port = ibkr_port) - # The weekly symbol for SPX (SPXW) is required in order to distinguish from monthly options. symbol, sub_symbol = 'SPX', 'SPXW' expiration = datetime.now() @@ -123,6 +119,8 @@ def _enter_iron_condor(entry_time: datetime): logging.info(f'Short Call Strike: {short_call_strike}') logging.info(f'Long Call Strike: {long_call_strike}') + ibkr_client = Client() + trade_records = [] call_spread_details = {} put_spread_details = {} diff --git a/iron_condor_scheduler.py b/iron_condor_scheduler.py index a9dd06b..426a01f 100644 --- a/iron_condor_scheduler.py +++ b/iron_condor_scheduler.py @@ -22,9 +22,7 @@ def enter_trade(entry_time: datetime): def connection_successful(): try: - ibkr_host = getenv('IBKR_HOST') - ibkr_port = getenv('IBKR_PORT') - Client(host = ibkr_host, port = ibkr_port) + Client() return True except: return False