Simplify IBKR client creation by removing optional host and port input parameters
This commit is contained in:
parent
cfdfb1421f
commit
e91cbb696b
@ -89,10 +89,6 @@ def enter_iron_condor(entry_time: datetime):
|
|||||||
logging.error('Error: %s', traceback.format_exc())
|
logging.error('Error: %s', traceback.format_exc())
|
||||||
|
|
||||||
def _enter_iron_condor(entry_time: datetime):
|
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.
|
# The weekly symbol for SPX (SPXW) is required in order to distinguish from monthly options.
|
||||||
symbol, sub_symbol = 'SPX', 'SPXW'
|
symbol, sub_symbol = 'SPX', 'SPXW'
|
||||||
expiration = datetime.now()
|
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'Short Call Strike: {short_call_strike}')
|
||||||
logging.info(f'Long Call Strike: {long_call_strike}')
|
logging.info(f'Long Call Strike: {long_call_strike}')
|
||||||
|
|
||||||
|
ibkr_client = Client()
|
||||||
|
|
||||||
trade_records = []
|
trade_records = []
|
||||||
call_spread_details = {}
|
call_spread_details = {}
|
||||||
put_spread_details = {}
|
put_spread_details = {}
|
||||||
|
@ -22,9 +22,7 @@ def enter_trade(entry_time: datetime):
|
|||||||
|
|
||||||
def connection_successful():
|
def connection_successful():
|
||||||
try:
|
try:
|
||||||
ibkr_host = getenv('IBKR_HOST')
|
Client()
|
||||||
ibkr_port = getenv('IBKR_PORT')
|
|
||||||
Client(host = ibkr_host, port = ibkr_port)
|
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user