import shinybroker as sb
import pandas as pd
= 265598 # AAPL Stock
con_id
= sb.create_ibkr_socket_conn()
ib_conn = ib_conn['ib_socket']
ib_socket
sb.send_ib_message(=ib_socket,
s=sb.req_sec_def_opt_params(
msg=1,
reqId="AAPL",
underlyingSymbol="",
futFopExchange="STK",
underlyingSecType=265598
underlyingConId
)
)
# start_time = datetime.datetime.now()
# while (datetime.datetime.now() - start_time).seconds < timeout:
= sb.read_ib_msg(sock=ib_socket)
incoming_msg = []
sdops while incoming_msg[0] != sb.functionary['incoming_msg_codes'][
'SECURITY_DEFINITION_OPTION_PARAMETER_END'
]:= sb.read_ib_msg(sock=ib_socket)
incoming_msg if incoming_msg[0] == sb.functionary['incoming_msg_codes'][
'SECURITY_DEFINITION_OPTION_PARAMETER'
]:=incoming_msg[2:]))
sdops.append(sb.format_sec_def_opt_params_input(sdop
ib_socket.close()
print(
=True)
pd.concat(sdops, ignore_index'exchange')
.sort_values( )
"Headless Mode" for In-App Scripting and Development
“Somewhat Interactive” Development Mode
As you’re developing apps, it’s sometimes useful to just create a scratch file containing a bit of code that grabs some input. You can watch the information get printed by the async reader loop as it becomes available off the socket, and maybe copy-paste it from the terminal printout do perform some of your exploratory development work.