fixField

Description

fixField task accesses FIX message field. FIX groups are also supported.

Parameters

Attribute Description Default Required
refid Reference name of the fixMessage to operate. None Yes
action Action to be done with fixField value. Possible values are:
get
set
getGroupCount
None Yes
group Parent group of the field in format '<Group Name>:<Entry Number>'. Group name is group's None No
name Name of the fixField to operate. Both tag name or tag number can be used as the value. None Yes
property Property name to be passed to action. Only one of property / value should be specified. None No
value Value to be passed to action. Only one of property / value should be specified.
Can be refered in 2 ways:
<fixField refid="new_order_single" action="set" name="Price">34.7</fixField> or
<fixField refid="new_order_single" action="set" name="Price" value="34.7"/>
None No
nullable Specifies if field can be null or not:
  • 'false' - makes test fail when trying to get value of non-existent tag;
  • 'true' - allowes to get value (empty) of non-existent tag.
  • false Yes

    Examples

    Set tag TransactTime of the message new_order_singleto the value of the new_order_trn_time propertty. Note: in order to work with message fields, the message should be defined earlier.

    	<!-- define message -->
    	<fixMessage id="new_order_single">
    		<field name="MsgType" value="D" />
    		<field name="HandlInst" value="1" />
    		<field name="Symbol" value="ZXZZT" />
    		<field name="Side" value="1" />
    		<field name="OrderQty" value="20000" />
    		<field name="OrdType" value="2" />
    		<field name="ClOrdID" value="Order#1" />
    		<field name="Price" value="34.7" />
    	</fixMessage>
    	<!-- Generate transaction time and store to the new_order_trn_time property -->
    	<tstamp>
    		<format property="new_order_trn_time" pattern="yyyyMMdd-hh:mm:ss.SSS" locale="en,US" offset="-5" unit="hour" />
    	</tstamp>
    	<!-- set field value -->
    	<fixField refid="new_order_single" action="set" name="TransactTime" property="new_order_trn_time" />
    


    Set tag values of two entries of NoMDEntries group of the hand_made_msg message.

    	<fixMessage id="hand_made_msg">
    		<field name="MsgType" value="X" />
    	</fixMessage>
    	
    	<property name="px_1" value="34.7" />
    	<property name="px_2" value="34.6" />
    	
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:1" name="MDUpdateAction" value="0" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:1" name="MDEntryType" value="3" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:1" name="MDEntrySize" value="190" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:1" name="MDEntryPx" property="px_1" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:1" name="Symbol" value="CSCO" />
    	
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:2" name="MDUpdateAction" value="0" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:2" name="MDEntryType" value="3" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:2" name="MDEntrySize" value="250" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:2" name="MDEntryPx" value="${px_2}" />
    	<fixField refid="hand_made_msg" action="set" group="NoMDEntries:2" name="Symbol" value="ZVZZT" />
    


    Get values of tags from the received exec_report message and print them to console.

    	<!-- receive the message -->
    	<fixReceive refid="simple_client" sender="TRGT" target="SNDR" type="FIX.4.4" repeat="1" count="1" timeout="10">
        	<fixMessage id="exec_report">
    	        <field name="MsgType" value="8" />
    	        <field name="SendingTime" />
    	        <field name="CheckSum" />
    	        <field name="ExecID" />
    	        <field name="OrderID" />
    		</fixMessage>
    	</fixReceive>
    	<!-- get tags' values -->
    	<fixField refid="exec_report" action="get" name="SendingTime" property="er_time" />
    	<fixField refid="exec_report" action="get" name="CheckSum" property="er_checksum" />
    	<fixField refid="exec_report" action="get" name="ExecID" property="er_exec_id" />
    	<fixField refid="exec_report" action="get" name="OrderID" property="er_order_id" />
            <fixField refid="exec_report" action="get" name="ExecRefID" property="er_exec_ref_id" nullable="true"/>
    
    	<!-- print the values -->
    	<echo>Execution Report OrderID: ${er_order_id}</echo>
    	<echo>Execution Report ExecID: ${er_exec_id}</echo>
    	<echo>Execution Report CheckSum: ${er_checksum}</echo>
    	<echo>Execution Report SendingTime: ${er_time}</echo>
            <if>
    	   <isset property="er_exec_ref_id" />
    	   <then>
    	      <echo>Execution Report ExecRefID: ${er_exec_ref_id}</echo>
    	   </then>
    	   <else>
                  <echo>Execution Report ExecRefID: not exist</echo>
    	   </else>
            </if>
    


    Get group entries number from the received message_with_group message and print it to the console.

           <!-- receive the message with group-->
           <fixReceive refid="simple_client" sender="TRGT" target="SNDR" type="FIX.4.4" repeat="1" count="1" timeout="10">
               <fixMessage id="message_with_group">
                   <field name="MsgType" value="X"/>
                   <group name="NoMDEntries">
                   </group>
               </fixMessage>
           </fixReceive>
           <!-- get group count value -->
           <fixField refid="message_with_group" action="getGroupCount" name="NoMDEntries" property="group_count" />
           <!-- print the value -->
           <echo>Group count ${group_count}</echo>