001/*
002 * Copyright 2014-2026 ConsensusJ Developers.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.consensusj.exchange.rx;
017
018import org.consensusj.exchange.CurrencyUnitPair;
019import org.javamoney.moneta.spi.DefaultNumberValue;
020
021import javax.money.NumberValue;
022
023/**
024 * 
025 */
026public class ExchangeRateUpdate {
027    public final CurrencyUnitPair pair;
028    public final NumberValue currentFactor;
029    public final long serverTimeStamp;
030    //public final long clientTimeStamp; // ??
031    //ExchangeRate rate;  // Should we have this?
032    //Other "Ticker" information?
033    
034    public ExchangeRateUpdate(CurrencyUnitPair pair, NumberValue currentFactor, long serverTimeStamp) {
035        this.pair = pair;
036        this.currentFactor = currentFactor;
037        this.serverTimeStamp = serverTimeStamp;
038    }
039
040    /**
041     * Create an ExchangeRateValue for "unknown" exchange rate (no data yet)
042     *
043     * @param pair Exchange pair we don't have information on
044     * @return An ExchangeRateUpdate with "unknown" values
045     */
046    public static ExchangeRateUpdate unknown(CurrencyUnitPair pair) {
047        return new ExchangeRateUpdate(pair, DefaultNumberValue.of(0), 0);
048    }
049}