org.marketcetera.orderloader.fix
Class FIXProcessor

java.lang.Object
  extended by org.marketcetera.orderloader.RowProcessor
      extended by org.marketcetera.orderloader.fix.FIXProcessor

public class FIXProcessor
extends RowProcessor

The processor that parses rows into FIX Messages.

Since:
1.0.0
Version:
$Id: FIXProcessor.java 16154 2012-07-14 16:34:05Z colin $
Author:
gmiller, toli, anshul@marketcetera.com

Field Summary
protected static String MKT_PRICE
           
 
Constructor Summary
FIXProcessor(OrderProcessor inProcessor, BrokerID inBrokerID, FIXVersion inFIXVersion)
          Creates an instance.
 
Method Summary
protected static void addDefaults(Message message)
           
protected  Field<?> getQuickFixFieldFromName(String inFieldName)
          Translate the incoming field name from String to a FIX standard using reflection.
protected static char getSide(String inValue)
           
protected  String parseMessageValue(Field<?> inField, String inFieldName, String inValue, Message inMessage)
          For some fields (day, side, etc) we do custom lookups since the orders may be "DAY", MKT (for price), etc For all others, delegate to the basic field type lookup
protected  Order parseOrder(String[] inRow)
          Parses the supplied row and creates an order instance from it.
 void setHeaders(String[] inHeaders)
          Implemented by subclasses to initialize themselves with the supplied headers.
 
Methods inherited from class org.marketcetera.orderloader.RowProcessor
geBrokerID, getFailedOrders, getNumFailed, getNumSuccess, getTotal, initialize, processOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MKT_PRICE

protected static String MKT_PRICE
Constructor Detail

FIXProcessor

public FIXProcessor(OrderProcessor inProcessor,
                    BrokerID inBrokerID,
                    FIXVersion inFIXVersion)
             throws OrderParsingException
Creates an instance.

Parameters:
inProcessor - the processor.
inBrokerID - the brokerID.
inFIXVersion - the FIX Version to use for parsing, constructing and validating messages.
Throws:
OrderParsingException - if the supplied FIX Version cannot be supported or if brokerID was not supplied.
Method Detail

setHeaders

public void setHeaders(String[] inHeaders)
                throws OrderParsingException
Description copied from class: RowProcessor
Implemented by subclasses to initialize themselves with the supplied headers.

Specified by:
setHeaders in class RowProcessor
Parameters:
inHeaders - the headers specified in the csv file.
Throws:
OrderParsingException - if there were errors with the supplied headers.

parseOrder

protected Order parseOrder(String[] inRow)
                    throws OrderParsingException
Description copied from class: RowProcessor
Parses the supplied row and creates an order instance from it.

Specified by:
parseOrder in class RowProcessor
Parameters:
inRow - the supplied row.
Returns:
the order created from the supplied row.
Throws:
OrderParsingException - if there were errors parsing the

getQuickFixFieldFromName

protected Field<?> getQuickFixFieldFromName(String inFieldName)
                                     throws OrderParsingException
Translate the incoming field name from String to a FIX standard using reflection. the quickfix.field package has all of these defined as quickfix.field. so we just need to create a class for each english string. If the field is not found, it could be a "undertermined" field in which case we check to see if it parses out to an integer. If it does, we store the int as the field value Otherwise, we throw an error.

Parameters:
inFieldName - the field name.
Returns:
the field instance represeting that field
Throws:
OrderParsingException - if there were failures

parseMessageValue

protected String parseMessageValue(Field<?> inField,
                                   String inFieldName,
                                   String inValue,
                                   Message inMessage)
                            throws OrderParsingException
For some fields (day, side, etc) we do custom lookups since the orders may be "DAY", MKT (for price), etc For all others, delegate to the basic field type lookup

Parameters:
inField - the field we are converting
inFieldName - the name of the field being processed.
inValue - string value
inMessage - the message to add the processed field to.
Returns:
Translated data
Throws:
OrderParsingException - if there were errors parsing the field.

getSide

protected static char getSide(String inValue)

addDefaults

protected static void addDefaults(Message message)


Copyright © 2012. All Rights Reserved.