示例#1
0
    def sessions(self):
        sessions = []
        self.cursor.execute("SELECT sessionId, targetCompId, senderCompId, outboundSeqNo, inboundSeqNo FROM session")
        for sessionInfo in self.cursor:
            session = FIXSession(sessionInfo[0], sessionInfo[1], sessionInfo[2])
            session.sndSeqNum = sessionInfo[3]
            session.nextExpectedMsgSeqNum = sessionInfo[4] + 1
            sessions.append(session)

        return sessions
示例#2
0
    def sessions(self):
        sessions = []
        self.cursor.execute("SELECT sessionId, targetCompId, senderCompId, outboundSeqNo, inboundSeqNo FROM session")
        for sessionInfo in self.cursor:
            session = FIXSession(sessionInfo[0], sessionInfo[1], sessionInfo[2])
            session.sndSeqNum = sessionInfo[3]
            session.nextExpectedMsgSeqNum = sessionInfo[4] + 1
            sessions.append(session)

        return sessions
示例#3
0
    def createSession(self, targetCompId, senderCompId):
        session = None
        try:
            self.cursor.execute("INSERT INTO session(targetCompId, senderCompId) VALUES(?, ?)", (targetCompId, senderCompId))
            sessionId = self.cursor.lastrowid
            self.conn.commit()
            session = FIXSession(sessionId, targetCompId, senderCompId)
        except sqlite3.IntegrityError:
            raise RuntimeError("Session already exists for TargetCompId: %s SenderCompId: %s" % (targetCompId, senderCompId))

        return session
    def testAddExtractMsg(self):
        journal = Journaler()

        msg = FIXMessage("AB")
        msg.setField("45", "dgd")
        msg.setField("32", "aaaa")
        msg.setField("323", "bbbb")

        rptgrp1 = FIXContext()
        rptgrp1.setField("611", "aaa")
        rptgrp1.setField("612", "bbb")
        rptgrp1.setField("613", "ccc")

        msg.addRepeatingGroup("444", rptgrp1, 0)
        session = FIXSession(1, "S1", "T1")
        for i in range(0, 5):
            msg.setField("34", str(i))
            journal.persistMsg(msg, session, MessageDirection.OUTBOUND)

        msg = journal.recoverMsg(session, MessageDirection.OUTBOUND, 1)