import socket
def send_ati_command(command):
try:
# Connect to NinjaTrader ATI port
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect(('localhost', 36973))
s.sendall(command.encode())
data = s.recv(1024)
print('Received', repr(data.decode()))
except Exception as e:
print("An error occurred:", e)
# Example command
command = "PLACE;Account=Sim101;Instrument=NQ 03-24;Action=BUY;Qty=1;OrderType=MARKET;TIF=DAY"
send_ati_command(command)
Received '2\x00'
Can someone please identify what I am doing wrong here, Also, there is no log being created while sending the command.


Thanks a lot
Comment