001package org.consensusj.exchange.rx;
002
003import org.consensusj.exchange.CurrencyUnitPair;
004import org.javamoney.moneta.spi.DefaultNumberValue;
005
006import javax.money.NumberValue;
007
008/**
009 * 
010 */
011public class ExchangeRateUpdate {
012    public final CurrencyUnitPair pair;
013    public final NumberValue currentFactor;
014    public final long serverTimeStamp;
015    //public final long clientTimeStamp; // ??
016    //ExchangeRate rate;  // Should we have this?
017    //Other "Ticker" information?
018    
019    public ExchangeRateUpdate(CurrencyUnitPair pair, NumberValue currentFactor, long serverTimeStamp) {
020        this.pair = pair;
021        this.currentFactor = currentFactor;
022        this.serverTimeStamp = serverTimeStamp;
023    }
024
025    /**
026     * Create an ExchangeRateValue for "unknown" exchange rate (no data yet)
027     *
028     * @param pair Exchange pair we don't have information on
029     * @return An ExchangeRateUpdate with "unknown" values
030     */
031    public static ExchangeRateUpdate unknown(CurrencyUnitPair pair) {
032        return new ExchangeRateUpdate(pair, DefaultNumberValue.of(0), 0);
033    }
034}