示例#1
0
    def test_reverseRoute(self):
        header = fix.Header()
        beginString = fix.BeginString( "FIX.4.2" )
        senderCompID = fix.SenderCompID( "SenderCompID" )
        targetCompID = fix.TargetCompID( "TargetCompID" )
        onBehalfOfCompID = fix.OnBehalfOfCompID( "OnBehalfOfCompID" )
        onBehalfOfSubID = fix.OnBehalfOfSubID( "OnBehalfOfSubID" )
        onBehalfOfLocationID = fix.OnBehalfOfLocationID( "OnBehalfOfLocationID" )
        deliverToCompID = fix.DeliverToCompID( "DeliverToCompID" )
        deliverToSubID = fix.DeliverToSubID( "DeliverToSubID" )
        deliverToLocationID = fix.DeliverToLocationID( "DeliverToLocationID" )

        reversedMessage = fix.Message()
        reversedHeader = reversedMessage.getHeader()

        header.setField( beginString )
        header.setField( senderCompID )
        header.setField( targetCompID )
        header.setField( onBehalfOfCompID )
        header.setField( onBehalfOfSubID )
        header.setField( onBehalfOfLocationID )
        header.setField( deliverToCompID )
        header.setField( deliverToSubID )
        header.setField( deliverToLocationID )

        reversedMessage.reverseRoute( header );
        self.assertTrue( reversedHeader.getField( beginString ).getString() == "FIX.4.2" )
        self.assertTrue( reversedHeader.getField( senderCompID ).getString() == "TargetCompID" )
        self.assertTrue( reversedHeader.getField( targetCompID ).getString() == "SenderCompID" )
        self.assertTrue( reversedHeader.getField( onBehalfOfCompID ).getString() == "DeliverToCompID" )
        self.assertTrue( reversedHeader.getField( onBehalfOfSubID ).getString() == "DeliverToSubID" )
        self.assertTrue( reversedHeader.getField( onBehalfOfLocationID ).getString() == "DeliverToLocationID" )
        self.assertTrue( reversedHeader.getField( deliverToCompID ).getString() == "OnBehalfOfCompID" )
        self.assertTrue( reversedHeader.getField( deliverToSubID ).getString() == "OnBehalfOfSubID" )
        self.assertTrue( reversedHeader.getField( deliverToLocationID ).getString() == "OnBehalfOfLocationID" )

        header.setField( fix.BeginString("FIX.4.0" ) )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField( onBehalfOfLocationID ) == 0 )
        self.assertTrue( reversedHeader.isSetField( deliverToLocationID ) == 0 )

        header.setField( beginString )
        reversedMessage.reverseRoute( header )

        header.removeField( fix.OnBehalfOfCompID().getTag() )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField(deliverToCompID) == 0 )
        header.removeField( fix.DeliverToCompID().getTag() )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField(onBehalfOfCompID) == 0 )
        header.removeField( fix.OnBehalfOfSubID().getTag() )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField(deliverToSubID) == 0 )
        header.removeField( fix.DeliverToSubID().getTag() )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField(onBehalfOfSubID) == 0 )
        header.removeField( fix.OnBehalfOfLocationID().getTag() )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField(deliverToLocationID) == 0 )
        header.removeField( fix.DeliverToLocationID().getTag() )
        reversedMessage.reverseRoute( header )
        self.assertTrue( reversedHeader.isSetField(onBehalfOfLocationID) == 0 )
示例#2
0
dd = fix.DataDictionary(definitions.FIX50SP02)

begin_string = fix.BeginString()
body_length = fix.BodyLength()
message_type = fix.MsgType()
sender_id = fix.SenderCompID()
target_id = fix.TargetCompID()
msg_seq = fix.MsgSeqNum()
sender_sub_id = fix.SenderSubID()
target_sub_id = fix.TargetSubID()
duplicate_flag = fix.PossDupFlag()
user_req_type = fix.UserRequestType()
gateway_id = fix.MarketID()
orig_sending_time = fix.OrigSendingTime()
sending_time = fix.SendingTime()
on_behalf_id = fix.OnBehalfOfCompID()
check_sum = fix.CheckSum()

TOKEN_NO = 48
LTP = 1835
LTQ = 1843
LTT = 1844
AVG_TP = 1845
OPEN = 1861
CLOSE = 1809
HIGH = 1802
LOW = 1801
YEAR_HIGH = 1824
YEAR_LOW = 1825
VOLUME = 387
TURNOVER = 1840