Currently, I am trying to connect to the FIX Protocol API (testnet). I have problem and I am not sure at which part is the problem.
I have some basic tcp/tls connection, I have tested it with api.binance.com, and it’s returns some result, but the fix api returns nothing and also doesnot return any exception. At this example I am trying send the example message from the doc.
import socket
import ssl
hostname = 'fix-oe.testnet.binance.vision'
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.load_verify_locations('cacert.pem')
with socket.create_connection((hostname, 9000)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
print(ssock.version())
r = ssock.write(
b"8=FIX.4.4|9=248|35=A|34=1|49=5JQmUOsm|52=20240612-08:52:21.613|56=SPOT|95=88|96=KhJLbZqADWknfTAcp0ZjyNz36Kxa4ffvpNf9nTIc+K5l35h+vA1vzDRvLAEQckyl6VDOwJ53NOBnmmRYxQvQBQ==|98=0|108=30|141=Y|553=W5rcOD30c0gT4jHK8oX5d5NbzWoa0k4SFVoTHIFNJVZ3NuRpYb6ZyJznj8THyx5d|25035=1|10=000|"
)
print(
ssock.recv(2048)
)