CurrencyContractBuilder implements IContractBuilder<CurrencyTicker> { public Contract buildContract(CurrencyTicker ticker) { Contract contract = new Contract(); contract.m_currency = ticker.getCurrency(); contract.m_exchange = ticker.getExchange().getExchangeName(); contract.m_secType = IbUtils.getSecurityType( ticker.getInstrumentType() ); contract.m_symbol = ticker.getSymbol(); return contract; }  Contract buildContract(CurrencyTicker ticker);  }
@Test public void testCurrencyContractBuilder() { CurrencyContractBuilder builder = new CurrencyContractBuilder(); CurrencyTicker currencyTicker = new CurrencyTicker(); currencyTicker.setContractMultiplier( BigDecimal.ONE ); currencyTicker.setCurrency("USD"); currencyTicker.setExchange(Exchange.IDEALPRO); currencyTicker.setMinimumTickSize( new BigDecimal( "0.0001" ) ); currencyTicker.setSymbol("EUR"); Contract contract = builder.buildContract(currencyTicker); assertEquals( "USD", contract.m_currency ); assertEquals( "IDEALPRO", contract.m_exchange ); assertEquals( "CASH", contract.m_secType ); assertEquals( "EUR", contract.m_symbol ); }