When I run the code, it executes the command and opens the incomming file, but I cannot implement any other function. The file does not exist or cannot be opened. ` import time import quickfix import quickfix44 from django.shortcuts import render from django.shortcuts import render import threading from django.http import JsonResponse from quickfix import Message, MsgType from django.views.decorators.csrf import csrf_exempt symbol=['EURUSD', 'NZDAUD'] messages=[] messages1=[] messages2=[] should_stop_data_flow = True
def messageToString(message):
............
def securityListRequest(sessionID):
...............
def marketDataRequest(sessionID):
............
class Application(quickfix.Application):
def __init__(self):
super().__init__()
def onCreate(self, sessionID):
print("onCreate:")
self.session_id = sessionID
target = sessionID.getTargetCompID().getString()
sender = sessionID.getSenderCompID().getString()
return
def onLogon(self, sessionID):
self.sessionID = sessionID
print("onLogon:", f"Session ID: {self.sessionID}")
message = marketDataRequest(sessionID)
print("market data request:", messageToString(message))
quickfix.Session.sendToTarget(message, sessionID)
def onLogout(self, sessionID):
print("onLogout..")
return
def toAdmin(self, message, sessionID):
print("toAdmin:", messageToString(message), '\n')
return
def toApp(self, message, sessionID):
print("toApp:", messageToString(message), '\n')
return
def fromAdmin(self, message, sessionID):
print("fromAdmin:", messageToString(message), '\n')
return
def fromApp( self,message, sessionID):
msg = messageToString(message)
print("fromApp:", msg, '\n')
def keepAlive(self):
while True:
time.sleep(30)
def run_fix():
global app
settings = quickfix.SessionSettings("CCFIX.ini")
app = Application()
storeFactory = quickfix.FileStoreFactory(settings)
logFactory = quickfix.FileLogFactory(settings)
initiator = quickfix.SocketInitiator(app, storeFactory, settings, logFactory)
initiator.start()
app.keepAlive()
def start_fix_thread():
fix_thread = threading.Thread(target=run_fix)
fix_thread.start()
def fix_example_view(request):
global symbol
start_fix_thread()
return render(request, 'show_messages.html', {'messages': messages})`