/** * utility method to invert the ccypair and return a new instrument * eg for Currency Pair EUR/USD, returns USD/EUR * * WARN: inverse MAINTAINS the tradedCCY field * * @return */ public Currency inverse(){ Currency inverse = new Currency(this.rightCCY,this.leftCCY,this.nearTenor,this.farTenor); inverse.setTradedCCY(this.getTradedCCY()); return inverse; }
@Override public void set(Instrument instrument, DataDictionary dictionary,String msgType, FieldMap message) { // always include the symbol message.setString(Symbol.FIELD, instrument.getSymbol()); message.setString(SecurityType.FIELD,SecurityType.FOREIGN_EXCHANGE_CONTRACT); if (dictionary.isMsgField(msgType, Product.FIELD)) { message.setInt(Product.FIELD, Product.CURRENCY); } Currency currencyInstrument = (Currency) instrument; if (dictionary.isMsgField(msgType, quickfix.field.Currency.FIELD) && currencyInstrument.getTradedCCY()!=null) { message.setString(quickfix.field.Currency.FIELD,currencyInstrument.getTradedCCY()); } if(MsgType.ORDER_CANCEL_REQUEST.equals(msgType)) { message.removeField(FutSettDate.FIELD); message.removeField(quickfix.field.OrdType.FIELD); } else { if(currencyInstrument.getNearTenor() !=null) { message.setString(FutSettDate.FIELD,currencyInstrument.getNearTenor()); } if (currencyInstrument.isSwap()) { message.setString(FutSettDate2.FIELD,currencyInstrument.getFarTenor()); message.setChar(quickfix.field.OrdType.FIELD,quickfix.field.OrdType.FOREX_SWAP); } } } /**