/** * Gets the instrument value as a <code>String</code>. * * @return a <code>String</code> value or <code>null</code> */ public String getInstrumentAsString() { if(instrument == null) { return null; } return instrument.getSymbol(); } /**
@Override public String generateSymbol(Instrument inInstrument) { if(inInstrument instanceof Future) { return inInstrument.getFullSymbol(); } return null; } private static final Pattern FIX_SYMBOL_PATTERN = Pattern.compile("^[A-Za-z0-9]{1,}-[0-9]{6,6}$"); //$NON-NLS-1$
@Override public SecurityType getSecurityType() { return mInstrument == null? null: mInstrument.getSecurityType(); }
@Override public String getInstrumentAsString() { return instrument.getSymbol(); } /* (non-Javadoc)
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("MarketdataCacheElement [").append(instrument.getFullSymbol()).append("]").append(System.lineSeparator()); for(Map.Entry<Content,OrderBook> entry : orderbooks.entrySet()) { builder.append(entry.getKey()).append(System.lineSeparator()); builder.append(entry.getValue()).append(System.lineSeparator()); } builder.append("Latest trade: ").append(trade).append(System.lineSeparator()); builder.append("Stats: ").append(marketstatCache).append(System.lineSeparator()); builder.append("Imbalance: ").append(imbalance).append(System.lineSeparator()); builder.append("Dividends: ").append(dividends).append(System.lineSeparator()); return builder.toString(); } /**
/** * Sets the security type field on the instrument if the FIX version is * greater than 4.0. * * @param inInstrument the instrument * @param inBeginString the begin string (fix version) value of the FIX message * @param inMessage the FIX message. */ protected static void setSecurityType(Instrument inInstrument, String inBeginString, FieldMap inMessage) { if((!FIXVersion.FIX40.equals(FIXVersion.getFIXVersion(inBeginString))) && inInstrument.getSecurityType() != null && org.marketcetera.trade.SecurityType.Unknown != inInstrument.getSecurityType()) { inMessage.setField(new SecurityType(inInstrument.getSecurityType().getFIXValue())); } }
@Override public String getInstrumentAsString() { return optionChainInstrument.getSymbol(); } });
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Imbalance for ").append(imbalance.getInstrument().getFullSymbol()).append(" [").append(imbalance.getEventType()).append("] ") .append(" auction: ").append(imbalance.getAuctionType()).append(" on exchange ").append(imbalance.getExchange()).append(" instrument status: ").append(imbalance.getInstrumentStatus()) .append(" market status: ").append(imbalance.getMarketStatus()).append(" at ").append(imbalance.getTimestamp()); return builder.toString(); } /* (non-Javadoc)
/** * Sets the security type on the message from the instrument if the FIX * dictionary supports the security type field and the specific value for * that field in the instrument. * * @param inInstrument the instrument. * @param inDictionary the FIX dictionary * @param inMsgType the FIX message type * @param inMessage the FIX message */ protected static void setSecurityType(Instrument inInstrument, DataDictionary inDictionary, String inMsgType, FieldMap inMessage) { if(inInstrument.getSecurityType() != null && inDictionary.isMsgField(inMsgType,SecurityType.FIELD)) { String fixValue = inInstrument.getSecurityType().getFIXValue(); if(inDictionary.isFieldValue(SecurityType.FIELD, fixValue)) { inMessage.setField(new SecurityType(fixValue)); } } } /**
/** * Returns a symbol that describes sufficient of the instrument attributes that it can be used to recreate the instrument. * * @return a <code>String</code> */ public String getFullSymbol() { return getSymbol(); } private static final long serialVersionUID = 1L;
@Override public String toString() { return Messages.EXECUTION_REPORT_ADAPTER_TO_STRING.getText(String .valueOf(getPositionKey().getInstrument().getFullSymbol()), String.valueOf(getPositionKey().getAccount()), String .valueOf(getPositionKey().getTraderId()), String .valueOf(getPrice()), String.valueOf(getQuantity()), String .valueOf(getSequenceNumber()), mReport.toString()); }
@Override public String getInstrumentAsString() { return instrument.getSymbol(); } /* (non-Javadoc)
null); if(marketData == null) { throw new IllegalArgumentException("No market data available for " + newOrReplaceOrder.getInstrument().getFullSymbol()); AskEvent ask = topOfBook.getAsk(); if(bid == null || ask == null) { throw new IllegalArgumentException("Insufficient liquidity to peg-to-midpoint for " + newOrReplaceOrder.getInstrument().getFullSymbol());
@Override public String generateSymbol(Instrument inInstrument) { return inInstrument.getSymbol(); } }
/** * Gets the instrument value as a <code>String</code>. * * @return a <code>String</code> value or <code>null</code> */ public String getInstrumentAsString() { if(instrument == null) { return null; } return instrument.getSymbol(); } /**
/** * Gets the instrument value as a <code>String</code>. * * @return a <code>String</code> value or <code>null</code> */ public String getInstrumentAsString() { if(instrument == null) { return null; } return instrument.getSymbol(); } /**
@Override public String getInstrumentAsString() { if(instrument == null) { return null; } return getInstrument().getSymbol(); } /**
@Override public void set(Instrument inInstrument, String inBeginString, FieldMap inMessage) { if(UNSUPPORTED_VERSIONS.contains(FIXVersion.getFIXVersion(inBeginString))) { throw new IllegalArgumentException(Messages.CONVERTIBLE_BONDS_NOT_SUPPORTED_FOR_FIX_VERSION.getText(inBeginString)); } setSecurityType(inInstrument, inBeginString, inMessage); inMessage.setField(new Symbol(inInstrument.getSymbol())); } /* (non-Javadoc)
@Override public int compare(Instrument inO1, Instrument inO2) { // this comparator will be used for two different cases: // 1) comparing underlying instrument to underlying instrument (straight symbol compare with no tie-breaker) // 2) comparing option-chain entry to option-chain entry (symbol, expiry, strike, type in order) int result = inO1.getSymbol().compareTo(inO2.getSymbol()); if(result != 0) { return result; } if(inO1 instanceof Option && inO2 instanceof Option) { Option option1 = (Option)inO1; Option option2 = (Option)inO2; result = option1.getExpiry().compareTo(option2.getExpiry()); if(result != 0) { return result; } result = option1.getStrikePrice().compareTo(option2.getStrikePrice()); if(result != 0) { return result; } return option1.getType().compareTo(option2.getType()); } return 0; } }
/** * Sets the symbol field on the instrument if the FIX dictionary * supports the symbol field. * * @param inInstrument the instrument. * @param inDictionary the FIX dictionary * @param inMsgType the FIX message type * @param inMessage the FIX message */ protected static void setSymbol(Instrument inInstrument, DataDictionary inDictionary, String inMsgType, FieldMap inMessage) { if(inDictionary.isMsgField(inMsgType, Symbol.FIELD)) { inMessage.setField(new Symbol(inInstrument.getSymbol())); } } /**