/** * The FIX message underlying the report, if the report has a FIX message, * null otherwise. * * @return the FIX message underlying the report. */ public Message getMessage() { if(mReport instanceof HasFIXMessage) { return ((HasFIXMessage)mReport).getMessage(); } return null; }
/** * Determines if the given event should be emitted or not. * * @param inEvent a <code>LogEvent</code> value * @return a <code>boolean</code> value */ private static boolean shouldLog(LogEvent inEvent) { return LogEventLevel.shouldLog(inEvent, Strategy.STRATEGY_MESSAGES); } /**
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((amount == null) ? 0 : amount.hashCode()); result = prime * result + ((currency == null) ? 0 : currency.hashCode()); result = prime * result + ((declareDate == null) ? 0 : declareDate.hashCode()); result = prime * result + ((equity == null) ? 0 : equity.hashCode()); result = prime * result + ((executionDate == null) ? 0 : executionDate.hashCode()); result = prime * result + ((frequency == null) ? 0 : frequency.hashCode()); result = prime * result + ((paymentDate == null) ? 0 : paymentDate.hashCode()); result = prime * result + ((recordDate == null) ? 0 : recordDate.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((eventType == null) ? 0 : eventType.hashCode()); return result; } /* (non-Javadoc)
/** * Builds a <code>CurrencyBean</code> based on the values of * the given event. * * @param inCurrencyEvent a <code>CurrencyEvent</code> value * @return a <code>CurrencyBean</code> value */ public static CurrencyBean getCurrencyBeanFromEvent(CurrencyEvent inCurrencyEvent) { CurrencyBean currency = new CurrencyBean(); currency.setInstrument(inCurrencyEvent.getInstrument()); //ToDo Set appropriate properties return currency; } /**
/** * Builds a <code>ConvertibleBondBean</code> based on the values of * the given event. * * @param inConvertibleBondEvent a <code>ConvertibleBondEvent</code> value * @return a <code>ConvertibleBondBean</code> value */ public static ConvertibleBondBean getConvertibleBondBeanFromEvent(ConvertibleBondEvent inConvertibleBondEvent) { ConvertibleBondBean bean = new ConvertibleBondBean(); bean.setInstrument(inConvertibleBondEvent.getInstrument()); return bean; } /**
/** * Builds a <code>QuoteBean</code> based on the values of the given event. * * @param inQuoteEvent a <code>QuoteEvent</code> value * @param inQuoteAction a <code>QuoteAction</code> value to use instead of the action from the quote * @return a <code>QuoteBean</code> value */ public static QuoteBean getQuoteBeanFromEvent(QuoteEvent inQuoteEvent, QuoteAction inQuoteAction) { return getQuoteBeanFromEvent(inQuoteEvent, inQuoteEvent.getTimestamp(), inQuoteEvent.getSize(), inQuoteAction); } /**
@Override public void publishTo(Object inData) { if(inData instanceof Event) { ((Event)inData).setSource(internalRequestId); } strategy.dataReceived(inData); } });
/** * Get the message id used for the event at the given level of the bid book. * * @param inOrderbook an <code>OrderBook</code> value * @param inLevel an <code>int</code> value * @return a <code>long</code> value */ private long getBidIdFor(OrderBook inOrderbook, int inLevel) { return inOrderbook.getBidBook().get(inLevel-1).getMessageId(); } /**
/** * Create a new OptionContractPair instance. * * @param inOptionEvent an <code>OptionEvent</code> value * @throws IllegalArgumentException if <code>Instrument</code> is <code>null</code> * @throws IllegalArgumentException if <code>UnderlyingInstrument</code> is <code>null</code> * @throws IllegalArgumentException if <code>ExpirationType</code> is <code>null</code> */ OptionContractPair(OptionEvent inOptionEvent) { key = getOptionContractPairKey(inOptionEvent.getInstrument()); process(inOptionEvent); } /**
/** * Returns the exchange of the given event or null. * * @param inEvent a <code>QuoteEvent</code> value * @return a <code>String</code> value */ private static String getExchange(QuoteEvent inEvent) { if(inEvent != null) { return inEvent.getExchange(); } return null; } /**
/** * Update/reset the levels of the book. */ private void updateLevels() { if(mBookOrder == null) { return; } int level = 1; for(QuoteEvent quote : mBookOrder) { quote.setLevel(level++); } } /**
/** * Returns the price of the given event as a <code>String</code>. * * @param inEvent a <code>QuoteEvent</code> value * @return a <code>String</code> value */ private static String getPriceAsString(QuoteEvent inEvent) { if(inEvent != null) { return inEvent.getPrice().toPlainString(); } return NO_QUANTITY; } /**
/** * Returns the size of the given event as a <code>String</code>. * * @param inEvent a <code>QuoteEvent</code> value * @return a <code>String</code> value */ private static String getSizeAsString(QuoteEvent inEvent) { if(inEvent != null) { return inEvent.getSize().toPlainString(); } return NO_QUANTITY; } /**
@Override public DateTime generateTimestamp(QuoteEvent inQuote) { return new DateTime(inQuote.getQuoteDate().getTime()); } /* (non-Javadoc)
@Override public DateTime generateTimestamp(TradeEvent inTrade) { return new DateTime(inTrade.getTradeDate().getTime()); } /* (non-Javadoc)
/** Extracts the FIX message from the incoming ER, pulls the custom fields out of it, and sets it on the specified order */ protected void addCustomFieldsFromReport(ExecutionReport inLatestReport, RelatedOrder order, Set<Integer> inExcludeFields) { if(inLatestReport instanceof HasFIXMessage) { Message msg = ((HasFIXMessage) inLatestReport).getMessage(); try { order.setCustomFields(getFieldMap(msg, inExcludeFields)); } catch (MessageCreationException e) { // ignore: unable to insert custom fields } } }