All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.osomahe.coinacrobat.api.ticker.entity.TimestampPrice Maven / Gradle / Ivy

There is a newer version: 0.4.0
Show newest version
package net.osomahe.coinacrobat.api.ticker.entity;

import java.time.ZonedDateTime;


/**
 * Object for storing price with timestamp information.
 *
 * @author Antonin Stoklasek
 */
public class TimestampPrice extends Price implements Comparable {

    public static final long serialVersionUID = -1L;

    private ZonedDateTime timestamp;

    public TimestampPrice() {

    }

    public TimestampPrice(ZonedDateTime timestamp) {
        this.timestamp = timestamp;
    }

    public TimestampPrice(ZonedDateTime timestamp, Price price) {
        super(price.getAsk(), price.getBid());
        this.timestamp = timestamp;
    }

    public ZonedDateTime getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(ZonedDateTime timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        return "TimestampPrice{" +
                "timestamp=" + timestamp +
                "} " + super.toString();
    }

    @Override
    public int compareTo(TimestampPrice tp) {
        return timestamp.compareTo(tp.timestamp);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy